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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1009,13 +1009,8 @@ function requireIndex_production_1 () {
1009
1009
  var renderDispatch = getCurrentDispatchFromFiber(fiber);
1010
1010
  safeCallWithCurrentFiber({
1011
1011
  fiber: fiber,
1012
- action: function safeCallFiberWarnListener() {
1013
- var _a, _b;
1014
- try {
1015
- (_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)); });
1016
- }
1017
- catch (_c) {
1018
- }
1012
+ action: function () {
1013
+ renderDispatch.callOnFiberWarn.apply(renderDispatch, __spreadArray([fiber], args, false));
1019
1014
  },
1020
1015
  });
1021
1016
  };
@@ -1027,13 +1022,8 @@ function requireIndex_production_1 () {
1027
1022
  var renderDispatch = getCurrentDispatchFromFiber(fiber);
1028
1023
  safeCallWithCurrentFiber({
1029
1024
  fiber: fiber,
1030
- action: function safeCallFiberErrorListener() {
1031
- var _a, _b;
1032
- try {
1033
- (_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)); });
1034
- }
1035
- catch (_c) {
1036
- }
1025
+ action: function () {
1026
+ renderDispatch.callOnFiberError.apply(renderDispatch, __spreadArray([fiber], args, false));
1037
1027
  },
1038
1028
  });
1039
1029
  };
@@ -2239,8 +2229,7 @@ function requireIndex_production_1 () {
2239
2229
  safeCallWithCurrentFiber({
2240
2230
  fiber: fiber,
2241
2231
  action: function safeCallFiberUpdateListener() {
2242
- var _a, _b;
2243
- (_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); });
2232
+ renderDispatch.callOnFiberUpdate(fiber);
2244
2233
  },
2245
2234
  });
2246
2235
  };
@@ -2446,8 +2435,7 @@ function requireIndex_production_1 () {
2446
2435
  safeCallWithCurrentFiber({
2447
2436
  fiber: fiber,
2448
2437
  action: function safeCallInstanceInitialListener() {
2449
- var _a, _b;
2450
- (_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); });
2438
+ renderDispatch.callOnInstanceInitial(instance, fiber);
2451
2439
  },
2452
2440
  });
2453
2441
  instance.props = props;
@@ -2464,8 +2452,7 @@ function requireIndex_production_1 () {
2464
2452
  safeCallWithCurrentFiber({
2465
2453
  fiber: fiber,
2466
2454
  action: function safeCallInstanceUpdateListener() {
2467
- var _a, _b;
2468
- (_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); });
2455
+ renderDispatch.callOnInstanceUpdate(typedInstance, fiber);
2469
2456
  },
2470
2457
  });
2471
2458
  setOwnerForInstance(typedInstance, fiber);
@@ -2730,8 +2717,7 @@ function requireIndex_production_1 () {
2730
2717
  safeCallWithCurrentFiber({
2731
2718
  fiber: fiber,
2732
2719
  action: function safeCallInstanceUnmountListener() {
2733
- var _a, _b;
2734
- (_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); });
2720
+ renderDispatch.callOnInstanceUnmount(typedInstance, fiber);
2735
2721
  },
2736
2722
  });
2737
2723
  safeCallWithCurrentFiber({
@@ -3307,8 +3293,7 @@ function requireIndex_production_1 () {
3307
3293
  safeCallWithCurrentFiber({
3308
3294
  fiber: ownerFiber,
3309
3295
  action: function safeCallFiberStateListener() {
3310
- var _a, _b;
3311
- (_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); });
3296
+ renderDispatch.callOnFiberState(ownerFiber, _params);
3312
3297
  },
3313
3298
  });
3314
3299
  var isImmediate = _params.isImmediate;
@@ -3320,8 +3305,7 @@ function requireIndex_production_1 () {
3320
3305
  safeCallWithCurrentFiber({
3321
3306
  fiber: ownerFiber,
3322
3307
  action: function safeCallInstanceStateListener() {
3323
- var _a, _b;
3324
- (_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); });
3308
+ renderDispatch.callOnInstanceState(trigger_1, ownerFiber, _params);
3325
3309
  },
3326
3310
  });
3327
3311
  ownerFiber.updateQueue = ownerFiber.updateQueue || new myreactSharedExports.ListTree();
@@ -3335,8 +3319,7 @@ function requireIndex_production_1 () {
3335
3319
  safeCallWithCurrentFiber({
3336
3320
  fiber: ownerFiber,
3337
3321
  action: function safeCallHookStateListener() {
3338
- var _a, _b;
3339
- (_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); });
3322
+ renderDispatch.callOnHookState(trigger_2, ownerFiber, _params);
3340
3323
  },
3341
3324
  });
3342
3325
  ownerFiber.updateQueue = ownerFiber.updateQueue || new myreactSharedExports.ListTree();
@@ -3632,11 +3615,10 @@ function requireIndex_production_1 () {
3632
3615
  renderDispatch.resetUpdateFlowRuntimeFiber();
3633
3616
  renderDispatch.pendingCommitFiberList = null;
3634
3617
  renderDispatch.pendingChangedFiberList = null;
3635
- (commitList === null || commitList === void 0 ? void 0 : commitList.length) && renderDispatch.reconcileUpdate(commitList);
3618
+ (commitList === null || commitList === void 0 ? void 0 : commitList.length) && renderDispatch.reconcileUpdate(commitList, true);
3636
3619
  (changedList === null || changedList === void 0 ? void 0 : changedList.length) &&
3637
3620
  safeCall(function safeCallFiberHasChangeListener() {
3638
- var _a, _b;
3639
- (_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); });
3621
+ renderDispatch.callOnFiberChange(changedList);
3640
3622
  });
3641
3623
  }
3642
3624
  var updateSyncFromRoot = function (renderDispatch) {
@@ -3659,8 +3641,7 @@ function requireIndex_production_1 () {
3659
3641
  (commitList === null || commitList === void 0 ? void 0 : commitList.length) && renderDispatch.reconcileUpdate(commitList);
3660
3642
  (changedList === null || changedList === void 0 ? void 0 : changedList.length) &&
3661
3643
  safeCall(function safeCallFiberHasChangeListener() {
3662
- var _a, _b;
3663
- (_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); });
3644
+ renderDispatch.callOnFiberChange(changedList);
3664
3645
  });
3665
3646
  }
3666
3647
  function checkNextFiberIsSync(renderDispatch) {
@@ -4230,8 +4211,7 @@ function requireIndex_production_1 () {
4230
4211
  safeCallWithCurrentFiber({
4231
4212
  fiber: fiber,
4232
4213
  action: function safeCallHookUnmountListener() {
4233
- var _a, _b;
4234
- (_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); });
4214
+ renderDispatch.callOnHookUnmount(hookNode, fiber);
4235
4215
  },
4236
4216
  });
4237
4217
  safeCallWithCurrentFiber({
@@ -4313,8 +4293,7 @@ function requireIndex_production_1 () {
4313
4293
  safeCallWithCurrentFiber({
4314
4294
  fiber: fiber,
4315
4295
  action: function safeCallFiberTriggerListener() {
4316
- var _a, _b;
4317
- (_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); });
4296
+ renderDispatch.callOnFiberTrigger(fiber, updateState);
4318
4297
  },
4319
4298
  });
4320
4299
  // TODO get from updateState ?
@@ -4464,8 +4443,7 @@ function requireIndex_production_1 () {
4464
4443
  safeCallWithCurrentFiber({
4465
4444
  fiber: newFiberNode,
4466
4445
  action: function safeCallFiberInitialListener() {
4467
- var _a, _b;
4468
- (_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); });
4446
+ renderDispatch.callOnFiberInitial(newFiberNode);
4469
4447
  },
4470
4448
  });
4471
4449
  if (myreactSharedExports.exclude(newFiberNode.patch, myreactSharedExports.PATCH_TYPE.__update__)) {
@@ -4544,8 +4522,7 @@ function requireIndex_production_1 () {
4544
4522
  safeCallWithCurrentFiber({
4545
4523
  fiber: fiber,
4546
4524
  action: function safeCallFiberInitialListener() {
4547
- var _a, _b;
4548
- (_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); });
4525
+ renderDispatch.callOnFiberInitial(fiber);
4549
4526
  },
4550
4527
  });
4551
4528
  if (myreactSharedExports.exclude(fiber.patch, myreactSharedExports.PATCH_TYPE.__update__)) {
@@ -4583,8 +4560,7 @@ function requireIndex_production_1 () {
4583
4560
  safeCallWithCurrentFiber({
4584
4561
  fiber: fiber,
4585
4562
  action: function safeCallFiberUnmountListener() {
4586
- var _a, _b;
4587
- (_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); });
4563
+ renderDispatch.callOnFiberUnmount(fiber);
4588
4564
  },
4589
4565
  });
4590
4566
  fiberToDispatchMap.delete(fiber);
@@ -4970,6 +4946,28 @@ function requireIndex_production_1 () {
4970
4946
  }
4971
4947
  };
4972
4948
 
4949
+ var initSuspenseInstance = function (instance) {
4950
+ var field = getInstanceFieldByInstance(instance);
4951
+ if (!field)
4952
+ throw new Error("[@my-react/react] can not get field for instance, this is a bug for @my-react");
4953
+ var typedField = field;
4954
+ typedField.isHidden = false;
4955
+ typedField.asyncLoadList = new myreactSharedExports.UniqueArray();
4956
+ };
4957
+
4958
+ var MyReactInternalInstance$2 = react.__my_react_internal__.MyReactInternalInstance;
4959
+ var processSuspense = function (fiber) {
4960
+ var isUpdate = !!fiber.instance;
4961
+ fiber.instance = fiber.instance || new MyReactInternalInstance$2();
4962
+ !isUpdate && initInstance(fiber.instance);
4963
+ !isUpdate && initVisibleInstance(fiber.instance);
4964
+ !isUpdate && initSuspenseInstance(fiber.instance);
4965
+ !isUpdate && setOwnerForInstance(fiber.instance, fiber);
4966
+ var instanceField = getInstanceFieldByInstance(fiber.instance);
4967
+ var children = WrapperBySuspenseScope(instanceField.isHidden ? fiber.pendingProps.fallback : fiber.pendingProps.children);
4968
+ return children;
4969
+ };
4970
+
4973
4971
  react.__my_react_internal__.MyReactInternalInstance; var instanceToInitialFieldMap = react.__my_react_internal__.instanceToInitialFieldMap;
4974
4972
  // support private instance field
4975
4973
  var instanceMap = instanceToInitialFieldMap;
@@ -5076,7 +5074,7 @@ function requireIndex_production_1 () {
5076
5074
  return field === null || field === void 0 ? void 0 : field.effect;
5077
5075
  };
5078
5076
 
5079
- var currentComponentFiber$1 = react.__my_react_internal__.currentComponentFiber, MyReactInternalInstance$2 = react.__my_react_internal__.MyReactInternalInstance;
5077
+ var currentComponentFiber$1 = react.__my_react_internal__.currentComponentFiber, MyReactInternalInstance$1 = react.__my_react_internal__.MyReactInternalInstance;
5080
5078
  var enablePerformanceLog = react.__my_react_shared__.enablePerformanceLog, enableDebugFiled = react.__my_react_shared__.enableDebugFiled;
5081
5079
  var nextWorkCommon = function (renderDispatch, fiber, children) {
5082
5080
  if (myreactSharedExports.exclude(fiber.patch, myreactSharedExports.PATCH_TYPE.__update__)) {
@@ -5150,7 +5148,7 @@ function requireIndex_production_1 () {
5150
5148
  };
5151
5149
  var nextWorkRoot = function (renderDispatch, fiber) {
5152
5150
  var isUpdate = !!fiber.instance;
5153
- fiber.instance = fiber.instance || new MyReactInternalInstance$2();
5151
+ fiber.instance = fiber.instance || new MyReactInternalInstance$1();
5154
5152
  !isUpdate && initInstance(fiber.instance);
5155
5153
  !isUpdate && initVisibleInstance(fiber.instance);
5156
5154
  !isUpdate && setOwnerForInstance(fiber.instance, fiber);
@@ -5169,8 +5167,7 @@ function requireIndex_production_1 () {
5169
5167
  safeCallWithCurrentFiber({
5170
5168
  fiber: fiber,
5171
5169
  action: function safeCallFiberRunListener() {
5172
- var _a, _b;
5173
- (_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); });
5170
+ renderDispatch.callOnBeforeFiberRun(fiber);
5174
5171
  },
5175
5172
  });
5176
5173
  setRefreshTypeMap(fiber);
@@ -5187,8 +5184,7 @@ function requireIndex_production_1 () {
5187
5184
  safeCallWithCurrentFiber({
5188
5185
  fiber: fiber,
5189
5186
  action: function safeCallPerformanceWarnListener() {
5190
- var _a, _b;
5191
- (_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); });
5187
+ renderDispatch.callOnPerformanceWarn(fiber, renderTime);
5192
5188
  },
5193
5189
  });
5194
5190
  }
