@stoplight/elements-core 7.14.0 → 7.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,13 @@
1
- declare const meta: import("@storybook/react").Meta<import("..").DocsComponentProps<string | import("@stoplight/markdown/ast-types/mdast").Root> & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
1
+ declare const meta: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, {
2
+ data: any;
3
+ } & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
2
4
  export default meta;
3
- export declare const Basic: import("@storybook/react").Story<import("..").DocsComponentProps<string | import("@stoplight/markdown/ast-types/mdast").Root> & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
4
- export declare const KitchenSink: import("@storybook/react").Story<import("..").DocsComponentProps<string | import("@stoplight/markdown/ast-types/mdast").Root> & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
5
- export declare const MultipleTryIts: import("@storybook/react").Story<import("..").DocsComponentProps<string | import("@stoplight/markdown/ast-types/mdast").Root> & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
5
+ export declare const Basic: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, {
6
+ data: any;
7
+ } & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
8
+ export declare const KitchenSink: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, {
9
+ data: any;
10
+ } & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
11
+ export declare const MultipleTryIts: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, {
12
+ data: any;
13
+ } & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
@@ -33,6 +33,7 @@ export interface DocsProps extends BaseDocsProps {
33
33
  nodeData: unknown;
34
34
  useNodeForRefResolving?: boolean;
35
35
  refResolver?: ReferenceResolver;
36
+ maxRefDepth?: number;
36
37
  }
