@tarojs/react 3.5.0-alpha.13 → 3.5.0-alpha.16
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.
- package/dist/index.js +296 -302
- package/dist/index.js.map +1 -1
- package/dist/react.esm.js +298 -302
- package/dist/react.esm.js.map +1 -1
- package/package.json +10 -11
package/dist/index.js
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
var shared = require('@tarojs/shared');
|
|
6
|
+
var runtime = require('@tarojs/runtime');
|
|
5
7
|
var Reconciler = require('react-reconciler');
|
|
6
8
|
var scheduler = require('scheduler');
|
|
7
|
-
var runtime = require('@tarojs/runtime');
|
|
8
|
-
var shared = require('@tarojs/shared');
|
|
9
9
|
|
|
10
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
11
11
|
|
|
@@ -30,317 +30,311 @@ function _interopNamespace(e) {
|
|
|
30
30
|
var Reconciler__default = /*#__PURE__*/_interopDefaultLegacy(Reconciler);
|
|
31
31
|
var scheduler__namespace = /*#__PURE__*/_interopNamespace(scheduler);
|
|
32
32
|
|
|
33
|
-
function isEventName(s) {
|
|
34
|
-
return s[0] === 'o' && s[1] === 'n';
|
|
35
|
-
}
|
|
36
|
-
var IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord/i;
|
|
37
|
-
function updateProps(dom, oldProps, newProps) {
|
|
38
|
-
var i;
|
|
39
|
-
for (i in oldProps) {
|
|
40
|
-
if (!(i in newProps)) {
|
|
41
|
-
setProperty(dom, i, null, oldProps[i]);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
var isFormElement = dom instanceof runtime.FormElement;
|
|
45
|
-
for (i in newProps) {
|
|
46
|
-
if (oldProps[i] !== newProps[i] || (isFormElement && i === 'value')) {
|
|
47
|
-
setProperty(dom, i, newProps[i], oldProps[i]);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
// function eventProxy (e: CommonEvent) {
|
|
52
|
-
// const el = document.getElementById(e.currentTarget.id)
|
|
53
|
-
// const handlers = el!.__handlers[e.type]
|
|
54
|
-
// handlers[0](e)
|
|
55
|
-
// }
|
|
56
|
-
function setEvent(dom, name, value, oldValue) {
|
|
57
|
-
var isCapture = name.endsWith('Capture');
|
|
58
|
-
var eventName = name.toLowerCase().slice(2);
|
|
59
|
-
if (isCapture) {
|
|
60
|
-
eventName = eventName.slice(0, -7);
|
|
61
|
-
}
|
|
62
|
-
var compName = shared.capitalize(shared.toCamelCase(dom.tagName.toLowerCase()));
|
|
63
|
-
if (eventName === 'click' && compName in shared.internalComponents) {
|
|
64
|
-
eventName = 'tap';
|
|
65
|
-
}
|
|
66
|
-
if (shared.isFunction(value)) {
|
|
67
|
-
if (
|
|
68
|
-
dom.
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
dom.
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
if (name === '
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
oldValue
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
else if (
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
dom.
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
dom.setAttribute(name, value);
|
|
143
|
-
}
|
|
144
|
-
}
|
|
33
|
+
function isEventName(s) {
|
|
34
|
+
return s[0] === 'o' && s[1] === 'n';
|
|
35
|
+
}
|
|
36
|
+
var IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord/i;
|
|
37
|
+
function updateProps(dom, oldProps, newProps) {
|
|
38
|
+
var i;
|
|
39
|
+
for (i in oldProps) {
|
|
40
|
+
if (!(i in newProps)) {
|
|
41
|
+
setProperty(dom, i, null, oldProps[i]);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
var isFormElement = dom instanceof runtime.FormElement;
|
|
45
|
+
for (i in newProps) {
|
|
46
|
+
if (oldProps[i] !== newProps[i] || (isFormElement && i === 'value')) {
|
|
47
|
+
setProperty(dom, i, newProps[i], oldProps[i]);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
// function eventProxy (e: CommonEvent) {
|
|
52
|
+
// const el = document.getElementById(e.currentTarget.id)
|
|
53
|
+
// const handlers = el!.__handlers[e.type]
|
|
54
|
+
// handlers[0](e)
|
|
55
|
+
// }
|
|
56
|
+
function setEvent(dom, name, value, oldValue) {
|
|
57
|
+
var isCapture = name.endsWith('Capture');
|
|
58
|
+
var eventName = name.toLowerCase().slice(2);
|
|
59
|
+
if (isCapture) {
|
|
60
|
+
eventName = eventName.slice(0, -7);
|
|
61
|
+
}
|
|
62
|
+
var compName = shared.capitalize(shared.toCamelCase(dom.tagName.toLowerCase()));
|
|
63
|
+
if (eventName === 'click' && compName in shared.internalComponents) {
|
|
64
|
+
eventName = 'tap';
|
|
65
|
+
}
|
|
66
|
+
if (shared.isFunction(value)) {
|
|
67
|
+
if (oldValue) {
|
|
68
|
+
dom.removeEventListener(eventName, oldValue, false);
|
|
69
|
+
dom.addEventListener(eventName, value, { isCapture: isCapture, sideEffect: false });
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
dom.addEventListener(eventName, value, isCapture);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
dom.removeEventListener(eventName, oldValue);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
function setStyle(style, key, value) {
|
|
80
|
+
if (key[0] === '-') {
|
|
81
|
+
style.setProperty(key, value.toString());
|
|
82
|
+
}
|
|
83
|
+
style[key] =
|
|
84
|
+
shared.isNumber(value) && IS_NON_DIMENSIONAL.test(key) === false
|
|
85
|
+
? value + 'px'
|
|
86
|
+
: value == null
|
|
87
|
+
? ''
|
|
88
|
+
: value;
|
|
89
|
+
}
|
|
90
|
+
function setProperty(dom, name, value, oldValue) {
|
|
91
|
+
var _a, _b;
|
|
92
|
+
name = name === 'className' ? 'class' : name;
|
|
93
|
+
if (name === 'key' ||
|
|
94
|
+
name === 'children' ||
|
|
95
|
+
name === 'ref') ;
|
|
96
|
+
else if (name === 'style') {
|
|
97
|
+
var style = dom.style;
|
|
98
|
+
if (shared.isString(value)) {
|
|
99
|
+
style.cssText = value;
|
|
100
|
+
}
|
|
101
|
+
else {
|
|
102
|
+
if (shared.isString(oldValue)) {
|
|
103
|
+
style.cssText = '';
|
|
104
|
+
oldValue = null;
|
|
105
|
+
}
|
|
106
|
+
if (shared.isObject(oldValue)) {
|
|
107
|
+
for (var i in oldValue) {
|
|
108
|
+
if (!(value && i in value)) {
|
|
109
|
+
setStyle(style, i, '');
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
if (shared.isObject(value)) {
|
|
114
|
+
for (var i$1 in value) {
|
|
115
|
+
if (!oldValue || value[i$1] !== oldValue[i$1]) {
|
|
116
|
+
setStyle(style, i$1, value[i$1]);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
else if (isEventName(name)) {
|
|
123
|
+
setEvent(dom, name, value, oldValue);
|
|
124
|
+
}
|
|
125
|
+
else if (name === 'dangerouslySetInnerHTML') {
|
|
126
|
+
var newHtml = (_a = value === null || value === void 0 ? void 0 : value.__html) !== null && _a !== void 0 ? _a : '';
|
|
127
|
+
var oldHtml = (_b = oldValue === null || oldValue === void 0 ? void 0 : oldValue.__html) !== null && _b !== void 0 ? _b : '';
|
|
128
|
+
if (newHtml || oldHtml) {
|
|
129
|
+
if (oldHtml !== newHtml) {
|
|
130
|
+
dom.innerHTML = newHtml;
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
else if (!shared.isFunction(value)) {
|
|
135
|
+
if (value == null) {
|
|
136
|
+
dom.removeAttribute(name);
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
dom.setAttribute(name, value);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
145
142
|
}
|
|
146
143
|
|
|
147
|
-
/* eslint-disable @typescript-eslint/indent */
|
|
148
|
-
var now = scheduler__namespace.unstable_now;
|
|
149
|
-
function returnFalse() {
|
|
150
|
-
return false;
|
|
151
|
-
}
|
|
152
|
-
var hostConfig = {
|
|
153
|
-
createInstance: function createInstance(type) {
|
|
154
|
-
return runtime.document.createElement(type);
|
|
155
|
-
},
|
|
156
|
-
createTextInstance: function createTextInstance(text) {
|
|
157
|
-
return runtime.document.createTextNode(text);
|
|
158
|
-
},
|
|
159
|
-
getPublicInstance: function getPublicInstance(inst) {
|
|
160
|
-
return inst;
|
|
161
|
-
},
|
|
162
|
-
getRootHostContext: function getRootHostContext() {
|
|
163
|
-
return {};
|
|
164
|
-
},
|
|
165
|
-
getChildHostContext: function getChildHostContext() {
|
|
166
|
-
return {};
|
|
167
|
-
},
|
|
168
|
-
getCurrentEventPriority: function getCurrentEventPriority() {
|
|
169
|
-
// 因 @types/react-reconciler 未更新,ts会报错,这里直接返回16
|
|
170
|
-
return 16; // import { DefaultEventPriority } from 'react-reconciler/constants'
|
|
171
|
-
},
|
|
172
|
-
detachDeletedInstance: function detachDeletedInstance() {
|
|
173
|
-
// noop
|
|
174
|
-
},
|
|
175
|
-
appendChild: function appendChild(parent, child) {
|
|
176
|
-
parent.appendChild(child);
|
|
177
|
-
},
|
|
178
|
-
appendInitialChild: function appendInitialChild(parent, child) {
|
|
179
|
-
parent.appendChild(child);
|
|
180
|
-
},
|
|
181
|
-
appendChildToContainer: function appendChildToContainer(parent, child) {
|
|
182
|
-
parent.appendChild(child);
|
|
183
|
-
},
|
|
184
|
-
removeChild: function removeChild(parent, child) {
|
|
185
|
-
parent.removeChild(child);
|
|
186
|
-
},
|
|
187
|
-
removeChildFromContainer: function removeChildFromContainer(parent, child) {
|
|
188
|
-
parent.removeChild(child);
|
|
189
|
-
},
|
|
190
|
-
insertBefore: function insertBefore(parent, child, refChild) {
|
|
191
|
-
parent.insertBefore(child, refChild);
|
|
192
|
-
},
|
|
193
|
-
insertInContainerBefore: function insertInContainerBefore(parent, child, refChild) {
|
|
194
|
-
parent.insertBefore(child, refChild);
|
|
195
|
-
},
|
|
196
|
-
commitTextUpdate: function commitTextUpdate(textInst, _, newText) {
|
|
197
|
-
textInst.nodeValue = newText;
|
|
198
|
-
},
|
|
199
|
-
finalizeInitialChildren: function finalizeInitialChildren(dom, _, props) {
|
|
200
|
-
updateProps(dom, {}, props);
|
|
201
|
-
return false;
|
|
202
|
-
},
|
|
203
|
-
prepareUpdate: function prepareUpdate() {
|
|
204
|
-
return shared.EMPTY_ARR;
|
|
205
|
-
},
|
|
206
|
-
commitUpdate: function commitUpdate(dom, _payload, _type, oldProps, newProps) {
|
|
207
|
-
updateProps(dom, oldProps, newProps);
|
|
208
|
-
},
|
|
209
|
-
hideInstance: function hideInstance(instance) {
|
|
210
|
-
var style = instance.style;
|
|
211
|
-
style.setProperty('display', 'none');
|
|
212
|
-
},
|
|
213
|
-
unhideInstance: function unhideInstance(instance, props) {
|
|
214
|
-
var styleProp = props.style;
|
|
215
|
-
var display = (styleProp === null || styleProp === void 0 ? void 0 : styleProp.hasOwnProperty('display')) ? styleProp.display : null;
|
|
216
|
-
display = display == null || shared.isBoolean(display) || display === '' ? '' : ('' + display).trim();
|
|
217
|
-
// eslint-disable-next-line dot-notation
|
|
218
|
-
instance.style['display'] = display;
|
|
219
|
-
},
|
|
220
|
-
clearContainer: function clearContainer(element) {
|
|
221
|
-
if (element.childNodes.length > 0) {
|
|
222
|
-
element.textContent = '';
|
|
223
|
-
}
|
|
224
|
-
},
|
|
225
|
-
queueMicrotask: !shared.isUndefined(Promise)
|
|
226
|
-
? function (callback) { return Promise.resolve(null)
|
|
227
|
-
.then(callback)
|
|
228
|
-
.catch(function (error) {
|
|
229
|
-
setTimeout(function () {
|
|
230
|
-
throw error;
|
|
231
|
-
});
|
|
232
|
-
}); }
|
|
233
|
-
: setTimeout,
|
|
234
|
-
shouldSetTextContent: returnFalse,
|
|
144
|
+
/* eslint-disable @typescript-eslint/indent */
|
|
145
|
+
var now = scheduler__namespace.unstable_now;
|
|
146
|
+
function returnFalse() {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
var hostConfig = {
|
|
150
|
+
createInstance: function createInstance(type) {
|
|
151
|
+
return runtime.document.createElement(type);
|
|
152
|
+
},
|
|
153
|
+
createTextInstance: function createTextInstance(text) {
|
|
154
|
+
return runtime.document.createTextNode(text);
|
|
155
|
+
},
|
|
156
|
+
getPublicInstance: function getPublicInstance(inst) {
|
|
157
|
+
return inst;
|
|
158
|
+
},
|
|
159
|
+
getRootHostContext: function getRootHostContext() {
|
|
160
|
+
return {};
|
|
161
|
+
},
|
|
162
|
+
getChildHostContext: function getChildHostContext() {
|
|
163
|
+
return {};
|
|
164
|
+
},
|
|
165
|
+
getCurrentEventPriority: function getCurrentEventPriority() {
|
|
166
|
+
// 因 @types/react-reconciler 未更新,ts会报错,这里直接返回16
|
|
167
|
+
return 16; // import { DefaultEventPriority } from 'react-reconciler/constants'
|
|
168
|
+
},
|
|
169
|
+
detachDeletedInstance: function detachDeletedInstance() {
|
|
170
|
+
// noop
|
|
171
|
+
},
|
|
172
|
+
appendChild: function appendChild(parent, child) {
|
|
173
|
+
parent.appendChild(child);
|
|
174
|
+
},
|
|
175
|
+
appendInitialChild: function appendInitialChild(parent, child) {
|
|
176
|
+
parent.appendChild(child);
|
|
177
|
+
},
|
|
178
|
+
appendChildToContainer: function appendChildToContainer(parent, child) {
|
|
179
|
+
parent.appendChild(child);
|
|
180
|
+
},
|
|
181
|
+
removeChild: function removeChild(parent, child) {
|
|
182
|
+
parent.removeChild(child);
|
|
183
|
+
},
|
|
184
|
+
removeChildFromContainer: function removeChildFromContainer(parent, child) {
|
|
185
|
+
parent.removeChild(child);
|
|
186
|
+
},
|
|
187
|
+
insertBefore: function insertBefore(parent, child, refChild) {
|
|
188
|
+
parent.insertBefore(child, refChild);
|
|
189
|
+
},
|
|
190
|
+
insertInContainerBefore: function insertInContainerBefore(parent, child, refChild) {
|
|
191
|
+
parent.insertBefore(child, refChild);
|
|
192
|
+
},
|
|
193
|
+
commitTextUpdate: function commitTextUpdate(textInst, _, newText) {
|
|
194
|
+
textInst.nodeValue = newText;
|
|
195
|
+
},
|
|
196
|
+
finalizeInitialChildren: function finalizeInitialChildren(dom, _, props) {
|
|
197
|
+
updateProps(dom, {}, props);
|
|
198
|
+
return false;
|
|
199
|
+
},
|
|
200
|
+
prepareUpdate: function prepareUpdate() {
|
|
201
|
+
return shared.EMPTY_ARR;
|
|
202
|
+
},
|
|
203
|
+
commitUpdate: function commitUpdate(dom, _payload, _type, oldProps, newProps) {
|
|
204
|
+
updateProps(dom, oldProps, newProps);
|
|
205
|
+
},
|
|
206
|
+
hideInstance: function hideInstance(instance) {
|
|
207
|
+
var style = instance.style;
|
|
208
|
+
style.setProperty('display', 'none');
|
|
209
|
+
},
|
|
210
|
+
unhideInstance: function unhideInstance(instance, props) {
|
|
211
|
+
var styleProp = props.style;
|
|
212
|
+
var display = (styleProp === null || styleProp === void 0 ? void 0 : styleProp.hasOwnProperty('display')) ? styleProp.display : null;
|
|
213
|
+
display = display == null || shared.isBoolean(display) || display === '' ? '' : ('' + display).trim();
|
|
214
|
+
// eslint-disable-next-line dot-notation
|
|
215
|
+
instance.style['display'] = display;
|
|
216
|
+
},
|
|
217
|
+
clearContainer: function clearContainer(element) {
|
|
218
|
+
if (element.childNodes.length > 0) {
|
|
219
|
+
element.textContent = '';
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
queueMicrotask: !shared.isUndefined(Promise)
|
|
223
|
+
? function (callback) { return Promise.resolve(null)
|
|
224
|
+
.then(callback)
|
|
225
|
+
.catch(function (error) {
|
|
226
|
+
setTimeout(function () {
|
|
227
|
+
throw error;
|
|
228
|
+
});
|
|
229
|
+
}); }
|
|
230
|
+
: setTimeout,
|
|
231
|
+
shouldSetTextContent: returnFalse,
|
|
235
232
|
prepareForCommit: function prepareForCommit() {
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
var
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
console.info('%cDownload the React DevTools ' + 'for a better development experience: ' + 'https://reactjs.org/link/react-devtools', 'font-weight:bold');
|
|
261
|
-
}
|
|
233
|
+
return null; },
|
|
234
|
+
resetAfterCommit: shared.noop,
|
|
235
|
+
commitMount: shared.noop,
|
|
236
|
+
now: now,
|
|
237
|
+
cancelTimeout: clearTimeout,
|
|
238
|
+
scheduleTimeout: setTimeout,
|
|
239
|
+
preparePortalMount: shared.noop,
|
|
240
|
+
noTimeout: -1,
|
|
241
|
+
supportsMutation: true,
|
|
242
|
+
supportsPersistence: false,
|
|
243
|
+
isPrimaryRenderer: true,
|
|
244
|
+
supportsHydration: false
|
|
245
|
+
};
|
|
246
|
+
var TaroReconciler = Reconciler__default["default"](hostConfig);
|
|
247
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
248
|
+
var foundDevTools = TaroReconciler.injectIntoDevTools({
|
|
249
|
+
bundleType: 1,
|
|
250
|
+
version: '18.0.0',
|
|
251
|
+
rendererPackageName: 'taro-react'
|
|
252
|
+
});
|
|
253
|
+
if (!foundDevTools) {
|
|
254
|
+
// eslint-disable-next-line no-console
|
|
255
|
+
console.info('%cDownload the React DevTools ' + 'for a better development experience: ' + 'https://reactjs.org/link/react-devtools', 'font-weight:bold');
|
|
256
|
+
}
|
|
262
257
|
}
|
|
263
258
|
|
|
264
|
-
var ContainerMap = new WeakMap();
|
|
259
|
+
var ContainerMap = new WeakMap();
|
|
265
260
|
var Root = function Root(renderer, domContainer, isConcurrentRoot) {
|
|
266
261
|
if ( isConcurrentRoot === void 0 ) isConcurrentRoot = false;
|
|
267
|
-
|
|
268
|
-
this.renderer = renderer;
|
|
269
|
-
/** ConcurrentRoot & LegacyRoot: react-reconciler/src/ReactRootTags.js */
|
|
270
|
-
this.internalRoot = renderer.createContainer(domContainer, isConcurrentRoot ? 1 : 0, false, null);
|
|
271
|
-
};
|
|
272
|
-
Root.prototype.render = function render (children, cb) {
|
|
262
|
+
|
|
263
|
+
this.renderer = renderer;
|
|
264
|
+
/** ConcurrentRoot & LegacyRoot: react-reconciler/src/ReactRootTags.js */
|
|
265
|
+
this.internalRoot = renderer.createContainer(domContainer, isConcurrentRoot ? 1 : 0, false, null);
|
|
266
|
+
};
|
|
267
|
+
Root.prototype.render = function render (children, cb) {
|
|
273
268
|
var ref = this;
|
|
274
269
|
var renderer = ref.renderer;
|
|
275
|
-
var internalRoot = ref.internalRoot;
|
|
276
|
-
renderer.updateContainer(children, internalRoot, null, cb);
|
|
277
|
-
return renderer.getPublicRootInstance(internalRoot);
|
|
278
|
-
};
|
|
279
|
-
Root.prototype.unmount = function unmount (cb) {
|
|
280
|
-
this.renderer.updateContainer(null, this.internalRoot, null, cb);
|
|
281
|
-
};
|
|
282
|
-
function render(element, domContainer, cb) {
|
|
283
|
-
var oldRoot = ContainerMap.get(domContainer);
|
|
284
|
-
if (oldRoot != null) {
|
|
285
|
-
return oldRoot.render(element, cb);
|
|
286
|
-
}
|
|
287
|
-
var root = new Root(TaroReconciler, domContainer);
|
|
288
|
-
ContainerMap.set(domContainer, root);
|
|
289
|
-
return root.render(element, cb);
|
|
290
|
-
}
|
|
291
|
-
function createRoot(domContainer) {
|
|
292
|
-
var oldRoot = ContainerMap.get(domContainer);
|
|
293
|
-
if (oldRoot != null) {
|
|
294
|
-
return oldRoot;
|
|
295
|
-
}
|
|
296
|
-
var root = new Root(TaroReconciler, domContainer, true);
|
|
297
|
-
ContainerMap.set(domContainer, root);
|
|
298
|
-
return root;
|
|
270
|
+
var internalRoot = ref.internalRoot;
|
|
271
|
+
renderer.updateContainer(children, internalRoot, null, cb);
|
|
272
|
+
return renderer.getPublicRootInstance(internalRoot);
|
|
273
|
+
};
|
|
274
|
+
Root.prototype.unmount = function unmount (cb) {
|
|
275
|
+
this.renderer.updateContainer(null, this.internalRoot, null, cb);
|
|
276
|
+
};
|
|
277
|
+
function render(element, domContainer, cb) {
|
|
278
|
+
var oldRoot = ContainerMap.get(domContainer);
|
|
279
|
+
if (oldRoot != null) {
|
|
280
|
+
return oldRoot.render(element, cb);
|
|
281
|
+
}
|
|
282
|
+
var root = new Root(TaroReconciler, domContainer);
|
|
283
|
+
ContainerMap.set(domContainer, root);
|
|
284
|
+
return root.render(element, cb);
|
|
285
|
+
}
|
|
286
|
+
function createRoot(domContainer) {
|
|
287
|
+
var oldRoot = ContainerMap.get(domContainer);
|
|
288
|
+
if (oldRoot != null) {
|
|
289
|
+
return oldRoot;
|
|
290
|
+
}
|
|
291
|
+
var root = new Root(TaroReconciler, domContainer, true);
|
|
292
|
+
ContainerMap.set(domContainer, root);
|
|
293
|
+
return root;
|
|
299
294
|
}
|
|
300
295
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
createPortal: createPortal
|
|
296
|
+
var unstable_batchedUpdates = TaroReconciler.batchedUpdates;
|
|
297
|
+
function unmountComponentAtNode(dom) {
|
|
298
|
+
shared.ensure(dom && [1, 8, 9, 11].includes(dom.nodeType), 'unmountComponentAtNode(...): Target container is not a DOM element.');
|
|
299
|
+
var root = ContainerMap.get(dom);
|
|
300
|
+
if (!root)
|
|
301
|
+
{ return false; }
|
|
302
|
+
unstable_batchedUpdates(function () {
|
|
303
|
+
root.unmount(function () {
|
|
304
|
+
ContainerMap.delete(dom);
|
|
305
|
+
});
|
|
306
|
+
}, null);
|
|
307
|
+
return true;
|
|
308
|
+
}
|
|
309
|
+
function findDOMNode(comp) {
|
|
310
|
+
if (comp == null) {
|
|
311
|
+
return null;
|
|
312
|
+
}
|
|
313
|
+
var nodeType = comp.nodeType;
|
|
314
|
+
if (nodeType === 1 || nodeType === 3) {
|
|
315
|
+
return comp;
|
|
316
|
+
}
|
|
317
|
+
return TaroReconciler.findHostInstance(comp);
|
|
318
|
+
}
|
|
319
|
+
var portalType = shared.isFunction(Symbol) && Symbol.for
|
|
320
|
+
? Symbol.for('react.portal')
|
|
321
|
+
: 0xeaca;
|
|
322
|
+
function createPortal(children, containerInfo, key) {
|
|
323
|
+
return {
|
|
324
|
+
$$typeof: portalType,
|
|
325
|
+
key: key == null ? null : String(key),
|
|
326
|
+
children: children,
|
|
327
|
+
containerInfo: containerInfo,
|
|
328
|
+
implementation: null
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
var index = {
|
|
332
|
+
render: render,
|
|
333
|
+
createRoot: createRoot,
|
|
334
|
+
unstable_batchedUpdates: unstable_batchedUpdates,
|
|
335
|
+
unmountComponentAtNode: unmountComponentAtNode,
|
|
336
|
+
findDOMNode: findDOMNode,
|
|
337
|
+
createPortal: createPortal
|
|
344
338
|
};
|
|
345
339
|
|
|
346
340
|
exports.createPortal = createPortal;
|