@@ -5219,121 +5215,514 @@ function requireIndex_production_1 () {
5219
5215
  safeCallWithCurrentFiber({
5220
5216
  fiber: fiber,
5221
5217
  action: function safeCallFiberRunListener() {
5222
- var _a, _b;
5223
- (_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); });
5218
+ renderDispatch.callOnAfterFiberRun(fiber);
5224
5219
  },
5225
5220
  });
5226
5221
  };
5227
5222
 
5228
- var initSuspenseInstance = function (instance) {
5229
- var field = getInstanceFieldByInstance(instance);
5230
- if (!field)
5231
- throw new Error("[@my-react/react] can not get field for instance, this is a bug for @my-react");
5232
- var typedField = field;
5233
- typedField.isHidden = false;
5234
- typedField.asyncLoadList = new myreactSharedExports.UniqueArray();
5223
+ react.__my_react_shared__.enableDebugFiled;
5224
+ var currentRunningFiber = react.__my_react_internal__.currentRunningFiber, MyReactInternalInstance = react.__my_react_internal__.MyReactInternalInstance;
5225
+ var defaultGetContextValue = function (fiber, ContextObject) {
5226
+ var _a;
5227
+ if (fiber) {
5228
+ return fiber.pendingProps["value"];
5229
+ }
5230
+ else {
5231
+ return (_a = ContextObject === null || ContextObject === void 0 ? void 0 : ContextObject.Provider) === null || _a === void 0 ? void 0 : _a["value"];
5232
+ }
5235
5233
  };
5236
-
5237
- var MyReactInternalInstance$1 = react.__my_react_internal__.MyReactInternalInstance;
5238
- var processSuspense = function (fiber) {
5234
+ var defaultGetContextFiber = function (fiber, ContextObject) {
5235
+ if ((fiber === null || fiber === void 0 ? void 0 : fiber.parent) && ContextObject) {
5236
+ var parent_1 = fiber.parent;
5237
+ while (parent_1) {
5238
+ if (myreactSharedExports.include(parent_1.type, exports.NODE_TYPE.__provider__)) {
5239
+ var typedElementType = parent_1.elementType;
5240
+ var contextObj = typedElementType["Context"];
5241
+ if (contextObj === ContextObject) {
5242
+ return parent_1;
5243
+ }
5244
+ }
5245
+ if (myreactSharedExports.include(parent_1.type, exports.NODE_TYPE.__context__)) {
5246
+ var typedElementType = parent_1.elementType;
5247
+ var contextObj = typedElementType;
5248
+ if (contextObj === ContextObject) {
5249
+ return parent_1;
5250
+ }
5251
+ }
5252
+ parent_1 = parent_1.parent;
5253
+ }
5254
+ }
5255
+ else {
5256
+ return null;
5257
+ }
5258
+ };
5259
+ var defaultReadContext = function (Context) {
5260
+ var fiber = currentRunningFiber.current;
5261
+ if (!Context) {
5262
+ throw new Error("the Context what you read is not exist");
5263
+ }
5264
+ if (!fiber) {
5265
+ throw new Error('current environment is not support "readContext"');
5266
+ }
5239
5267
  var isUpdate = !!fiber.instance;
5240
- fiber.instance = fiber.instance || new MyReactInternalInstance$1();
5268
+ fiber.instance = fiber.instance || new MyReactInternalInstance();
5241
5269
  !isUpdate && initInstance(fiber.instance);
5242
- !isUpdate && initVisibleInstance(fiber.instance);
5243
- !isUpdate && initSuspenseInstance(fiber.instance);
5244
5270
  !isUpdate && setOwnerForInstance(fiber.instance, fiber);
5245
- var instanceField = getInstanceFieldByInstance(fiber.instance);
5246
- var children = WrapperBySuspenseScope(instanceField.isHidden ? fiber.pendingProps.fallback : fiber.pendingProps.children);
5247
- return children;
5248
- };
5249
-
5250
- var Dispatcher = react.__my_react_internal__.Dispatcher, MyReactInternalInstanceClass = react.__my_react_internal__.MyReactInternalInstance, dispatchToListenerMap = react.__my_react_internal__.dispatchToListenerMap;
5251
- var getInitialListeners = function () {
5252
- return {
5253
- fiberInitial: new Set(),
5254
- fiberUpdate: new Set(),
5255
- fiberHasChange: new Set(),
5256
- fiberUnmount: new Set(),
5257
- fiberState: new Set(),
5258
- fiberTrigger: new Set(),
5259
- instanceInitial: new Set(),
5260
- instanceUpdate: new Set(),
5261
- instanceState: new Set(),
5262
- instanceUnmount: new Set(),
5263
- hookInitial: new Set(),
5264
- hookUpdate: new Set(),
5265
- hookState: new Set(),
5266
- hookUnmount: new Set(),
5267
- beforeCommitMount: new Set(),
5268
- afterCommitMount: new Set(),
5269
- beforeCommitUpdate: new Set(),
5270
- afterCommitUpdate: new Set(),
5271
- beforeCommitUnmount: new Set(),
5272
- afterCommitUnmount: new Set(),
5273
- };
5271
+ var contextFiber = defaultGetContextFiber(fiber, Context);
5272
+ setSubscribeForInstance(fiber.instance, contextFiber);
5273
+ return defaultGetContextValue(contextFiber, Context);
5274
5274
  };
5275
- var getInitialMap = function () { return ({
5276
- effectMap: new MyWeakMap(),
5277
- layoutEffectMap: new MyWeakMap(),
5278
- insertionEffectMap: new MyWeakMap(),
5279
- unmountMap: new MyWeakMap(),
5280
- eventMap: new MyWeakMap(),
5281
- triggerCallbackMap: new MyWeakMap(),
5282
- }); };
5283
- var getInitialFiber = function () { return ({
5284
- scheduledFiber: null,
5285
- errorCatchFiber: null,
5286
- nextWorkingFiber: null,
5287
- retriggerFiber: null,
5288
- }); };
5289
- var initialRef = {
5290
- typeForRef: exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__class__,
5291
- typeForCreate: exports.NODE_TYPE.__text__ | exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__portal__ | exports.NODE_TYPE.__comment__,
5292
- typeForUpdate: exports.NODE_TYPE.__text__ | exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__comment__,
5293
- typeForAppend: exports.NODE_TYPE.__text__ | exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__comment__,
5294
- typeForNativeNode: exports.NODE_TYPE.__text__ | exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__portal__ | exports.NODE_TYPE.__comment__,
5275
+ var prepareUpdateAllDependence = function (renderDispatch, fiber, beforeValue, afterValue) {
5276
+ var consumerList = new Set((fiber === null || fiber === void 0 ? void 0 : fiber.dependence) || []);
5277
+ consumerList.forEach(function prepareUpdateSingleConsumer(i) {
5278
+ var owner = getInstanceOwnerFiber(i);
5279
+ if (owner && myreactSharedExports.exclude(owner.state, myreactSharedExports.STATE_TYPE.__unmount__)) {
5280
+ var typedFiber_1 = owner;
5281
+ typedFiber_1.state = myreactSharedExports.STATE_TYPE.__triggerSyncForce__;
5282
+ }
5283
+ });
5284
+ var processedNodes = [];
5285
+ var updater = {
5286
+ type: myreactSharedExports.UpdateQueueType.context,
5287
+ trigger: fiber,
5288
+ payLoad: afterValue,
5289
+ isSync: true,
5290
+ isForce: true,
5291
+ isImmediate: true,
5292
+ isRetrigger: true,
5293
+ };
5294
+ processedNodes.push(updater);
5295
+ var updateState = {
5296
+ needUpdate: true,
5297
+ nodes: processedNodes,
5298
+ isSync: true,
5299
+ isForce: true,
5300
+ isImmediate: true,
5301
+ isRetrigger: true,
5302
+ };
5303
+ safeCallWithCurrentFiber({
5304
+ fiber: fiber,
5305
+ action: function safeCallFiberTriggerListener() {
5306
+ renderDispatch.callOnFiberTrigger(fiber, updateState);
5307
+ },
5308
+ });
5295
5309
  };
5296
- var listenerMap = dispatchToListenerMap;
5297
- var RenderDispatchEvent = /** @class */ (function (_super) {
5298
- __extends(RenderDispatchEvent, _super);
5299
- function RenderDispatchEvent() {
5300
- var _this = _super.call(this) || this;
5301
- _this.dispatcher = Dispatcher;
5302
- _this.runtimeRef = initialRef;
5303
- _this.runtimeMap = getInitialMap();
5304
- _this.runtimeFiber = getInitialFiber();
5305
- listenerMap.set(_this, getInitialListeners());
5306
- initInstance(_this);
5307
- initVisibleInstance(_this);
5308
- initSuspenseInstance(_this);
5309
- Object.defineProperty(_this, "dispatcher", {
5310
- value: Dispatcher,
5311
- writable: false,
5312
- enumerable: false,
5313
- configurable: false,
5310
+
5311
+ var currentScheduler$2 = react.__my_react_internal__.currentScheduler;
5312
+ react.__my_react_shared__.enableScopeTreeLog;
5313
+ // TODO improve
5314
+ var defaultDispatchMountLatest = function (_dispatch, _fiber) {
5315
+ beforeSyncUpdate();
5316
+ var _list = generateFiberToListWithAction(_fiber, function invokeUnmountPendingList(_fiber) {
5317
+ defaultInvokeUnmountList(_dispatch, _fiber);
5318
+ });
5319
+ _list.listToFoot(function invokeInsertionEffectList(_fiber) {
5320
+ insertionEffect(_dispatch, _fiber);
5321
+ });
5322
+ afterSyncUpdate();
5323
+ _list.listToFoot(function invokeCreateAndUpdateList(_fiber) {
5324
+ safeCallWithCurrentFiber({
5325
+ fiber: _fiber,
5326
+ action: function safeCallCreateAndUpdate() {
5327
+ _dispatch.commitCreate(_fiber);
5328
+ _dispatch.commitUpdate(_fiber);
5329
+ },
5330
+ });
5331
+ });
5332
+ _list.listToFoot(function invokeAppendList(_fiber) {
5333
+ safeCallWithCurrentFiber({
5334
+ fiber: _fiber,
5335
+ action: function safeCallAppendList() {
5336
+ _dispatch.commitAppend(_fiber);
5337
+ },
5338
+ });
5339
+ });
5340
+ _list.listToFoot(function invokeSetRefList(_fiber) {
5341
+ safeCallWithCurrentFiber({
5342
+ fiber: _fiber,
5343
+ action: function safeCallSetRefList() {
5344
+ _dispatch.commitSetRef(_fiber);
5345
+ },
5346
+ });
5347
+ });
5348
+ beforeSyncUpdate();
5349
+ _list.listToFoot(function invokeLayoutEffectList(_fiber) {
5350
+ layoutEffect(_dispatch, _fiber);
5351
+ });
5352
+ afterSyncUpdate();
5353
+ function invokeEffectListTask() {
5354
+ _list.listToFoot(function invokeEffectList(_fiber) {
5355
+ effect(_dispatch, _fiber);
5314
5356
  });
5315
- return _this;
5316
5357
  }
5317
- RenderDispatchEvent.prototype.getFiberTree = function (_fiber) {
5318
- throw new Error("Method not implemented.");
5319
- };
5320
- RenderDispatchEvent.prototype.readPromise = function (_params) {
5321
- throw new Error("Method not implemented.");
5322
- };
5323
- RenderDispatchEvent.prototype.readContext = function (_params) {
5324
- throw new Error("Method not implemented.");
5325
- };
5326
- RenderDispatchEvent.prototype.dispatchHook = function (_params) {
5327
- throw new Error("Method not implemented.");
5328
- };
5329
- RenderDispatchEvent.prototype.dispatchState = function (_params) {
5330
- throw new Error("Method not implemented.");
5331
- };
5332
- RenderDispatchEvent.prototype.dispatchError = function (_params) {
5333
- throw new Error("Method not implemented.");
5334
- };
5335
- RenderDispatchEvent.prototype.dispatchPromise = function (_params) {
5336
- throw new Error("Method not implemented.");
5358
+ addEffectCallback(invokeEffectListTask);
5359
+ var renderScheduler = currentScheduler$2.current;
5360
+ if (_dispatch.enableConcurrentMode) {
5361
+ renderScheduler.macroTask(function flushEffect() {
5362
+ flushEffectCallback();
5363
+ });
5364
+ }
5365
+ else {
5366
+ renderScheduler.microTask(function flushEffect() {
5367
+ flushEffectCallback();
5368
+ });
5369
+ }
5370
+ };
5371
+ var defaultDispatchMount = defaultDispatchMountLatest;
5372
+
5373
+ var defaultResolveScope = function (fiber) {
5374
+ var parent = fiber.parent;
5375
+ while (parent) {
5376
+ if (myreactSharedExports.include(parent.type, exports.NODE_TYPE.__scope__) || myreactSharedExports.include(parent.type, exports.NODE_TYPE.__scopeSuspense__)) {
5377
+ return parent;
5378
+ }
5379
+ parent = parent.parent;
5380
+ }
5381
+ return null;
5382
+ };
5383
+
5384
+ react.__my_react_shared__.enableDebugFiled;
5385
+ var defaultGenerateStrict = function (fiber) {
5386
+ return false;
5387
+ };
5388
+
5389
+ var currentScheduler$1 = react.__my_react_internal__.currentScheduler;
5390
+ react.__my_react_shared__.enableScopeTreeLog;
5391
+ var defaultDispatchUpdate = function (_dispatch, _list, sync) {
5392
+ // TODO maybe need call `insertionEffect` in another function
5393
+ beforeSyncUpdate();
5394
+ _list.listToFoot(function invokeUnmountPendingAndInsertionEffectList(_fiber) {
5395
+ if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
5396
+ defaultInvokeUnmountList(_dispatch, _fiber);
5397
+ }
5398
+ });
5399
+ _list.listToFoot(function invokeUnmountPendingAndInsertionEffectList(_fiber) {
5400
+ if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
5401
+ insertionEffect(_dispatch, _fiber);
5402
+ }
5403
+ });
5404
+ afterSyncUpdate();
5405
+ _list.listToFoot(function invokeCreateAndUpdateList(_fiber) {
5406
+ if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
5407
+ safeCallWithCurrentFiber({
5408
+ fiber: _fiber,
5409
+ action: function safeCallCreateAndUpdate() {
5410
+ _dispatch.commitCreate(_fiber);
5411
+ _dispatch.commitUpdate(_fiber);
5412
+ },
5413
+ });
5414
+ }
5415
+ });
5416
+ _list.listToHead(function invokePositionList(_fiber) {
5417
+ if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
5418
+ safeCallWithCurrentFiber({
5419
+ fiber: _fiber,
5420
+ action: function safeCallPosition() {
5421
+ _dispatch.commitPosition(_fiber);
5422
+ },
5423
+ });
5424
+ }
5425
+ });
5426
+ _list.listToFoot(function invokeAppendList(_fiber) {
5427
+ if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
5428
+ safeCallWithCurrentFiber({
5429
+ fiber: _fiber,
5430
+ action: function safeCallAppendList() {
5431
+ _dispatch.commitAppend(_fiber);
5432
+ },
5433
+ });
5434
+ }
5435
+ });
5436
+ _list.listToFoot(function invokeSetRefList(_fiber) {
5437
+ if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
5438
+ safeCallWithCurrentFiber({
5439
+ fiber: _fiber,
5440
+ action: function safeCallSetRefList() {
5441
+ _dispatch.commitSetRef(_fiber);
5442
+ },
5443
+ });
5444
+ }
5445
+ });
5446
+ beforeSyncUpdate();
5447
+ _list.listToFoot(function invokeLayoutEffectList(_fiber) {
5448
+ if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
5449
+ layoutEffect(_dispatch, _fiber);
5450
+ }
5451
+ });
5452
+ afterSyncUpdate();
5453
+ function invokeEffectListTask() {
5454
+ _list.listToFoot(function invokeEffectList(_fiber) {
5455
+ if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
5456
+ effect(_dispatch, _fiber);
5457
+ }
5458
+ });
5459
+ }
5460
+ addEffectCallback(invokeEffectListTask);
5461
+ var renderScheduler = currentScheduler$1.current;
5462
+ if (_dispatch.enableConcurrentMode && !sync) {
5463
+ renderScheduler.macroTask(function flushEffect() {
5464
+ flushEffectCallback();
5465
+ });
5466
+ }
5467
+ else {
5468
+ renderScheduler.microTask(function flushEffect() {
5469
+ flushEffectCallback();
5470
+ });
5471
+ }
5472
+ };
5473
+
5474
+ var currentComponentFiber = react.__my_react_internal__.currentComponentFiber, currentHookNodeIndex = react.__my_react_internal__.currentHookNodeIndex;
5475
+ var resolveHookValue = function (hookNode, field) {
5476
+ if (hookNode) {
5477
+ switch (hookNode.type) {
5478
+ case myreactSharedExports.HOOK_TYPE.useState:
5479
+ case myreactSharedExports.HOOK_TYPE.useReducer:
5480
+ return [hookNode.result, field.dispatch];
5481
+ case myreactSharedExports.HOOK_TYPE.useId:
5482
+ case myreactSharedExports.HOOK_TYPE.useRef:
5483
+ case myreactSharedExports.HOOK_TYPE.useMemo:
5484
+ case myreactSharedExports.HOOK_TYPE.useContext:
5485
+ case myreactSharedExports.HOOK_TYPE.useCallback:
5486
+ case myreactSharedExports.HOOK_TYPE.useDeferredValue:
5487
+ case myreactSharedExports.HOOK_TYPE.useSyncExternalStore:
5488
+ case myreactSharedExports.HOOK_TYPE.useEffectEvent:
5489
+ return hookNode.result;
5490
+ case myreactSharedExports.HOOK_TYPE.useOptimistic:
5491
+ case myreactSharedExports.HOOK_TYPE.useTransition:
5492
+ return [hookNode.result.value, hookNode.result.start];
5493
+ case myreactSharedExports.HOOK_TYPE.useSignal:
5494
+ return [hookNode.result.getValue, hookNode.result.setValue];
5495
+ }
5496
+ }
5497
+ };
5498
+ var processHook = function (renderDispatch, _a) {
5499
+ var type = _a.type, reducer = _a.reducer, value = _a.value, deps = _a.deps;
5500
+ var fiber = currentComponentFiber.current;
5501
+ if (!fiber)
5502
+ throw new Error("[@my-react/react] can not use hook outside of component");
5503
+ if (!renderDispatch)
5504
+ throw new Error("[@my-react/react] internal error, can not get 'renderDispatch' for current render");
5505
+ fiber.hookList = fiber.hookList || new myreactSharedExports.ListTree();
5506
+ var currentHook = null;
5507
+ // initial
5508
+ if (myreactSharedExports.include(fiber.state, myreactSharedExports.STATE_TYPE.__create__ | myreactSharedExports.STATE_TYPE.__recreate__)) {
5509
+ currentHook = createHookNode(renderDispatch, { type: type, reducer: reducer, value: value, deps: deps }, fiber);
5510
+ safeCall(function safeCallHookInitialListener() {
5511
+ renderDispatch.callOnHookInitial(currentHook, fiber);
5512
+ });
5513
+ }
5514
+ else {
5515
+ // update
5516
+ currentHook = updateHookNode(renderDispatch, { type: type, reducer: reducer, value: value, deps: deps }, fiber, false);
5517
+ safeCall(function safeCallHookUpdateListener() {
5518
+ renderDispatch.callOnHookUpdate(currentHook, fiber);
5519
+ });
5520
+ }
5521
+ currentHookNodeIndex.current++;
5522
+ var field = getInstanceFieldByInstance(currentHook);
5523
+ effectHookNode(renderDispatch, fiber, currentHook, field);
5524
+ return resolveHookValue(currentHook, field);
5525
+ };
5526
+
5527
+ var enableSuspenseRoot = react.__my_react_shared__.enableSuspenseRoot;
5528
+ var currentScheduler = react.__my_react_internal__.currentScheduler;
5529
+ var loadPromise = function (renderDispatch, promise) { return __awaiter(void 0, void 0, void 0, function () {
5530
+ var value, reason_1;
5531
+ return __generator(this, function (_a) {
5532
+ switch (_a.label) {
5533
+ case 0:
5534
+ if (promise.status === "fulfilled" || promise.status === "rejected")
5535
+ return [2 /*return*/];
5536
+ _a.label = 1;
5537
+ case 1:
5538
+ _a.trys.push([1, 3, , 4]);
5539
+ promise.status = "pending";
5540
+ return [4 /*yield*/, Promise.resolve(promise)];
5541
+ case 2:
5542
+ value = _a.sent();
5543
+ promise.status = "fulfilled";
5544
+ promise._value = value;
5545
+ return [3 /*break*/, 4];
5546
+ case 3:
5547
+ reason_1 = _a.sent();
5548
+ promise.status = "rejected";
5549
+ promise._reason = reason_1;
5550
+ return [3 /*break*/, 4];
5551
+ case 4: return [2 /*return*/];
5552
+ }
5553
+ });
5554
+ }); };
5555
+ var processPromise = function (renderDispatch, fiber, promise) {
5556
+ var _a, _b;
5557
+ defaultDeleteCurrentEffect(renderDispatch, fiber);
5558
+ if (promise.status === "rejected") {
5559
+ (_b = (_a = currentScheduler.current).dispatchError) === null || _b === void 0 ? void 0 : _b.call(_a, { fiber: fiber, error: promise._reason });
5560
+ return null;
5561
+ }
5562
+ if (promise.status === "fulfilled") ;
5563
+ promise._list = promise._list || new Set();
5564
+ promise._list.add(fiber);
5565
+ var suspenseFiber = renderDispatch.resolveSuspenseFiber(fiber);
5566
+ if (suspenseFiber) {
5567
+ var suspenseField = getInstanceFieldByInstance(suspenseFiber.instance);
5568
+ suspenseField.asyncLoadList.uniPush(promise);
5569
+ renderDispatch.pendingSuspenseFiberArray.uniPush(suspenseFiber);
5570
+ return null;
5571
+ }
5572
+ else {
5573
+ // TODO update flow
5574
+ if (enableSuspenseRoot.current && !renderDispatch.isAppMounted) {
5575
+ var suspenseField = getInstanceFieldByInstance(renderDispatch);
5576
+ suspenseField.asyncLoadList.uniPush(promise);
5577
+ return null;
5578
+ }
5579
+ devWarnWithFiber(fiber, "[@my-react/react] promise must be used inside a Suspense component, otherwise it will not work as expected");
5580
+ if (promise._loading)
5581
+ return null;
5582
+ promise._loading = true;
5583
+ promise.status = "pending";
5584
+ var renderScheduler_1 = currentScheduler.current;
5585
+ renderDispatch
5586
+ .processPromise(promise)
5587
+ .then(function () {
5588
+ fiber.state = myreactSharedExports.STATE_TYPE.__recreate__;
5589
+ promise._list.delete(fiber);
5590
+ promise._loading = false;
5591
+ var updater = {
5592
+ type: myreactSharedExports.UpdateQueueType.promise,
5593
+ trigger: fiber,
5594
+ isSync: true,
5595
+ isForce: true,
5596
+ payLoad: promise,
5597
+ };
5598
+ renderScheduler_1.dispatchState(updater);
5599
+ })
5600
+ .catch(function (e) { return renderScheduler_1.dispatchError({ fiber: fiber, error: e }); });
5601
+ return null;
5602
+ }
5603
+ };
5604
+ var processSuspensePromise = function (renderDispatch, fiber, promise) {
5605
+ var _a, _b;
5606
+ defaultDeleteCurrentEffect(renderDispatch, fiber);
5607
+ fiber.state = myreactSharedExports.STATE_TYPE.__suspense__;
5608
+ if (promise.status === "rejected") {
5609
+ (_b = (_a = currentScheduler.current).dispatchError) === null || _b === void 0 ? void 0 : _b.call(_a, { fiber: fiber, error: promise._reason });
5610
+ return null;
5611
+ }
5612
+ if (promise.status === "fulfilled") ;
5613
+ promise._list = promise._list || new Set();
5614
+ promise._list.add(fiber);
5615
+ if (promise._loading)
5616
+ return null;
5617
+ promise._loading = true;
5618
+ promise.status = "pending";
5619
+ var renderScheduler = currentScheduler.current;
5620
+ renderDispatch
5621
+ .processPromise(promise)
5622
+ .then(function () {
5623
+ fiber.state = myreactSharedExports.STATE_TYPE.__recreate__;
5624
+ promise._list.delete(fiber);
5625
+ promise._loading = false;
5626
+ var updater = {
5627
+ type: myreactSharedExports.UpdateQueueType.promise,
5628
+ trigger: fiber,
5629
+ isSync: true,
5630
+ isForce: true,
5631
+ payLoad: promise,
5632
+ };
5633
+ renderScheduler.dispatchState(updater);
5634
+ })
5635
+ .catch(function (e) { return renderScheduler.dispatchError({ fiber: fiber, error: e }); });
5636
+ return null;
5637
+ };
5638
+
5639
+ var Dispatcher = react.__my_react_internal__.Dispatcher, MyReactInternalInstanceClass = react.__my_react_internal__.MyReactInternalInstance, dispatchToListenerMap = react.__my_react_internal__.dispatchToListenerMap;
5640
+ var getInitialListeners = function () {
5641
+ return {
5642
+ fiberInitial: new Set(),
5643
+ fiberUpdate: new Set(),
5644
+ fiberHasChange: new Set(),
5645
+ fiberUnmount: new Set(),
5646
+ fiberState: new Set(),
5647
+ fiberTrigger: new Set(),
5648
+ instanceInitial: new Set(),
5649
+ instanceUpdate: new Set(),
5650
+ instanceState: new Set(),
5651
+ instanceUnmount: new Set(),
5652
+ hookInitial: new Set(),
5653
+ hookUpdate: new Set(),
5654
+ hookState: new Set(),
5655
+ hookUnmount: new Set(),
5656
+ beforeCommitMount: new Set(),
5657
+ afterCommitMount: new Set(),
5658
+ beforeCommitUpdate: new Set(),
5659
+ afterCommitUpdate: new Set(),
5660
+ beforeCommitUnmount: new Set(),
5661
+ afterCommitUnmount: new Set(),
5662
+ };
5663
+ };
5664
+ var getInitialMap = function () { return ({
5665
+ effectMap: new MyWeakMap(),
5666
+ layoutEffectMap: new MyWeakMap(),
5667
+ insertionEffectMap: new MyWeakMap(),
5668
+ unmountMap: new MyWeakMap(),
5669
+ eventMap: new MyWeakMap(),
5670
+ triggerCallbackMap: new MyWeakMap(),
5671
+ }); };
5672
+ var getInitialFiber = function () { return ({
5673
+ scheduledFiber: null,
5674
+ errorCatchFiber: null,
5675
+ nextWorkingFiber: null,
5676
+ retriggerFiber: null,
5677
+ }); };
5678
+ var initialRef = {
5679
+ typeForRef: exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__class__,
5680
+ typeForCreate: exports.NODE_TYPE.__text__ | exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__portal__ | exports.NODE_TYPE.__comment__,
5681
+ typeForUpdate: exports.NODE_TYPE.__text__ | exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__comment__,
5682
+ typeForAppend: exports.NODE_TYPE.__text__ | exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__comment__,
5683
+ typeForNativeNode: exports.NODE_TYPE.__text__ | exports.NODE_TYPE.__plain__ | exports.NODE_TYPE.__portal__ | exports.NODE_TYPE.__comment__,
5684
+ };
5685
+ var listenerMap = dispatchToListenerMap;
5686
+ var RenderDispatchEvent = /** @class */ (function (_super) {
5687
+ __extends(RenderDispatchEvent, _super);
5688
+ function RenderDispatchEvent() {
5689
+ var _this = _super.call(this) || this;
5690
+ _this.dispatcher = Dispatcher;
5691
+ _this.runtimeRef = initialRef;
5692
+ _this.runtimeMap = getInitialMap();
5693
+ _this.runtimeFiber = getInitialFiber();
5694
+ listenerMap.set(_this, getInitialListeners());
5695
+ initInstance(_this);
5696
+ initVisibleInstance(_this);
5697
+ initSuspenseInstance(_this);
5698
+ Object.defineProperty(_this, "dispatcher", {
5699
+ value: Dispatcher,
5700
+ writable: false,
5701
+ enumerable: false,
5702
+ configurable: false,
5703
+ });
5704
+ return _this;
5705
+ }
5706
+ RenderDispatchEvent.prototype.getFiberTree = function (_fiber) {
5707
+ throw new Error("Method not implemented.");
5708
+ };
5709
+ RenderDispatchEvent.prototype.readPromise = function (_params) {
5710
+ throw new Error("Method not implemented.");
5711
+ };
5712
+ RenderDispatchEvent.prototype.readContext = function (_params) {
5713
+ throw new Error("Method not implemented.");
5714
+ };
5715
+ RenderDispatchEvent.prototype.dispatchHook = function (_params) {
5716
+ throw new Error("Method not implemented.");
5717
+ };
5718
+ RenderDispatchEvent.prototype.dispatchState = function (_params) {
5719
+ throw new Error("Method not implemented.");
5720
+ };
5721
+ RenderDispatchEvent.prototype.dispatchError = function (_params) {
5722
+ throw new Error("Method not implemented.");
5723
+ };
5724
+ RenderDispatchEvent.prototype.dispatchPromise = function (_params) {
5725
+ throw new Error("Method not implemented.");
5337
5726
  };
5338
5727
  RenderDispatchEvent.prototype.dispatchSuspensePromise = function (_params) {
5339
5728
  throw new Error("Method not implemented.");
@@ -5407,11 +5796,29 @@ function requireIndex_production_1 () {
5407
5796
  };
5408
5797
  set.add(onceCb);
5409
5798
  };
5799
+ RenderDispatchEvent.prototype.callOnFiberInitial = function (_fiber) {
5800
+ var _a;
5801
+ var set = listenerMap.get(this).fiberInitial;
5802
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_fiber); });
5803
+ };
5410
5804
  RenderDispatchEvent.prototype.onFiberUpdate = function (cb) {
5411
5805
  var set = listenerMap.get(this).fiberUpdate;
5412
5806
  set.add(cb);
5413
5807
  return function () { return set.delete(cb); };
5414
5808
  };