37
38
  export interface DocsComponentProps<T = unknown> extends BaseDocsProps {
38
39
  data: T;
@@ -1,5 +1,5 @@
1
- import { Meta, Story } from '@storybook/react';
1
+ import { Story } from '@storybook/react';
2
2
  import { DocsProps } from './Docs';
3
- declare const _default: Meta<DocsProps>;
3
+ declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, DocsProps>;
4
4
  export default _default;
5
5
  export declare const DocsStory: Story<DocsProps>;
@@ -1,3 +1,7 @@
1
- declare const meta: import("@storybook/react").Meta<import("./HttpOperation").HttpOperationProps & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
1
+ declare const meta: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, {
2
+ data: any;
3
+ } & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
2
4
  export default meta;
3
- export declare const Story: import("@storybook/react").Story<import("./HttpOperation").HttpOperationProps & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
5
+ export declare const Story: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, {
6
+ data: any;
7
+ } & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
@@ -1,3 +1,7 @@
1
- declare const meta: import("@storybook/react").Meta<import("./HttpService").HttpServiceProps & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
1
+ declare const meta: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, {
2
+ data: any;
3
+ } & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
2
4
  export default meta;
3
- export declare const Story: import("@storybook/react").Story<import("./HttpService").HttpServiceProps & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
5
+ export declare const Story: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, {
6
+ data: any;
7
+ } & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
@@ -1,3 +1,7 @@
1
- declare const meta: import("@storybook/react").Meta<import("./Model").ModelProps & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
1
+ declare const meta: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, {
2
+ data: any;
3
+ } & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
2
4
  export default meta;
3
- export declare const Story: import("@storybook/react").Story<import("./Model").ModelProps & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
5
+ export declare const Story: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, {
6
+ data: any;
7
+ } & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
@@ -1,13 +1,16 @@
1
1
  import type { ErrorBoundaryProps } from '@stoplight/react-error-boundary';
2
- import type { Meta, Story } from '@storybook/react';
2
+ import type { Meta, StoryFn } from '@storybook/react';
3
3
  import * as React from 'react';
4
4
  declare type DocsProps = {
5
- data: unknown;
5
+ data: any;
6
6
  } & ErrorBoundaryProps;
7
- interface HelperReturn<P extends Partial<DocsProps>> {
8
- meta: Meta<P>;
9
- createStory(name: string, input: Partial<P>): Story<P>;
10
- createHoistedStory(input: Partial<P>): Story<P>;
7
+ declare type storyOptions = DocsProps & {
8
+ layoutOptions?: object;
9
+ };
10
+ interface HelperReturn<P extends DocsProps> {
11
+ meta: Meta<DocsProps>;
12
+ createStory(name: string, input: storyOptions): StoryFn<P>;
13
+ createHoistedStory(input: storyOptions): StoryFn<P>;
11
14
  }
12
- export declare const createStoriesForDocsComponent: <P extends Partial<DocsProps> = DocsProps>(Component: React.ComponentType<P>, title?: string) => HelperReturn<P>;
15
+ export declare const createStoriesForDocsComponent: (Component: React.ComponentType<DocsProps>, title?: string) => HelperReturn<DocsProps>;
13
16
  export {};
@@ -1,5 +1,4 @@
1
- import { Meta, Story } from '@storybook/react';
2
1
  import { RequestSamplesProps } from './RequestSamples';
3
- declare const _default: Meta<RequestSamplesProps>;
2
+ declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, RequestSamplesProps>;
4
3
  export default _default;
5
- export declare const HoistedStory: Story<RequestSamplesProps>;
4
+ export declare const HoistedStory: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, RequestSamplesProps>;
@@ -1,5 +1,4 @@
1
- import { Meta, Story } from '@storybook/react';
2
1
  import { ResponseExamplesProps } from './ResponseExamples';
3
- declare const _default: Meta<ResponseExamplesProps>;
2
+ declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, ResponseExamplesProps>;
4
3
  export default _default;
5
- export declare const HoistedStory: Story<ResponseExamplesProps>;
4
+ export declare const HoistedStory: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, ResponseExamplesProps>;
@@ -1,14 +1,13 @@
1
- import { Meta, Story } from '@storybook/react';
2
1
  import { TryItProps } from './TryIt';
3
- declare const _default: Meta<TryItProps>;
2
+ declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, TryItProps>;
4
3
  export default _default;
5
- export declare const SimpleGET: Story<TryItProps>;
6
- export declare const WithParameters: Story<TryItProps>;
7
- export declare const WithVariables: Story<TryItProps>;
8
- export declare const UrlEncoded: Story<TryItProps>;
9
- export declare const UrlEncodedOneOf: Story<TryItProps>;
10
- export declare const Multipart: Story<TryItProps>;
11
- export declare const RequestBodySchema: Story<TryItProps>;
12
- export declare const RequestBodyExamples: Story<TryItProps>;
13
- export declare const TryItAuth: Story<TryItProps>;
14
- export declare const TryItAuthDuplicated: Story<TryItProps>;
4
+ export declare const SimpleGET: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, TryItProps>;
5
+ export declare const WithParameters: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, TryItProps>;
6
+ export declare const WithVariables: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, TryItProps>;
7
+ export declare const UrlEncoded: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, TryItProps>;
8
+ export declare const UrlEncodedOneOf: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, TryItProps>;
9
+ export declare const Multipart: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, TryItProps>;
10
+ export declare const RequestBodySchema: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, TryItProps>;
11
+ export declare const RequestBodyExamples: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, TryItProps>;
12
+ export declare const TryItAuth: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, TryItProps>;
13
+ export declare const TryItAuthDuplicated: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, TryItProps>;
@@ -1,6 +1,5 @@
1
- import { Meta, Story } from '@storybook/react';
2
1
  import { TryItWithRequestSamplesProps } from './TryItWithRequestSamples';
3
- declare const _default: Meta<TryItWithRequestSamplesProps>;
2
+ declare const _default: import("@storybook/types").ComponentAnnotations<import("@storybook/react/dist/types-0a347bb9").R, TryItWithRequestSamplesProps>;
4
3
  export default _default;
5
- export declare const WithParameters: Story<TryItWithRequestSamplesProps>;
6
- export declare const WithVariables: Story<TryItWithRequestSamplesProps>;
4
+ export declare const WithParameters: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, TryItWithRequestSamplesProps>;
5
+ export declare const WithVariables: import("@storybook/types").AnnotatedStoryFn<import("@storybook/react/dist/types-0a347bb9").R, TryItWithRequestSamplesProps>;
@@ -1,12 +1,18 @@
1
1
  import * as React from 'react';
2
2
  import { ReferenceResolver } from '../utils/ref-resolving/ReferenceResolver';
3
+ declare type InlineRefResolverContext = {
4
+ resolver: ReferenceResolver | undefined;
5
+ maxRefDepth: number | undefined;
6
+ };
7
+ declare const InlineRefResolverContext: React.Context<InlineRefResolverContext | undefined>;
3
8
  declare type InlineRefResolverProviderProps = {
4
9
  document?: unknown;
5
10
  resolver?: ReferenceResolver;
11
+ maxRefDepth?: number;
6
12
  };
7
13
  export declare const InlineRefResolverProvider: React.FC<InlineRefResolverProviderProps>;
8
- export declare const useInlineRefResolver: () => ReferenceResolver | undefined;
14
+ export declare const useInlineRefResolver: () => InlineRefResolverContext | undefined;
9
15
  export declare const useDocument: () => object | undefined;
10
16
  export declare const useResolvedObject: (currentObject: object) => object;
11
- export declare const useSchemaInlineRefResolver: () => ReferenceResolver;
17
+ export declare const useSchemaInlineRefResolver: () => [ReferenceResolver, number | undefined];
12
18
  export {};
package/index.esm.js CHANGED
@@ -119,23 +119,25 @@ const InlineRefResolverContext = React.createContext(undefined);
119
119
  InlineRefResolverContext.displayName = 'InlineRefResolverContext';
120
120
  const DocumentContext = React.createContext(undefined);
121
121
  DocumentContext.displayName = 'DocumentContext';
122
- const InlineRefResolverProvider = ({ children, document: maybeDocument, resolver, }) => {
122
+ const InlineRefResolverProvider = ({ children, document: maybeDocument, resolver, maxRefDepth, }) => {
123
123
  const document = isPlainObject$1(maybeDocument) ? maybeDocument : undefined;
124
124
  const computedResolver = React.useMemo(() => resolver || (document !== undefined ? defaultResolver(document) : undefined), [document, resolver]);
125
- return (React.createElement(InlineRefResolverContext.Provider, { value: computedResolver },
125
+ return (React.createElement(InlineRefResolverContext.Provider, { value: { resolver: computedResolver, maxRefDepth } },
126
126
  React.createElement(DocumentContext.Provider, { value: document }, children)));
127
127
  };
128
128
  const useInlineRefResolver = () => useContext(InlineRefResolverContext);
129
129
  const useDocument = () => useContext(DocumentContext);
130
130
  const useResolvedObject = (currentObject) => {
131
+ var _a;
131
132
  const document = useDocument();
132
- const resolver = useInlineRefResolver();
133
+ const { resolver } = (_a = useInlineRefResolver()) !== null && _a !== void 0 ? _a : {};
133
134
  return React.useMemo(() => createResolvedObject(currentObject, { contextObject: document, resolver }), [currentObject, document, resolver]);
134
135
  };
135
136
  const useSchemaInlineRefResolver = () => {
137
+ var _a;
136
138
  const document = useDocument();
137
- const resolver = useInlineRefResolver();
138
- return React.useCallback((...args) => {
139
+ const { resolver, maxRefDepth } = (_a = useInlineRefResolver()) !== null && _a !== void 0 ? _a : {};
140
+ const referenceResolver = React.useCallback((...args) => {
139
141
  const resolved = resolver === null || resolver === void 0 ? void 0 : resolver(...args);
140
142
  if (!isPlainObject$1(resolved)) {
141
143
  return resolved;
@@ -151,6 +153,7 @@ const useSchemaInlineRefResolver = () => {
151
153
  delete converted.$schema;
152
154
  return converted;
153
155
  }, [document, resolver]);
156
+ return [referenceResolver, maxRefDepth];
154
157
  };
155
158
 
156
159
  const DEFAULT_CONTEXT = {};
@@ -2446,7 +2449,7 @@ const isBodyEmpty = (body) => {
2446
2449
  };
2447
2450
  const Body = ({ body, onChange }) => {
2448
2451
  var _a;
2449
- const refResolver = useSchemaInlineRefResolver();
2452
+ const [refResolver, maxRefDepth] = useSchemaInlineRefResolver();
2450
2453
  const [chosenContent, setChosenContent] = React.useState(0);
2451
2454
  const { nodeHasChanged } = useOptionsCtx();
2452
2455
  React.useEffect(() => {
@@ -2463,7 +2466,7 @@ const Body = ({ body, onChange }) => {
2463
2466
  description && (React.createElement(Box, { pos: "relative" },
2464
2467
  React.createElement(MarkdownViewer, { markdown: description }),
2465
2468
  React.createElement(NodeAnnotation, { change: descriptionChanged }))),
2466
- isJSONSchema(schema) && (React.createElement(JsonSchemaViewer, { resolveRef: refResolver, schema: getOriginalObject(schema), viewMode: "write", renderRootTreeLines: true, nodeHasChanged: nodeHasChanged }))));
2469
+ isJSONSchema(schema) && (React.createElement(JsonSchemaViewer, { resolveRef: refResolver, maxRefDepth: maxRefDepth, schema: getOriginalObject(schema), viewMode: "write", renderRootTreeLines: true, nodeHasChanged: nodeHasChanged }))));
2467
2470
  };
2468
2471
  Body.displayName = 'HttpOperation.Body';
2469
2472
 
@@ -2488,11 +2491,11 @@ const defaultStyle = {
2488
2491
  };
2489
2492
  const Parameters = ({ parameters, parameterType }) => {
2490
2493
  const { nodeHasChanged } = useOptionsCtx();
2491
- const refResolver = useSchemaInlineRefResolver();
2494
+ const [refResolver, maxRefDepth] = useSchemaInlineRefResolver();
2492
2495
  const schema = React.useMemo(() => httpOperationParamsToSchema({ parameters, parameterType }), [parameters, parameterType]);
2493
2496
  if (!schema)
2494
2497
  return null;
2495
- return React.createElement(JsonSchemaViewer, { resolveRef: refResolver, schema: schema, disableCrumbs: true, nodeHasChanged: nodeHasChanged });
2498
+ return (React.createElement(JsonSchemaViewer, { resolveRef: refResolver, maxRefDepth: maxRefDepth, schema: schema, disableCrumbs: true, nodeHasChanged: nodeHasChanged }));
2496
2499
  };
2497
2500
  Parameters.displayName = 'HttpOperation.Parameters';
2498
2501
  const httpOperationParamsToSchema = ({ parameters, parameterType }) => {
@@ -2626,7 +2629,7 @@ Responses.displayName = 'HttpOperation.Responses';
2626
2629
  const Response = ({ response, onMediaTypeChange }) => {
2627
2630
  const { contents = [], headers = [], description } = response;
2628
2631
  const [chosenContent, setChosenContent] = React.useState(0);
2629
- const refResolver = useSchemaInlineRefResolver();
2632
+ const [refResolver, maxRefDepth] = useSchemaInlineRefResolver();
2630
2633
  const { nodeHasChanged } = useOptionsCtx();
2631
2634
  const responseContent = contents[chosenContent];
2632
2635
  const schema = responseContent === null || responseContent === void 0 ? void 0 : responseContent.schema;
@@ -2645,7 +2648,7 @@ const Response = ({ response, onMediaTypeChange }) => {
2645
2648
  React.createElement(SectionSubtitle, { title: "Body", id: "response-body" },
2646
2649
  React.createElement(Flex, { flex: 1, justify: "end" },
2647
2650
  React.createElement(Select, { "aria-label": "Response Body Content Type", value: String(chosenContent), onChange: value => setChosenContent(parseInt(String(value), 10)), options: contents.map((content, index) => ({ label: content.mediaType, value: index })), size: "sm" }))),
2648
- schema && (React.createElement(JsonSchemaViewer, { schema: getOriginalObject(schema), resolveRef: refResolver, viewMode: "read", parentCrumbs: ['responses', response.code], renderRootTreeLines: true, nodeHasChanged: nodeHasChanged }))))));
2651
+ schema && (React.createElement(JsonSchemaViewer, { schema: getOriginalObject(schema), resolveRef: refResolver, maxRefDepth: maxRefDepth, viewMode: "read", parentCrumbs: ['responses', response.code], renderRootTreeLines: true, nodeHasChanged: nodeHasChanged }))))));
2649
2652
  };
2650
2653
  Response.displayName = 'HttpOperation.Response';
2651
2654
  const codeToIntentVal = (code) => {
@@ -2929,7 +2932,7 @@ const HttpService = withErrorBoundary(HttpServiceComponent, { recoverableProps:
2929
2932
 
2930
2933
  const ModelComponent = ({ data: unresolvedData, className, nodeTitle, layoutOptions, exportProps, }) => {
2931
2934
  var _a, _b;
2932
- const resolveRef = useSchemaInlineRefResolver();
2935
+ const [resolveRef, maxRefDepth] = useSchemaInlineRefResolver();
2933
2936
  const data = useResolvedObject(unresolvedData);
2934
2937
  const { nodeHasChanged } = useOptionsCtx();
2935
2938
  const { ref: layoutRef, isCompact } = useIsCompact(layoutOptions);
@@ -2955,7 +2958,7 @@ const ModelComponent = ({ data: unresolvedData, className, nodeTitle, layoutOpti
2955
2958
  React.createElement(MarkdownViewer, { role: "textbox", markdown: data.description }),
2956
2959
  React.createElement(NodeAnnotation, { change: descriptionChanged }))),
2957
2960
  isCompact && modelExamples,
2958
- React.createElement(JsonSchemaViewer, { resolveRef: resolveRef, schema: getOriginalObject(data), nodeHasChanged: nodeHasChanged, skipTopLevelDescription: true })));
2961
+ React.createElement(JsonSchemaViewer, { resolveRef: resolveRef, maxRefDepth: maxRefDepth, schema: getOriginalObject(data), nodeHasChanged: nodeHasChanged, skipTopLevelDescription: true })));
2959
2962
  return (React.createElement(TwoColumnLayout, { ref: layoutRef, className: cn('Model', className), header: header, left: description, right: !isCompact && modelExamples }));
2960
2963
  };
2961
2964
  const ModelExamples = React.memo(({ data, isCollapsible = false }) => {
@@ -2978,7 +2981,7 @@ const Model = withErrorBoundary(ModelComponent, { recoverableProps: ['data'] });
2978
2981
 
2979
2982
  const Docs = React.memo((_a) => {
2980
2983
  var _b;
2981
- var { nodeType, nodeData, useNodeForRefResolving = false, refResolver, nodeHasChanged } = _a, commonProps = __rest(_a, ["nodeType", "nodeData", "useNodeForRefResolving", "refResolver", "nodeHasChanged"]);
2984
+ var { nodeType, nodeData, useNodeForRefResolving = false, refResolver, maxRefDepth, nodeHasChanged } = _a, commonProps = __rest(_a, ["nodeType", "nodeData", "useNodeForRefResolving", "refResolver", "maxRefDepth", "nodeHasChanged"]);
2982
2985
  const parsedNode = useParsedData(nodeType, nodeData);
2983
2986
  if (!parsedNode) {
2984
2987
  (_b = commonProps.nodeUnsupported) === null || _b === void 0 ? void 0 : _b.call(commonProps, 'dataEmpty');
@@ -2986,7 +2989,7 @@ const Docs = React.memo((_a) => {
2986
2989
  }
2987
2990
  let elem = React.createElement(ParsedDocs, Object.assign({ node: parsedNode }, commonProps));
2988
2991
  if (useNodeForRefResolving) {
2989
- elem = (React.createElement(InlineRefResolverProvider, { document: parsedNode.data, resolver: refResolver }, elem));
2992
+ elem = (React.createElement(InlineRefResolverProvider, { document: parsedNode.data, resolver: refResolver, maxRefDepth: maxRefDepth }, elem));
2990
2993
  }
2991
2994
  return React.createElement(ElementsOptionsProvider, { nodeHasChanged: nodeHasChanged }, elem);
2992
2995
  });
@@ -3098,13 +3101,13 @@ function isPartialHttpRequest(maybeHttpRequest) {
3098
3101
  typeof maybeHttpRequest['url'] === 'string');
3099
3102
  }
3100
3103
  const SchemaAndDescription = ({ title: titleProp, schema }) => {
3101
- const resolveRef = useSchemaInlineRefResolver();
3104
+ const [resolveRef, maxRefDepth] = useSchemaInlineRefResolver();
3102
3105
  const title = titleProp !== null && titleProp !== void 0 ? titleProp : schema.title;
3103
3106
  return (React__default.createElement(Box, { py: 2 },
3104
3107
  title && (React__default.createElement(Flex, { alignItems: "center", p: 2 },
3105
3108
  React__default.createElement(Icon, { icon: NodeTypeIconDefs[NodeType.Model], color: NodeTypeColors[NodeType.Model] }),
3106
3109
  React__default.createElement(Box, { color: "muted", px: 2 }, title))),
3107
- React__default.createElement(JsonSchemaViewer, { resolveRef: resolveRef, schema: getOriginalObject(schema) })));
3110
+ React__default.createElement(JsonSchemaViewer, { resolveRef: resolveRef, maxRefDepth: maxRefDepth, schema: getOriginalObject(schema) })));
3108
3111
  };
3109
3112
  const CodeComponent = props => {
3110
3113
  const { title, jsonSchema, http, resolved, children } = props;
@@ -3115,7 +3118,7 @@ const CodeComponent = props => {
3115
3118
  if (!isJSONSchema(parsedValue)) {
3116
3119
  return null;
3117
3120
  }
3118
- return (React__default.createElement(InlineRefResolverProvider, { document: parsedValue, resolver: resolver },
3121
+ return (React__default.createElement(InlineRefResolverProvider, { document: parsedValue, resolver: resolver === null || resolver === void 0 ? void 0 : resolver.resolver, maxRefDepth: resolver === null || resolver === void 0 ? void 0 : resolver.maxRefDepth },
3119
3122
  React__default.createElement(SchemaAndDescription, { title: title, schema: parsedValue })));
3120
3123
  }
3121
3124
  if (http) {
package/index.js CHANGED
@@ -176,23 +176,25 @@ const InlineRefResolverContext = React__namespace.createContext(undefined);
176
176
  InlineRefResolverContext.displayName = 'InlineRefResolverContext';
177
177
  const DocumentContext = React__namespace.createContext(undefined);
178
178
  DocumentContext.displayName = 'DocumentContext';
179
- const InlineRefResolverProvider = ({ children, document: maybeDocument, resolver, }) => {
179
+ const InlineRefResolverProvider = ({ children, document: maybeDocument, resolver, maxRefDepth, }) => {
180
180
  const document = json.isPlainObject(maybeDocument) ? maybeDocument : undefined;
181
181
  const computedResolver = React__namespace.useMemo(() => resolver || (document !== undefined ? defaultResolver(document) : undefined), [document, resolver]);
182
- return (React__namespace.createElement(InlineRefResolverContext.Provider, { value: computedResolver },
182
+ return (React__namespace.createElement(InlineRefResolverContext.Provider, { value: { resolver: computedResolver, maxRefDepth } },
183
183
  React__namespace.createElement(DocumentContext.Provider, { value: document }, children)));
184
184
  };
185
185
  const useInlineRefResolver = () => React.useContext(InlineRefResolverContext);
186
186
  const useDocument = () => React.useContext(DocumentContext);
187
187
  const useResolvedObject = (currentObject) => {
188
+ var _a;
188
189
  const document = useDocument();
189
- const resolver = useInlineRefResolver();
190
+ const { resolver } = (_a = useInlineRefResolver()) !== null && _a !== void 0 ? _a : {};
190
191
  return React__namespace.useMemo(() => createResolvedObject(currentObject, { contextObject: document, resolver }), [currentObject, document, resolver]);
191
192
  };
192
193
  const useSchemaInlineRefResolver = () => {
194
+ var _a;
193
195
  const document = useDocument();
194
- const resolver = useInlineRefResolver();
195
- return React__namespace.useCallback((...args) => {
196
+ const { resolver, maxRefDepth } = (_a = useInlineRefResolver()) !== null && _a !== void 0 ? _a : {};
197
+ const referenceResolver = React__namespace.useCallback((...args) => {
196
198
  const resolved = resolver === null || resolver === void 0 ? void 0 : resolver(...args);
197
199
  if (!json.isPlainObject(resolved)) {
198
200
  return resolved;
@@ -208,6 +210,7 @@ const useSchemaInlineRefResolver = () => {
208
210
  delete converted.$schema;
209
211
  return converted;
210
212
  }, [document, resolver]);
213
+ return [referenceResolver, maxRefDepth];
211
214
  };
212
215
 
213
216
  const DEFAULT_CONTEXT = {};
@@ -2503,7 +2506,7 @@ const isBodyEmpty = (body) => {
2503
2506
  };
2504
2507
  const Body = ({ body, onChange }) => {
2505
2508
  var _a;
2506
- const refResolver = useSchemaInlineRefResolver();
2509
+ const [refResolver, maxRefDepth] = useSchemaInlineRefResolver();
2507
2510
  const [chosenContent, setChosenContent] = React__namespace.useState(0);
2508
2511
  const { nodeHasChanged } = useOptionsCtx();
2509
2512
  React__namespace.useEffect(() => {
@@ -2520,7 +2523,7 @@ const Body = ({ body, onChange }) => {
2520
2523
  description && (React__namespace.createElement(mosaic.Box, { pos: "relative" },
2521
2524
  React__namespace.createElement(MarkdownViewer, { markdown: description }),
2522
2525
  React__namespace.createElement(mosaic.NodeAnnotation, { change: descriptionChanged }))),
2523
- isJSONSchema(schema) && (React__namespace.createElement(jsonSchemaViewer.JsonSchemaViewer, { resolveRef: refResolver, schema: getOriginalObject(schema), viewMode: "write", renderRootTreeLines: true, nodeHasChanged: nodeHasChanged }))));
2526
+ isJSONSchema(schema) && (React__namespace.createElement(jsonSchemaViewer.JsonSchemaViewer, { resolveRef: refResolver, maxRefDepth: maxRefDepth, schema: getOriginalObject(schema), viewMode: "write", renderRootTreeLines: true, nodeHasChanged: nodeHasChanged }))));
2524
2527
  };
2525
2528
  Body.displayName = 'HttpOperation.Body';
2526
2529
 
@@ -2545,11 +2548,11 @@ const defaultStyle = {
2545
2548
  };
2546
2549
  const Parameters = ({ parameters, parameterType }) => {
2547
2550
  const { nodeHasChanged } = useOptionsCtx();
2548
- const refResolver = useSchemaInlineRefResolver();
2551
+ const [refResolver, maxRefDepth] = useSchemaInlineRefResolver();
2549
2552
  const schema = React__namespace.useMemo(() => httpOperationParamsToSchema({ parameters, parameterType }), [parameters, parameterType]);
2550
2553
  if (!schema)
2551
2554
  return null;
2552
- return React__namespace.createElement(jsonSchemaViewer.JsonSchemaViewer, { resolveRef: refResolver, schema: schema, disableCrumbs: true, nodeHasChanged: nodeHasChanged });
2555
+ return (React__namespace.createElement(jsonSchemaViewer.JsonSchemaViewer, { resolveRef: refResolver, maxRefDepth: maxRefDepth, schema: schema, disableCrumbs: true, nodeHasChanged: nodeHasChanged }));
2553
2556
  };
2554
2557
  Parameters.displayName = 'HttpOperation.Parameters';
2555
2558
  const httpOperationParamsToSchema = ({ parameters, parameterType }) => {
@@ -2683,7 +2686,7 @@ Responses.displayName = 'HttpOperation.Responses';
2683
2686
  const Response = ({ response, onMediaTypeChange }) => {
2684
2687
  const { contents = [], headers = [], description } = response;
2685
2688
  const [chosenContent, setChosenContent] = React__namespace.useState(0);
2686
- const refResolver = useSchemaInlineRefResolver();
2689
+ const [refResolver, maxRefDepth] = useSchemaInlineRefResolver();
2687
2690
  const { nodeHasChanged } = useOptionsCtx();
2688
2691
  const responseContent = contents[chosenContent];
2689
2692
  const schema = responseContent === null || responseContent === void 0 ? void 0 : responseContent.schema;
@@ -2702,7 +2705,7 @@ const Response = ({ response, onMediaTypeChange }) => {
2702
2705
  React__namespace.createElement(SectionSubtitle, { title: "Body", id: "response-body" },
2703
2706
  React__namespace.createElement(mosaic.Flex, { flex: 1, justify: "end" },
2704
2707
  React__namespace.createElement(mosaic.Select, { "aria-label": "Response Body Content Type", value: String(chosenContent), onChange: value => setChosenContent(parseInt(String(value), 10)), options: contents.map((content, index) => ({ label: content.mediaType, value: index })), size: "sm" }))),
2705
- schema && (React__namespace.createElement(jsonSchemaViewer.JsonSchemaViewer, { schema: getOriginalObject(schema), resolveRef: refResolver, viewMode: "read", parentCrumbs: ['responses', response.code], renderRootTreeLines: true, nodeHasChanged: nodeHasChanged }))))));
2708
+ schema && (React__namespace.createElement(jsonSchemaViewer.JsonSchemaViewer, { schema: getOriginalObject(schema), resolveRef: refResolver, maxRefDepth: maxRefDepth, viewMode: "read", parentCrumbs: ['responses', response.code], renderRootTreeLines: true, nodeHasChanged: nodeHasChanged }))))));
2706
2709
  };
2707
2710
  Response.displayName = 'HttpOperation.Response';
2708
2711
  const codeToIntentVal = (code) => {
@@ -2986,7 +2989,7 @@ const HttpService = reactErrorBoundary.withErrorBoundary(HttpServiceComponent, {
2986
2989
 
2987
2990
  const ModelComponent = ({ data: unresolvedData, className, nodeTitle, layoutOptions, exportProps, }) => {
2988
2991
  var _a, _b;
2989
- const resolveRef = useSchemaInlineRefResolver();
2992
+ const [resolveRef, maxRefDepth] = useSchemaInlineRefResolver();
2990
2993
  const data = useResolvedObject(unresolvedData);
2991
2994
  const { nodeHasChanged } = useOptionsCtx();
2992
2995
  const { ref: layoutRef, isCompact } = useIsCompact(layoutOptions);
@@ -3012,7 +3015,7 @@ const ModelComponent = ({ data: unresolvedData, className, nodeTitle, layoutOpti
3012
3015
  React__namespace.createElement(MarkdownViewer, { role: "textbox", markdown: data.description }),
3013
3016
  React__namespace.createElement(mosaic.NodeAnnotation, { change: descriptionChanged }))),
3014
3017
  isCompact && modelExamples,
3015
- React__namespace.createElement(jsonSchemaViewer.JsonSchemaViewer, { resolveRef: resolveRef, schema: getOriginalObject(data), nodeHasChanged: nodeHasChanged, skipTopLevelDescription: true })));
3018
+ React__namespace.createElement(jsonSchemaViewer.JsonSchemaViewer, { resolveRef: resolveRef, maxRefDepth: maxRefDepth, schema: getOriginalObject(data), nodeHasChanged: nodeHasChanged, skipTopLevelDescription: true })));
3016
3019
  return (React__namespace.createElement(TwoColumnLayout, { ref: layoutRef, className: cn__default["default"]('Model', className), header: header, left: description, right: !isCompact && modelExamples }));
3017
3020
  };
3018
3021
  const ModelExamples = React__namespace.memo(({ data, isCollapsible = false }) => {
@@ -3035,7 +3038,7 @@ const Model = reactErrorBoundary.withErrorBoundary(ModelComponent, { recoverable
3035
3038
 
3036
3039
  const Docs = React__namespace.memo((_a) => {
3037
3040
  var _b;
3038
- var { nodeType, nodeData, useNodeForRefResolving = false, refResolver, nodeHasChanged } = _a, commonProps = tslib.__rest(_a, ["nodeType", "nodeData", "useNodeForRefResolving", "refResolver", "nodeHasChanged"]);
3041
+ var { nodeType, nodeData, useNodeForRefResolving = false, refResolver, maxRefDepth, nodeHasChanged } = _a, commonProps = tslib.__rest(_a, ["nodeType", "nodeData", "useNodeForRefResolving", "refResolver", "maxRefDepth", "nodeHasChanged"]);
3039
3042
  const parsedNode = useParsedData(nodeType, nodeData);
3040
3043
  if (!parsedNode) {
3041
3044
  (_b = commonProps.nodeUnsupported) === null || _b === void 0 ? void 0 : _b.call(commonProps, 'dataEmpty');
@@ -3043,7 +3046,7 @@ const Docs = React__namespace.memo((_a) => {
3043
3046
  }
3044
3047
  let elem = React__namespace.createElement(ParsedDocs, Object.assign({ node: parsedNode }, commonProps));
3045
3048
  if (useNodeForRefResolving) {
3046
- elem = (React__namespace.createElement(InlineRefResolverProvider, { document: parsedNode.data, resolver: refResolver }, elem));
3049
+ elem = (React__namespace.createElement(InlineRefResolverProvider, { document: parsedNode.data, resolver: refResolver, maxRefDepth: maxRefDepth }, elem));
3047
3050
  }
3048
3051
  return React__namespace.createElement(ElementsOptionsProvider, { nodeHasChanged: nodeHasChanged }, elem);
3049
3052
  });
@@ -3155,13 +3158,13 @@ function isPartialHttpRequest(maybeHttpRequest) {
3155
3158
  typeof maybeHttpRequest['url'] === 'string');
3156
3159
  }
3157
3160
  const SchemaAndDescription = ({ title: titleProp, schema }) => {
3158
- const resolveRef = useSchemaInlineRefResolver();
3161
+ const [resolveRef, maxRefDepth] = useSchemaInlineRefResolver();
3159
3162
  const title = titleProp !== null && titleProp !== void 0 ? titleProp : schema.title;
3160
3163
  return (React__default["default"].createElement(mosaic.Box, { py: 2 },
3161
3164
  title && (React__default["default"].createElement(mosaic.Flex, { alignItems: "center", p: 2 },
3162
3165
  React__default["default"].createElement(mosaic.Icon, { icon: NodeTypeIconDefs[types.NodeType.Model], color: NodeTypeColors[types.NodeType.Model] }),
3163
3166
  React__default["default"].createElement(mosaic.Box, { color: "muted", px: 2 }, title))),
3164
- React__default["default"].createElement(jsonSchemaViewer.JsonSchemaViewer, { resolveRef: resolveRef, schema: getOriginalObject(schema) })));
3167
+ React__default["default"].createElement(jsonSchemaViewer.JsonSchemaViewer, { resolveRef: resolveRef, maxRefDepth: maxRefDepth, schema: getOriginalObject(schema) })));
3165
3168
  };
3166
3169
  const CodeComponent = props => {
3167
3170
  const { title, jsonSchema, http, resolved, children } = props;
@@ -3172,7 +3175,7 @@ const CodeComponent = props => {
3172
3175
  if (!isJSONSchema(parsedValue)) {
3173
3176
  return null;
3174
3177
  }
3175
- return (React__default["default"].createElement(InlineRefResolverProvider, { document: parsedValue, resolver: resolver },
3178
+ return (React__default["default"].createElement(InlineRefResolverProvider, { document: parsedValue, resolver: resolver === null || resolver === void 0 ? void 0 : resolver.resolver, maxRefDepth: resolver === null || resolver === void 0 ? void 0 : resolver.maxRefDepth },
3176
3179
  React__default["default"].createElement(SchemaAndDescription, { title: title, schema: parsedValue })));
3177
3180
  }
3178
3181
  if (http) {