mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-23 00:56:33 +03:00
chore: upgrade to mobx@6 (#1412)
This commit is contained in:
parent
84ab95ddc7
commit
a0f15d99f0
6
package-lock.json
generated
6
package-lock.json
generated
|
@ -12998,9 +12998,9 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"mobx": {
|
"mobx": {
|
||||||
"version": "5.15.4",
|
"version": "6.0.1",
|
||||||
"resolved": "https://registry.npmjs.org/mobx/-/mobx-5.15.4.tgz",
|
"resolved": "https://registry.npmjs.org/mobx/-/mobx-6.0.1.tgz",
|
||||||
"integrity": "sha512-xRFJxSU2Im3nrGCdjSuOTFmxVDGeqOHL+TyADCGbT0k4HHqGmx5u2yaHNryvoORpI4DfbzjJ5jPmuv+d7sioFw==",
|
"integrity": "sha512-Pk6uJXZ34yqd661yRmS6z/9avm4FOGXpFpVjnEfiYYOsZXnAxv1fpYjxTCEZ9tuwk0Xe1qnUUlgm+rJtGe0YJA==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"mobx-react": {
|
"mobx-react": {
|
||||||
|
|
|
@ -103,7 +103,7 @@
|
||||||
"jest": "^26.1.0",
|
"jest": "^26.1.0",
|
||||||
"license-checker": "^25.0.1",
|
"license-checker": "^25.0.1",
|
||||||
"lodash": "^4.17.19",
|
"lodash": "^4.17.19",
|
||||||
"mobx": "^5.15.4",
|
"mobx": "^6.0.1",
|
||||||
"prettier": "^2.0.5",
|
"prettier": "^2.0.5",
|
||||||
"raf": "^3.4.1",
|
"raf": "^3.4.1",
|
||||||
"react": "^16.13.1",
|
"react": "^16.13.1",
|
||||||
|
@ -129,7 +129,7 @@
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"core-js": "^3.1.4",
|
"core-js": "^3.1.4",
|
||||||
"mobx": "^4.2.0 || ^5.0.0",
|
"mobx": "^6.0.1",
|
||||||
"react": "^16.8.4",
|
"react": "^16.8.4",
|
||||||
"react-dom": "^16.8.4",
|
"react-dom": "^16.8.4",
|
||||||
"styled-components": "^4.1.1 || ^5.1.1"
|
"styled-components": "^4.1.1 || ^5.1.1"
|
||||||
|
|
|
@ -2,6 +2,8 @@ import 'core-js/es/promise';
|
||||||
|
|
||||||
import 'core-js/es/array/find';
|
import 'core-js/es/array/find';
|
||||||
import 'core-js/es/object/assign';
|
import 'core-js/es/object/assign';
|
||||||
|
import 'core-js/es/object/entries';
|
||||||
|
import 'core-js/es/object/is';
|
||||||
import 'core-js/es/string/ends-with';
|
import 'core-js/es/string/ends-with';
|
||||||
import 'core-js/es/string/starts-with';
|
import 'core-js/es/string/starts-with';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { action, observable } from 'mobx';
|
import { action, observable, makeObservable } from 'mobx';
|
||||||
import { querySelector } from '../utils/dom';
|
import { querySelector } from '../utils/dom';
|
||||||
import { SpecStore } from './models';
|
import { SpecStore } from './models';
|
||||||
|
|
||||||
|
@ -76,6 +76,8 @@ export class MenuStore {
|
||||||
* @param scroll scroll service instance used by this menu
|
* @param scroll scroll service instance used by this menu
|
||||||
*/
|
*/
|
||||||
constructor(spec: SpecStore, public scroll: ScrollService, public history: HistoryService) {
|
constructor(spec: SpecStore, public scroll: ScrollService, public history: HistoryService) {
|
||||||
|
makeObservable(this);
|
||||||
|
|
||||||
this.items = spec.contentItems;
|
this.items = spec.contentItems;
|
||||||
|
|
||||||
this.flatItems = flattenByProp(this.items || [], 'items');
|
this.flatItems = flattenByProp(this.items || [], 'items');
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { action, observable } from 'mobx';
|
import { action, observable, makeObservable } from 'mobx';
|
||||||
|
|
||||||
import { OpenAPICallback, Referenced } from '../../types';
|
import { OpenAPICallback, Referenced } from '../../types';
|
||||||
import { isOperationName, JsonPointer } from '../../utils';
|
import { isOperationName, JsonPointer } from '../../utils';
|
||||||
|
@ -19,6 +19,8 @@ export class CallbackModel {
|
||||||
pointer: string,
|
pointer: string,
|
||||||
options: RedocNormalizedOptions,
|
options: RedocNormalizedOptions,
|
||||||
) {
|
) {
|
||||||
|
makeObservable(this);
|
||||||
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
const paths = parser.deref<OpenAPICallback>(infoOrRef);
|
const paths = parser.deref<OpenAPICallback>(infoOrRef);
|
||||||
parser.exitRef(infoOrRef);
|
parser.exitRef(infoOrRef);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { action, observable } from 'mobx';
|
import { action, observable, makeObservable } from 'mobx';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
OpenAPIParameter,
|
OpenAPIParameter,
|
||||||
|
@ -61,6 +61,8 @@ export class FieldModel {
|
||||||
pointer: string,
|
pointer: string,
|
||||||
options: RedocNormalizedOptions,
|
options: RedocNormalizedOptions,
|
||||||
) {
|
) {
|
||||||
|
makeObservable(this);
|
||||||
|
|
||||||
const info = parser.deref<OpenAPIParameter>(infoOrRef);
|
const info = parser.deref<OpenAPIParameter>(infoOrRef);
|
||||||
this.kind = infoOrRef.kind || 'field';
|
this.kind = infoOrRef.kind || 'field';
|
||||||
this.name = infoOrRef.name || info.name;
|
this.name = infoOrRef.name || info.name;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { action, observable } from 'mobx';
|
import { action, observable, makeObservable } from 'mobx';
|
||||||
|
|
||||||
import { OpenAPIExternalDocumentation, OpenAPITag } from '../../types';
|
import { OpenAPIExternalDocumentation, OpenAPITag } from '../../types';
|
||||||
import { safeSlugify } from '../../utils';
|
import { safeSlugify } from '../../utils';
|
||||||
|
@ -35,6 +35,8 @@ export class GroupModel implements IMenuItem {
|
||||||
tagOrGroup: OpenAPITag | MarkdownHeading,
|
tagOrGroup: OpenAPITag | MarkdownHeading,
|
||||||
parent?: GroupModel,
|
parent?: GroupModel,
|
||||||
) {
|
) {
|
||||||
|
makeObservable(this);
|
||||||
|
|
||||||
// markdown headings already have ids calculated as they are needed for heading anchors
|
// markdown headings already have ids calculated as they are needed for heading anchors
|
||||||
this.id = (tagOrGroup as MarkdownHeading).id || type + '/' + safeSlugify(tagOrGroup.name);
|
this.id = (tagOrGroup as MarkdownHeading).id || type + '/' + safeSlugify(tagOrGroup.name);
|
||||||
this.type = type;
|
this.type = type;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { action, computed, observable } from 'mobx';
|
import { action, computed, observable, makeObservable } from 'mobx';
|
||||||
|
|
||||||
import { OpenAPIMediaType } from '../../types';
|
import { OpenAPIMediaType } from '../../types';
|
||||||
import { MediaTypeModel } from './MediaType';
|
import { MediaTypeModel } from './MediaType';
|
||||||
|
@ -26,6 +26,8 @@ export class MediaContentModel {
|
||||||
public isRequestType: boolean,
|
public isRequestType: boolean,
|
||||||
options: RedocNormalizedOptions,
|
options: RedocNormalizedOptions,
|
||||||
) {
|
) {
|
||||||
|
makeObservable(this);
|
||||||
|
|
||||||
if (options.unstable_ignoreMimeParameters) {
|
if (options.unstable_ignoreMimeParameters) {
|
||||||
info = mergeSimilarMediaTypes(info);
|
info = mergeSimilarMediaTypes(info);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { action, observable } from 'mobx';
|
import { action, observable, makeObservable } from 'mobx';
|
||||||
|
|
||||||
import { IMenuItem } from '../MenuStore';
|
import { IMenuItem } from '../MenuStore';
|
||||||
import { GroupModel } from './Group.model';
|
import { GroupModel } from './Group.model';
|
||||||
|
@ -84,6 +84,8 @@ export class OperationModel implements IMenuItem {
|
||||||
private options: RedocNormalizedOptions,
|
private options: RedocNormalizedOptions,
|
||||||
isCallback: boolean = false,
|
isCallback: boolean = false,
|
||||||
) {
|
) {
|
||||||
|
makeObservable(this);
|
||||||
|
|
||||||
this.pointer = operationSpec.pointer;
|
this.pointer = operationSpec.pointer;
|
||||||
|
|
||||||
this.description = operationSpec.description;
|
this.description = operationSpec.description;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { action, observable } from 'mobx';
|
import { action, observable, makeObservable } from 'mobx';
|
||||||
|
|
||||||
import { OpenAPIResponse, Referenced } from '../../types';
|
import { OpenAPIResponse, Referenced } from '../../types';
|
||||||
|
|
||||||
|
@ -26,6 +26,8 @@ export class ResponseModel {
|
||||||
infoOrRef: Referenced<OpenAPIResponse>,
|
infoOrRef: Referenced<OpenAPIResponse>,
|
||||||
options: RedocNormalizedOptions,
|
options: RedocNormalizedOptions,
|
||||||
) {
|
) {
|
||||||
|
makeObservable(this);
|
||||||
|
|
||||||
this.expanded = options.expandResponses === 'all' || options.expandResponses[code];
|
this.expanded = options.expandResponses === 'all' || options.expandResponses[code];
|
||||||
|
|
||||||
const info = parser.deref(infoOrRef);
|
const info = parser.deref(infoOrRef);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { action, observable } from 'mobx';
|
import { action, observable, makeObservable } from 'mobx';
|
||||||
|
|
||||||
import { OpenAPIExternalDocumentation, OpenAPISchema, Referenced } from '../../types';
|
import { OpenAPIExternalDocumentation, OpenAPISchema, Referenced } from '../../types';
|
||||||
|
|
||||||
|
@ -72,6 +72,8 @@ export class SchemaModel {
|
||||||
private options: RedocNormalizedOptions,
|
private options: RedocNormalizedOptions,
|
||||||
isChild: boolean = false,
|
isChild: boolean = false,
|
||||||
) {
|
) {
|
||||||
|
makeObservable(this);
|
||||||
|
|
||||||
this.pointer = schemaOrRef.$ref || pointer || '';
|
this.pointer = schemaOrRef.$ref || pointer || '';
|
||||||
this.rawSchema = parser.deref(schemaOrRef);
|
this.rawSchema = parser.deref(schemaOrRef);
|
||||||
this.schema = parser.mergeAllOf(this.rawSchema, this.pointer, isChild);
|
this.schema = parser.mergeAllOf(this.rawSchema, this.pointer, isChild);
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { hydrate as hydrateComponent, render } from 'react-dom';
|
import { hydrate as hydrateComponent, render } from 'react-dom';
|
||||||
|
import { configure } from "mobx"
|
||||||
|
|
||||||
import { Redoc, RedocStandalone } from './components/';
|
import { Redoc, RedocStandalone } from './components/';
|
||||||
import { AppStore, StoreState } from './services/AppStore';
|
import { AppStore, StoreState } from './services/AppStore';
|
||||||
import { debugTime, debugTimeEnd } from './utils/debug';
|
import { debugTime, debugTimeEnd } from './utils/debug';
|
||||||
import { querySelector } from './utils/dom';
|
import { querySelector } from './utils/dom';
|
||||||
|
|
||||||
|
configure({
|
||||||
|
useProxies: 'ifavailable'
|
||||||
|
})
|
||||||
|
|
||||||
export { Redoc, AppStore } from '.';
|
export { Redoc, AppStore } from '.';
|
||||||
|
|
||||||
export const version = __REDOC_VERSION__;
|
export const version = __REDOC_VERSION__;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user