5809
+ RenderDispatchEvent.prototype.onceFiberUpdate = function (cb) {
5810
+ var set = listenerMap.get(this).fiberUpdate;
5811
+ var onceCb = function (_fiber) {
5812
+ cb(_fiber);
5813
+ set.delete(onceCb);
5814
+ };
5815
+ set.add(onceCb);
5816
+ };
5817
+ RenderDispatchEvent.prototype.callOnFiberUpdate = function (_fiber) {
5818
+ var _a;
5819
+ var set = listenerMap.get(this).fiberUpdate;
5820
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_fiber); });
5821
+ };
5415
5822
  RenderDispatchEvent.prototype.onFiberChange = function (cb) {
5416
5823
  var set = listenerMap.get(this).fiberHasChange;
5417
5824
  set.add(cb);
@@ -5425,13 +5832,10 @@ function requireIndex_production_1 () {
5425
5832
  };
5426
5833
  set.add(onceCb);
5427
5834
  };
5428
- RenderDispatchEvent.prototype.onceFiberUpdate = function (cb) {
5429
- var set = listenerMap.get(this).fiberUpdate;
5430
- var onceCb = function (_fiber) {
5431
- cb(_fiber);
5432
- set.delete(onceCb);
5433
- };
5434
- set.add(onceCb);
5835
+ RenderDispatchEvent.prototype.callOnFiberChange = function (_list) {
5836
+ var _a;
5837
+ var set = listenerMap.get(this).fiberHasChange;
5838
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_list); });
5435
5839
  };
