mobx-react
Version:
React bindings for MobX. Create fully reactive components.
1 lines • 59.3 kB
Source Map (JSON)
{"version":3,"file":"mobxreact.umd.development.js","sources":["../src/utils/utils.ts","../src/observerClass.ts","../src/observer.tsx","../src/Provider.tsx","../src/inject.ts","../src/disposeOnUnmount.ts","../src/propTypes.ts","../src/index.ts"],"sourcesContent":["export function shallowEqual(objA: any, objB: any): boolean {\n //From: https://github.com/facebook/fbjs/blob/c69904a511b900266935168223063dd8772dfc40/packages/fbjs/src/core/shallowEqual.js\n if (is(objA, objB)) {\n return true\n }\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) {\n return false\n }\n for (let i = 0; i < keysA.length; i++) {\n if (!Object.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: any, y: any): boolean {\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 displayName: 1,\n propTypes: 1\n}\n\nexport function copyStaticProperties(base: object, target: object): void {\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: object, prop: any, value: any): void {\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 = Symbol(\"patchMixins\")\nconst mobxPatchedDefinition = Symbol(\"patchedDefinition\")\n\nexport interface Mixins extends Record<string, any> {\n locks: number\n methods: Array<Function>\n}\n\nfunction getMixins(target: object, methodName: string): Mixins {\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: Function, mixins: Mixins, ...args: Array<any>) {\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: Function, mixins: Mixins): (...args: Array<any>) => any {\n const fn = function (...args: Array<any>) {\n wrapper.call(this, realMethod, mixins, ...args)\n }\n return fn\n}\n\nexport function patch(target: object, methodName: string, mixinMethod: Function): void {\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(\n target: object,\n methodName: string,\n enumerable: any,\n mixins: Mixins,\n originalMethod: Function\n): PropertyDescriptor {\n let wrappedFunc = wrapFunction(originalMethod, mixins)\n\n return {\n // @ts-ignore\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, ComponentClass, ClassAttributes } from \"react\"\nimport {\n _allowStateChanges,\n Reaction,\n _allowStateReadsStart,\n _allowStateReadsEnd,\n _getGlobalState\n} from \"mobx\"\nimport {\n isUsingStaticRendering,\n _observerFinalizationRegistry as observerFinalizationRegistry\n} from \"mobx-react-lite\"\nimport { shallowEqual, patch } from \"./utils/utils\"\n\nconst administrationSymbol = Symbol(\"ObserverAdministration\")\nconst isMobXReactObserverSymbol = Symbol(\"isMobXReactObserver\")\n\nlet observablePropDescriptors: PropertyDescriptorMap\nif (__DEV__) {\n observablePropDescriptors = {\n props: createObservablePropDescriptor(\"props\"),\n state: createObservablePropDescriptor(\"state\"),\n context: createObservablePropDescriptor(\"context\")\n }\n}\n\ntype ObserverAdministration = {\n reaction: Reaction | null // also serves as disposed flag\n forceUpdate: Function | null\n mounted: boolean // we could use forceUpdate as mounted flag\n reactionInvalidatedBeforeMount: boolean\n name: string\n // Used only on __DEV__\n props: any\n state: any\n context: any\n}\n\nfunction getAdministration(component: Component): ObserverAdministration {\n // We create administration lazily, because we can't patch constructor\n // and the exact moment of initialization partially depends on React internals.\n // At the time of writing this, the first thing invoked is one of the observable getter/setter (state/props/context).\n return (component[administrationSymbol] ??= {\n reaction: null,\n mounted: false,\n reactionInvalidatedBeforeMount: false,\n forceUpdate: null,\n name: getDisplayName(component.constructor as ComponentClass),\n state: undefined,\n props: undefined,\n context: undefined\n })\n}\n\nexport function makeClassComponentObserver(\n componentClass: ComponentClass<any, any>\n): ComponentClass<any, any> {\n const { prototype } = componentClass\n\n if (componentClass[isMobXReactObserverSymbol]) {\n const displayName = getDisplayName(componentClass)\n throw new Error(\n `The provided component class (${displayName}) has already been declared as an observer component.`\n )\n } else {\n componentClass[isMobXReactObserverSymbol] = true\n }\n\n if (prototype.componentWillReact) {\n throw new Error(\"The componentWillReact life-cycle event is no longer supported\")\n }\n if (componentClass[\"__proto__\"] !== PureComponent) {\n if (!prototype.shouldComponentUpdate) {\n prototype.shouldComponentUpdate = observerSCU\n } else if (prototype.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\n if (__DEV__) {\n Object.defineProperties(prototype, observablePropDescriptors)\n }\n\n const originalRender = prototype.render\n if (typeof originalRender !== \"function\") {\n const displayName = getDisplayName(componentClass)\n throw new Error(\n `[mobx-react] class component (${displayName}) is missing \\`render\\` method.` +\n `\\n\\`observer\\` requires \\`render\\` being a function defined on prototype.` +\n `\\n\\`render = () => {}\\` or \\`render = function() {}\\` is not supported.`\n )\n }\n\n prototype.render = function () {\n Object.defineProperty(this, \"render\", {\n // There is no safe way to replace render, therefore it's forbidden.\n configurable: false,\n writable: false,\n value: isUsingStaticRendering()\n ? originalRender\n : createReactiveRender.call(this, originalRender)\n })\n return this.render()\n }\n\n const originalComponentDidMount = prototype.componentDidMount\n prototype.componentDidMount = function () {\n if (__DEV__ && this.componentDidMount !== Object.getPrototypeOf(this).componentDidMount) {\n const displayName = getDisplayName(componentClass)\n throw new Error(\n `[mobx-react] \\`observer(${displayName}).componentDidMount\\` must be defined on prototype.` +\n `\\n\\`componentDidMount = () => {}\\` or \\`componentDidMount = function() {}\\` is not supported.`\n )\n }\n\n // `componentDidMount` may not be called at all. React can abandon the instance after `render`.\n // That's why we use finalization registry to dispose reaction created during render.\n // Happens with `<Suspend>` see #3492\n //\n // `componentDidMount` can be called immediately after `componentWillUnmount` without calling `render` in between.\n // Happens with `<StrictMode>`see #3395.\n //\n // If `componentDidMount` is called, it's guaranteed to run synchronously with render (similary to `useLayoutEffect`).\n // Therefore we don't have to worry about external (observable) state being updated before mount (no state version checking).\n //\n // Things may change: \"In the future, React will provide a feature that lets components preserve state between unmounts\"\n\n const admin = getAdministration(this)\n\n admin.mounted = true\n\n // Component instance committed, prevent reaction disposal.\n observerFinalizationRegistry.unregister(this)\n\n // We don't set forceUpdate before mount because it requires a reference to `this`,\n // therefore `this` could NOT be garbage collected before mount,\n // preventing reaction disposal by FinalizationRegistry and leading to memory leak.\n // As an alternative we could have `admin.instanceRef = new WeakRef(this)`, but lets avoid it if possible.\n admin.forceUpdate = () => this.forceUpdate()\n\n if (!admin.reaction || admin.reactionInvalidatedBeforeMount) {\n // Missing reaction:\n // 1. Instance was unmounted (reaction disposed) and immediately remounted without running render #3395.\n // 2. Reaction was disposed by finalization registry before mount. Shouldn't ever happen for class components:\n // `componentDidMount` runs synchronously after render, but our registry are deferred (can't run in between).\n // In any case we lost subscriptions to observables, so we have to create new reaction and re-render to resubscribe.\n // The reaction will be created lazily by following render.\n\n // Reaction invalidated before mount:\n // 1. A descendant's `componenDidMount` invalidated it's parent #3730\n\n admin.forceUpdate()\n }\n return originalComponentDidMount?.apply(this, arguments)\n }\n\n // TODO@major Overly complicated \"patch\" is only needed to support the deprecated @disposeOnUnmount\n patch(prototype, \"componentWillUnmount\", function () {\n if (isUsingStaticRendering()) {\n return\n }\n const admin = getAdministration(this)\n admin.reaction?.dispose()\n admin.reaction = null\n admin.forceUpdate = null\n admin.mounted = false\n admin.reactionInvalidatedBeforeMount = false\n })\n\n return componentClass\n}\n\n// Generates a friendly name for debugging\nfunction getDisplayName(componentClass: ComponentClass) {\n return componentClass.displayName || componentClass.name || \"<component>\"\n}\n\nfunction createReactiveRender(originalRender: any) {\n const boundOriginalRender = originalRender.bind(this)\n\n const admin = getAdministration(this)\n\n function reactiveRender() {\n if (!admin.reaction) {\n // Create reaction lazily to support re-mounting #3395\n admin.reaction = createReaction(admin)\n if (!admin.mounted) {\n // React can abandon this instance and never call `componentDidMount`/`componentWillUnmount`,\n // we have to make sure reaction will be disposed.\n observerFinalizationRegistry.register(this, admin, this)\n }\n }\n\n let error: unknown = undefined\n let renderResult = undefined\n admin.reaction.track(() => {\n try {\n // TODO@major\n // Optimization: replace with _allowStateChangesStart/End (not available in mobx@6.0.0)\n renderResult = _allowStateChanges(false, boundOriginalRender)\n } catch (e) {\n error = e\n }\n })\n if (error) {\n throw error\n }\n return renderResult\n }\n\n return reactiveRender\n}\n\nfunction createReaction(admin: ObserverAdministration) {\n return new Reaction(`${admin.name}.render()`, () => {\n if (!admin.mounted) {\n // This is neccessary to avoid react warning about calling forceUpdate on component that isn't mounted yet.\n // This happens when component is abandoned after render - our reaction is already created and reacts to changes.\n // `componenDidMount` runs synchronously after `render`, so unlike functional component, there is no delay during which the reaction could be invalidated.\n // However `componentDidMount` runs AFTER it's descendants' `componentDidMount`, which CAN invalidate the reaction, see #3730. Therefore remember and forceUpdate on mount.\n admin.reactionInvalidatedBeforeMount = true\n return\n }\n\n try {\n admin.forceUpdate?.()\n } catch (error) {\n admin.reaction?.dispose()\n admin.reaction = null\n }\n })\n}\n\nfunction observerSCU(nextProps: ClassAttributes<any>, nextState: any): boolean {\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 createObservablePropDescriptor(key: \"props\" | \"state\" | \"context\") {\n return {\n configurable: true,\n enumerable: true,\n get() {\n const admin = getAdministration(this)\n const derivation = _getGlobalState().trackingDerivation\n if (derivation && derivation !== admin.reaction) {\n throw new Error(\n `[mobx-react] Cannot read \"${admin.name}.${key}\" in a reactive context, as it isn't observable.\n Please use component lifecycle method to copy the value into a local observable first.\n See https://github.com/mobxjs/mobx/blob/main/packages/mobx-react/README.md#note-on-using-props-and-state-in-derivations`\n )\n }\n return admin[key]\n },\n set(value) {\n getAdministration(this)[key] = value\n }\n }\n}\n","import * as React from \"react\"\nimport { observer as observerLite } from \"mobx-react-lite\"\n\nimport { makeClassComponentObserver } from \"./observerClass\"\nimport { IReactComponent } from \"./types/IReactComponent\"\n\n/**\n * Observer function / decorator\n */\nexport function observer<T extends IReactComponent>(component: T, context: ClassDecoratorContext): void\nexport function observer<T extends IReactComponent>(component: T): T\nexport function observer<T extends IReactComponent>(component: T, context?: ClassDecoratorContext): T {\n if (context && context.kind !== \"class\") {\n throw new Error(\"The @observer decorator can be used on classes only\")\n }\n if (component[\"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 if (\n Object.prototype.isPrototypeOf.call(React.Component, component) ||\n Object.prototype.isPrototypeOf.call(React.PureComponent, component)\n ) {\n // Class component\n return makeClassComponentObserver(component as React.ComponentClass<any, any>) as T\n } else {\n // Function component\n return observerLite(component as React.FunctionComponent<any>) as T\n }\n}\n","import React from \"react\"\nimport { shallowEqual } from \"./utils/utils\"\nimport { IValueMap } from \"./types/IValueMap\"\n\nexport const MobXProviderContext = React.createContext<IValueMap>({})\n\nexport interface ProviderProps extends IValueMap {\n children: React.ReactNode\n}\n\nexport function Provider(props: ProviderProps) {\n const { children, ...stores } = props\n const parentValue = React.useContext(MobXProviderContext)\n const mutableProviderRef = React.useRef({ ...parentValue, ...stores })\n const value = mutableProviderRef.current\n\n if (__DEV__) {\n const newValue = { ...value, ...stores } // spread in previous state for the context based stores\n if (!shallowEqual(value, newValue)) {\n throw new Error(\n \"MobX Provider: The set of provided stores has changed. See: https://github.com/mobxjs/mobx-react#the-set-of-provided-stores-has-changed-error.\"\n )\n }\n }\n\n return <MobXProviderContext.Provider value={value}>{children}</MobXProviderContext.Provider>\n}\n\nProvider.displayName = \"MobXProvider\"\n","import React from \"react\"\nimport { observer } from \"./observer\"\nimport { copyStaticProperties } from \"./utils/utils\"\nimport { MobXProviderContext } from \"./Provider\"\nimport { IReactComponent } from \"./types/IReactComponent\"\nimport { IValueMap } from \"./types/IValueMap\"\nimport { IWrappedComponent } from \"./types/IWrappedComponent\"\nimport { IStoresToProps } from \"./types/IStoresToProps\"\n\n/**\n * Store Injection\n */\nfunction createStoreInjector(\n grabStoresFn: IStoresToProps,\n component: IReactComponent<any>,\n injectNames: string,\n makeReactive: boolean\n): IReactComponent<any> {\n // Support forward refs\n let Injector: IReactComponent<any> = React.forwardRef((props, ref) => {\n const newProps = { ...props }\n const context = React.useContext(MobXProviderContext)\n Object.assign(newProps, grabStoresFn(context || {}, newProps) || {})\n\n if (ref) {\n newProps.ref = ref\n }\n\n return React.createElement(component, newProps)\n })\n\n if (makeReactive) Injector = observer(Injector)\n Injector[\"isMobxInjector\"] = true // assigned late to suppress observer warning\n\n // Static fields from component should be visible on the generated Injector\n copyStaticProperties(component, Injector)\n Injector[\"wrappedComponent\"] = component\n Injector.displayName = getInjectName(component, injectNames)\n return Injector\n}\n\nfunction getInjectName(component: IReactComponent<any>, injectNames: string): string {\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(\n storeNames: Array<string>\n): (\n baseStores: IValueMap,\n nextProps: React.ClassAttributes<any>\n) => React.PropsWithRef<any> | undefined {\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\nexport function inject(\n ...stores: Array<string>\n): <T extends IReactComponent<any>>(\n target: T\n) => T & (T extends IReactComponent<infer P> ? IWrappedComponent<P> : never)\nexport function inject<S extends IValueMap = {}, P extends IValueMap = {}, I extends IValueMap = {}, C extends IValueMap = {}>(\n fn: IStoresToProps<S, P, I, C>\n): <T extends IReactComponent>(target: T) => T & IWrappedComponent<P>\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: Array<any>) {\n if (typeof arguments[0] === \"function\") {\n let grabStoresFn = arguments[0]\n return (componentClass: React.ComponentClass<any, any>) =>\n createStoreInjector(grabStoresFn, componentClass, grabStoresFn.name, true)\n } else {\n return (componentClass: React.ComponentClass<any, any>) =>\n createStoreInjector(\n grabStoresByName(storeNames),\n componentClass,\n storeNames.join(\"-\"),\n false\n )\n }\n}\n","import React from \"react\"\nimport { patch } from \"./utils/utils\"\n\nconst reactMajorVersion = Number.parseInt(React.version.split(\".\")[0])\nlet warnedAboutDisposeOnUnmountDeprecated = false\n\ntype Disposer = () => void\n\nconst protoStoreKey = Symbol(\"disposeOnUnmountProto\")\nconst instStoreKey = Symbol(\"disposeOnUnmountInst\")\n\nfunction runDisposersOnWillUnmount() {\n ;[...(this[protoStoreKey] || []), ...(this[instStoreKey] || [])].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}\n\n/**\n * @deprecated `disposeOnUnmount` is not compatible with React 18 and higher.\n */\nexport function disposeOnUnmount(target: React.Component<any, any>, propertyKey: PropertyKey): void\n\n/**\n * @deprecated `disposeOnUnmount` is not compatible with React 18 and higher.\n */\nexport function disposeOnUnmount<TF extends Disposer | Array<Disposer>>(\n target: React.Component<any, any>,\n fn: TF\n): TF\n\n/**\n * @deprecated `disposeOnUnmount` is not compatible with React 18 and higher.\n */\nexport function disposeOnUnmount(\n target: React.Component<any, any>,\n propertyKeyOrFunction: PropertyKey | Disposer | Array<Disposer>\n): PropertyKey | Disposer | Array<Disposer> | void {\n if (Array.isArray(propertyKeyOrFunction)) {\n return propertyKeyOrFunction.map(fn => disposeOnUnmount(target, fn))\n }\n\n if (!warnedAboutDisposeOnUnmountDeprecated) {\n if (reactMajorVersion >= 18) {\n console.error(\n \"[mobx-react] disposeOnUnmount is not compatible with React 18 and higher. Don't use it.\"\n )\n } else {\n console.warn(\n \"[mobx-react] disposeOnUnmount is deprecated. It won't work correctly with React 18 and higher.\"\n )\n }\n warnedAboutDisposeOnUnmountDeprecated = true\n }\n\n const c = Object.getPrototypeOf(target).constructor\n const c2 = Object.getPrototypeOf(target.constructor)\n // Special case for react-hot-loader\n const c3 = Object.getPrototypeOf(Object.getPrototypeOf(target))\n if (\n !(\n c === React.Component ||\n c === React.PureComponent ||\n c2 === React.Component ||\n c2 === React.PureComponent ||\n c3 === React.Component ||\n c3 === 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 // decorator's target is the prototype, so it doesn't have any instance properties like props\n const isDecorator = typeof propertyKeyOrFunction === \"string\"\n\n // add property key / function we want run (disposed) to the store\n const componentWasAlreadyModified = !!target[protoStoreKey] || !!target[instStoreKey]\n const store = isDecorator\n ? // decorators are added to the prototype store\n target[protoStoreKey] || (target[protoStoreKey] = [])\n : // functions are added to the instance store\n target[instStoreKey] || (target[instStoreKey] = [])\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(validator: React.Validator<any>): React.Requireable<any> {\n function checkType(\n isRequired: boolean,\n props: any,\n propName: string,\n componentName: string,\n location: string,\n propFullName: string,\n ...rest: any[]\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 // @ts-ignore rest arg is necessary for some React internals - fails tests otherwise\n return validator(props, propName, componentName, location, propFullName, ...rest)\n }\n })\n }\n\n const chainedCheckType: any = checkType.bind(null, false)\n // Add isRequired to satisfy Requirable\n chainedCheckType.isRequired = checkType.bind(null, true)\n return chainedCheckType\n}\n\n// Copied from React.PropTypes\nfunction isSymbol(propType: any, propValue: any): boolean {\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: any): string {\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: any): string {\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(\n allowNativeType: any,\n mobxType: any\n): React.Requireable<any> {\n return createChainableTypeChecker((props, propName, componentName, location, propFullName) => {\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(\n allowNativeType: boolean,\n typeChecker: React.Validator<any>\n) {\n return createChainableTypeChecker(\n (props, propName, componentName, location, propFullName, ...rest) => {\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 } else {\n let error = createObservableTypeCheckerCreator(allowNativeType, \"Array\")(\n props,\n propName,\n componentName,\n location,\n propFullName\n )\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 as React.Validator<any>)(\n propValue,\n i as any,\n componentName,\n location,\n propFullName + \"[\" + i + \"]\",\n ...rest\n )\n if (error instanceof Error) return error\n }\n\n return null\n }\n })\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 } from \"mobx\"\nimport { Component } from \"react\"\n\nif (!Component) {\n throw new Error(\"mobx-react requires React to be available\")\n}\n\nif (!observable) {\n throw new Error(\"mobx-react requires mobx to be available\")\n}\n\nexport {\n Observer,\n useObserver,\n useAsObservableSource,\n useLocalStore,\n isUsingStaticRendering,\n useStaticRendering,\n enableStaticRendering,\n observerBatching,\n useLocalObservable\n} from \"mobx-react-lite\"\n\nexport { observer } from \"./observer\"\n\nexport { MobXProviderContext, Provider, ProviderProps } from \"./Provider\"\nexport { inject } from \"./inject\"\nexport { disposeOnUnmount } from \"./disposeOnUnmount\"\nexport { PropTypes } from \"./propTypes\"\nexport { IWrappedComponent } from \"./types/IWrappedComponent\"\n"],"names":["shallowEqual","objA","objB","is","keysA","Object","keys","keysB","length","i","hasOwnProperty","call","x","y","hoistBlackList","$$typeof","render","compare","type","childContextTypes","contextType","contextTypes","defaultProps","getDefaultProps","getDerivedStateFromError","getDerivedStateFromProps","mixins","displayName","propTypes","copyStaticProperties","base","target","protoProps","getOwnPropertyNames","getPrototypeOf","forEach","key","indexOf","defineProperty","getOwnPropertyDescriptor","mobxMixins","Symbol","mobxPatchedDefinition","getMixins","methodName","methodMixins","locks","methods","wrapper","realMethod","args","Array","_len","_key","arguments","retVal","undefined","apply","mx","_this","wrapFunction","fn","_len2","_key2","concat","patch","mixinMethod","push","oldDefinition","originalMethod","newDefinition","createDefinition","enumerable","wrappedFunc","_ref","get","set","value","configurable","administrationSymbol","isMobXReactObserverSymbol","observablePropDescriptors","props","createObservablePropDescriptor","state","context","getAdministration","component","_component$administra","reaction","mounted","reactionInvalidatedBeforeMount","forceUpdate","name","getDisplayName","constructor","makeClassComponentObserver","componentClass","prototype","Error","componentWillReact","PureComponent","shouldComponentUpdate","observerSCU","defineProperties","originalRender","writable","isUsingStaticRendering","createReactiveRender","originalComponentDidMount","componentDidMount","process","admin","observerFinalizationRegistry","unregister","_admin$reaction","dispose","boundOriginalRender","bind","reactiveRender","createReaction","register","error","renderResult","track","_allowStateChanges","e","Reaction","_admin$reaction2","nextProps","nextState","console","warn","derivation","_getGlobalState","trackingDerivation","observer","kind","isPrototypeOf","React","observerLite","MobXProviderContext","createContext","Provider","children","stores","_objectWithoutPropertiesLoose","_excluded","parentValue","useContext","mutableProviderRef","useRef","_extends","current","newValue","createStoreInjector","grabStoresFn","injectNames","makeReactive","Injector","forwardRef","ref","newProps","assign","createElement","getInjectName","componentName","grabStoresByName","storeNames","baseStores","storeName","inject","join","reactMajorVersion","Number","parseInt","version","split","warnedAboutDisposeOnUnmountDeprecated","protoStoreKey","instStoreKey","runDisposersOnWillUnmount","propKeyOrFunction","prop","isArray","map","f","disposeOnUnmount","propertyKeyOrFunction","c","c2","c3","Component","isDecorator","componentWasAlreadyModified","store","createChainableTypeChecker","validator","checkType","isRequired","propName","location","propFullName","rest","untracked","actual","chainedCheckType","isSymbol","propType","propValue","getPropType","RegExp","getPreciseType","Date","createObservableTypeCheckerCreator","allowNativeType","mobxType","toLowerCase","mobxChecker","isObservableArray","isObservableObject","isObservableMap","preciseType","nativeTypeExpectationMessage","createObservableArrayOfTypeChecker","typeChecker","observableArray","observableArrayOf","observableMap","observableObject","arrayOrObservableArray","arrayOrObservableArrayOf","objectOrObservableObject","PropTypes","observable"],"mappings":";;;;;;;;aAAgBA,YAAYA,CAACC,IAAS,EAAEC,IAAS;;MAE7C,IAAIC,EAAE,CAACF,IAAI,EAAEC,IAAI,CAAC,EAAE;QAChB,OAAO,IAAI;;MAEf,IAAI,OAAOD,IAAI,KAAK,QAAQ,IAAIA,IAAI,KAAK,IAAI,IAAI,OAAOC,IAAI,KAAK,QAAQ,IAAIA,IAAI,KAAK,IAAI,EAAE;QACxF,OAAO,KAAK;;MAEhB,IAAME,KAAK,GAAGC,MAAM,CAACC,IAAI,CAACL,IAAI,CAAC;MAC/B,IAAMM,KAAK,GAAGF,MAAM,CAACC,IAAI,CAACJ,IAAI,CAAC;MAC/B,IAAIE,KAAK,CAACI,MAAM,KAAKD,KAAK,CAACC,MAAM,EAAE;QAC/B,OAAO,KAAK;;MAEhB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,KAAK,CAACI,MAAM,EAAEC,CAAC,EAAE,EAAE;QACnC,IAAI,CAACJ,MAAM,CAACK,cAAc,CAACC,IAAI,CAACT,IAAI,EAAEE,KAAK,CAACK,CAAC,CAAC,CAAC,IAAI,CAACN,EAAE,CAACF,IAAI,CAACG,KAAK,CAACK,CAAC,CAAC,CAAC,EAAEP,IAAI,CAACE,KAAK,C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