UNPKG

mobx-react

Version:

React bindings for MobX. Create fully reactive components.

1 lines 59.3 kB
{"version":3,"file":"mobxreact.esm.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","process","env","NODE_ENV","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","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":";;;;;SAAgBA,YAAYA,CAACC,IAAS,EAAEC,IAAS;;EAE7C,IAAIC,EAAE,CAACF,IAAI,EAAEC,IAAI,CAAC,EAAE;IAChB,OAAO,IAAI;;EAEf,IAAI,OAAOD,IAAI,KAAK,QAAQ,IAAIA,IAAI,KAAK,IAAI,IAAI,OAAOC,IAAI,KAAK,QAAQ,IAAIA,IAAI,KAAK,IAAI,EAAE;IACxF,OAAO,KAAK;;EAEhB,IAAME,KAAK,GAAGC,MAAM,CAACC,IAAI,CAACL,IAAI,CAAC;EAC/B,IAAMM,KAAK,GAAGF,MAAM,CAACC,IAAI,CAACJ,IAAI,CAAC;EAC/B,IAAIE,KAAK,CAACI,MAAM,KAAKD,KAAK,CAACC,MAAM,EAAE;IAC/B,OAAO,KAAK;;EAEhB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,KAAK,CAACI,MAAM,EAAEC,CAAC,EAAE,EAAE;IACnC,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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