5436
5840
  RenderDispatchEvent.prototype.onFiberUnmount = function (cb) {
5437
5841
  var set = listenerMap.get(this).fiberUnmount;
@@ -5446,6 +5850,11 @@ function requireIndex_production_1 () {
5446
5850
  };
5447
5851
  set.add(onceCb);
5448
5852
  };
5853
+ RenderDispatchEvent.prototype.callOnFiberUnmount = function (_fiber) {
5854
+ var _a;
5855
+ var set = listenerMap.get(this).fiberUnmount;
5856
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_fiber); });
5857
+ };
5449
5858
  RenderDispatchEvent.prototype.onFiberState = function (cb) {
5450
5859
  var set = listenerMap.get(this).fiberState;
5451
5860
  set.add(cb);
@@ -5459,6 +5868,11 @@ function requireIndex_production_1 () {
5459
5868
  };
5460
5869
  set.add(onceCb);
5461
5870
  };
5871
+ RenderDispatchEvent.prototype.callOnFiberState = function (_fiber, _updater) {
5872
+ var _a;
5873
+ var set = listenerMap.get(this).fiberState;
5874
+ (_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); });
5875
+ };
5462
5876
  RenderDispatchEvent.prototype.onFiberTrigger = function (cb) {
5463
5877
  var set = listenerMap.get(this).fiberTrigger;
5464
5878
  set.add(cb);
@@ -5472,6 +5886,11 @@ function requireIndex_production_1 () {
5472
5886
  };
5473
5887
  set.add(onceCb);
5474
5888
  };
5889
+ RenderDispatchEvent.prototype.callOnFiberTrigger = function (_fiber, _state) {
5890
+ var _a;
5891
+ var set = listenerMap.get(this).fiberTrigger;
5892
+ (_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); });
5893
+ };
5475
5894
  RenderDispatchEvent.prototype.onFiberHMR = function (cb) {
5476
5895
  var _a;
5477
5896
  var set = listenerMap.get(this).fiberHMR;
@@ -5488,6 +5907,11 @@ function requireIndex_production_1 () {
5488
5907
  };
5489
5908
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
5490
5909
  };
5910
+ RenderDispatchEvent.prototype.callOnFiberHMR = function (_fiber, _forceRefresh) {
5911
+ var _a;
5912
+ var set = listenerMap.get(this).fiberHMR;
5913
+ (_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); });
5914
+ };
5491
5915
  RenderDispatchEvent.prototype.onFiberWarn = function (cb) {
5492
5916
  var _a;
5493
5917
  var set = listenerMap.get(this).fiberWarn;
@@ -5504,6 +5928,15 @@ function requireIndex_production_1 () {
5504
5928
  };
5505
5929
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
5506
5930
  };
5931
+ RenderDispatchEvent.prototype.callOnFiberWarn = function (_fiber) {
5932
+ var _a;
5933
+ var args = [];
5934
+ for (var _i = 1; _i < arguments.length; _i++) {
5935
+ args[_i - 1] = arguments[_i];
5936
+ }
5937
+ var set = listenerMap.get(this).fiberWarn;
5938
+ (_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)); });
5939
+ };
5507
5940
  RenderDispatchEvent.prototype.onFiberError = function (cb) {
5508
5941
  var _a;
5509
5942
  var set = listenerMap.get(this).fiberError;
@@ -5520,6 +5953,15 @@ function requireIndex_production_1 () {
5520
5953
  };
5521
5954
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
5522
5955
  };
5956
+ RenderDispatchEvent.prototype.callOnFiberError = function (_fiber) {
5957
+ var _a;
5958
+ var args = [];
5959
+ for (var _i = 1; _i < arguments.length; _i++) {
5960
+ args[_i - 1] = arguments[_i];
5961
+ }
5962
+ var set = listenerMap.get(this).fiberError;
5963
+ (_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)); });
5964
+ };
5523
5965
  RenderDispatchEvent.prototype.onPerformanceWarn = function (cb) {
5524
5966
  var _a;
5525
5967
  var set = listenerMap.get(this).performanceWarn;
@@ -5529,13 +5971,18 @@ function requireIndex_production_1 () {
5529
5971
  RenderDispatchEvent.prototype.oncePerformanceWarn = function (cb) {
5530
5972
  var _a;
5531
5973
  var set = listenerMap.get(this).performanceWarn;
5532
- var onceCb = function (_fiber) {
5974
+ var onceCb = function (_fiber, _renderTime) {
5533
5975
  var _a;
5534
- cb(_fiber);
5976
+ cb(_fiber, _renderTime);
5535
5977
  (_a = set === null || set === void 0 ? void 0 : set.delete) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
5536
5978
  };
5537
5979
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
5538
5980
  };
5981
+ RenderDispatchEvent.prototype.callOnPerformanceWarn = function (_fiber, _renderTime) {
5982
+ var _a;
5983
+ var set = listenerMap.get(this).performanceWarn;
5984
+ (_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); });
5985
+ };
5539
5986
  RenderDispatchEvent.prototype.onBeforeFiberRun = function (cb) {
5540
5987
  var _a;
5541
5988
  var set = listenerMap.get(this).beforeFiberRun;
@@ -5552,6 +5999,11 @@ function requireIndex_production_1 () {
5552
5999
  };
5553
6000
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
5554
6001
  };
6002
+ RenderDispatchEvent.prototype.callOnBeforeFiberRun = function (_fiber) {
6003
+ var _a;
6004
+ var set = listenerMap.get(this).beforeFiberRun;
6005
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_fiber); });
6006
+ };
5555
6007
  RenderDispatchEvent.prototype.onAfterFiberRun = function (cb) {
5556
6008
  var _a;
5557
6009
  var set = listenerMap.get(this).afterFiberRun;
@@ -5568,6 +6020,11 @@ function requireIndex_production_1 () {
5568
6020
  };
5569
6021
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
5570
6022
  };
