@tarojs/react 3.3.14 → 3.5.0-canary.0

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
@@ -2,13 +2,36 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
-
7
- var Reconciler = _interopDefault(require('react-reconciler'));
5
+ var Reconciler = require('react-reconciler');
8
6
  var scheduler = require('scheduler');
9
7
  var runtime = require('@tarojs/runtime');
10
8
  var shared = require('@tarojs/shared');
11
9
 
10
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
11
+
12
+ function _interopNamespace(e) {
13
+ if (e && e.__esModule) return e;
14
+ var n = Object.create(null);
15
+ if (e) {
16
+ Object.keys(e).forEach(function (k) {
17
+ if (k !== 'default') {
18
+ var d = Object.getOwnPropertyDescriptor(e, k);
19
+ Object.defineProperty(n, k, d.get ? d : {
20
+ enumerable: true,
21
+ get: function () {
22
+ return e[k];
23
+ }
24
+ });
25
+ }
26
+ });
27
+ }
28
+ n['default'] = e;
29
+ return Object.freeze(n);
30
+ }
31
+
32
+ var Reconciler__default = /*#__PURE__*/_interopDefaultLegacy(Reconciler);
33
+ var scheduler__namespace = /*#__PURE__*/_interopNamespace(scheduler);
34
+
12
35
  function isEventName(s) {
13
36
  return s[0] === 'o' && s[1] === 'n';
14
37
  }
@@ -124,7 +147,7 @@ function setProperty(dom, name, value, oldValue) {
124
147
  }
125
148
 
126
149
  /* eslint-disable @typescript-eslint/indent */
127
- var now = scheduler.unstable_now;
150
+ var now = scheduler__namespace.unstable_now;
128
151
  function returnFalse() {
129
152
  return false;
130
153
  }
@@ -185,7 +208,7 @@ var hostConfig = {
185
208
  unhideInstance: function unhideInstance(instance, props) {
186
209
  var styleProp = props.style;
187
210
  var display = (styleProp === null || styleProp === void 0 ? void 0 : styleProp.hasOwnProperty('display')) ? styleProp.display : null;
188
- display = display == null || typeof display === 'boolean' || display === '' ? '' : ('' + display).trim();
211
+ display = display == null || shared.isBoolean(display) || display === '' ? '' : ('' + display).trim();
189
212
  // eslint-disable-next-line dot-notation
190
213
  instance.style['display'] = display;
191
214
  },
@@ -194,7 +217,7 @@ var hostConfig = {
194
217
  element.textContent = '';
195
218
  }
196
219
  },
