UNPKG

40.8 kBSource Map (JSON)View Raw
1{"version":3,"file":"mobx-react.module.js","sources":["../src/utils/utils.js","../src/observerClass.js","../src/observer.js","../src/Provider.js","../src/inject.js","../src/disposeOnUnmount.js","../src/propTypes.js","../src/index.js"],"sourcesContent":["export function isStateless(component) {\n // `function() {}` has prototype, but `() => {}` doesn't\n // `() => {}` via Babel has prototype too.\n return !(component.prototype && component.prototype.render)\n}\n\nlet symbolId = 0\nfunction createSymbol(name) {\n if (typeof Symbol === \"function\") {\n return Symbol(name)\n }\n const symbol = `__$mobx-react ${name} (${symbolId})`\n symbolId++\n return symbol\n}\n\nconst createdSymbols = {}\nexport function newSymbol(name) {\n if (!createdSymbols[name]) {\n createdSymbols[name] = createSymbol(name)\n }\n return createdSymbols[name]\n}\n\nexport function shallowEqual(objA, objB) {\n //From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js\n if (is(objA, objB)) return true\n if (typeof objA !== \"object\" || objA === null || typeof objB !== \"object\" || objB === null) {\n return false\n }\n const keysA = Object.keys(objA)\n const keysB = Object.keys(objB)\n if (keysA.length !== keysB.length) return false\n for (let i = 0; i < keysA.length; i++) {\n if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {\n return false\n }\n }\n return true\n}\n\nfunction is(x, y) {\n // From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js\n if (x === y) {\n return x !== 0 || 1 / x === 1 / y\n } else {\n return x !== x && y !== y\n }\n}\n\n// based on https://github.com/mridgway/hoist-non-react-statics/blob/master/src/index.js\nconst hoistBlackList = {\n $$typeof: 1,\n render: 1,\n compare: 1,\n type: 1,\n childContextTypes: 1,\n contextType: 1,\n contextTypes: 1,\n defaultProps: 1,\n getDefaultProps: 1,\n getDerivedStateFromError: 1,\n getDerivedStateFromProps: 1,\n mixins: 1,\n propTypes: 1\n}\n\nexport function copyStaticProperties(base, target) {\n const protoProps = Object.getOwnPropertyNames(Object.getPrototypeOf(base))\n Object.getOwnPropertyNames(base).forEach(key => {\n if (!hoistBlackList[key] && protoProps.indexOf(key) === -1) {\n Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(base, key))\n }\n })\n}\n\n/**\n * Helper to set `prop` to `this` as non-enumerable (hidden prop)\n * @param target\n * @param prop\n * @param value\n */\nexport function setHiddenProp(target, prop, value) {\n if (!Object.hasOwnProperty.call(target, prop)) {\n Object.defineProperty(target, prop, {\n enumerable: false,\n configurable: true,\n writable: true,\n value\n })\n } else {\n target[prop] = value\n }\n}\n\n/**\n * Utilities for patching componentWillUnmount, to make sure @disposeOnUnmount works correctly icm with user defined hooks\n * and the handler provided by mobx-react\n */\nconst mobxMixins = newSymbol(\"patchMixins\")\nconst mobxPatchedDefinition = newSymbol(\"patchedDefinition\")\n\nfunction getMixins(target, methodName) {\n const mixins = (target[mobxMixins] = target[mobxMixins] || {})\n const methodMixins = (mixins[methodName] = mixins[methodName] || {})\n methodMixins.locks = methodMixins.locks || 0\n methodMixins.methods = methodMixins.methods || []\n return methodMixins\n}\n\nfunction wrapper(realMethod, mixins, ...args) {\n // locks are used to ensure that mixins are invoked only once per invocation, even on recursive calls\n mixins.locks++\n\n try {\n let retVal\n if (realMethod !== undefined && realMethod !== null) {\n retVal = realMethod.apply(this, args)\n }\n\n return retVal\n } finally {\n mixins.locks--\n if (mixins.locks === 0) {\n mixins.methods.forEach(mx => {\n mx.apply(this, args)\n })\n }\n }\n}\n\nfunction wrapFunction(realMethod, mixins) {\n const fn = function(...args) {\n wrapper.call(this, realMethod, mixins, ...args)\n }\n return fn\n}\n\nexport function patch(target, methodName, mixinMethod) {\n const mixins = getMixins(target, methodName)\n\n if (mixins.methods.indexOf(mixinMethod) < 0) {\n mixins.methods.push(mixinMethod)\n }\n\n const oldDefinition = Object.getOwnPropertyDescriptor(target, methodName)\n if (oldDefinition && oldDefinition[mobxPatchedDefinition]) {\n // already patched definition, do not repatch\n return\n }\n\n const originalMethod = target[methodName]\n const newDefinition = createDefinition(\n target,\n methodName,\n oldDefinition ? oldDefinition.enumerable : undefined,\n mixins,\n originalMethod\n )\n\n Object.defineProperty(target, methodName, newDefinition)\n}\n\nfunction createDefinition(target, methodName, enumerable, mixins, originalMethod) {\n let wrappedFunc = wrapFunction(originalMethod, mixins)\n\n return {\n [mobxPatchedDefinition]: true,\n get: function() {\n return wrappedFunc\n },\n set: function(value) {\n if (this === target) {\n wrappedFunc = wrapFunction(value, mixins)\n } else {\n // when it is an instance of the prototype/a child prototype patch that particular case again separately\n // since we need to store separate values depending on wether it is the actual instance, the prototype, etc\n // e.g. the method for super might not be the same as the method for the prototype which might be not the same\n // as the method for the instance\n const newDefinition = createDefinition(this, methodName, enumerable, mixins, value)\n Object.defineProperty(this, methodName, newDefinition)\n }\n },\n configurable: true,\n enumerable: enumerable\n }\n}\n","import { PureComponent, Component } from \"react\"\nimport { createAtom, _allowStateChanges, Reaction, $mobx } from \"mobx\"\nimport { isUsingStaticRendering } from \"mobx-react-lite\"\n\nimport { newSymbol, shallowEqual, setHiddenProp, patch } from \"./utils/utils\"\n\nconst mobxAdminProperty = $mobx || \"$mobx\"\nconst mobxIsUnmounted = newSymbol(\"isUnmounted\")\nconst skipRenderKey = newSymbol(\"skipRender\")\nconst isForcingUpdateKey = newSymbol(\"isForcingUpdate\")\n\nexport function makeClassComponentObserver(componentClass) {\n const target = componentClass.prototype\n if (target.componentWillReact)\n throw new Error(\"The componentWillReact life-cycle event is no longer supported\")\n if (componentClass.__proto__ !== PureComponent) {\n if (!target.shouldComponentUpdate) target.shouldComponentUpdate = observerSCU\n else if (target.shouldComponentUpdate !== observerSCU)\n // n.b. unequal check, instead of existence check, as @observer might be on superclass as well\n throw new Error(\n \"It is not allowed to use shouldComponentUpdate in observer based components.\"\n )\n }\n\n // this.props and this.state are made observable, just to make sure @computed fields that\n // are defined inside the component, and which rely on state or props, re-compute if state or props change\n // (otherwise the computed wouldn't update and become stale on props change, since props are not observable)\n // However, this solution is not without it's own problems: https://github.com/mobxjs/mobx-react/issues?utf8=%E2%9C%93&q=is%3Aissue+label%3Aobservable-props-or-not+\n makeObservableProp(target, \"props\")\n makeObservableProp(target, \"state\")\n\n const baseRender = target.render\n target.render = function() {\n return makeComponentReactive.call(this, baseRender)\n }\n patch(target, \"componentWillUnmount\", function() {\n if (isUsingStaticRendering() === true) return\n this.render[mobxAdminProperty] && this.render[mobxAdminProperty].dispose()\n this[mobxIsUnmounted] = true\n })\n return componentClass\n}\n\nfunction makeComponentReactive(render) {\n if (isUsingStaticRendering() === true) return render.call(this)\n\n /**\n * If props are shallowly modified, react will render anyway,\n * so atom.reportChanged() should not result in yet another re-render\n */\n setHiddenProp(this, skipRenderKey, false)\n /**\n * forceUpdate will re-assign this.props. We don't want that to cause a loop,\n * so detect these changes\n */\n setHiddenProp(this, isForcingUpdateKey, false)\n\n // Generate friendly name for debugging\n const initialName =\n this.displayName ||\n this.name ||\n (this.constructor && (this.constructor.displayName || this.constructor.name)) ||\n \"<component>\"\n const baseRender = render.bind(this)\n\n let isRenderingPending = false\n\n const reaction = new Reaction(`${initialName}.render()`, () => {\n if (!isRenderingPending) {\n // N.B. Getting here *before mounting* means that a component constructor has side effects (see the relevant test in misc.js)\n // This unidiomatic React usage but React will correctly warn about this so we continue as usual\n // See #85 / Pull #44\n isRenderingPending = true\n if (this[mobxIsUnmounted] !== true) {\n let hasError = true\n try {\n setHiddenProp(this, isForcingUpdateKey, true)\n if (!this[skipRenderKey]) Component.prototype.forceUpdate.call(this)\n hasError = false\n } finally {\n setHiddenProp(this, isForcingUpdateKey, false)\n if (hasError) reaction.dispose()\n }\n }\n }\n })\n reaction.reactComponent = this\n reactiveRender[mobxAdminProperty] = reaction\n this.render = reactiveRender\n\n function reactiveRender() {\n isRenderingPending = false\n let exception = undefined\n let rendering = undefined\n reaction.track(() => {\n try {\n rendering = _allowStateChanges(false, baseRender)\n } catch (e) {\n exception = e\n }\n })\n if (exception) {\n throw exception\n }\n return rendering\n }\n\n return reactiveRender.call(this)\n}\n\nfunction observerSCU(nextProps, nextState) {\n if (isUsingStaticRendering()) {\n console.warn(\n \"[mobx-react] It seems that a re-rendering of a React component is triggered while in static (server-side) mode. Please make sure components are rendered only once server-side.\"\n )\n }\n // update on any state changes (as is the default)\n if (this.state !== nextState) {\n return true\n }\n // update if props are shallowly not equal, inspired by PureRenderMixin\n // we could return just 'false' here, and avoid the `skipRender` checks etc\n // however, it is nicer if lifecycle events are triggered like usually,\n // so we return true here if props are shallowly modified.\n return !shallowEqual(this.props, nextProps)\n}\n\nfunction makeObservableProp(target, propName) {\n const valueHolderKey = newSymbol(`reactProp_${propName}_valueHolder`)\n const atomHolderKey = newSymbol(`reactProp_${propName}_atomHolder`)\n function getAtom() {\n if (!this[atomHolderKey]) {\n setHiddenProp(this, atomHolderKey, createAtom(\"reactive \" + propName))\n }\n return this[atomHolderKey]\n }\n Object.defineProperty(target, propName, {\n configurable: true,\n enumerable: true,\n get: function() {\n getAtom.call(this).reportObserved()\n return this[valueHolderKey]\n },\n set: function set(v) {\n if (!this[isForcingUpdateKey] && !shallowEqual(this[valueHolderKey], v)) {\n setHiddenProp(this, valueHolderKey, v)\n setHiddenProp(this, skipRenderKey, true)\n getAtom.call(this).reportChanged()\n setHiddenProp(this, skipRenderKey, false)\n } else {\n setHiddenProp(this, valueHolderKey, v)\n }\n }\n })\n}\n","import React, { Component, forwardRef } from \"react\"\nimport { _allowStateChanges } from \"mobx\"\nimport { observer as observerLite, Observer } from \"mobx-react-lite\"\n\nimport { makeClassComponentObserver } from \"./observerClass\"\n\n// Using react-is had some issues (and operates on elements, not on types), see #608 / #609\nconst ReactForwardRefSymbol =\n typeof forwardRef === \"function\" && forwardRef((_props, _ref) => {})[\"$$typeof\"]\n\n/**\n * Observer function / decorator\n */\nexport function observer(componentClass) {\n if (componentClass.isMobxInjector === true) {\n console.warn(\n \"Mobx observer: You are trying to use 'observer' on a component that already has 'inject'. Please apply 'observer' before applying 'inject'\"\n )\n }\n\n // Unwrap forward refs into `<Observer>` component\n // we need to unwrap the render, because it is the inner render that needs to be tracked,\n // not the ForwardRef HoC\n if (ReactForwardRefSymbol && componentClass[\"$$typeof\"] === ReactForwardRefSymbol) {\n const baseRender = componentClass.render\n if (typeof baseRender !== \"function\")\n throw new Error(\"render property of ForwardRef was not a function\")\n return forwardRef(function ObserverForwardRef() {\n return <Observer>{() => baseRender.apply(undefined, arguments)}</Observer>\n })\n }\n\n // Function component\n if (\n typeof componentClass === \"function\" &&\n (!componentClass.prototype || !componentClass.prototype.render) &&\n !componentClass.isReactClass &&\n !Component.isPrototypeOf(componentClass)\n ) {\n return observerLite(componentClass)\n }\n\n return makeClassComponentObserver(componentClass)\n}\n","import { Children, Component, createContext, createElement } from \"react\"\nimport { shallowEqual } from \"./utils/utils\"\n\nconst specialReactKeys = { children: true, key: true, ref: true }\n\nexport const MobXProviderContext = createContext({})\n\nexport class Provider extends Component {\n static contextType = MobXProviderContext\n\n constructor(props, context) {\n super(props, context)\n this.state = {\n ...context,\n ...grabStores(props)\n }\n }\n\n render() {\n return createElement(\n MobXProviderContext.Provider,\n { value: this.state },\n Children.only(this.props.children)\n )\n }\n\n static getDerivedStateFromProps(nextProps, prevState) {\n if (process.env.NODE_ENV !== \"production\") {\n const newStores = { ...prevState, ...grabStores(nextProps) } // spread in prevState for the context based stores\n if (!shallowEqual(prevState, newStores))\n throw new Error(\n \"MobX Provider: The set of provided stores has changed. Please avoid changing stores as the change might not propagate to all children\"\n )\n }\n return prevState // because they didn't change, remember!\n }\n}\n\nfunction grabStores(from) {\n const res = {}\n if (!from) return res\n for (let key in from) if (validStoreName(key)) res[key] = from[key]\n return res\n}\n\nfunction validStoreName(key) {\n return !specialReactKeys[key] && key !== \"suppressChangedStoreWarning\"\n}\n","import React, { Component, createElement } from \"react\"\nimport { observer } from \"./observer\"\nimport { isStateless, copyStaticProperties } from \"./utils/utils\"\nimport { MobXProviderContext } from \"./Provider\"\n\n/**\n * Store Injection\n */\nfunction createStoreInjector(grabStoresFn, component, injectNames, makeReactive) {\n let displayName = getInjectName(component, injectNames)\n\n class Injector extends Component {\n static contextType = MobXProviderContext\n\n render() {\n const { forwardRef, ...props } = this.props\n\n Object.assign(props, grabStoresFn(this.context || {}, props) || {})\n\n if (forwardRef && !isStateless(component)) {\n props.ref = this.props.forwardRef\n }\n\n return createElement(component, props)\n }\n }\n if (makeReactive) Injector = observer(Injector)\n Injector.isMobxInjector = true // assigned late to suppress observer warning\n\n // Support forward refs\n const InjectHocRef = React.forwardRef((props, ref) =>\n React.createElement(Injector, { ...props, forwardRef: ref })\n )\n // Static fields from component should be visible on the generated Injector\n copyStaticProperties(component, InjectHocRef)\n InjectHocRef.wrappedComponent = component\n InjectHocRef.displayName = displayName\n return InjectHocRef\n}\n\nfunction getInjectName(component, injectNames) {\n let displayName\n const componentName =\n component.displayName ||\n component.name ||\n (component.constructor && component.constructor.name) ||\n \"Component\"\n if (injectNames) displayName = \"inject-with-\" + injectNames + \"(\" + componentName + \")\"\n else displayName = \"inject(\" + componentName + \")\"\n return displayName\n}\n\nfunction grabStoresByName(storeNames) {\n return function(baseStores, nextProps) {\n storeNames.forEach(function(storeName) {\n if (\n storeName in nextProps // prefer props over stores\n )\n return\n if (!(storeName in baseStores))\n throw new Error(\n \"MobX injector: Store '\" +\n storeName +\n \"' is not available! Make sure it is provided by some Provider\"\n )\n nextProps[storeName] = baseStores[storeName]\n })\n return nextProps\n }\n}\n\n/**\n * higher order component that injects stores to a child.\n * takes either a varargs list of strings, which are stores read from the context,\n * or a function that manually maps the available stores from the context to props:\n * storesToProps(mobxStores, props, context) => newProps\n */\nexport function inject(/* fn(stores, nextProps) or ...storeNames */ ...storeNames) {\n let grabStoresFn\n if (typeof arguments[0] === \"function\") {\n grabStoresFn = arguments[0]\n return componentClass =>\n createStoreInjector(grabStoresFn, componentClass, grabStoresFn.name, true)\n } else {\n return componentClass =>\n createStoreInjector(\n grabStoresByName(storeNames),\n componentClass,\n storeNames.join(\"-\"),\n false\n )\n }\n}\n","import * as React from \"react\"\nimport { patch, newSymbol } from \"./utils/utils\"\n\nconst storeKey = newSymbol(\"disposeOnUnmount\")\n\nfunction runDisposersOnWillUnmount() {\n if (!this[storeKey]) {\n // when disposeOnUnmount is only set to some instances of a component it will still patch the prototype\n return\n }\n this[storeKey].forEach(propKeyOrFunction => {\n const prop =\n typeof propKeyOrFunction === \"string\" ? this[propKeyOrFunction] : propKeyOrFunction\n if (prop !== undefined && prop !== null) {\n if (Array.isArray(prop)) prop.map(f => f())\n else prop()\n }\n })\n this[storeKey] = []\n}\n\nexport function disposeOnUnmount(target, propertyKeyOrFunction) {\n if (Array.isArray(propertyKeyOrFunction)) {\n return propertyKeyOrFunction.map(fn => disposeOnUnmount(target, fn))\n }\n\n const c = Object.getPrototypeOf(target).constructor || Object.getPrototypeOf(target.constructor)\n const c2 = Object.getPrototypeOf(target.constructor)\n if (\n !(\n c === React.Component ||\n c === React.PureComponent ||\n c2 === React.Component ||\n c2 === React.PureComponent\n )\n ) {\n throw new Error(\n \"[mobx-react] disposeOnUnmount only supports direct subclasses of React.Component or React.PureComponent.\"\n )\n }\n\n if (\n typeof propertyKeyOrFunction !== \"string\" &&\n typeof propertyKeyOrFunction !== \"function\" &&\n !Array.isArray(propertyKeyOrFunction)\n ) {\n throw new Error(\n \"[mobx-react] disposeOnUnmount only works if the parameter is either a property key or a function.\"\n )\n }\n\n // add property key / function we want run (disposed) to the store\n const componentWasAlreadyModified = !!target[storeKey]\n const store = target[storeKey] || (target[storeKey] = [])\n\n store.push(propertyKeyOrFunction)\n\n // tweak the component class componentWillUnmount if not done already\n if (!componentWasAlreadyModified) {\n patch(target, \"componentWillUnmount\", runDisposersOnWillUnmount)\n }\n\n // return the disposer as is if invoked as a non decorator\n if (typeof propertyKeyOrFunction !== \"string\") {\n return propertyKeyOrFunction\n }\n}\n","import { isObservableArray, isObservableObject, isObservableMap, untracked } from \"mobx\"\n\n// Copied from React.PropTypes\nfunction createChainableTypeChecker(validate) {\n function checkType(\n isRequired,\n props,\n propName,\n componentName,\n location,\n propFullName,\n ...rest\n ) {\n return untracked(() => {\n componentName = componentName || \"<<anonymous>>\"\n propFullName = propFullName || propName\n if (props[propName] == null) {\n if (isRequired) {\n const actual = props[propName] === null ? \"null\" : \"undefined\"\n return new Error(\n \"The \" +\n location +\n \" `\" +\n propFullName +\n \"` is marked as required \" +\n \"in `\" +\n componentName +\n \"`, but its value is `\" +\n actual +\n \"`.\"\n )\n }\n return null\n } else {\n return validate(props, propName, componentName, location, propFullName, ...rest)\n }\n })\n }\n\n const chainedCheckType = checkType.bind(null, false)\n chainedCheckType.isRequired = checkType.bind(null, true)\n return chainedCheckType\n}\n\n// Copied from React.PropTypes\nfunction isSymbol(propType, propValue) {\n // Native Symbol.\n if (propType === \"symbol\") {\n return true\n }\n\n // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'\n if (propValue[\"@@toStringTag\"] === \"Symbol\") {\n return true\n }\n\n // Fallback for non-spec compliant Symbols which are polyfilled.\n if (typeof Symbol === \"function\" && propValue instanceof Symbol) {\n return true\n }\n\n return false\n}\n\n// Copied from React.PropTypes\nfunction getPropType(propValue) {\n const propType = typeof propValue\n if (Array.isArray(propValue)) {\n return \"array\"\n }\n if (propValue instanceof RegExp) {\n // Old webkits (at least until Android 4.0) return 'function' rather than\n // 'object' for typeof a RegExp. We'll normalize this here so that /bla/\n // passes PropTypes.object.\n return \"object\"\n }\n if (isSymbol(propType, propValue)) {\n return \"symbol\"\n }\n return propType\n}\n\n// This handles more types than `getPropType`. Only used for error messages.\n// Copied from React.PropTypes\nfunction getPreciseType(propValue) {\n const propType = getPropType(propValue)\n if (propType === \"object\") {\n if (propValue instanceof Date) {\n return \"date\"\n } else if (propValue instanceof RegExp) {\n return \"regexp\"\n }\n }\n return propType\n}\n\nfunction createObservableTypeCheckerCreator(allowNativeType, mobxType) {\n return createChainableTypeChecker(function(\n props,\n propName,\n componentName,\n location,\n propFullName\n ) {\n return untracked(() => {\n if (allowNativeType) {\n if (getPropType(props[propName]) === mobxType.toLowerCase()) return null\n }\n let mobxChecker\n switch (mobxType) {\n case \"Array\":\n mobxChecker = isObservableArray\n break\n case \"Object\":\n mobxChecker = isObservableObject\n break\n case \"Map\":\n mobxChecker = isObservableMap\n break\n default:\n throw new Error(`Unexpected mobxType: ${mobxType}`)\n }\n const propValue = props[propName]\n if (!mobxChecker(propValue)) {\n const preciseType = getPreciseType(propValue)\n const nativeTypeExpectationMessage = allowNativeType\n ? \" or javascript `\" + mobxType.toLowerCase() + \"`\"\n : \"\"\n return new Error(\n \"Invalid prop `\" +\n propFullName +\n \"` of type `\" +\n preciseType +\n \"` supplied to\" +\n \" `\" +\n componentName +\n \"`, expected `mobx.Observable\" +\n mobxType +\n \"`\" +\n nativeTypeExpectationMessage +\n \".\"\n )\n }\n return null\n })\n })\n}\n\nfunction createObservableArrayOfTypeChecker(allowNativeType, typeChecker) {\n return createChainableTypeChecker(function(\n props,\n propName,\n componentName,\n location,\n propFullName,\n ...rest\n ) {\n return untracked(() => {\n if (typeof typeChecker !== \"function\") {\n return new Error(\n \"Property `\" +\n propFullName +\n \"` of component `\" +\n componentName +\n \"` has \" +\n \"invalid PropType notation.\"\n )\n }\n let error = createObservableTypeCheckerCreator(allowNativeType, \"Array\")(\n props,\n propName,\n componentName\n )\n if (error instanceof Error) return error\n const propValue = props[propName]\n for (let i = 0; i < propValue.length; i++) {\n error = typeChecker(\n propValue,\n i,\n componentName,\n location,\n propFullName + \"[\" + i + \"]\",\n ...rest\n )\n if (error instanceof Error) return error\n }\n return null\n })\n })\n}\n\nconst observableArray = createObservableTypeCheckerCreator(false, \"Array\")\nconst observableArrayOf = createObservableArrayOfTypeChecker.bind(null, false)\nconst observableMap = createObservableTypeCheckerCreator(false, \"Map\")\nconst observableObject = createObservableTypeCheckerCreator(false, \"Object\")\nconst arrayOrObservableArray = createObservableTypeCheckerCreator(true, \"Array\")\nconst arrayOrObservableArrayOf = createObservableArrayOfTypeChecker.bind(null, true)\nconst objectOrObservableObject = createObservableTypeCheckerCreator(true, \"Object\")\n\nexport const PropTypes = {\n observableArray,\n observableArrayOf,\n observableMap,\n observableObject,\n arrayOrObservableArray,\n arrayOrObservableArrayOf,\n objectOrObservableObject\n}\n","import { observable, configure } from \"mobx\"\nimport { Component } from \"react\"\nimport { unstable_batchedUpdates as rdBatched } from \"react-dom\"\n\nif (!Component) throw new Error(\"mobx-react requires React to be available\")\nif (!observable) throw new Error(\"mobx-react requires mobx to be available\")\n\nif (typeof rdBatched === \"function\") configure({ reactionScheduler: rdBatched })\n\nexport {\n Observer,\n useAsObservableSource,\n useLocalStore,\n isUsingStaticRendering,\n useStaticRendering\n} from \"mobx-react-lite\"\n\nexport { observer } from \"./observer\"\n\nexport { Provider, MobXProviderContext } from \"./Provider\"\nexport { inject } from \"./inject\"\nexport { disposeOnUnmount } from \"./disposeOnUnmount\"\nexport { PropTypes } from \"./propTypes\"\n"],"names":["let","symbolId","createdSymbols","newSymbol","name","Symbol","symbol","createSymbol","shallowEqual","objA","objB","is","keysA","Object","keys","keysB","length","i","hasOwnProperty","call","x","y","const","hoistBlackList","$$typeof","render","compare","type","childContextTypes","contextType","contextTypes","defaultProps","getDefaultProps","getDerivedStateFromError","getDerivedStateFromProps","mixins","propTypes","setHiddenProp","target","prop","value","defineProperty","enumerable","configurable","writable","mobxMixins","mobxPatchedDefinition","wrapper","realMethod","locks","retVal","apply","this","args","methods","forEach","mx","wrapFunction","patch","methodName","mixinMethod","methodMixins","getMixins","indexOf","push","oldDefinition","getOwnPropertyDescriptor","newDefinition","createDefinition","originalMethod","wrappedFunc","get","set","undefined","mobxAdminProperty","$mobx","mobxIsUnmounted","skipRenderKey","isForcingUpdateKey","observerSCU","nextProps","nextState","isUsingStaticRendering","console","warn","state","props","makeObservableProp","propName","valueHolderKey","atomHolderKey","getAtom","createAtom","reportObserved","v","reportChanged","ReactForwardRefSymbol","forwardRef","_props","_ref","observer","componentClass","isMobxInjector","baseRender","Error","React","Observer","arguments","prototype","isReactClass","Component","isPrototypeOf","componentWillReact","__proto__","PureComponent","shouldComponentUpdate","initialName","displayName","constructor","bind","isRenderingPending","reaction","Reaction","hasError","forceUpdate","dispose","reactiveRender","exception","rendering","track","_allowStateChanges","e","reactComponent","makeClassComponentObserver","observerLite","specialReactKeys","children","key","ref","MobXProviderContext","createContext","Provider","context","grabStores","createElement","Children","only","prevState","process","env","NODE_ENV","from","res","validStoreName","createStoreInjector","grabStoresFn","component","injectNames","makeReactive","componentName","getInjectName","Injector","assign","isStateless","base","protoProps","InjectHocRef","getOwnPropertyNames","getPrototypeOf","wrappedComponent","inject","storeNames","baseStores","storeName","grabStoresByName","join","storeKey","runDisposersOnWillUnmount","propKeyOrFunction","Array","isArray","map","f","disposeOnUnmount","propertyKeyOrFunction","fn","c","c2","componentWasAlreadyModified","createChainableTypeChecker","validate","checkType","isRequired","location","propFullName","untracked","rest","chainedCheckType","getPropType","propValue","propType","RegExp","isSymbol","createObservableTypeCheckerCreator","allowNativeType","mobxType","toLowerCase","mobxChecker","isObservableArray","isObservableObject","isObservableMap","preciseType","Date","getPreciseType","nativeTypeExpectationMessage","createObservableArrayOfTypeChecker","typeChecker","error","PropTypes","observable","rdBatched","configure","reactionScheduler"],"mappings":"8jBAMAA,IAAIC,EAAW,EAUTC,EAAiB,GAChB,SAASC,EAAUC,UACjBF,EAAeE,KAChBF,EAAeE,GAZvB,SAAsBA,MACI,mBAAXC,cACAA,OAAOD,OAEZE,EAAU,iBAAgBF,OAASH,aACzCA,IACOK,EAMoBC,CAAaH,IAEjCF,EAAeE,GAGnB,SAASI,EAAaC,EAAMC,MAE3BC,EAAGF,EAAMC,GAAO,OAAO,KACP,iBAATD,GAA8B,OAATA,GAAiC,iBAATC,GAA8B,OAATA,SAClE,MAELE,EAAQC,OAAOC,KAAKL,GACpBM,EAAQF,OAAOC,KAAKJ,MACtBE,EAAMI,SAAWD,EAAMC,OAAQ,OAAO,MAC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