6023
+ RenderDispatchEvent.prototype.callOnAfterFiberRun = function (_fiber) {
6024
+ var _a;
6025
+ var set = listenerMap.get(this).afterFiberRun;
6026
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_fiber); });
6027
+ };
5571
6028
  RenderDispatchEvent.prototype.onAfterFiberDone = function (cb) {
5572
6029
  var _a;
5573
6030
  var set = listenerMap.get(this).afterFiberDone;
@@ -5576,23 +6033,49 @@ function requireIndex_production_1 () {
5576
6033
  };
5577
6034
  RenderDispatchEvent.prototype.onceAfterFiberDone = function (cb) {
5578
6035
  var _a;
5579
- var set = listenerMap.get(this).afterFiberDone;
5580
- var onceCb = function (_fiber) {
6036
+ var set = listenerMap.get(this).afterFiberDone;
6037
+ var onceCb = function (_fiber) {
6038
+ var _a;
6039
+ cb(_fiber);
6040
+ (_a = set === null || set === void 0 ? void 0 : set.delete) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6041
+ };
6042
+ (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6043
+ };
6044
+ RenderDispatchEvent.prototype.callOnAfterFiberDone = function (_fiber) {
6045
+ var _a;
6046
+ var set = listenerMap.get(this).afterFiberDone;
6047
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(_fiber); });
6048
+ };
6049
+ RenderDispatchEvent.prototype.onBeforeDispatchRender = function (cb) {
6050
+ var _a;
6051
+ var set = listenerMap.get(this).beforeDispatchRender;
6052
+ (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, cb);
6053
+ 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); };
6054
+ };
6055
+ RenderDispatchEvent.prototype.onceBeforeDispatchRender = function (cb) {
6056
+ var _a;
6057
+ var set = listenerMap.get(this).beforeDispatchRender;
6058
+ var onceCb = function (renderDispatch, fiber) {
5581
6059
  var _a;
5582
- cb(_fiber);
6060
+ cb(renderDispatch, fiber);
5583
6061
  (_a = set === null || set === void 0 ? void 0 : set.delete) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
5584
6062
  };
5585
6063
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
5586
6064
  };
5587
- RenderDispatchEvent.prototype.onBeforeDispatchRender = function (cb) {
6065
+ RenderDispatchEvent.prototype.callOnBeforeDispatchRender = function (renderDispatch, fiber) {
5588
6066
  var _a;
5589
6067
  var set = listenerMap.get(this).beforeDispatchRender;
6068
+ (_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); });
6069
+ };
6070
+ RenderDispatchEvent.prototype.onAfterDispatchRender = function (cb) {
6071
+ var _a;
6072
+ var set = listenerMap.get(this).afterDispatchRender;
5590
6073
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, cb);
5591
6074
  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); };
5592
6075
  };
5593
- RenderDispatchEvent.prototype.onceBeforeDispatchRender = function (cb) {
6076
+ RenderDispatchEvent.prototype.onceAfterDispatchRender = function (cb) {
5594
6077
  var _a;
5595
- var set = listenerMap.get(this).beforeDispatchRender;
6078
+ var set = listenerMap.get(this).afterDispatchRender;
5596
6079
  var onceCb = function (renderDispatch) {
5597
6080
  var _a;
5598
6081
  cb(renderDispatch);
@@ -5600,6 +6083,11 @@ function requireIndex_production_1 () {
5600
6083
  };
5601
6084
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
5602
6085
  };
6086
+ RenderDispatchEvent.prototype.callOnAfterDispatchRender = function (renderDispatch) {
6087
+ var _a;
6088
+ var set = listenerMap.get(this).afterDispatchRender;
6089
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(renderDispatch); });
6090
+ };
5603
6091
  RenderDispatchEvent.prototype.onBeforeDispatchUpdate = function (cb) {
5604
6092
  var _a;
5605
6093
  var set = listenerMap.get(this).beforeDispatchUpdate;
@@ -5616,6 +6104,32 @@ function requireIndex_production_1 () {
5616
6104
  };
5617
6105
  (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
5618
6106
  };
6107
+ RenderDispatchEvent.prototype.callOnBeforeDispatchUpdate = function (renderDispatch, list) {
6108
+ var _a;
6109
+ var set = listenerMap.get(this).beforeDispatchUpdate;
6110
+ (_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); });
6111
+ };
6112
+ RenderDispatchEvent.prototype.onAfterDispatchUpdate = function (cb) {
6113
+ var _a;
6114
+ var set = listenerMap.get(this).afterDispatchUpdate;
6115
+ (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, cb);
6116
+ 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); };
6117
+ };
6118
+ RenderDispatchEvent.prototype.onceAfterDispatchUpdate = function (cb) {
6119
+ var _a;
6120
+ var set = listenerMap.get(this).afterDispatchUpdate;
6121
+ var onceCb = function (renderDispatch) {
6122
+ var _a;
6123
+ cb(renderDispatch);
6124
+ (_a = set === null || set === void 0 ? void 0 : set.delete) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6125
+ };
6126
+ (_a = set === null || set === void 0 ? void 0 : set.add) === null || _a === void 0 ? void 0 : _a.call(set, onceCb);
6127
+ };
6128
+ RenderDispatchEvent.prototype.callOnAfterDispatchUpdate = function (renderDispatch) {
6129
+ var _a;
6130
+ var set = listenerMap.get(this).afterDispatchUpdate;
6131
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(renderDispatch); });
6132
+ };
5619
6133
  RenderDispatchEvent.prototype.onInstanceInitial = function (cb) {
5620
6134
  var set = listenerMap.get(this).instanceInitial;
5621
6135
  set.add(cb);
@@ -5629,6 +6143,11 @@ function requireIndex_production_1 () {
5629
6143
  };
5630
6144
  set.add(onceCb);
5631
6145
  };
6146
+ RenderDispatchEvent.prototype.callOnInstanceInitial = function (_instance, _fiber) {
6147
+ var _a;
6148
+ var set = listenerMap.get(this).instanceInitial;
6149
+ (_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); });
6150
+ };
5632
6151
  RenderDispatchEvent.prototype.onInstanceUpdate = function (cb) {
5633
6152
  var set = listenerMap.get(this).instanceUpdate;
5634
6153
  set.add(cb);
@@ -5642,6 +6161,11 @@ function requireIndex_production_1 () {
5642
6161
  };
5643
6162
  set.add(onceCb);
5644
6163
  };
6164
+ RenderDispatchEvent.prototype.callOnInstanceUpdate = function (_instance, _fiber) {
6165
+ var _a;
6166
+ var set = listenerMap.get(this).instanceUpdate;
6167
+ (_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); });
6168
+ };
5645
6169
  RenderDispatchEvent.prototype.onInstanceState = function (cb) {
5646
6170
  var set = listenerMap.get(this).instanceState;
5647
6171
  set.add(cb);
@@ -5655,6 +6179,11 @@ function requireIndex_production_1 () {
5655
6179
  };
5656
6180
  set.add(onceCb);
5657
6181
  };
6182
+ RenderDispatchEvent.prototype.callOnInstanceState = function (_instance, _fiber, _updater) {
6183
+ var _a;
6184
+ var set = listenerMap.get(this).instanceState;
6185
+ (_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); });
6186
+ };
5658
6187
  RenderDispatchEvent.prototype.onInstanceUnmount = function (cb) {
5659
6188
  var set = listenerMap.get(this).instanceUnmount;
5660
6189
  set.add(cb);
@@ -5668,6 +6197,11 @@ function requireIndex_production_1 () {
5668
6197
  };
5669
6198
  set.add(onceCb);
5670
6199
  };
6200
+ RenderDispatchEvent.prototype.callOnInstanceUnmount = function (_instance, _fiber) {
6201
+ var _a;
6202
+ var set = listenerMap.get(this).instanceUnmount;
6203
+ (_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); });
6204
+ };
5671
6205
  RenderDispatchEvent.prototype.onHookInitial = function (cb) {
5672
6206
  var set = listenerMap.get(this).hookInitial;
5673
6207
  set.add(cb);
@@ -5675,12 +6209,17 @@ function requireIndex_production_1 () {
5675
6209
  };
5676
6210
  RenderDispatchEvent.prototype.onceHookInitial = function (cb) {
5677
6211
  var set = listenerMap.get(this).hookInitial;
5678
- var onceCb = function (_hook) {
5679
- cb(_hook);
6212
+ var onceCb = function (_hook, _fiber) {
6213
+ cb(_hook, _fiber);
5680
6214
  set.delete(onceCb);
5681
6215
  };
5682
6216
  set.add(onceCb);
5683
6217
  };
6218
+ RenderDispatchEvent.prototype.callOnHookInitial = function (_hook, _fiber) {
6219
+ var _a;
6220
+ var set = listenerMap.get(this).hookInitial;
6221
+ (_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); });
6222
+ };
5684
6223
  RenderDispatchEvent.prototype.onHookUpdate = function (cb) {
5685
6224
  var set = listenerMap.get(this).hookUpdate;
5686
6225
  set.add(cb);
@@ -5688,12 +6227,17 @@ function requireIndex_production_1 () {
5688
6227
  };
5689
6228
  RenderDispatchEvent.prototype.onceHookUpdate = function (cb) {
5690
6229
  var set = listenerMap.get(this).hookUpdate;
5691
- var onceCb = function (_hook) {
5692
- cb(_hook);
6230
+ var onceCb = function (_hook, _fiber) {
6231
+ cb(_hook, _fiber);
5693
6232
  set.delete(onceCb);
5694
6233
  };
5695
6234
  set.add(onceCb);
5696
6235
  };
6236
+ RenderDispatchEvent.prototype.callOnHookUpdate = function (_hook, _fiber) {
6237
+ var _a;
6238
+ var set = listenerMap.get(this).hookUpdate;
6239
+ (_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); });
6240
+ };
5697
6241
  RenderDispatchEvent.prototype.onHookUnmount = function (cb) {
5698
6242
  var set = listenerMap.get(this).hookUnmount;
5699
6243
  set.add(cb);
@@ -5701,12 +6245,17 @@ function requireIndex_production_1 () {
5701
6245
  };
5702
6246
  RenderDispatchEvent.prototype.onceHookUnmount = function (cb) {
5703
6247
  var set = listenerMap.get(this).hookUnmount;
5704
- var onceCb = function (_hook) {
5705
- cb(_hook);
6248
+ var onceCb = function (_hook, _fiber) {
6249
+ cb(_hook, _fiber);
5706
6250
  set.delete(onceCb);
5707
6251
  };
5708
6252
  set.add(onceCb);
5709
6253
  };
6254
+ RenderDispatchEvent.prototype.callOnHookUnmount = function (_hook, _fiber) {
6255
+ var _a;
6256
+ var set = listenerMap.get(this).hookUnmount;
6257
+ (_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); });
6258
+ };
5710
6259
  RenderDispatchEvent.prototype.onHookState = function (cb) {
5711
6260
  var set = listenerMap.get(this).hookState;
5712
6261
  set.add(cb);
@@ -5720,6 +6269,11 @@ function requireIndex_production_1 () {
5720
6269
  };
5721
6270
  set.add(onceCb);
5722
6271
  };