197
- queueMicrotask: typeof Promise !== 'undefined'
220
+ queueMicrotask: !shared.isUndefined(Promise)
198
221
  ? function (callback) { return Promise.resolve(null)
199
222
  .then(callback)
200
223
  .catch(function (error) {
@@ -220,7 +243,7 @@ var hostConfig = {
220
243
  isPrimaryRenderer: true,
221
244
  supportsHydration: false
222
245
  };
223
- var TaroReconciler = Reconciler(hostConfig);
246
+ var TaroReconciler = Reconciler__default['default'](hostConfig);
224
247
  if (process.env.NODE_ENV !== 'production') {
225
248
  var foundDevTools = TaroReconciler.injectIntoDevTools({
226
249
  bundleType: 1,
@@ -239,8 +262,11 @@ var Root = function Root(renderer, domContainer) {
239
262
  this.internalRoot = renderer.createContainer(domContainer, 0 /** LegacyRoot: react-reconciler/src/ReactRootTags.js */, false, null);
240
263
  };
241
264
  Root.prototype.render = function render (children, cb) {
242
- this.renderer.updateContainer(children, this.internalRoot, null, cb);
243
- return this.renderer.getPublicRootInstance(this.internalRoot);
265
+ var ref = this;
266
+ var renderer = ref.renderer;
267
+ var internalRoot = ref.internalRoot;
268
+ renderer.updateContainer(children, internalRoot, null, cb);
269
+ return renderer.getPublicRootInstance(internalRoot);
244
270
  };
245
271
  Root.prototype.unmount = function unmount (cb) {
246
272
  this.renderer.updateContainer(null, this.internalRoot, null, cb);
@@ -279,7 +305,7 @@ function findDOMNode(comp) {
279
305
  }
280
306
  return TaroReconciler.findHostInstance(comp);
281
307
  }
282
- var portalType = typeof Symbol === 'function' && Symbol.for
308
+ var portalType = shared.isFunction(Symbol) && Symbol.for
283
309
  ? Symbol.for('react.portal')
284
310
  : 0xeaca;
285
311
  function createPortal(children, containerInfo, key) {
@@ -300,7 +326,7 @@ var index = {
300
326
  };
301
327
 
302
328
  exports.createPortal = createPortal;
303
- exports.default = index;
329
+ exports['default'] = index;
304
330
  exports.findDOMNode = findDOMNode;
305
331
  exports.render = render;
306
332
  exports.unmountComponentAtNode = unmountComponentAtNode;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/props.ts","../src/reconciler.ts","../src/render.ts","../src/index.ts"],"sourcesContent":["import { TaroElement, Style, FormElement } from '@tarojs/runtime'\nimport { isFunction, isString, isObject, isNumber, internalComponents, capitalize, toCamelCase } from '@tarojs/shared'\n\nexport type Props = Record<string, unknown>\n\nfunction isEventName (s: string) {\n return s[0] === 'o' && s[1] === 'n'\n}\n\nconst IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord/i\n\nexport function updateProps (dom: TaroElement, oldProps: Props, newProps: Props) {\n let i: string\n\n for (i in oldProps) {\n if (!(i in newProps)) {\n setProperty(dom, i, null, oldProps[i])\n }\n }\n const isFormElement = dom instanceof FormElement\n for (i in newProps) {\n if (oldProps[i] !== newProps[i] || (isFormElement && i === 'value')) {\n setProperty(dom, i, newProps[i], oldProps[i])\n }\n }\n}\n\n// function eventProxy (e: CommonEvent) {\n// const el = document.getElementById(e.currentTarget.id)\n// const handlers = el!.__handlers[e.type]\n// handlers[0](e)\n// }\n\nfunction setEvent (dom: TaroElement, name: string, value: unknown, oldValue?: unknown) {\n const isCapture = name.endsWith('Capture')\n let eventName = name.toLowerCase().slice(2)\n if (isCapture) {\n eventName = eventName.slice(0, -7)\n }\n\n const compName = capitalize(toCamelCase(dom.tagName.toLowerCase()))\n\n if (eventName === 'click' && compName in internalComponents) {\n eventName = 'tap'\n }\n\n if (isFunction(value)) {\n if (!oldValue) {\n dom.addEventListener(eventName, value, isCapture)\n }\n if (eventName === 'regionchange') {\n dom.__handlers.begin[0] = value\n dom.__handlers.end[0] = value\n } else {\n dom.__handlers[eventName][0] = value\n }\n } else {\n dom.removeEventListener(eventName, oldValue as any)\n }\n}\n\nfunction setStyle (style: Style, key: string, value: string | number) {\n if (key[0] === '-') {\n style.setProperty(key, value.toString())\n }\n\n style[key] =\n isNumber(value) && IS_NON_DIMENSIONAL.test(key) === false\n ? value + 'px'\n : value == null\n ? ''\n : value\n}\n\ntype StyleValue = Record<string, string | number>\ninterface DangerouslySetInnerHTML {\n __html?: string\n}\n\nfunction setProperty (dom: TaroElement, name: string, value: unknown, oldValue?: unknown) {\n name = name === 'className' ? 'class' : name\n\n if (\n name === 'key' ||\n name === 'children' ||\n name === 'ref'\n ) {\n // skip\n } else if (name === 'style') {\n const style = dom.style\n if (isString(value)) {\n style.cssText = value\n } else {\n if (isString(oldValue)) {\n style.cssText = ''\n oldValue = null\n }\n\n if (isObject<StyleValue>(oldValue)) {\n for (const i in oldValue) {\n if (!(value && i in (value as StyleValue))) {\n setStyle(style, i, '')\n }\n }\n }\n\n if (isObject<StyleValue>(value)) {\n for (const i in value) {\n if (!oldValue || value[i] !== (oldValue as StyleValue)[i]) {\n setStyle(style, i, value[i])\n }\n }\n }\n }\n } else if (isEventName(name)) {\n setEvent(dom, name, value, oldValue)\n } else if (name === 'dangerouslySetInnerHTML') {\n const newHtml = (value as DangerouslySetInnerHTML)?.__html ?? ''\n const oldHtml = (oldValue as DangerouslySetInnerHTML)?.__html ?? ''\n if (newHtml || oldHtml) {\n if (oldHtml !== newHtml) {\n dom.innerHTML = newHtml\n }\n }\n } else if (!isFunction(value)) {\n if (value == null) {\n dom.removeAttribute(name)\n } else {\n dom.setAttribute(name, value as string)\n }\n }\n}\n","/* eslint-disable @typescript-eslint/indent */\nimport Reconciler, { HostConfig } from 'react-reconciler'\nimport * as scheduler from 'scheduler'\nimport { TaroElement, TaroText, document } from '@tarojs/runtime'\nimport { noop, EMPTY_ARR } from '@tarojs/shared'\nimport { Props, updateProps } from './props'\n\nconst {\n unstable_now: now\n} = scheduler\n\nfunction returnFalse () {\n return false\n}\n\nconst hostConfig: HostConfig<\n string, // Type\n Props, // Props\n TaroElement, // Container\n TaroElement, // Instance\n TaroText, // TextInstance\n TaroElement, // SuspenseInstance\n TaroElement, // HydratableInstance\n TaroElement, // PublicInstance\n Record<string, any>, // HostContext\n string[], // UpdatePayload\n unknown, // ChildSet\n unknown, // TimeoutHandle\n unknown // NoTimeout\n> & {\n hideInstance (instance: TaroElement): void\n unhideInstance (instance: TaroElement, props): void\n} = {\n createInstance (type) {\n return document.createElement(type)\n },\n\n createTextInstance (text) {\n return document.createTextNode(text)\n },\n\n getPublicInstance (inst: TaroElement) {\n return inst\n },\n\n getRootHostContext () {\n return {}\n },\n\n getChildHostContext () {\n return {}\n },\n\n appendChild (parent, child) {\n parent.appendChild(child)\n },\n\n appendInitialChild (parent, child) {\n parent.appendChild(child)\n },\n\n appendChildToContainer (parent, child) {\n parent.appendChild(child)\n },\n\n removeChild (parent, child) {\n parent.removeChild(child)\n },\n\n removeChildFromContainer (parent, child) {\n parent.removeChild(child)\n },\n\n insertBefore (parent, child, refChild) {\n parent.insertBefore(child, refChild)\n },\n\n insertInContainerBefore (parent, child, refChild) {\n parent.insertBefore(child, refChild)\n },\n\n commitTextUpdate (textInst, _, newText) {\n textInst.nodeValue = newText\n },\n\n finalizeInitialChildren (dom, _, props) {\n updateProps(dom, {}, props)\n return false\n },\n\n prepareUpdate () {\n return EMPTY_ARR\n },\n\n commitUpdate (dom, _payload, _type, oldProps, newProps) {\n updateProps(dom, oldProps, newProps)\n },\n\n hideInstance (instance) {\n const style = instance.style\n style.setProperty('display', 'none')\n },\n\n unhideInstance (instance, props) {\n const styleProp = props.style\n let display = styleProp?.hasOwnProperty('display') ? styleProp.display : null\n display = display == null || typeof display === 'boolean' || display === '' ? '' : ('' + display).trim()\n // eslint-disable-next-line dot-notation\n instance.style['display'] = display\n },\n\n clearContainer (element) {\n if (element.childNodes.length > 0) {\n element.textContent = ''\n }\n },\n\n queueMicrotask: typeof Promise !== 'undefined'\n ? callback =>\n Promise.resolve(null)\n .then(callback)\n .catch(function (error) {\n setTimeout(() => {\n throw error\n })\n })\n : setTimeout,\n\n shouldSetTextContent: returnFalse,\n prepareForCommit (..._: any[]) { return null },\n resetAfterCommit: noop,\n commitMount: noop,\n now,\n cancelTimeout: clearTimeout,\n scheduleTimeout: setTimeout,\n preparePortalMount: noop,\n noTimeout: -1,\n supportsMutation: true,\n supportsPersistence: false,\n isPrimaryRenderer: true,\n supportsHydration: false\n}\n\nconst TaroReconciler = Reconciler(hostConfig)\n\nif (process.env.NODE_ENV !== 'production') {\n const foundDevTools = TaroReconciler.injectIntoDevTools({\n bundleType: 1,\n version: '17.0.2',\n rendererPackageName: 'taro-react'\n })\n if (!foundDevTools) {\n // eslint-disable-next-line no-console\n console.info('%cDownload the React DevTools ' + 'for a better development experience: ' + 'https://reactjs.org/link/react-devtools', 'font-weight:bold')\n }\n}\n\nexport {\n TaroReconciler\n}\n","import { TaroElement } from '@tarojs/runtime'\nimport { ReactNode } from 'react'\nimport { TaroReconciler } from './reconciler'\nimport { OpaqueRoot } from 'react-reconciler'\n\nexport const ContainerMap: WeakMap<TaroElement, Root> = new WeakMap()\n\ntype Renderer = typeof TaroReconciler\n\nexport type Callback = () => void | null | undefined\n\nclass Root {\n private renderer: Renderer\n private internalRoot: OpaqueRoot\n\n public constructor (renderer: Renderer, domContainer: TaroElement) {\n this.renderer = renderer\n this.internalRoot = renderer.createContainer(domContainer, 0/** LegacyRoot: react-reconciler/src/ReactRootTags.js */, false, null)\n }\n\n public render (children: ReactNode, cb: Callback) {\n this.renderer.updateContainer(children, this.internalRoot, null, cb)\n\n return this.renderer.getPublicRootInstance(this.internalRoot)\n }\n\n public unmount (cb: Callback) {\n this.renderer.updateContainer(null, this.internalRoot, null, cb)\n }\n}\n\nexport function render (element: ReactNode, domContainer: TaroElement, cb: Callback) {\n const oldRoot = ContainerMap.get(domContainer)\n if (oldRoot != null) {\n return oldRoot.render(element, cb)\n }\n\n const root = new Root(TaroReconciler, domContainer)\n ContainerMap.set(domContainer, root)\n return root.render(element, cb)\n}\n","/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { render, ContainerMap } from './render'\nimport { TaroReconciler } from './reconciler'\nimport { TaroElement } from '@tarojs/runtime'\nimport { ReactNode } from 'react'\nimport { ensure } from '@tarojs/shared'\n\nconst unstable_batchedUpdates = TaroReconciler.batchedUpdates\n\nfunction unmountComponentAtNode (dom: TaroElement) {\n ensure(dom && [1, 8, 9, 11].includes(dom.nodeType), 'unmountComponentAtNode(...): Target container is not a DOM element.')\n\n const root = ContainerMap.get(dom)\n\n if (!root) return false\n\n unstable_batchedUpdates(() => {\n root.unmount(() => {\n ContainerMap.delete(dom)\n })\n }, null)\n\n return true\n}\n\nfunction findDOMNode (comp?: TaroElement | ReactNode) {\n if (comp == null) {\n return null\n }\n\n const nodeType = (comp as TaroElement).nodeType\n if (nodeType === 1 || nodeType === 3) {\n return comp\n }\n\n return TaroReconciler.findHostInstance(comp as Record<string, any>)\n}\n\nconst portalType = typeof Symbol === 'function' && Symbol.for\n ? Symbol.for('react.portal')\n : 0xeaca\n\nfunction createPortal (\n children: ReactNode,\n containerInfo: TaroElement,\n key?: string\n) {\n return {\n $$typeof: portalType,\n key: key == null ? null : String(key),\n children,\n containerInfo,\n implementation: null\n }\n}\n\nexport {\n render,\n unstable_batchedUpdates,\n unmountComponentAtNode,\n findDOMNode,\n createPortal\n}\n\nexport default {\n render,\n unstable_batchedUpdates,\n unmountComponentAtNode,\n findDOMNode,\n createPortal\n}\n"],"names":["const","let","FormElement","capitalize","toCamelCase","internalComponents","isFunction","isNumber","isString","isObject","i","document","EMPTY_ARR","noop","ensure"],"mappings":";;;;;;;;;;;AAKA,SAAS,WAAW,CAAE,CAAS;IAC7B,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAA;AACrC,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/dist/react.esm.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import Reconciler from 'react-reconciler';
2
2
  import * as scheduler from 'scheduler';
3
3
  import { FormElement, document } from '@tarojs/runtime';
4
- import { isString, isObject, isFunction, capitalize, toCamelCase, internalComponents, isNumber, EMPTY_ARR, noop, ensure } from '@tarojs/shared';
4
+ import { isString, isObject, isFunction, capitalize, toCamelCase, internalComponents, isNumber, EMPTY_ARR, isBoolean, isUndefined, noop, ensure } from '@tarojs/shared';
5
5
 
6
6
  function isEventName(s) {
7
7
  return s[0] === 'o' && s[1] === 'n';
@@ -179,7 +179,7 @@ const hostConfig = {
179
179
  unhideInstance(instance, props) {
180
180
  const styleProp = props.style;
181
181
  let display = (styleProp === null || styleProp === void 0 ? void 0 : styleProp.hasOwnProperty('display')) ? styleProp.display : null;
182
- display = display == null || typeof display === 'boolean' || display === '' ? '' : ('' + display).trim();
182
+ display = display == null || isBoolean(display) || display === '' ? '' : ('' + display).trim();
183
183
  // eslint-disable-next-line dot-notation
184
184
  instance.style['display'] = display;
185
185
  },
@@ -188,7 +188,7 @@ const hostConfig = {
188
188
  element.textContent = '';
189
189
  }
190
190
  },
191
- queueMicrotask: typeof Promise !== 'undefined'
191
+ queueMicrotask: !isUndefined(Promise)
192
192
  ? callback => Promise.resolve(null)
193
193
  .then(callback)
194
194
  .catch(function (error) {
@@ -231,8 +231,9 @@ class Root {
231
231
  this.internalRoot = renderer.createContainer(domContainer, 0 /** LegacyRoot: react-reconciler/src/ReactRootTags.js */, false, null);
232
232
  }
233
233
  render(children, cb) {
234
- this.renderer.updateContainer(children, this.internalRoot, null, cb);
235
- return this.renderer.getPublicRootInstance(this.internalRoot);
234
+ const { renderer, internalRoot } = this;
235
+ renderer.updateContainer(children, internalRoot, null, cb);
236
+ return renderer.getPublicRootInstance(internalRoot);
236
237
  }
237
238
  unmount(cb) {
238
239
  this.renderer.updateContainer(null, this.internalRoot, null, cb);
@@ -272,7 +273,7 @@ function findDOMNode(comp) {
272
273
  }
273
274
  return TaroReconciler.findHostInstance(comp);
274
275
  }
275
- const portalType = typeof Symbol === 'function' && Symbol.for
276
+ const portalType = isFunction(Symbol) && Symbol.for
276
277
  ? Symbol.for('react.portal')
277
278
  : 0xeaca;
278
279
  function createPortal(children, containerInfo, key) {
@@ -292,6 +293,5 @@ var index = {
292
293
  createPortal
293
294
  };
294
295
 
295
- export default index;
296
- export { createPortal, findDOMNode, render, unmountComponentAtNode, unstable_batchedUpdates };
296
+ export { createPortal, index as default, findDOMNode, render, unmountComponentAtNode, unstable_batchedUpdates };
297
297
  //# sourceMappingURL=react.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"react.esm.js","sources":["../src/props.ts","../src/reconciler.ts","../src/render.ts","../src/index.ts"],"sourcesContent":["import { TaroElement, Style, FormElement } from '@tarojs/runtime'\nimport { isFunction, isString, isObject, isNumber, internalComponents, capitalize, toCamelCase } from '@tarojs/shared'\n\nexport type Props = Record<string, unknown>\n\nfunction isEventName (s: string) {\n return s[0] === 'o' && s[1] === 'n'\n}\n\nconst IS_NON_DIMENSIONAL = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord/i\n\nexport function updateProps (dom: TaroElement, oldProps: Props, newProps: Props) {\n let i: string\n\n for (i in oldProps) {\n if (!(i in newProps)) {\n setProperty(dom, i, null, oldProps[i])\n }\n }\n const isFormElement = dom instanceof FormElement\n for (i in newProps) {\n if (oldProps[i] !== newProps[i] || (isFormElement && i === 'value')) {\n setProperty(dom, i, newProps[i], oldProps[i])\n }\n }\n}\n\n// function eventProxy (e: CommonEvent) {\n// const el = document.getElementById(e.currentTarget.id)\n// const handlers = el!.__handlers[e.type]\n// handlers[0](e)\n// }\n\nfunction setEvent (dom: TaroElement, name: string, value: unknown, oldValue?: unknown) {\n const isCapture = name.endsWith('Capture')\n let eventName = name.toLowerCase().slice(2)\n if (isCapture) {\n eventName = eventName.slice(0, -7)\n }\n\n const compName = capitalize(toCamelCase(dom.tagName.toLowerCase()))\n\n if (eventName === 'click' && compName in internalComponents) {\n eventName = 'tap'\n }\n\n if (isFunction(value)) {\n if (!oldValue) {\n dom.addEventListener(eventName, value, isCapture)\n }\n if (eventName === 'regionchange') {\n dom.__handlers.begin[0] = value\n dom.__handlers.end[0] = value\n } else {\n dom.__handlers[eventName][0] = value\n }\n } else {\n dom.removeEventListener(eventName, oldValue as any)\n }\n}\n\nfunction setStyle (style: Style, key: string, value: string | number) {\n if (key[0] === '-') {\n style.setProperty(key, value.toString())\n }\n\n style[key] =\n isNumber(value) && IS_NON_DIMENSIONAL.test(key) === false\n ? value + 'px'\n : value == null\n ? ''\n : value\n}\n\ntype StyleValue = Record<string, string | number>\ninterface DangerouslySetInnerHTML {\n __html?: string\n}\n\nfunction setProperty (dom: TaroElement, name: string, value: unknown, oldValue?: unknown) {\n name = name === 'className' ? 'class' : name\n\n if (\n name === 'key' ||\n name === 'children' ||\n name === 'ref'\n ) {\n // skip\n } else if (name === 'style') {\n const style = dom.style\n if (isString(value)) {\n style.cssText = value\n } else {\n if (isString(oldValue)) {\n style.cssText = ''\n oldValue = null\n }\n\n if (isObject<StyleValue>(oldValue)) {\n for (const i in oldValue) {\n if (!(value && i in (value as StyleValue))) {\n setStyle(style, i, '')\n }\n }\n }\n\n if (isObject<StyleValue>(value)) {\n for (const i in value) {\n if (!oldValue || value[i] !== (oldValue as StyleValue)[i]) {\n setStyle(style, i, value[i])\n }\n }\n }\n }\n } else if (isEventName(name)) {\n setEvent(dom, name, value, oldValue)\n } else if (name === 'dangerouslySetInnerHTML') {\n const newHtml = (value as DangerouslySetInnerHTML)?.__html ?? ''\n const oldHtml = (oldValue as DangerouslySetInnerHTML)?.__html ?? ''\n if (newHtml || oldHtml) {\n if (oldHtml !== newHtml) {\n dom.innerHTML = newHtml\n }\n }\n } else if (!isFunction(value)) {\n if (value == null) {\n dom.removeAttribute(name)\n } else {\n dom.setAttribute(name, value as string)\n }\n }\n}\n","/* eslint-disable @typescript-eslint/indent */\nimport Reconciler, { HostConfig } from 'react-reconciler'\nimport * as scheduler from 'scheduler'\nimport { TaroElement, TaroText, document } from '@tarojs/runtime'\nimport { noop, EMPTY_ARR } from '@tarojs/shared'\nimport { Props, updateProps } from './props'\n\nconst {\n unstable_now: now\n} = scheduler\n\nfunction returnFalse () {\n return false\n}\n\nconst hostConfig: HostConfig<\n string, // Type\n Props, // Props\n TaroElement, // Container\n TaroElement, // Instance\n TaroText, // TextInstance\n TaroElement, // SuspenseInstance\n TaroElement, // HydratableInstance\n TaroElement, // PublicInstance\n Record<string, any>, // HostContext\n string[], // UpdatePayload\n unknown, // ChildSet\n unknown, // TimeoutHandle\n unknown // NoTimeout\n> & {\n hideInstance (instance: TaroElement): void\n unhideInstance (instance: TaroElement, props): void\n} = {\n createInstance (type) {\n return document.createElement(type)\n },\n\n createTextInstance (text) {\n return document.createTextNode(text)\n },\n\n getPublicInstance (inst: TaroElement) {\n return inst\n },\n\n getRootHostContext () {\n return {}\n },\n\n getChildHostContext () {\n return {}\n },\n\n appendChild (parent, child) {\n parent.appendChild(child)\n },\n\n appendInitialChild (parent, child) {\n parent.appendChild(child)\n },\n\n appendChildToContainer (parent, child) {\n parent.appendChild(child)\n },\n\n removeChild (parent, child) {\n parent.removeChild(child)\n },\n\n removeChildFromContainer (parent, child) {\n parent.removeChild(child)\n },\n\n insertBefore (parent, child, refChild) {\n parent.insertBefore(child, refChild)\n },\n\n insertInContainerBefore (parent, child, refChild) {\n parent.insertBefore(child, refChild)\n },\n\n commitTextUpdate (textInst, _, newText) {\n textInst.nodeValue = newText\n },\n\n finalizeInitialChildren (dom, _, props) {\n updateProps(dom, {}, props)\n return false\n },\n\n prepareUpdate () {\n return EMPTY_ARR\n },\n\n commitUpdate (dom, _payload, _type, oldProps, newProps) {\n updateProps(dom, oldProps, newProps)\n },\n\n hideInstance (instance) {\n const style = instance.style\n style.setProperty('display', 'none')\n },\n\n unhideInstance (instance, props) {\n const styleProp = props.style\n let display = styleProp?.hasOwnProperty('display') ? styleProp.display : null\n display = display == null || typeof display === 'boolean' || display === '' ? '' : ('' + display).trim()\n // eslint-disable-next-line dot-notation\n instance.style['display'] = display\n },\n\n clearContainer (element) {\n if (element.childNodes.length > 0) {\n element.textContent = ''\n }\n },\n\n queueMicrotask: typeof Promise !== 'undefined'\n ? callback =>\n Promise.resolve(null)\n .then(callback)\n .catch(function (error) {\n setTimeout(() => {\n throw error\n })\n })\n : setTimeout,\n\n shouldSetTextContent: returnFalse,\n prepareForCommit (..._: any[]) { return null },\n resetAfterCommit: noop,\n commitMount: noop,\n now,\n cancelTimeout: clearTimeout,\n scheduleTimeout: setTimeout,\n preparePortalMount: noop,\n noTimeout: -1,\n supportsMutation: true,\n supportsPersistence: false,\n isPrimaryRenderer: true,\n supportsHydration: false\n}\n\nconst TaroReconciler = Reconciler(hostConfig)\n\nif (process.env.NODE_ENV !== 'production') {\n const foundDevTools = TaroReconciler.injectIntoDevTools({\n bundleType: 1,\n version: '17.0.2',\n rendererPackageName: 'taro-react'\n })\n if (!foundDevTools) {\n // eslint-disable-next-line no-console\n console.info('%cDownload the React DevTools ' + 'for a better development experience: ' + 'https://reactjs.org/link/react-devtools', 'font-weight:bold')\n }\n}\n\nexport {\n TaroReconciler\n}\n","import { TaroElement } from '@tarojs/runtime'\nimport { ReactNode } from 'react'\nimport { TaroReconciler } from './reconciler'\nimport { OpaqueRoot } from 'react-reconciler'\n\nexport const ContainerMap: WeakMap<TaroElement, Root> = new WeakMap()\n\ntype Renderer = typeof TaroReconciler\n\nexport type Callback = () => void | null | undefined\n\nclass Root {\n private renderer: Renderer\n private internalRoot: OpaqueRoot\n\n public constructor (renderer: Renderer, domContainer: TaroElement) {\n this.renderer = renderer\n this.internalRoot = renderer.createContainer(domContainer, 0/** LegacyRoot: react-reconciler/src/ReactRootTags.js */, false, null)\n }\n\n public render (children: ReactNode, cb: Callback) {\n this.renderer.updateContainer(children, this.internalRoot, null, cb)\n\n return this.renderer.getPublicRootInstance(this.internalRoot)\n }\n\n public unmount (cb: Callback) {\n this.renderer.updateContainer(null, this.internalRoot, null, cb)\n }\n}\n\nexport function render (element: ReactNode, domContainer: TaroElement, cb: Callback) {\n const oldRoot = ContainerMap.get(domContainer)\n if (oldRoot != null) {\n return oldRoot.render(element, cb)\n }\n\n const root = new Root(TaroReconciler, domContainer)\n ContainerMap.set(domContainer, root)\n return root.render(element, cb)\n}\n","/* eslint-disable @typescript-eslint/no-unused-vars */\nimport { render, ContainerMap } from './render'\nimport { TaroReconciler } from './reconciler'\nimport { TaroElement } from '@tarojs/runtime'\nimport { ReactNode } from 'react'\nimport { ensure } from '@tarojs/shared'\n\nconst unstable_batchedUpdates = TaroReconciler.batchedUpdates\n\nfunction unmountComponentAtNode (dom: TaroElement) {\n ensure(dom && [1, 8, 9, 11].includes(dom.nodeType), 'unmountComponentAtNode(...): Target container is not a DOM element.')\n\n const root = ContainerMap.get(dom)\n\n if (!root) return false\n\n unstable_batchedUpdates(() => {\n root.unmount(() => {\n ContainerMap.delete(dom)\n })\n }, null)\n\n return true\n}\n\nfunction findDOMNode (comp?: TaroElement | ReactNode) {\n if (comp == null) {\n return null\n }\n\n const nodeType = (comp as TaroElement).nodeType\n if (nodeType === 1 || nodeType === 3) {\n return comp\n }\n\n return TaroReconciler.findHostInstance(comp as Record<string, any>)\n}\n\nconst portalType = typeof Symbol === 'function' && Symbol.for\n ? Symbol.for('react.portal')\n : 0xeaca\n\nfunction createPortal (\n children: ReactNode,\n containerInfo: TaroElement,\n key?: string\n) {\n return {\n $$typeof: portalType,\n key: key == null ? null : String(key),\n children,\n containerInfo,\n implementation: null\n }\n}\n\nexport {\n render,\n unstable_batchedUpdates,\n unmountComponentAtNode,\n findDOMNode,\n createPortal\n}\n\nexport default {\n render,\n unstable_batchedUpdates,\n unmountComponentAtNode,\n findDOMNode,\n createPortal\n}\n"],"names":[],"mappings":";;;;;AAKA,SAAS,WAAW,CAAE,CAAS;IAC7B,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAA;AACrC,CAAC;AAED,MAAM,kBAAkB,GAAG,6DAA6D,CAAA;SAExE,WAAW,CAAE,GAAgB,EAAE,QAAe,EAAE,QAAe;IAC7E,IAAI,CAAS,CAAA;IAEb,KAAK,CAAC,IAAI,QAAQ,EAAE;QAClB,IAAI,EAAE,CAAC,IAAI,QAAQ,CAAC,EAAE;YACpB,WAAW,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;SACvC;KACF;IACD,MAAM,aAAa,GAAG,GAAG,YAAY,WAAW,CAAA;IAChD,KAAK,CAAC,IAAI,QAAQ,EAAE;QAClB,IAAI,QAAQ,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,aAAa,IAAI,CAAC,KAAK,OAAO,CAAC,EAAE;YACnE,WAAW,CAAC,GAAG,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAA;SAC9C;KACF;AACH,CAAC;AAED;AACA;AACA;AACA;AACA;AAEA,SAAS,QAAQ,CAAE,GAAgB,EAAE,IAAY,EAAE,KAAc,EAAE,QAAkB;IACnF,MAAM,SAAS,GAAG,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAA;IAC1C,IAAI,SAAS,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAC3C,IAAI,SAAS,EAAE;QACb,SAAS,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,C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js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/react",
3
- "version": "3.3.14",
3
+ "version": "3.5.0-canary.0",
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.3.14",
28
- "@tarojs/shared": "3.3.14",
27
+ "@tarojs/runtime": "3.5.0-canary.0",
28
+ "@tarojs/shared": "3.5.0-canary.0",
29
29
  "react-reconciler": "0.26.1",
30
30
  "scheduler": "^0.20.1"
31
31
  },
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
35
- "gitHead": "ffd2b33c2a760094372a9ec69735ab9c4d1877e5"
35
+ "gitHead": "a0222bc41bc05b0e34413d6db3de963d777a5015"
36
36
  }