react-test-renderer 15.5.0 → 15.5.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (168) hide show
  1. package/lib/ReactShallowRenderer.js +6 -0
  2. package/lib/shallow/ARIADOMPropertyConfig.js +73 -0
  3. package/lib/shallow/AutoFocusUtils.js +23 -0
  4. package/lib/shallow/BeforeInputEventPlugin.js +384 -0
  5. package/lib/shallow/CSSProperty.js +147 -0
  6. package/lib/shallow/CSSPropertyOperations.js +208 -0
  7. package/lib/shallow/CallbackQueue.js +118 -0
  8. package/lib/shallow/ChangeEventPlugin.js +345 -0
  9. package/lib/shallow/DOMChildrenOperations.js +224 -0
  10. package/lib/shallow/DOMLazyTree.js +117 -0
  11. package/lib/shallow/DOMNamespaces.js +19 -0
  12. package/lib/shallow/DOMProperty.js +209 -0
  13. package/lib/shallow/DOMPropertyOperations.js +236 -0
  14. package/lib/shallow/Danger.js +47 -0
  15. package/lib/shallow/DefaultEventPluginOrder.js +25 -0
  16. package/lib/shallow/EnterLeaveEventPlugin.js +99 -0
  17. package/lib/shallow/EventConstants.js +91 -0
  18. package/lib/shallow/EventPluginHub.js +277 -0
  19. package/lib/shallow/EventPluginRegistry.js +254 -0
  20. package/lib/shallow/EventPluginUtils.js +225 -0
  21. package/lib/shallow/EventPropagators.js +133 -0
  22. package/lib/shallow/FallbackCompositionState.js +94 -0
  23. package/lib/shallow/HTMLDOMPropertyConfig.js +235 -0
  24. package/lib/shallow/KeyEscapeUtils.js +58 -0
  25. package/lib/shallow/LinkedValueUtils.js +137 -0
  26. package/lib/shallow/PluginModuleType.js +12 -0
  27. package/lib/shallow/PooledClass.js +111 -0
  28. package/lib/shallow/ReactBrowserEventEmitter.js +327 -0
  29. package/lib/shallow/ReactChildFiber.js +243 -0
  30. package/lib/shallow/ReactChildReconciler.js +153 -0
  31. package/lib/shallow/ReactComponentBrowserEnvironment.js +29 -0
  32. package/lib/shallow/ReactComponentEnvironment.js +45 -0
  33. package/lib/shallow/ReactCompositeComponent.js +901 -0
  34. package/lib/shallow/ReactCoroutine.js +80 -0
  35. package/lib/shallow/ReactDOM.js +110 -0
  36. package/lib/shallow/ReactDOMComponent.js +1000 -0
  37. package/lib/shallow/ReactDOMComponentFlags.js +17 -0
  38. package/lib/shallow/ReactDOMComponentTree.js +194 -0
  39. package/lib/shallow/ReactDOMContainerInfo.js +32 -0
  40. package/lib/shallow/ReactDOMEmptyComponent.js +59 -0
  41. package/lib/shallow/ReactDOMFeatureFlags.js +18 -0
  42. package/lib/shallow/ReactDOMFiber.js +97 -0
  43. package/lib/shallow/ReactDOMIDOperations.js +33 -0
  44. package/lib/shallow/ReactDOMInput.js +284 -0
  45. package/lib/shallow/ReactDOMInvalidARIAHook.js +92 -0
  46. package/lib/shallow/ReactDOMNullInputValuePropHook.js +42 -0
  47. package/lib/shallow/ReactDOMOption.js +122 -0
  48. package/lib/shallow/ReactDOMSelect.js +199 -0
  49. package/lib/shallow/ReactDOMSelection.js +211 -0
  50. package/lib/shallow/ReactDOMServer.js +25 -0
  51. package/lib/shallow/ReactDOMTextComponent.js +163 -0
  52. package/lib/shallow/ReactDOMTextarea.js +159 -0
  53. package/lib/shallow/ReactDOMTreeTraversal.js +135 -0
  54. package/lib/shallow/ReactDOMUnknownPropertyHook.js +111 -0
  55. package/lib/shallow/ReactDebugTool.js +358 -0
  56. package/lib/shallow/ReactDefaultBatchingStrategy.js +67 -0
  57. package/lib/shallow/ReactDefaultInjection.js +85 -0
  58. package/lib/shallow/ReactElementSymbol.js +19 -0
  59. package/lib/shallow/ReactEmptyComponent.js +29 -0
  60. package/lib/shallow/ReactErrorUtils.js +75 -0
  61. package/lib/shallow/ReactEventEmitterMixin.js +32 -0
  62. package/lib/shallow/ReactEventListener.js +154 -0
  63. package/lib/shallow/ReactFeatureFlags.js +21 -0
  64. package/lib/shallow/ReactFiber.js +190 -0
  65. package/lib/shallow/ReactFiberBeginWork.js +380 -0
  66. package/lib/shallow/ReactFiberCommitWork.js +78 -0
  67. package/lib/shallow/ReactFiberCompleteWork.js +208 -0
  68. package/lib/shallow/ReactFiberReconciler.js +64 -0
  69. package/lib/shallow/ReactFiberRoot.js +29 -0
  70. package/lib/shallow/ReactFiberScheduler.js +331 -0
  71. package/lib/shallow/ReactFiberUpdateQueue.js +77 -0
  72. package/lib/shallow/ReactHostComponent.js +67 -0
  73. package/lib/shallow/ReactHostOperationHistoryHook.js +33 -0
  74. package/lib/shallow/ReactInjection.js +33 -0
  75. package/lib/shallow/ReactInputSelection.js +123 -0
  76. package/lib/shallow/ReactInstanceMap.js +47 -0
  77. package/lib/shallow/ReactInstanceType.js +12 -0
  78. package/lib/shallow/ReactInstrumentation.js +23 -0
  79. package/lib/shallow/ReactInvalidSetStateWarningHook.js +36 -0
  80. package/lib/shallow/ReactMarkupChecksum.js +49 -0
  81. package/lib/shallow/ReactMount.js +537 -0
  82. package/lib/shallow/ReactMultiChild.js +449 -0
  83. package/lib/shallow/ReactMultiChildUpdateTypes.js +18 -0
  84. package/lib/shallow/ReactNodeTypes.js +39 -0
  85. package/lib/shallow/ReactOwner.js +93 -0
  86. package/lib/shallow/ReactPerf.js +500 -0
  87. package/lib/shallow/ReactPriorityLevel.js +20 -0
  88. package/lib/shallow/ReactPropTypeLocationNames.js +24 -0
  89. package/lib/shallow/ReactPropTypeLocations.js +12 -0
  90. package/lib/shallow/ReactPropTypesSecret.js +16 -0
  91. package/lib/shallow/ReactReconcileTransaction.js +177 -0
  92. package/lib/shallow/ReactReconciler.js +167 -0
  93. package/lib/shallow/ReactRef.js +88 -0
  94. package/lib/shallow/ReactReifiedYield.js +30 -0
  95. package/lib/shallow/ReactServerBatchingStrategy.js +21 -0
  96. package/lib/shallow/ReactServerRendering.js +89 -0
  97. package/lib/shallow/ReactServerRenderingTransaction.js +89 -0
  98. package/lib/shallow/ReactServerUpdateQueue.js +138 -0
  99. package/lib/shallow/ReactShallowRenderer.js +150 -0
  100. package/lib/shallow/ReactSimpleEmptyComponent.js +36 -0
  101. package/lib/shallow/ReactSyntheticEventType.js +14 -0
  102. package/lib/shallow/ReactTestEmptyComponent.js +36 -0
  103. package/lib/shallow/ReactTestMount.js +131 -0
  104. package/lib/shallow/ReactTestReconcileTransaction.js +128 -0
  105. package/lib/shallow/ReactTestRenderer.js +139 -0
  106. package/lib/shallow/ReactTestTextComponent.js +40 -0
  107. package/lib/shallow/ReactTypeOfWork.js +23 -0
  108. package/lib/shallow/ReactTypes.js +12 -0
  109. package/lib/shallow/ReactUpdateQueue.js +235 -0
  110. package/lib/shallow/ReactUpdates.js +250 -0
  111. package/lib/shallow/ReactVersion.js +13 -0
  112. package/lib/shallow/ResponderEventPlugin.js +507 -0
  113. package/lib/shallow/ResponderSyntheticEvent.js +38 -0
  114. package/lib/shallow/ResponderTouchHistoryStore.js +183 -0
  115. package/lib/shallow/SVGDOMPropertyConfig.js +301 -0
  116. package/lib/shallow/SelectEventPlugin.js +190 -0
  117. package/lib/shallow/SimpleEventPlugin.js +227 -0
  118. package/lib/shallow/SyntheticAnimationEvent.js +38 -0
  119. package/lib/shallow/SyntheticClipboardEvent.js +37 -0
  120. package/lib/shallow/SyntheticCompositionEvent.js +35 -0
  121. package/lib/shallow/SyntheticDragEvent.js +35 -0
  122. package/lib/shallow/SyntheticEvent.js +267 -0
  123. package/lib/shallow/SyntheticFocusEvent.js +35 -0
  124. package/lib/shallow/SyntheticInputEvent.js +36 -0
  125. package/lib/shallow/SyntheticKeyboardEvent.js +83 -0
  126. package/lib/shallow/SyntheticMouseEvent.js +71 -0
  127. package/lib/shallow/SyntheticTouchEvent.js +44 -0
  128. package/lib/shallow/SyntheticTransitionEvent.js +38 -0
  129. package/lib/shallow/SyntheticUIEvent.js +58 -0
  130. package/lib/shallow/SyntheticWheelEvent.js +53 -0
  131. package/lib/shallow/TapEventPlugin.js +115 -0
  132. package/lib/shallow/TouchHistoryMath.js +98 -0
  133. package/lib/shallow/Transaction.js +224 -0
  134. package/lib/shallow/ViewportMetrics.js +26 -0
  135. package/lib/shallow/accumulate.js +45 -0
  136. package/lib/shallow/accumulateInto.js +57 -0
  137. package/lib/shallow/adler32.js +43 -0
  138. package/lib/shallow/canDefineProperty.js +25 -0
  139. package/lib/shallow/checkReactTypeSpec.js +86 -0
  140. package/lib/shallow/createMicrosoftUnsafeLocalFunction.js +31 -0
  141. package/lib/shallow/dangerousStyleValue.js +78 -0
  142. package/lib/shallow/deprecated.js +56 -0
  143. package/lib/shallow/escapeTextContentForBrowser.js +122 -0
  144. package/lib/shallow/findDOMNode.js +59 -0
  145. package/lib/shallow/flattenChildren.js +75 -0
  146. package/lib/shallow/forEachAccumulated.js +30 -0
  147. package/lib/shallow/getEventCharCode.js +49 -0
  148. package/lib/shallow/getEventKey.js +101 -0
  149. package/lib/shallow/getEventModifierState.js +42 -0
  150. package/lib/shallow/getEventTarget.js +34 -0
  151. package/lib/shallow/getHostComponentFromComposite.js +29 -0
  152. package/lib/shallow/getIteratorFn.js +40 -0
  153. package/lib/shallow/getNodeForCharacterOffset.js +73 -0
  154. package/lib/shallow/getTextContentAccessor.js +32 -0
  155. package/lib/shallow/getVendorPrefixedEventName.js +100 -0
  156. package/lib/shallow/instantiateReactComponent.js +128 -0
  157. package/lib/shallow/isEventSupported.js +59 -0
  158. package/lib/shallow/isTextInputElement.js +50 -0
  159. package/lib/shallow/quoteAttributeValueForBrowser.js +25 -0
  160. package/lib/shallow/reactProdInvariant.js +38 -0
  161. package/lib/shallow/renderSubtreeIntoContainer.js +15 -0
  162. package/lib/shallow/setInnerHTML.js +97 -0
  163. package/lib/shallow/setTextContent.js +51 -0
  164. package/lib/shallow/shouldUpdateReactComponent.js +41 -0
  165. package/lib/shallow/traverseAllChildren.js +175 -0
  166. package/lib/shallow/validateDOMNesting.js +376 -0
  167. package/package.json +1 -1
  168. package/shallow.js +1 -1
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ *
9
+ */
10
+
11
+ 'use strict';
12
+
13
+ var _assign = require('object-assign');
14
+
15
+ var EventListener = require('fbjs/lib/EventListener');
16
+ var ExecutionEnvironment = require('fbjs/lib/ExecutionEnvironment');
17
+ var PooledClass = require('./PooledClass');
18
+ var ReactDOMComponentTree = require('./ReactDOMComponentTree');
19
+ var ReactUpdates = require('./ReactUpdates');
20
+
21
+ var getEventTarget = require('./getEventTarget');
22
+ var getUnboundedScrollPosition = require('fbjs/lib/getUnboundedScrollPosition');
23
+
24
+ /**
25
+ * Find the deepest React component completely containing the root of the
26
+ * passed-in instance (for use when entire React trees are nested within each
27
+ * other). If React trees are not nested, returns null.
28
+ */
29
+ function findParent(inst) {
30
+ // TODO: It may be a good idea to cache this to prevent unnecessary DOM
31
+ // traversal, but caching is difficult to do correctly without using a
32
+ // mutation observer to listen for all DOM changes.
33
+ while (inst._hostParent) {
34
+ inst = inst._hostParent;
35
+ }
36
+ var rootNode = ReactDOMComponentTree.getNodeFromInstance(inst);
37
+ var container = rootNode.parentNode;
38
+ return ReactDOMComponentTree.getClosestInstanceFromNode(container);
39
+ }
40
+
41
+ // Used to store ancestor hierarchy in top level callback
42
+ function TopLevelCallbackBookKeeping(topLevelType, nativeEvent) {
43
+ this.topLevelType = topLevelType;
44
+ this.nativeEvent = nativeEvent;
45
+ this.ancestors = [];
46
+ }
47
+ _assign(TopLevelCallbackBookKeeping.prototype, {
48
+ destructor: function () {
49
+ this.topLevelType = null;
50
+ this.nativeEvent = null;
51
+ this.ancestors.length = 0;
52
+ }
53
+ });
54
+ PooledClass.addPoolingTo(TopLevelCallbackBookKeeping, PooledClass.twoArgumentPooler);
55
+
56
+ function handleTopLevelImpl(bookKeeping) {
57
+ var nativeEventTarget = getEventTarget(bookKeeping.nativeEvent);
58
+ var targetInst = ReactDOMComponentTree.getClosestInstanceFromNode(nativeEventTarget);
59
+
60
+ // Loop through the hierarchy, in case there's any nested components.
61
+ // It's important that we build the array of ancestors before calling any
62
+ // event handlers, because event handlers can modify the DOM, leading to
63
+ // inconsistencies with ReactMount's node cache. See #1105.
64
+ var ancestor = targetInst;
65
+ do {
66
+ bookKeeping.ancestors.push(ancestor);
67
+ ancestor = ancestor && findParent(ancestor);
68
+ } while (ancestor);
69
+
70
+ for (var i = 0; i < bookKeeping.ancestors.length; i++) {
71
+ targetInst = bookKeeping.ancestors[i];
72
+ ReactEventListener._handleTopLevel(bookKeeping.topLevelType, targetInst, bookKeeping.nativeEvent, getEventTarget(bookKeeping.nativeEvent));
73
+ }
74
+ }
75
+
76
+ function scrollValueMonitor(cb) {
77
+ var scrollPosition = getUnboundedScrollPosition(window);
78
+ cb(scrollPosition);
79
+ }
80
+
81
+ var ReactEventListener = {
82
+ _enabled: true,
83
+ _handleTopLevel: null,
84
+
85
+ WINDOW_HANDLE: ExecutionEnvironment.canUseDOM ? window : null,
86
+
87
+ setHandleTopLevel: function (handleTopLevel) {
88
+ ReactEventListener._handleTopLevel = handleTopLevel;
89
+ },
90
+
91
+ setEnabled: function (enabled) {
92
+ ReactEventListener._enabled = !!enabled;
93
+ },
94
+
95
+ isEnabled: function () {
96
+ return ReactEventListener._enabled;
97
+ },
98
+
99
+ /**
100
+ * Traps top-level events by using event bubbling.
101
+ *
102
+ * @param {string} topLevelType Record from `EventConstants`.
103
+ * @param {string} handlerBaseName Event name (e.g. "click").
104
+ * @param {object} element Element on which to attach listener.
105
+ * @return {?object} An object with a remove function which will forcefully
106
+ * remove the listener.
107
+ * @internal
108
+ */
109
+ trapBubbledEvent: function (topLevelType, handlerBaseName, element) {
110
+ if (!element) {
111
+ return null;
112
+ }
113
+ return EventListener.listen(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
114
+ },
115
+
116
+ /**
117
+ * Traps a top-level event by using event capturing.
118
+ *
119
+ * @param {string} topLevelType Record from `EventConstants`.
120
+ * @param {string} handlerBaseName Event name (e.g. "click").
121
+ * @param {object} element Element on which to attach listener.
122
+ * @return {?object} An object with a remove function which will forcefully
123
+ * remove the listener.
124
+ * @internal
125
+ */
126
+ trapCapturedEvent: function (topLevelType, handlerBaseName, element) {
127
+ if (!element) {
128
+ return null;
129
+ }
130
+ return EventListener.capture(element, handlerBaseName, ReactEventListener.dispatchEvent.bind(null, topLevelType));
131
+ },
132
+
133
+ monitorScrollValue: function (refresh) {
134
+ var callback = scrollValueMonitor.bind(null, refresh);
135
+ EventListener.listen(window, 'scroll', callback);
136
+ },
137
+
138
+ dispatchEvent: function (topLevelType, nativeEvent) {
139
+ if (!ReactEventListener._enabled) {
140
+ return;
141
+ }
142
+
143
+ var bookKeeping = TopLevelCallbackBookKeeping.getPooled(topLevelType, nativeEvent);
144
+ try {
145
+ // Event queue being processed in the same cycle allows
146
+ // `preventDefault`.
147
+ ReactUpdates.batchedUpdates(handleTopLevelImpl, bookKeeping);
148
+ } finally {
149
+ TopLevelCallbackBookKeeping.release(bookKeeping);
150
+ }
151
+ }
152
+ };
153
+
154
+ module.exports = ReactEventListener;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ *
9
+ *
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ var ReactFeatureFlags = {
15
+ // When true, call console.time() before and .timeEnd() after each top-level
16
+ // render (both initial renders and updates). Useful when looking at prod-mode
17
+ // timeline profiles in Chrome, for example.
18
+ logTopLevelRenders: false
19
+ };
20
+
21
+ module.exports = ReactFeatureFlags;
@@ -0,0 +1,190 @@
1
+ /**
2
+ * Copyright 2013-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ *
9
+ *
10
+ */
11
+
12
+ 'use strict';
13
+
14
+ var ReactTypeOfWork = require('./ReactTypeOfWork');
15
+ var IndeterminateComponent = ReactTypeOfWork.IndeterminateComponent,
16
+ ClassComponent = ReactTypeOfWork.ClassComponent,
17
+ HostContainer = ReactTypeOfWork.HostContainer,
18
+ HostComponent = ReactTypeOfWork.HostComponent,
19
+ CoroutineComponent = ReactTypeOfWork.CoroutineComponent,
20
+ YieldComponent = ReactTypeOfWork.YieldComponent;
21
+
22
+ var _require = require('./ReactPriorityLevel'),
23
+ NoWork = _require.NoWork;
24
+
25
+ // An Instance is shared between all versions of a component. We can easily
26
+ // break this out into a separate object to avoid copying so much to the
27
+ // alternate versions of the tree. We put this on a single object for now to
28
+ // minimize the number of objects created during the initial render.
29
+
30
+
31
+ // A Fiber is work on a Component that needs to be done or was done. There can
32
+ // be more than one per component.
33
+
34
+
35
+ // This is a constructor of a POJO instead of a constructor function for a few
36
+ // reasons:
37
+ // 1) Nobody should add any instance methods on this. Instance methods can be
38
+ // more difficult to predict when they get optimized and they are almost
39
+ // never inlined properly in static compilers.
40
+ // 2) Nobody should rely on `instanceof Fiber` for type testing. We should
41
+ // always know when it is a fiber.
42
+ // 3) We can easily go from a createFiber call to calling a constructor if that
43
+ // is faster. The opposite is not true.
44
+ // 4) We might want to experiment with using numeric keys since they are easier
45
+ // to optimize in a non-JIT environment.
46
+ // 5) It should be easy to port this to a C struct and keep a C implementation
47
+ // compatible.
48
+ var createFiber = function (tag, key) {
49
+ return {
50
+
51
+ // Instance
52
+
53
+ tag: tag,
54
+
55
+ key: key,
56
+
57
+ type: null,
58
+
59
+ stateNode: null,
60
+
61
+ // Fiber
62
+
63
+ 'return': null,
64
+
65
+ child: null,
66
+ sibling: null,
67
+
68
+ ref: null,
69
+
70
+ pendingProps: null,
71
+ memoizedProps: null,
72
+ updateQueue: null,
73
+ memoizedState: null,
74
+ callbackList: null,
75
+ output: null,
76
+
77
+ nextEffect: null,
78
+ firstEffect: null,
79
+ lastEffect: null,
80
+
81
+ pendingWorkPriority: NoWork,
82
+ progressedPriority: NoWork,
83
+ progressedChild: null,
84
+
85
+ alternate: null
86
+
87
+ };
88
+ };
89
+
90
+ function shouldConstruct(Component) {
91
+ return !!(Component.prototype && Component.prototype.isReactComponent);
92
+ }
93
+
94
+ // This is used to create an alternate fiber to do work on.
95
+ // TODO: Rename to createWorkInProgressFiber or something like that.
96
+ exports.cloneFiber = function (fiber, priorityLevel) {
97
+ // We clone to get a work in progress. That means that this fiber is the
98
+ // current. To make it safe to reuse that fiber later on as work in progress
99
+ // we need to reset its work in progress flag now. We don't have an
100
+ // opportunity to do this earlier since we don't traverse the tree when
101
+ // the work in progress tree becomes the current tree.
102
+ // fiber.progressedPriority = NoWork;
103
+ // fiber.progressedChild = null;
104
+
105
+ // We use a double buffering pooling technique because we know that we'll only
106
+ // ever need at most two versions of a tree. We pool the "other" unused node
107
+ // that we're free to reuse. This is lazily created to avoid allocating extra
108
+ // objects for things that are never updated. It also allow us to reclaim the
109
+ // extra memory if needed.
110
+ var alt = fiber.alternate;
111
+ if (alt) {
112
+ // Whenever we clone, we do so to get a new work in progress.
113
+ // This ensures that we've reset these in the new tree.
114
+ alt.nextEffect = null;
115
+ alt.firstEffect = null;
116
+ alt.lastEffect = null;
117
+ } else {
118
+ // This should not have an alternate already
119
+ alt = createFiber(fiber.tag, fiber.key);
120
+ alt.type = fiber.type;
121
+
122
+ alt.progressedChild = fiber.progressedChild;
123
+ alt.progressedPriority = fiber.progressedPriority;
124
+
125
+ alt.alternate = fiber;
126
+ fiber.alternate = alt;
127
+ }
128
+
129
+ alt.stateNode = fiber.stateNode;
130
+ alt.child = fiber.child;
131
+ alt.sibling = fiber.sibling; // This should always be overridden. TODO: null
132
+ alt.ref = fiber.ref;
133
+ // pendingProps is here for symmetry but is unnecessary in practice for now.
134
+ // TODO: Pass in the new pendingProps as an argument maybe?
135
+ alt.pendingProps = fiber.pendingProps;
136
+ alt.updateQueue = fiber.updateQueue;
137
+ alt.callbackList = fiber.callbackList;
138
+ alt.pendingWorkPriority = priorityLevel;
139
+
140
+ alt.memoizedProps = fiber.memoizedProps;
141
+ alt.output = fiber.output;
142
+
143
+ return alt;
144
+ };
145
+
146
+ exports.createHostContainerFiber = function () {
147
+ var fiber = createFiber(HostContainer, null);
148
+ return fiber;
149
+ };
150
+
151
+ exports.createFiberFromElement = function (element, priorityLevel) {
152
+ // $FlowFixMe: ReactElement.key is currently defined as ?string but should be defined as null | string in Flow.
153
+ var fiber = createFiberFromElementType(element.type, element.key);
154
+ fiber.pendingProps = element.props;
155
+ fiber.pendingWorkPriority = priorityLevel;
156
+ return fiber;
157
+ };
158
+
159
+ function createFiberFromElementType(type, key) {
160
+ var fiber = void 0;
161
+ if (typeof type === 'function') {
162
+ fiber = shouldConstruct(type) ? createFiber(ClassComponent, key) : createFiber(IndeterminateComponent, key);
163
+ fiber.type = type;
164
+ } else if (typeof type === 'string') {
165
+ fiber = createFiber(HostComponent, key);
166
+ fiber.type = type;
167
+ } else if (typeof type === 'object' && type !== null) {
168
+ // Currently assumed to be a continuation and therefore is a fiber already.
169
+ fiber = type;
170
+ } else {
171
+ throw new Error('Unknown component type: ' + typeof type);
172
+ }
173
+ return fiber;
174
+ }
175
+
176
+ exports.createFiberFromElementType = createFiberFromElementType;
177
+
178
+ exports.createFiberFromCoroutine = function (coroutine, priorityLevel) {
179
+ var fiber = createFiber(CoroutineComponent, coroutine.key);
180
+ fiber.type = coroutine.handler;
181
+ fiber.pendingProps = coroutine;
182
+ fiber.pendingWorkPriority = priorityLevel;
183
+ return fiber;
184
+ };
185
+
186
+ exports.createFiberFromYield = function (yieldNode, priorityLevel) {
187
+ var fiber = createFiber(YieldComponent, yieldNode.key);
188
+ fiber.pendingProps = {};
189
+ return fiber;
190
+ };