6272
+ RenderDispatchEvent.prototype.callOnHookState = function (_hook, _fiber, _updater) {
6273
+ var _a;
6274
+ var set = listenerMap.get(this).hookState;
6275
+ (_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); });
6276
+ };
5723
6277
  RenderDispatchEvent.prototype.onBeforeCommitMount = function (cb) {
5724
6278
  var set = listenerMap.get(this).beforeCommitMount;
5725
6279
  set.add(cb);
@@ -5727,12 +6281,17 @@ function requireIndex_production_1 () {
5727
6281
  };
5728
6282
  RenderDispatchEvent.prototype.onceBeforeCommitMount = function (cb) {
5729
6283
  var set = listenerMap.get(this).beforeCommitMount;
5730
- var onceCb = function () {
5731
- cb();
6284
+ var onceCb = function (renderDispatch) {
6285
+ cb(renderDispatch);
5732
6286
  set.delete(onceCb);
5733
6287
  };
5734
6288
  set.add(onceCb);
5735
6289
  };
6290
+ RenderDispatchEvent.prototype.callOnBeforeCommitMount = function (renderDispatch) {
6291
+ var _a;
6292
+ var set = listenerMap.get(this).beforeCommitMount;
6293
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(renderDispatch); });
6294
+ };
5736
6295
  RenderDispatchEvent.prototype.onAfterCommitMount = function (cb) {
5737
6296
  var set = listenerMap.get(this).afterCommitMount;
5738
6297
  set.add(cb);
@@ -5740,12 +6299,17 @@ function requireIndex_production_1 () {
5740
6299
  };
5741
6300
  RenderDispatchEvent.prototype.onceAfterCommitMount = function (cb) {
5742
6301
  var set = listenerMap.get(this).afterCommitMount;
5743
- var onceCb = function () {
5744
- cb();
6302
+ var onceCb = function (renderDispatch) {
6303
+ cb(renderDispatch);
5745
6304
  set.delete(onceCb);
5746
6305
  };
5747
6306
  set.add(onceCb);
5748
6307
  };
6308
+ RenderDispatchEvent.prototype.callOnAfterCommitMount = function (renderDispatch) {
6309
+ var _a;
6310
+ var set = listenerMap.get(this).afterCommitMount;
6311
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(renderDispatch); });
6312
+ };
5749
6313
  RenderDispatchEvent.prototype.onBeforeCommitUpdate = function (cb) {
5750
6314
  var set = listenerMap.get(this).beforeCommitUpdate;
5751
6315
  set.add(cb);
@@ -5753,12 +6317,17 @@ function requireIndex_production_1 () {
5753
6317
  };
5754
6318
  RenderDispatchEvent.prototype.onceBeforeCommitUpdate = function (cb) {
5755
6319
  var set = listenerMap.get(this).beforeCommitUpdate;
5756
- var onceCb = function () {
5757
- cb();
6320
+ var onceCb = function (renderDispatch) {
6321
+ cb(renderDispatch);
5758
6322
  set.delete(onceCb);
5759
6323
  };
5760
6324
  set.add(onceCb);
5761
6325
  };
6326
+ RenderDispatchEvent.prototype.callOnBeforeCommitUpdate = function (renderDispatch) {
6327
+ var _a;
6328
+ var set = listenerMap.get(this).beforeCommitUpdate;
6329
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(renderDispatch); });
6330
+ };
5762
6331
  RenderDispatchEvent.prototype.onAfterCommitUpdate = function (cb) {
5763
6332
  var set = listenerMap.get(this).afterCommitUpdate;
5764
6333
  set.add(cb);
@@ -5766,12 +6335,17 @@ function requireIndex_production_1 () {
5766
6335
  };
5767
6336
  RenderDispatchEvent.prototype.onceAfterCommitUpdate = function (cb) {
5768
6337
  var set = listenerMap.get(this).afterCommitUpdate;
5769
- var onceCb = function () {
5770
- cb();
6338
+ var onceCb = function (renderDispatch) {
6339
+ cb(renderDispatch);
5771
6340
  set.delete(onceCb);
5772
6341
  };
5773
6342
  set.add(onceCb);
5774
6343
  };
6344
+ RenderDispatchEvent.prototype.callOnAfterCommitUpdate = function (renderDispatch) {
6345
+ var _a;
6346
+ var set = listenerMap.get(this).afterCommitUpdate;
6347
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(renderDispatch); });
6348
+ };
5775
6349
  RenderDispatchEvent.prototype.onBeforeCommitUnmount = function (cb) {
5776
6350
  var set = listenerMap.get(this).beforeCommitUnmount;
5777
6351
  set.add(cb);
@@ -5779,12 +6353,17 @@ function requireIndex_production_1 () {
5779
6353
  };
5780
6354
  RenderDispatchEvent.prototype.onceBeforeCommitUnmount = function (cb) {
5781
6355
  var set = listenerMap.get(this).beforeCommitUnmount;
5782
- var onceCb = function () {
5783
- cb();
6356
+ var onceCb = function (renderDispatch) {
6357
+ cb(renderDispatch);
5784
6358
  set.delete(onceCb);
5785
6359
  };
5786
6360
  set.add(onceCb);
5787
6361
  };
6362
+ RenderDispatchEvent.prototype.callOnBeforeCommitUnmount = function (renderDispatch) {
6363
+ var _a;
6364
+ var set = listenerMap.get(this).beforeCommitUnmount;
6365
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(renderDispatch); });
6366
+ };
5788
6367
  RenderDispatchEvent.prototype.onAfterCommitUnmount = function (cb) {
5789
6368
  var set = listenerMap.get(this).afterCommitUnmount;
5790
6369
  set.add(cb);
@@ -5792,12 +6371,17 @@ function requireIndex_production_1 () {
5792
6371
  };
5793
6372
  RenderDispatchEvent.prototype.onceAfterCommitUnmount = function (cb) {
5794
6373
  var set = listenerMap.get(this).afterCommitUnmount;
5795
- var onceCb = function () {
5796
- cb();
6374
+ var onceCb = function (renderDispatch) {
6375
+ cb(renderDispatch);
5797
6376
  set.delete(onceCb);
5798
6377
  };
5799
6378
  set.add(onceCb);
5800
6379
  };
6380
+ RenderDispatchEvent.prototype.callOnAfterCommitUnmount = function (renderDispatch) {
6381
+ var _a;
6382
+ var set = listenerMap.get(this).afterCommitUnmount;
6383
+ (_a = set === null || set === void 0 ? void 0 : set.forEach) === null || _a === void 0 ? void 0 : _a.call(set, function (cb) { return cb(renderDispatch); });
6384
+ };
5801
6385
  return RenderDispatchEvent;
5802
6386
  }(MyReactInternalInstanceClass));
5803
6387
 
@@ -5815,293 +6399,18 @@ function requireIndex_production_1 () {
5815
6399
  else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__suspense__)) {
5816
6400
  nextWorkSuspense(renderDispatch, fiber);
5817
6401
  }
5818
- else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__consumer__)) {
5819
- nextWorkConsumer(renderDispatch, fiber);
5820
- }
5821
- else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__provider__ | exports.NODE_TYPE.__context__)) {
5822
- nextWorkProvider(renderDispatch, fiber);
5823
- }
5824
- else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__activity__)) {
5825
- nextWorkActivity(renderDispatch, fiber);
5826
- }
5827
- else {
5828
- nextWorkNormal(renderDispatch, fiber);
5829
- }
5830
- };
5831
-
5832
- var currentScheduler$2 = react.__my_react_internal__.currentScheduler;
5833
- react.__my_react_shared__.enableScopeTreeLog;
5834
- // TODO improve
5835
- var defaultDispatchMountLatest = function (_dispatch, _fiber) {
5836
- beforeSyncUpdate();
5837
- var _list = generateFiberToListWithAction(_fiber, function invokeUnmountPendingList(_fiber) {
5838
- defaultInvokeUnmountList(_dispatch, _fiber);
5839
- });
5840
- _list.listToFoot(function invokeInsertionEffectList(_fiber) {
5841
- insertionEffect(_dispatch, _fiber);
5842
- });
5843
- afterSyncUpdate();
5844
- _list.listToFoot(function invokeCreateAndUpdateList(_fiber) {
5845
- safeCallWithCurrentFiber({
5846
- fiber: _fiber,
5847
- action: function safeCallCreateAndUpdate() {
5848
- _dispatch.commitCreate(_fiber);
5849
- _dispatch.commitUpdate(_fiber);
5850
- },
5851
- });
5852
- });
5853
- _list.listToFoot(function invokeAppendList(_fiber) {
5854
- safeCallWithCurrentFiber({
5855
- fiber: _fiber,
5856
- action: function safeCallAppendList() {
5857
- _dispatch.commitAppend(_fiber);
5858
- },
5859
- });
5860
- });
5861
- _list.listToFoot(function invokeSetRefList(_fiber) {
5862
- safeCallWithCurrentFiber({
5863
- fiber: _fiber,
5864
- action: function safeCallSetRefList() {
5865
- _dispatch.commitSetRef(_fiber);
5866
- },
5867
- });
5868
- });
5869
- beforeSyncUpdate();
5870
- _list.listToFoot(function invokeLayoutEffectList(_fiber) {
5871
- layoutEffect(_dispatch, _fiber);
5872
- });
5873
- afterSyncUpdate();
5874
- function invokeEffectListTask() {
5875
- _list.listToFoot(function invokeEffectList(_fiber) {
5876
- effect(_dispatch, _fiber);
5877
- });
5878
- }
5879
- addEffectCallback(invokeEffectListTask);
5880
- var renderScheduler = currentScheduler$2.current;
5881
- if (_dispatch.enableConcurrentMode) {
5882
- renderScheduler.macroTask(function flushEffect() {
5883
- flushEffectCallback();
5884
- });
5885
- }
5886
- else {
5887
- renderScheduler.microTask(function flushEffect() {
5888
- flushEffectCallback();
5889
- });
5890
- }
5891
- };
5892
- var defaultDispatchMount = defaultDispatchMountLatest;
5893
-
5894
- var defaultResolveScope = function (fiber) {
5895
- var parent = fiber.parent;
5896
- while (parent) {
5897
- if (myreactSharedExports.include(parent.type, exports.NODE_TYPE.__scope__) || myreactSharedExports.include(parent.type, exports.NODE_TYPE.__scopeSuspense__)) {
5898
- return parent;
5899
- }
5900
- parent = parent.parent;
5901
- }
5902
- return null;
5903
- };
5904
-
5905
- react.__my_react_shared__.enableDebugFiled;
5906
- var defaultGenerateStrict = function (fiber) {
5907
- return false;
5908
- };
5909
-
5910
- var currentScheduler$1 = react.__my_react_internal__.currentScheduler;
5911
- react.__my_react_shared__.enableScopeTreeLog;
5912
- var defaultDispatchUpdate = function (_dispatch, _list) {
5913
- // TODO maybe need call `insertionEffect` in another function
5914
- beforeSyncUpdate();
5915
- _list.listToFoot(function invokeUnmountPendingAndInsertionEffectList(_fiber) {
5916
- if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
5917
- defaultInvokeUnmountList(_dispatch, _fiber);
5918
- }
5919
- });
5920
- _list.listToFoot(function invokeUnmountPendingAndInsertionEffectList(_fiber) {
5921
- if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
5922
- insertionEffect(_dispatch, _fiber);
5923
- }
5924
- });
5925
- afterSyncUpdate();
5926
- _list.listToFoot(function invokeCreateAndUpdateList(_fiber) {
5927
- if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
5928
- safeCallWithCurrentFiber({
5929
- fiber: _fiber,
5930
- action: function safeCallCreateAndUpdate() {
5931
- _dispatch.commitCreate(_fiber);
5932
- _dispatch.commitUpdate(_fiber);
5933
- },
5934
- });
5935
- }
5936
- });
5937
- _list.listToHead(function invokePositionList(_fiber) {
5938
- if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
5939
- safeCallWithCurrentFiber({
5940
- fiber: _fiber,
5941
- action: function safeCallPosition() {
5942
- _dispatch.commitPosition(_fiber);
5943
- },
5944
- });
5945
- }
5946
- });
5947
- _list.listToFoot(function invokeAppendList(_fiber) {
5948
- if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
5949
- safeCallWithCurrentFiber({
5950
- fiber: _fiber,
5951
- action: function safeCallAppendList() {
5952
- _dispatch.commitAppend(_fiber);
5953
- },
5954
- });
5955
- }
5956
- });
5957
- _list.listToFoot(function invokeSetRefList(_fiber) {
5958
- if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
5959
- safeCallWithCurrentFiber({
5960
- fiber: _fiber,
5961
- action: function safeCallSetRefList() {
5962
- _dispatch.commitSetRef(_fiber);
5963
- },
5964
- });
5965
- }
5966
- });
5967
- beforeSyncUpdate();
5968
- _list.listToFoot(function invokeLayoutEffectList(_fiber) {
5969
- if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
5970
- layoutEffect(_dispatch, _fiber);
5971
- }
5972
- });
5973
- afterSyncUpdate();
5974
- function invokeEffectListTask() {
5975
- _list.listToFoot(function invokeEffectList(_fiber) {
5976
- if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
5977
- effect(_dispatch, _fiber);
5978
- }
5979
- });
5980
- }
5981
- addEffectCallback(invokeEffectListTask);
5982
- var renderScheduler = currentScheduler$1.current;
5983
- if (_dispatch.enableConcurrentMode) {
5984
- renderScheduler.macroTask(function flushEffect() {
5985
- flushEffectCallback();
5986
- });
5987
- }
5988
- else {
5989
- renderScheduler.microTask(function flushEffect() {
5990
- flushEffectCallback();
5991
- });
6402
+ else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__consumer__)) {
6403
+ nextWorkConsumer(renderDispatch, fiber);
5992
6404
  }
