@tarojs/react 3.5.0-alpha.2 → 3.5.0-alpha.5

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 CHANGED
@@ -91,7 +91,7 @@ function setStyle(style, key, value) {
91
91
  : value;
92
92
  }
93
93
  function setProperty(dom, name, value, oldValue) {
94
- var _a, _b, _c, _d;
94
+ var _a, _b;
95
95
  name = name === 'className' ? 'class' : name;
96
96
  if (name === 'key' ||
97
97
  name === 'children' ||
@@ -126,8 +126,8 @@ function setProperty(dom, name, value, oldValue) {
126
126
  setEvent(dom, name, value, oldValue);
127
127
  }
128
128
  else if (name === 'dangerouslySetInnerHTML') {
129
- var newHtml = (_b = (_a = value) === null || _a === void 0 ? void 0 : _a.__html) !== null && _b !== void 0 ? _b : '';
130
- var oldHtml = (_d = (_c = oldValue) === null || _c === void 0 ? void 0 : _c.__html) !== null && _d !== void 0 ? _d : '';
129
+ var newHtml = (_a = value === null || value === void 0 ? void 0 : value.__html) !== null && _a !== void 0 ? _a : '';
130
+ var oldHtml = (_b = oldValue === null || oldValue === void 0 ? void 0 : oldValue.__html) !== null && _b !== void 0 ? _b : '';
131
131
  if (newHtml || oldHtml) {
132
132
  if (oldHtml !== newHtml) {
133
133
  dom.innerHTML = newHtml;
@@ -165,6 +165,13 @@ var hostConfig = {
165
165
  getChildHostContext: function getChildHostContext() {
166
166
  return {};
167
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
+ },
168
175
  appendChild: function appendChild(parent, child) {
169
176
  parent.appendChild(child);
170
177
  },
@@ -245,7 +252,7 @@ var TaroReconciler = Reconciler__default["default"](hostConfig);
245
252
  if (process.env.NODE_ENV !== 'production') {
246
253
  var foundDevTools = TaroReconciler.injectIntoDevTools({
247
254
  bundleType: 1,
248
- version: '17.0.2',
255
+ version: '18.0.0',
249
256
  rendererPackageName: 'taro-react'
250
257
  });
251
258
  if (!foundDevTools) {
@@ -255,9 +262,12 @@ if (process.env.NODE_ENV !== 'production') {
255
262
  }
256
263
 
257
264
  var ContainerMap = new WeakMap();
258
- var Root = function Root(renderer, domContainer) {
265
+ var Root = function Root(renderer, domContainer, isConcurrentRoot) {
266
+ if ( isConcurrentRoot === void 0 ) isConcurrentRoot = false;
267
+
259
268
  this.renderer = renderer;
260
- this.internalRoot = renderer.createContainer(domContainer, 0 /** LegacyRoot: react-reconciler/src/ReactRootTags.js */, false, null);
269
+ /** ConcurrentRoot & LegacyRoot: react-reconciler/src/ReactRootTags.js */
270
+ this.internalRoot = renderer.createContainer(domContainer, isConcurrentRoot ? 1 : 0, false, null);
261
271
  };
262
272
  Root.prototype.render = function render (children, cb) {
263
273
  var ref = this;
@@ -277,6 +287,15 @@ function render(element, domContainer, cb) {
277
287
  var root = new Root(TaroReconciler, domContainer);
278
288
  ContainerMap.set(domContainer, root);
279
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;
280
299
  }
281
300
 
282
301
  /* eslint-disable @typescript-eslint/no-unused-vars */
@@ -317,6 +336,7 @@ function createPortal(children, containerInfo, key) {
317
336
  }
318
337
  var index = {
319
338
  render: render,
339
+ createRoot: createRoot,
320
340
  unstable_batchedUpdates: unstable_batchedUpdates,
321
341
  unmountComponentAtNode: unmountComponentAtNode,
322
342
  findDOMNode: findDOMNode,
@@ -324,6 +344,7 @@ var index = {
324
344
  };
325
345
 
326
346
  exports.createPortal = createPortal;
347
+ exports.createRoot = createRoot;
327
348
  exports["default"] = index;
328
349
  exports.findDOMNode = findDOMNode;
329
350
  exports.render = render;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/react.esm.js CHANGED
@@ -64,7 +64,7 @@ function setStyle(style, key, value) {
64
64
  : value;
65
65
  }
66
66
  function setProperty(dom, name, value, oldValue) {
67
- var _a, _b, _c, _d;
67
+ var _a, _b;
68
68
  name = name === 'className' ? 'class' : name;
69
69
  if (name === 'key' ||
70
70
  name === 'children' ||
@@ -99,8 +99,8 @@ function setProperty(dom, name, value, oldValue) {
99
99
  setEvent(dom, name, value, oldValue);
100
100
  }
101
101
  else if (name === 'dangerouslySetInnerHTML') {
102
- const newHtml = (_b = (_a = value) === null || _a === void 0 ? void 0 : _a.__html) !== null && _b !== void 0 ? _b : '';
103
- const oldHtml = (_d = (_c = oldValue) === null || _c === void 0 ? void 0 : _c.__html) !== null && _d !== void 0 ? _d : '';
102
+ const newHtml = (_a = value === null || value === void 0 ? void 0 : value.__html) !== null && _a !== void 0 ? _a : '';
103
+ const oldHtml = (_b = oldValue === null || oldValue === void 0 ? void 0 : oldValue.__html) !== null && _b !== void 0 ? _b : '';
104
104
  if (newHtml || oldHtml) {
105
105
  if (oldHtml !== newHtml) {
106
106
  dom.innerHTML = newHtml;
@@ -138,6 +138,13 @@ const hostConfig = {
138
138
  getChildHostContext() {
139
139
  return {};
140
140
  },
141
+ getCurrentEventPriority() {
142
+ // 因 @types/react-reconciler 未更新,ts会报错,这里直接返回16
143
+ return 16; // import { DefaultEventPriority } from 'react-reconciler/constants'
144
+ },
145
+ detachDeletedInstance() {
146
+ // noop
147
+ },
141
148
  appendChild(parent, child) {
142
149
  parent.appendChild(child);
143
150
  },
@@ -215,7 +222,7 @@ const TaroReconciler = Reconciler(hostConfig);
215
222
  if (process.env.NODE_ENV !== 'production') {
216
223
  const foundDevTools = TaroReconciler.injectIntoDevTools({
217
224
  bundleType: 1,
218
- version: '17.0.2',
225
+ version: '18.0.0',
219
226
  rendererPackageName: 'taro-react'
220
227
  });
221
228
  if (!foundDevTools) {
@@ -226,9 +233,10 @@ if (process.env.NODE_ENV !== 'production') {
226
233
 
227
234
  const ContainerMap = new WeakMap();
228
235
  class Root {
229
- constructor(renderer, domContainer) {
236
+ constructor(renderer, domContainer, isConcurrentRoot = false) {
230
237
  this.renderer = renderer;
231
- this.internalRoot = renderer.createContainer(domContainer, 0 /** LegacyRoot: react-reconciler/src/ReactRootTags.js */, false, null);
238
+ /** ConcurrentRoot & LegacyRoot: react-reconciler/src/ReactRootTags.js */
239
+ this.internalRoot = renderer.createContainer(domContainer, isConcurrentRoot ? 1 : 0, false, null);
232
240
  }
233
241
  render(children, cb) {
234
242
  const { renderer, internalRoot } = this;
@@ -247,6 +255,15 @@ function render(element, domContainer, cb) {
247
255
  const root = new Root(TaroReconciler, domContainer);
248
256
  ContainerMap.set(domContainer, root);
249
257
  return root.render(element, cb);
258
+ }
259
+ function createRoot(domContainer) {
260
+ const oldRoot = ContainerMap.get(domContainer);
261
+ if (oldRoot != null) {
262
+ return oldRoot;
263
+ }
264
+ const root = new Root(TaroReconciler, domContainer, true);
265
+ ContainerMap.set(domContainer, root);
266
+ return root;
250
267
  }
251
268
 
252
269
  /* eslint-disable @typescript-eslint/no-unused-vars */
@@ -287,11 +304,12 @@ function createPortal(children, containerInfo, key) {
287
304
  }
288
305
  var index = {
289
306
  render,
307
+ createRoot,
290
308
  unstable_batchedUpdates,
291
309
  unmountComponentAtNode,
292
310
  findDOMNode,
293
311
  createPortal
294
312
  };
295
313
 
296
- export { createPortal, index as default, findDOMNode, render, unmountComponentAtNode, unstable_batchedUpdates };
314
+ export { createPortal, createRoot, index as default, findDOMNode, render, unmountComponentAtNode, unstable_batchedUpdates };
297
315
  //# sourceMappingURL=react.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"react.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"react.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/react",
3
- "version": "3.5.0-alpha.2",
3
+ "version": "3.5.0-alpha.5",
4
4
  "description": "like react-dom, but for mini apps.",
5
5
  "author": "yuche <i@yuche.me>",
6
6
  "homepage": "https://github.com/nervjs/taro/tree/master/packages/taro-react#readme",
@@ -24,13 +24,13 @@
24
24
  "url": "https://github.com/NervJS/taro/issues"
25
25
  },
26
26
  "dependencies": {
27
- "@tarojs/runtime": "3.5.0-alpha.2",
28
- "@tarojs/shared": "3.5.0-alpha.2",
29
- "react-reconciler": "0.26.1",
27
+ "@tarojs/runtime": "3.5.0-alpha.5",
28
+ "@tarojs/shared": "3.5.0-alpha.5",
29
+ "react-reconciler": "0.27.0",
30
30
  "scheduler": "^0.20.1"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
- "gitHead": "a7f74344335ee3b4c57a401c1d103e16da99ee7a"
35
+ "gitHead": "7ff334bcd20a076766616639bc1859691ecad481"
36
36
  }