5993
- };
5994
-
5995
- var enableSuspenseRoot = react.__my_react_shared__.enableSuspenseRoot;
5996
- var currentScheduler = react.__my_react_internal__.currentScheduler;
5997
- var loadPromise = function (renderDispatch, promise) { return __awaiter(void 0, void 0, void 0, function () {
5998
- var value, reason_1;
5999
- return __generator(this, function (_a) {
6000
- switch (_a.label) {
6001
- case 0:
6002
- if (promise.status === "fulfilled" || promise.status === "rejected")
6003
- return [2 /*return*/];
6004
- _a.label = 1;
6005
- case 1:
6006
- _a.trys.push([1, 3, , 4]);
6007
- promise.status = "pending";
6008
- return [4 /*yield*/, Promise.resolve(promise)];
6009
- case 2:
6010
- value = _a.sent();
6011
- promise.status = "fulfilled";
6012
- promise._value = value;
6013
- return [3 /*break*/, 4];
6014
- case 3:
6015
- reason_1 = _a.sent();
6016
- promise.status = "rejected";
6017
- promise._reason = reason_1;
6018
- return [3 /*break*/, 4];
6019
- case 4: return [2 /*return*/];
6020
- }
6021
- });
6022
- }); };
6023
- var processPromise = function (renderDispatch, fiber, promise) {
6024
- var _a, _b;
6025
- defaultDeleteCurrentEffect(renderDispatch, fiber);
6026
- if (promise.status === "rejected") {
6027
- (_b = (_a = currentScheduler.current).dispatchError) === null || _b === void 0 ? void 0 : _b.call(_a, { fiber: fiber, error: promise._reason });
6028
- return null;
6405
+ else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__provider__ | exports.NODE_TYPE.__context__)) {
6406
+ nextWorkProvider(renderDispatch, fiber);
6029
6407
  }
6030
- if (promise.status === "fulfilled") ;
6031
- promise._list = promise._list || new Set();
6032
- promise._list.add(fiber);
6033
- var suspenseFiber = renderDispatch.resolveSuspenseFiber(fiber);
6034
- if (suspenseFiber) {
6035
- var suspenseField = getInstanceFieldByInstance(suspenseFiber.instance);
6036
- suspenseField.asyncLoadList.uniPush(promise);
6037
- renderDispatch.pendingSuspenseFiberArray.uniPush(suspenseFiber);
6038
- return null;
6408
+ else if (myreactSharedExports.include(fiber.type, exports.NODE_TYPE.__activity__)) {
6409
+ nextWorkActivity(renderDispatch, fiber);
6039
6410
  }
6040
6411
  else {
6041
- // TODO update flow
6042
- if (enableSuspenseRoot.current && !renderDispatch.isAppMounted) {
6043
- var suspenseField = getInstanceFieldByInstance(renderDispatch);
6044
- suspenseField.asyncLoadList.uniPush(promise);
6045
- return null;
6046
- }
6047
- devWarnWithFiber(fiber, "[@my-react/react] promise must be used inside a Suspense component, otherwise it will not work as expected");
6048
- if (promise._loading)
6049
- return null;
6050
- promise._loading = true;
6051
- promise.status = "pending";
6052
- var renderScheduler_1 = currentScheduler.current;
6053
- renderDispatch
6054
- .processPromise(promise)
6055
- .then(function () {
6056
- fiber.state = myreactSharedExports.STATE_TYPE.__recreate__;
6057
- promise._list.delete(fiber);
6058
- promise._loading = false;
6059
- var updater = {
6060
- type: myreactSharedExports.UpdateQueueType.promise,
6061
- trigger: fiber,
6062
- isSync: true,
6063
- isForce: true,
6064
- payLoad: promise,
6065
- };
6066
- renderScheduler_1.dispatchState(updater);
6067
- })
6068
- .catch(function (e) { return renderScheduler_1.dispatchError({ fiber: fiber, error: e }); });
6069
- return null;
6070
- }
6071
- };
6072
- var processSuspensePromise = function (renderDispatch, fiber, promise) {
6073
- var _a, _b;
6074
- defaultDeleteCurrentEffect(renderDispatch, fiber);
6075
- fiber.state = myreactSharedExports.STATE_TYPE.__suspense__;
6076
- if (promise.status === "rejected") {
6077
- (_b = (_a = currentScheduler.current).dispatchError) === null || _b === void 0 ? void 0 : _b.call(_a, { fiber: fiber, error: promise._reason });
6078
- return null;
6412
+ nextWorkNormal(renderDispatch, fiber);
6079
6413
  }
6080
- if (promise.status === "fulfilled") ;
6081
- promise._list = promise._list || new Set();
6082
- promise._list.add(fiber);
6083
- if (promise._loading)
6084
- return null;
6085
- promise._loading = true;
6086
- promise.status = "pending";
6087
- var renderScheduler = currentScheduler.current;
6088
- renderDispatch
6089
- .processPromise(promise)
6090
- .then(function () {
6091
- fiber.state = myreactSharedExports.STATE_TYPE.__recreate__;
6092
- promise._list.delete(fiber);
6093
- promise._loading = false;
6094
- var updater = {
6095
- type: myreactSharedExports.UpdateQueueType.promise,
6096
- trigger: fiber,
6097
- isSync: true,
6098
- isForce: true,
6099
- payLoad: promise,
6100
- };
6101
- renderScheduler.dispatchState(updater);
6102
- })
6103
- .catch(function (e) { return renderScheduler.dispatchError({ fiber: fiber, error: e }); });
6104
- return null;
6105
6414
  };
6106
6415
 
6107
6416
  var CustomRenderDispatch = /** @class */ (function (_super) {
@@ -6113,7 +6422,7 @@ function requireIndex_production_1 () {
6113
6422
  _this.isAppMounted = false;
6114
6423
  _this.isAppCrashed = false;
6115
6424
  _this.isAppUnmounted = false;
6116
- _this.version = "0.3.19";
6425
+ _this.version = "0.3.20";
6117
6426
  _this.mode = "production";
6118
6427
  _this.renderMode = "render";
6119
6428
  _this.pendingCommitFiberList = null;
@@ -6257,29 +6566,29 @@ function requireIndex_production_1 () {
6257
6566
  (_a = instance.beforeCommit) === null || _a === void 0 ? void 0 : _a.call(instance);
6258
6567
  });
6259
6568
  safeCall(function safeCallBeforeCommitListener() {
6260
- listenerMap.get(instance).beforeCommitMount.forEach(function (cb) { return cb(); });
6569
+ instance.callOnBeforeCommitMount(instance);
6261
6570
  });
6262
6571
  defaultDispatchMount(this, _fiber);
6263
6572
  safeCall(function safeCallAfterCommitListener() {
6264
- listenerMap.get(instance).afterCommitMount.forEach(function (cb) { return cb(); });
6573
+ instance.callOnAfterCommitMount(instance);
6265
6574
  });
6266
6575
  safeCall(function safeCallAfterCommit() {
6267
6576
  var _a;
6268
6577
  (_a = instance.afterCommit) === null || _a === void 0 ? void 0 : _a.call(instance);
6269
6578
  });
6270
6579
  };
6271
- CustomRenderDispatch.prototype.reconcileUpdate = function (_list) {
6580
+ CustomRenderDispatch.prototype.reconcileUpdate = function (_list, sync) {
6272
6581
  var instance = this;
6273
6582
  safeCall(function safeCallBeforeUpdate() {
6274
6583
  var _a;
6275
6584
  (_a = instance.beforeUpdate) === null || _a === void 0 ? void 0 : _a.call(instance);
6276
6585
  });
6277
6586
  safeCall(function safeCallBeforeUpdateListener() {
6278
- listenerMap.get(instance).beforeCommitUpdate.forEach(function (cb) { return cb(); });
6587
+ instance.callOnBeforeCommitUpdate(instance);
6279
6588
  });
6280
- defaultDispatchUpdate(this, _list);
6589
+ defaultDispatchUpdate(this, _list, sync);
6281
6590
  safeCall(function safeCallAfterUpdateListener() {
6282
- listenerMap.get(instance).afterCommitUpdate.forEach(function (cb) { return cb(); });
6591
+ instance.callOnAfterCommitUpdate(instance);
6283
6592
  });
6284
6593
  safeCall(function safeCallAfterUpdate() {
6285
6594
  var _a;
@@ -6293,11 +6602,11 @@ function requireIndex_production_1 () {
6293
6602
  (_a = instance.beforeUnmount) === null || _a === void 0 ? void 0 : _a.call(instance);
6294
6603
  });
6295
6604
  safeCall(function safeCallBeforeUnmountListener() {
6296
- listenerMap.get(instance).beforeCommitUnmount.forEach(function (cb) { return cb(); });
6605
+ instance.callOnBeforeCommitUnmount(instance);
6297
6606
  });
6298
6607
  defaultDispatchUnmount(this);
6299
6608
  safeCall(function safeCallAfterUnmountListener() {
6300
- listenerMap.get(instance).afterCommitUnmount.forEach(function (cb) { return cb(); });
6609
+ instance.callOnAfterCommitUnmount(instance);
6301
6610
  });
6302
6611
  safeCall(function safeCallAfterUnmount() {
6303
6612
  var _a;
@@ -6327,150 +6636,6 @@ function requireIndex_production_1 () {
6327
6636
  return CustomRenderDispatch;
6328
6637
  }(RenderDispatchEvent));
6329
6638
 
6330
- react.__my_react_shared__.enableDebugFiled;
6331
- var currentRunningFiber = react.__my_react_internal__.currentRunningFiber, MyReactInternalInstance = react.__my_react_internal__.MyReactInternalInstance;
6332
- var defaultGetContextValue = function (fiber, ContextObject) {
6333
- var _a;
6334
- if (fiber) {
6335
- return fiber.pendingProps["value"];
6336
- }
6337
- else {
6338
- return (_a = ContextObject === null || ContextObject === void 0 ? void 0 : ContextObject.Provider) === null || _a === void 0 ? void 0 : _a["value"];
6339
- }
6340
- };
6341
- var defaultGetContextFiber = function (fiber, ContextObject) {
6342
- if ((fiber === null || fiber === void 0 ? void 0 : fiber.parent) && ContextObject) {
6343
- var parent_1 = fiber.parent;
6344
- while (parent_1) {
6345
- if (myreactSharedExports.include(parent_1.type, exports.NODE_TYPE.__provider__)) {
6346
- var typedElementType = parent_1.elementType;
6347
- var contextObj = typedElementType["Context"];
6348
- if (contextObj === ContextObject) {
6349
- return parent_1;
6350
- }
6351
- }
6352
- if (myreactSharedExports.include(parent_1.type, exports.NODE_TYPE.__context__)) {
6353
- var typedElementType = parent_1.elementType;
6354
- var contextObj = typedElementType;
6355
- if (contextObj === ContextObject) {
6356
- return parent_1;
6357
- }
6358
- }
6359
- parent_1 = parent_1.parent;
6360
- }
6361
- }
6362
- else {
6363
- return null;
6364
- }
6365
- };
6366
- var defaultReadContext = function (Context) {
6367
- var fiber = currentRunningFiber.current;
6368
- if (!Context) {
6369
- throw new Error("the Context what you read is not exist");
6370
- }
6371
- if (!fiber) {
6372
- throw new Error('current environment is not support "readContext"');
6373
- }
6374
- var isUpdate = !!fiber.instance;
6375
- fiber.instance = fiber.instance || new MyReactInternalInstance();
6376
- !isUpdate && initInstance(fiber.instance);
6377
- !isUpdate && setOwnerForInstance(fiber.instance, fiber);
6378
- var contextFiber = defaultGetContextFiber(fiber, Context);
6379
- setSubscribeForInstance(fiber.instance, contextFiber);
6380
- return defaultGetContextValue(contextFiber, Context);
6381
- };
6382
- var prepareUpdateAllDependence = function (renderDispatch, fiber, beforeValue, afterValue) {
6383
- var consumerList = new Set((fiber === null || fiber === void 0 ? void 0 : fiber.dependence) || []);
6384
- consumerList.forEach(function prepareUpdateSingleConsumer(i) {
6385
- var owner = getInstanceOwnerFiber(i);
6386
- if (owner && myreactSharedExports.exclude(owner.state, myreactSharedExports.STATE_TYPE.__unmount__)) {
6387
- var typedFiber_1 = owner;
6388
- typedFiber_1.state = myreactSharedExports.STATE_TYPE.__triggerSyncForce__;
6389
- }
6390
- });
6391
- var processedNodes = [];
6392
- var updater = {
6393
- type: myreactSharedExports.UpdateQueueType.context,
6394
- trigger: fiber,
6395
- payLoad: afterValue,
6396
- isSync: true,
6397
- isForce: true,
6398
- isImmediate: true,
6399
- isRetrigger: true,
6400
- };
6401
- processedNodes.push(updater);
6402
- var updateState = {
6403
- needUpdate: true,
6404
- nodes: processedNodes,
6405
- isSync: true,
6406
- isForce: true,
6407
- isImmediate: true,
6408
- isRetrigger: true,
6409
- };
6410
- safeCallWithCurrentFiber({
6411
- fiber: fiber,
6412
- action: function safeCallFiberTriggerListener() {
6413
- var _a, _b;
6414
- (_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); });
6415
- },
6416
- });
6417
- };
6418
-
6419
- var currentComponentFiber = react.__my_react_internal__.currentComponentFiber, currentHookNodeIndex = react.__my_react_internal__.currentHookNodeIndex;
6420
- var resolveHookValue = function (hookNode, field) {
6421
- if (hookNode) {
6422
- switch (hookNode.type) {
6423
- case myreactSharedExports.HOOK_TYPE.useState:
6424
- case myreactSharedExports.HOOK_TYPE.useReducer:
6425
- return [hookNode.result, field.dispatch];
6426
- case myreactSharedExports.HOOK_TYPE.useId:
6427
- case myreactSharedExports.HOOK_TYPE.useRef:
6428
- case myreactSharedExports.HOOK_TYPE.useMemo:
6429
- case myreactSharedExports.HOOK_TYPE.useContext:
6430
- case myreactSharedExports.HOOK_TYPE.useCallback:
6431
- case myreactSharedExports.HOOK_TYPE.useDeferredValue:
6432
- case myreactSharedExports.HOOK_TYPE.useSyncExternalStore:
6433
- case myreactSharedExports.HOOK_TYPE.useEffectEvent:
6434
- return hookNode.result;
6435
- case myreactSharedExports.HOOK_TYPE.useOptimistic:
6436
- case myreactSharedExports.HOOK_TYPE.useTransition:
6437
- return [hookNode.result.value, hookNode.result.start];
6438
- case myreactSharedExports.HOOK_TYPE.useSignal:
6439
- return [hookNode.result.getValue, hookNode.result.setValue];
6440
- }
6441
- }
6442
- };
6443
- var processHook = function (renderDispatch, _a) {
6444
- var type = _a.type, reducer = _a.reducer, value = _a.value, deps = _a.deps;
6445
- var fiber = currentComponentFiber.current;
6446
- if (!fiber)
6447
- throw new Error("[@my-react/react] can not use hook outside of component");
6448
- if (!renderDispatch)
6449
- throw new Error("[@my-react/react] internal error, can not get 'renderDispatch' for current render");
6450
- fiber.hookList = fiber.hookList || new myreactSharedExports.ListTree();
6451
- var currentHook = null;
6452
- // initial
6453
- if (myreactSharedExports.include(fiber.state, myreactSharedExports.STATE_TYPE.__create__ | myreactSharedExports.STATE_TYPE.__recreate__)) {
6454
- currentHook = createHookNode(renderDispatch, { type: type, reducer: reducer, value: value, deps: deps }, fiber);
6455
- safeCall(function safeCallHookInitialListener() {
6456
- var _a, _b;
6457
- (_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); });
6458
- });
6459
- }
6460
- else {
6461
- // update
6462
- currentHook = updateHookNode(renderDispatch, { type: type, reducer: reducer, value: value, deps: deps }, fiber, false);
6463
- safeCall(function safeCallHookUpdateListener() {
6464
- var _a, _b;
6465
- (_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); });
6466
- });
6467
- }
6468
- currentHookNodeIndex.current++;
6469
- var field = getInstanceFieldByInstance(currentHook);
6470
- effectHookNode(renderDispatch, fiber, currentHook, field);
6471
- return resolveHookValue(currentHook, field);
6472
- };
6473
-
6474
6639
  var globalLoop = react.__my_react_internal__.globalLoop;
6475
6640
  react.__my_react_shared__.enableScopeTreeLog;
6476
6641
  function finishMountSync(renderDispatch, fiber) {
@@ -6483,8 +6648,7 @@ function requireIndex_production_1 () {
6483
6648
  safeCallWithCurrentFiber({
6484
6649
  fiber: fiber,
6485
6650
  action: function safeCallFiberHasChangeListener() {
6486
- var _a, _b;
6487
- (_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); });
6651
+ renderDispatch.callOnFiberChange(changedList);
6488
6652
  },
6489
6653
  });
6490
6654
  }
@@ -6505,20 +6669,19 @@ function requireIndex_production_1 () {
6505
6669
  safeCallWithCurrentFiber({
6506
6670
  fiber: fiber,
6507
6671
  action: function safeCallFiberHasChangeListener() {
6508
- var _a, _b;
6509
- (_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); });
6672
+ renderDispatch.callOnFiberChange(changedList);
6510
6673
  },
6511
6674
  });
6512
6675
  }
6513
6676
  var mountAsync = function (renderDispatch, fiber) { return __awaiter(void 0, void 0, void 0, function () {
6514
- return __generator(this, function (_d) {
6515
- switch (_d.label) {
6677
+ return __generator(this, function (_a) {
6678
+ switch (_a.label) {
6516
6679
  case 0:
6517
6680
  globalLoop.current = true;
6518
6681
  mountLoopAll(renderDispatch, fiber);
6519
6682
  return [4 /*yield*/, processAsyncLoadListOnAsyncMount(renderDispatch)];
6520
6683
  case 1:
6521
- _d.sent();
6684
+ _a.sent();
6522
6685
  finishMountAsync(renderDispatch, fiber);
6523
6686
  globalLoop.current = false;
6524
6687
  return [2 /*return*/];
@@ -6526,7 +6689,7 @@ function requireIndex_production_1 () {
6526
6689
  });
6527
6690
  }); };
6528
6691
 
6529
- var version = "0.3.19";
6692
+ var version = "0.3.20";
6530
6693
 
6531
6694
  exports.CustomRenderDispatch = CustomRenderDispatch;
6532
6695
  exports.MyReactFiberNode = MyReactFiberNode;
@@ -6628,7 +6791,6 @@ function requireIndex_production_1 () {
6628
6791
  exports.isErrorBoundariesComponent = isErrorBoundariesComponent;
6629
6792
  exports.isErrorBoundariesInstance = isErrorBoundariesInstance;
6630
6793
  exports.layoutEffect = layoutEffect;
6631
- exports.listenerMap = listenerMap;
6632
6794
  exports.loadLazy = loadLazy;
6633
6795
  exports.loadPromise = loadPromise;
6634
6796
  exports.mountAsync = mountAsync;
@@ -7985,7 +8147,7 @@ var ReconcilerDispatchMount = function (_dispatch, _fiber, config) {
7985
8147
 
7986
8148
  var currentScheduler$1 = require$$0.__my_react_internal__.currentScheduler;
7987
8149
  require$$0.__my_react_shared__.enableScopeTreeLog;
7988
- var ReconcilerDispatchUpdate = function (_dispatch, _list, config) {
8150
+ var ReconcilerDispatchUpdate = function (_dispatch, _list, config, sync) {
7989
8151
  myreactReconcilerExports.beforeSyncUpdate();
7990
8152
  _list.listToFoot(function invokeUnmountPendingAndInsertionEffectList(_fiber) {
7991
8153
  if (myreactSharedExports.exclude(_fiber.state, myreactSharedExports.STATE_TYPE.__unmount__) && !_dispatch.isAppUnmounted) {
@@ -8085,7 +8247,7 @@ var ReconcilerDispatchUpdate = function (_dispatch, _list, config) {
8085
8247
  }
8086
8248
  myreactReconcilerExports.addEffectCallback(invokeEffectListTask);
8087
8249
  var renderScheduler = currentScheduler$1.current;
8088
- if (_dispatch.enableConcurrentMode) {
8250
+ if (_dispatch.enableConcurrentMode && !sync) {
8089
8251
  renderScheduler.macroTask(function flushEffect() {
8090
8252
  myreactReconcilerExports.flushEffectCallback();
8091
8253
  });
@@ -8152,11 +8314,11 @@ var createDispatch = function (rootNode, rootFiber, rootElement, config, flag) {
8152
8314
  (_a = instance.beforeCommit) === null || _a === void 0 ? void 0 : _a.call(instance);
8153
8315
  });
8154
8316
  myreactReconcilerExports.safeCall(function safeCallBeforeCommitListener() {
8155
- myreactReconcilerExports.listenerMap.get(instance).beforeCommitMount.forEach(function (cb) { return cb(); });
8317
+ instance.callOnBeforeCommitMount(instance);
8156
8318
  });
8157
8319
  ReconcilerDispatchMount(this, _fiber, config);
8158
8320
  myreactReconcilerExports.safeCall(function safeCallAfterCommitListener() {
8159
- myreactReconcilerExports.listenerMap.get(instance).afterCommitMount.forEach(function (cb) { return cb(); });
8321
+ instance.callOnAfterCommitMount(instance);
8160
8322
  });
8161
8323
  myreactReconcilerExports.safeCall(function safeCallAfterCommit() {
8162
8324
  var _a;
@@ -8164,7 +8326,7 @@ var createDispatch = function (rootNode, rootFiber, rootElement, config, flag) {
8164
8326
  });
8165
8327
  (_b = config.resetAfterCommit) === null || _b === void 0 ? void 0 : _b.call(config, rootNode);
8166
8328
  };
8167
- ReconcilerDispatch.prototype.reconcileUpdate = function (_list) {
8329
+ ReconcilerDispatch.prototype.reconcileUpdate = function (_list, sync) {
8168
8330
  var _a, _b;
8169
8331
  (_a = config.prepareForCommit) === null || _a === void 0 ? void 0 : _a.call(config, rootNode);
8170
8332
  var instance = this;
@@ -8173,11 +8335,11 @@ var createDispatch = function (rootNode, rootFiber, rootElement, config, flag) {
8173
8335
  (_a = instance.beforeUpdate) === null || _a === void 0 ? void 0 : _a.call(instance);
8174
8336
  });
8175
8337
  myreactReconcilerExports.safeCall(function safeCallBeforeUpdateListener() {
8176
- myreactReconcilerExports.listenerMap.get(instance).beforeCommitUpdate.forEach(function (cb) { return cb(); });
8338
+ instance.callOnBeforeCommitUpdate(instance);
8177
8339
  });
8178
- ReconcilerDispatchUpdate(this, _list, config);
8340
+ ReconcilerDispatchUpdate(this, _list, config, sync);
8179
8341
  myreactReconcilerExports.safeCall(function safeCallAfterUpdateListener() {
8180
- myreactReconcilerExports.listenerMap.get(instance).afterCommitUpdate.forEach(function (cb) { return cb(); });
8342
+ instance.callOnAfterCommitUpdate(instance);
8181
8343
  });
8182
8344
  myreactReconcilerExports.safeCall(function safeCallAfterUpdate() {
8183
8345
  var _a;
@@ -8397,7 +8559,7 @@ var Reconciler = function (_config) {
8397
8559
  };
8398
8560
  };
8399
8561
 
8400
- var version = "0.0.10";
8562
+ var version = "0.0.11";
8401
8563
  var createReconciler = Reconciler;
8402
8564
 
8403
8565
  exports.createReconciler = createReconciler;