@stoplight/elements-core 7.10.0 → 7.12.0

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.
@@ -4,6 +4,7 @@ import * as React from 'react';
4
4
  import { ParsedNode } from '../../types';
5
5
  import { ReferenceResolver } from '../../utils/ref-resolving/ReferenceResolver';
6
6
  import { ExportButtonProps } from './HttpService/ExportButton';
7
+ declare type NodeUnsupportedFn = (err: 'dataEmpty' | 'invalidType' | Error) => void;
7
8
  interface BaseDocsProps {
8
9
  className?: string;
9
10
  uri?: string;
@@ -25,6 +26,7 @@ interface BaseDocsProps {
25
26
  compact?: number | boolean;
26
27
  };
27
28
  nodeHasChanged?: NodeHasChangedFn<React.ReactNode>;
29
+ nodeUnsupported?: NodeUnsupportedFn;
28
30
  }
29
31
  export interface DocsProps extends BaseDocsProps {
30
32
  nodeType: NodeType;
@@ -39,5 +41,5 @@ export declare const Docs: React.NamedExoticComponent<DocsProps>;
39
41
  export interface ParsedDocsProps extends BaseDocsProps {
40
42
  node: ParsedNode;
41
43
  }
42
- export declare const ParsedDocs: ({ node, ...commonProps }: ParsedDocsProps) => JSX.Element | null;
44
+ export declare const ParsedDocs: ({ node, nodeUnsupported, ...commonProps }: ParsedDocsProps) => JSX.Element | null;
43
45
  export { DocsSkeleton } from './Skeleton';
@@ -2,11 +2,19 @@ import { IIconProps } from '@stoplight/mosaic';
2
2
  export declare const NODE_TYPE_TITLE_ICON: {
3
3
  [nodeType: string]: IIconProps['icon'];
4
4
  };
5
+ export declare const NODE_TITLE_ICON: {
6
+ [nodeTitle: string]: IIconProps['icon'];
7
+ };
5
8
  export declare const NODE_TYPE_META_ICON: {
6
9
  [nodeType: string]: IIconProps['icon'];
7
10
  };
8
11
  export declare const NODE_TYPE_ICON_COLOR: {
9
12
  model: string;
13
+ http_service: string;
14
+ http_operation: string;
15
+ };
16
+ export declare const NODE_TITLE_ICON_COLOR: {
17
+ Schemas: string;
10
18
  };
11
19
  export declare const NODE_META_COLOR: {
12
20
  get: string;
@@ -4,6 +4,7 @@ export declare type TableOfContentsProps = {
4
4
  Link: CustomLinkComponent;
5
5
  maxDepthOpenByDefault?: number;
6
6
  externalScrollbar?: boolean;
7
+ isInResponsiveMode?: boolean;
7
8
  onLinkClick?(): void;
8
9
  };
9
10
  export declare type CustomLinkComponent = React.ComponentType<{
package/index.esm.js CHANGED
@@ -293,6 +293,11 @@ var faBookOpen = {
293
293
  iconName: 'book-open',
294
294
  icon: [576, 512, [128366, 128214], "f518", "M144.3 32.04C106.9 31.29 63.7 41.44 18.6 61.29c-11.42 5.026-18.6 16.67-18.6 29.15l0 357.6c0 11.55 11.99 19.55 22.45 14.65c126.3-59.14 219.8 11 223.8 14.01C249.1 478.9 252.5 480 256 480c12.4 0 16-11.38 16-15.98V80.04c0-5.203-2.531-10.08-6.781-13.08C263.3 65.58 216.7 33.35 144.3 32.04zM557.4 61.29c-45.11-19.79-88.48-29.61-125.7-29.26c-72.44 1.312-118.1 33.55-120.9 34.92C306.5 69.96 304 74.83 304 80.04v383.1C304 468.4 307.5 480 320 480c3.484 0 6.938-1.125 9.781-3.328c3.925-3.018 97.44-73.16 223.8-14c10.46 4.896 22.45-3.105 22.45-14.65l.0001-357.6C575.1 77.97 568.8 66.31 557.4 61.29z"]
295
295
  };
296
+ var faBullseye = {
297
+ prefix: 'fas',
298
+ iconName: 'bullseye',
299
+ icon: [512, 512, [], "f140", "M288 256C288 273.7 273.7 288 256 288C238.3 288 224 273.7 224 256C224 238.3 238.3 224 256 224C273.7 224 288 238.3 288 256zM112 256C112 176.5 176.5 112 256 112C335.5 112 400 176.5 400 256C400 335.5 335.5 400 256 400C176.5 400 112 335.5 112 256zM256 336C300.2 336 336 300.2 336 256C336 211.8 300.2 176 256 176C211.8 176 176 211.8 176 256C176 300.2 211.8 336 256 336zM512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256zM256 64C149.1 64 64 149.1 64 256C64 362 149.1 448 256 448C362 448 448 362 448 256C448 149.1 362 64 256 64z"]
300
+ };
296
301
  var faCircleQuestion = {
297
302
  prefix: 'fas',
298
303
  iconName: 'circle-question',
@@ -314,6 +319,11 @@ var faCube = {
314
319
  iconName: 'cube',
315
320
  icon: [512, 512, [], "f1b2", "M234.5 5.709C248.4 .7377 263.6 .7377 277.5 5.709L469.5 74.28C494.1 83.38 512 107.5 512 134.6V377.4C512 404.5 494.1 428.6 469.5 437.7L277.5 506.3C263.6 511.3 248.4 511.3 234.5 506.3L42.47 437.7C17 428.6 0 404.5 0 377.4V134.6C0 107.5 17 83.38 42.47 74.28L234.5 5.709zM256 65.98L82.34 128L256 190L429.7 128L256 65.98zM288 434.6L448 377.4V189.4L288 246.6V434.6z"]
316
321
  };
322
+ var faCubes = {
323
+ prefix: 'fas',
324
+ iconName: 'cubes',
325
+ icon: [576, 512, [], "f1b3", "M172.1 40.16L268.1 3.76C280.9-1.089 295.1-1.089 307.9 3.76L403.9 40.16C425.6 48.41 440 69.25 440 92.52V204.7C441.3 205.1 442.6 205.5 443.9 205.1L539.9 242.4C561.6 250.6 576 271.5 576 294.7V413.9C576 436.1 562.9 456.2 542.5 465.1L446.5 507.3C432.2 513.7 415.8 513.7 401.5 507.3L288 457.5L174.5 507.3C160.2 513.7 143.8 513.7 129.5 507.3L33.46 465.1C13.13 456.2 0 436.1 0 413.9V294.7C0 271.5 14.39 250.6 36.15 242.4L132.1 205.1C133.4 205.5 134.7 205.1 136 204.7V92.52C136 69.25 150.4 48.41 172.1 40.16V40.16zM290.8 48.64C289 47.95 286.1 47.95 285.2 48.64L206.8 78.35L287.1 109.5L369.2 78.35L290.8 48.64zM392 210.6V121L309.6 152.6V241.8L392 210.6zM154.8 250.9C153 250.2 150.1 250.2 149.2 250.9L70.81 280.6L152 311.7L233.2 280.6L154.8 250.9zM173.6 455.3L256 419.1V323.2L173.6 354.8V455.3zM342.8 280.6L424 311.7L505.2 280.6L426.8 250.9C425 250.2 422.1 250.2 421.2 250.9L342.8 280.6zM528 413.9V323.2L445.6 354.8V455.3L523.2 421.2C526.1 419.9 528 417.1 528 413.9V413.9z"]
326
+ };
317
327
  var faDatabase = {
318
328
  prefix: 'fas',
319
329
  iconName: 'database',
@@ -2806,9 +2816,11 @@ const ModelExamples = React.memo(({ data, isCollapsible = false }) => {
2806
2816
  const Model = withErrorBoundary(ModelComponent, { recoverableProps: ['data'] });
2807
2817
 
2808
2818
  const Docs = React.memo((_a) => {
2819
+ var _b;
2809
2820
  var { nodeType, nodeData, useNodeForRefResolving = false, refResolver, nodeHasChanged } = _a, commonProps = __rest(_a, ["nodeType", "nodeData", "useNodeForRefResolving", "refResolver", "nodeHasChanged"]);
2810
2821
  const parsedNode = useParsedData(nodeType, nodeData);
2811
2822
  if (!parsedNode) {
2823
+ (_b = commonProps.nodeUnsupported) === null || _b === void 0 ? void 0 : _b.call(commonProps, 'dataEmpty');
2812
2824
  return null;
2813
2825
  }
2814
2826
  let elem = React.createElement(ParsedDocs, Object.assign({ node: parsedNode }, commonProps));
@@ -2818,7 +2830,7 @@ const Docs = React.memo((_a) => {
2818
2830
  return React.createElement(ElementsOptionsProvider, { nodeHasChanged: nodeHasChanged }, elem);
2819
2831
  });
2820
2832
  const ParsedDocs = (_a) => {
2821
- var { node } = _a, commonProps = __rest(_a, ["node"]);
2833
+ var { node, nodeUnsupported } = _a, commonProps = __rest(_a, ["node", "nodeUnsupported"]);
2822
2834
  switch (node.type) {
2823
2835
  case 'article':
2824
2836
  return React.createElement(Article, Object.assign({ data: node.data }, commonProps));
@@ -2829,6 +2841,7 @@ const ParsedDocs = (_a) => {
2829
2841
  case 'model':
2830
2842
  return React.createElement(Model, Object.assign({ data: node.data }, commonProps));
2831
2843
  default:
2844
+ nodeUnsupported === null || nodeUnsupported === void 0 ? void 0 : nodeUnsupported('invalidType');
2832
2845
  return null;
2833
2846
  }
2834
2847
  };
@@ -3026,12 +3039,22 @@ function useFirstRender() {
3026
3039
 
3027
3040
  const NODE_TYPE_TITLE_ICON = {
3028
3041
  http_service: faCloud,
3042
+ http_operation: faBullseye,
3043
+ model: faCube,
3044
+ };
3045
+ const NODE_TITLE_ICON = {
3046
+ Schemas: faCubes,
3029
3047
  };
3030
3048
  const NODE_TYPE_META_ICON = {
3031
3049
  model: faCube,
3032
3050
  };
3033
3051
  const NODE_TYPE_ICON_COLOR = {
3034
3052
  model: 'warning',
3053
+ http_service: '#D812EA',
3054
+ http_operation: '#9747FF',
3055
+ };
3056
+ const NODE_TITLE_ICON_COLOR = {
3057
+ Schemas: 'warning',
3035
3058
  };
3036
3059
  const NODE_META_COLOR = {
3037
3060
  get: 'success',
@@ -3098,7 +3121,7 @@ function isExternalLink(item) {
3098
3121
 
3099
3122
  const ActiveIdContext = React.createContext(undefined);
3100
3123
  const LinkContext = React.createContext(undefined);
3101
- const TableOfContents = React.memo(({ tree, activeId, Link, maxDepthOpenByDefault, externalScrollbar = false, onLinkClick }) => {
3124
+ const TableOfContents = React.memo(({ tree, activeId, Link, maxDepthOpenByDefault, externalScrollbar = false, isInResponsiveMode = false, onLinkClick, }) => {
3102
3125
  const container = React.useRef(null);
3103
3126
  const child = React.useRef(null);
3104
3127
  const firstRender = useFirstRender();
@@ -3115,35 +3138,35 @@ const TableOfContents = React.memo(({ tree, activeId, Link, maxDepthOpenByDefaul
3115
3138
  }
3116
3139
  }, 0);
3117
3140
  }, [activeId]);
3118
- return (React.createElement(Box, { ref: container, w: "full", bg: "canvas-100", overflowY: "auto" },
3141
+ return (React.createElement(Box, { ref: container, w: "full", bg: isInResponsiveMode ? 'canvas' : 'canvas-100', overflowY: "auto" },
3119
3142
  React.createElement(Box, { ref: child, my: 3 },
3120
3143
  React.createElement(LinkContext.Provider, { value: Link },
3121
3144
  React.createElement(ActiveIdContext.Provider, { value: activeId }, tree.map((item, key) => {
3122
3145
  if (isDivider(item)) {
3123
- return React.createElement(Divider, { key: key, item: item });
3146
+ return React.createElement(Divider, { key: key, item: item, isInResponsiveMode: isInResponsiveMode });
3124
3147
  }
3125
- return (React.createElement(GroupItem, { key: key, item: item, depth: 0, maxDepthOpenByDefault: maxDepthOpenByDefault, onLinkClick: onLinkClick }));
3148
+ return (React.createElement(GroupItem, { key: key, item: item, depth: 0, maxDepthOpenByDefault: maxDepthOpenByDefault, onLinkClick: onLinkClick, isInResponsiveMode: isInResponsiveMode }));
3126
3149
  }))))));
3127
3150
  });
3128
- const Divider = React.memo(({ item }) => {
3129
- return (React.createElement(Box, { pl: 4, mb: 2, mt: 6, textTransform: "uppercase", fontSize: "sm", lineHeight: "relaxed", letterSpacing: "wide", fontWeight: "bold" }, item.title));
3151
+ const Divider = React.memo(({ item, isInResponsiveMode = false }) => {
3152
+ return (React.createElement(Box, { pl: 4, mb: 2, mt: 6, textTransform: "uppercase", fontSize: isInResponsiveMode ? 'lg' : 'sm', lineHeight: "relaxed", letterSpacing: "wide", fontWeight: "bold" }, item.title));
3130
3153
  });
3131
- const GroupItem = React.memo(({ item, depth, maxDepthOpenByDefault, onLinkClick }) => {
3154
+ const GroupItem = React.memo(({ item, depth, maxDepthOpenByDefault, isInResponsiveMode, onLinkClick }) => {
3132
3155
  if (isExternalLink(item)) {
3133
3156
  return (React.createElement(Box, { as: "a", href: item.url, target: "_blank", rel: "noopener noreferrer", display: "block" },
3134
- React.createElement(Item, { depth: depth, title: item.title, meta: React.createElement(Box, { as: Icon, icon: ['fas', 'external-link'] }) })));
3157
+ React.createElement(Item, { isInResponsiveMode: isInResponsiveMode, depth: depth, title: item.title, meta: React.createElement(Box, { as: Icon, icon: ['fas', 'external-link'] }) })));
3135
3158
  }
3136
3159
  else if (isGroup(item) || isNodeGroup(item)) {
3137
- return React.createElement(Group, { depth: depth, item: item, maxDepthOpenByDefault: maxDepthOpenByDefault, onLinkClick: onLinkClick });
3160
+ return (React.createElement(Group, { depth: depth, item: item, maxDepthOpenByDefault: maxDepthOpenByDefault, onLinkClick: onLinkClick, isInResponsiveMode: isInResponsiveMode }));
3138
3161
  }
3139
3162
  else if (isNode(item)) {
3140
- return (React.createElement(Node, { depth: depth, item: item, onLinkClick: onLinkClick, meta: item.meta ? (React.createElement(Box, { color: NODE_META_COLOR[item.meta], textTransform: "uppercase", fontWeight: "medium" }, item.meta)) : (NODE_TYPE_META_ICON[item.type] && (React.createElement(Flex, { alignItems: "center" },
3163
+ return (React.createElement(Node, { depth: depth, isInResponsiveMode: isInResponsiveMode, item: item, onLinkClick: onLinkClick, meta: item.meta ? (React.createElement(Box, { color: NODE_META_COLOR[item.meta], textTransform: "uppercase", fontWeight: "medium" }, item.meta)) : (NODE_TYPE_META_ICON[item.type] && (React.createElement(Flex, { alignItems: "center" },
3141
3164
  item.version && React.createElement(Version, { value: item.version }),
3142
- React.createElement(Box, { as: Icon, color: NODE_TYPE_ICON_COLOR[item.type], icon: NODE_TYPE_META_ICON[item.type] })))) }));
3165
+ item.type !== 'model' && (React.createElement(Box, { as: Icon, color: NODE_TYPE_ICON_COLOR[item.type], icon: NODE_TYPE_META_ICON[item.type] }))))) }));
3143
3166
  }
3144
3167
  return null;
3145
3168
  });
3146
- const Group = React.memo(({ depth, item, maxDepthOpenByDefault, onLinkClick = () => { } }) => {
3169
+ const Group = React.memo(({ depth, item, maxDepthOpenByDefault, isInResponsiveMode, onLinkClick = () => { } }) => {
3147
3170
  const activeId = React.useContext(ActiveIdContext);
3148
3171
  const [isOpen, setIsOpen] = React.useState(() => isGroupOpenByDefault(depth, item, activeId, maxDepthOpenByDefault));
3149
3172
  const hasActive = !!activeId && hasActiveItem(item.items, activeId);
@@ -3171,25 +3194,28 @@ const Group = React.memo(({ depth, item, maxDepthOpenByDefault, onLinkClick = ()
3171
3194
  const showAsActive = hasActive && !isOpen;
3172
3195
  let elem;
3173
3196
  if (isNodeGroup(item)) {
3174
- elem = (React.createElement(Node, { depth: depth, item: item, meta: meta, showAsActive: showAsActive, onClick: handleClick, onLinkClick: onLinkClick }));
3197
+ elem = (React.createElement(Node, { depth: depth, item: item, meta: meta, showAsActive: showAsActive, onClick: handleClick, onLinkClick: onLinkClick, isInResponsiveMode: isInResponsiveMode }));
3175
3198
  }
3176
3199
  else {
3177
- elem = React.createElement(Item, { title: item.title, meta: meta, onClick: handleClick, depth: depth, isActive: showAsActive });
3200
+ elem = (React.createElement(Item, { isInResponsiveMode: isInResponsiveMode, title: item.title, meta: meta, onClick: handleClick, depth: depth, isActive: showAsActive, icon: NODE_TITLE_ICON[item.title] && (React.createElement(Box, { as: Icon, color: NODE_TITLE_ICON_COLOR[item.title], icon: NODE_TITLE_ICON[item.title] })) }));
3178
3201
  }
3179
3202
  return (React.createElement(React.Fragment, null,
3180
3203
  elem,
3181
3204
  isOpen &&
3182
3205
  item.items.map((groupItem, key) => {
3183
- return React.createElement(GroupItem, { key: key, item: groupItem, depth: depth + 1, onLinkClick: onLinkClick });
3206
+ return (React.createElement(GroupItem, { key: key, item: groupItem, depth: depth + 1, onLinkClick: onLinkClick, isInResponsiveMode: isInResponsiveMode }));
3184
3207
  })));
3185
3208
  });
3186
- const Item = React.memo(({ depth, isActive, id, title, meta, icon, onClick }) => {
3187
- return (React.createElement(Flex, { id: id, bg: { default: isActive ? 'primary-tint' : 'canvas-100', hover: isActive ? undefined : 'canvas-200' }, cursor: "pointer", pl: 4 + depth * 4, pr: 4, h: "md", align: "center", userSelect: "none", onClick: onClick, title: title },
3209
+ const Item = React.memo(({ depth, isActive, id, title, meta, icon, isInResponsiveMode, onClick }) => {
3210
+ return (React.createElement(Flex, { id: id, bg: {
3211
+ default: isInResponsiveMode ? 'canvas' : isActive ? 'primary-tint' : 'canvas-100',
3212
+ hover: isActive ? undefined : 'canvas-200',
3213
+ }, cursor: "pointer", pl: 4 + depth * 4, pr: 4, h: isInResponsiveMode ? 'lg' : 'md', align: "center", userSelect: "none", onClick: onClick, title: title },
3188
3214
  icon,
3189
- React.createElement(Box, { alignItems: "center", flex: 1, mr: meta ? 1.5 : undefined, ml: icon && 1.5, textOverflow: "truncate" }, title),
3190
- React.createElement(Flex, { alignItems: "center", fontSize: "xs" }, meta)));
3215
+ React.createElement(Box, { alignItems: "center", flex: 1, mr: meta ? 1.5 : undefined, ml: icon && 1.5, textOverflow: "truncate", fontSize: isInResponsiveMode ? 'lg' : 'base' }, title),
3216
+ React.createElement(Flex, { alignItems: "center", fontSize: isInResponsiveMode ? 'base' : 'xs' }, meta)));
3191
3217
  });
3192
- const Node = React.memo(({ item, depth, meta, showAsActive, onClick, onLinkClick = () => { } }) => {
3218
+ const Node = React.memo(({ item, depth, meta, showAsActive, isInResponsiveMode, onClick, onLinkClick = () => { } }) => {
3193
3219
  const activeId = React.useContext(ActiveIdContext);
3194
3220
  const isActive = activeId === item.slug || activeId === item.id;
3195
3221
  const LinkComponent = React.useContext(LinkContext);
@@ -3206,7 +3232,7 @@ const Node = React.memo(({ item, depth, meta, showAsActive, onClick, onLinkClick
3206
3232
  }
3207
3233
  };
3208
3234
  return (React.createElement(Box, { as: LinkComponent, to: item.slug, display: "block", textDecoration: "no-underline", className: "ElementsTableOfContentsItem" },
3209
- React.createElement(Item, { id: getHtmlIdFromItemId(item.slug || item.id), isActive: isActive || showAsActive, depth: depth, title: item.title, icon: NODE_TYPE_TITLE_ICON[item.type] && (React.createElement(Box, { as: Icon, color: NODE_TYPE_ICON_COLOR[item.type], icon: NODE_TYPE_TITLE_ICON[item.type] })), meta: meta, onClick: handleClick })));
3235
+ React.createElement(Item, { id: getHtmlIdFromItemId(item.slug || item.id), isActive: isActive || showAsActive, depth: depth, title: item.title, icon: NODE_TYPE_TITLE_ICON[item.type] && (React.createElement(Box, { as: Icon, color: NODE_TYPE_ICON_COLOR[item.type], icon: NODE_TYPE_TITLE_ICON[item.type] })), meta: meta, isInResponsiveMode: isInResponsiveMode, onClick: handleClick })));
3210
3236
  });
3211
3237
  const Version = ({ value }) => {
3212
3238
  return (React.createElement(Box, { mr: 2 },
package/index.js CHANGED
@@ -349,6 +349,11 @@ var faBookOpen = {
349
349
  iconName: 'book-open',
350
350
  icon: [576, 512, [128366, 128214], "f518", "M144.3 32.04C106.9 31.29 63.7 41.44 18.6 61.29c-11.42 5.026-18.6 16.67-18.6 29.15l0 357.6c0 11.55 11.99 19.55 22.45 14.65c126.3-59.14 219.8 11 223.8 14.01C249.1 478.9 252.5 480 256 480c12.4 0 16-11.38 16-15.98V80.04c0-5.203-2.531-10.08-6.781-13.08C263.3 65.58 216.7 33.35 144.3 32.04zM557.4 61.29c-45.11-19.79-88.48-29.61-125.7-29.26c-72.44 1.312-118.1 33.55-120.9 34.92C306.5 69.96 304 74.83 304 80.04v383.1C304 468.4 307.5 480 320 480c3.484 0 6.938-1.125 9.781-3.328c3.925-3.018 97.44-73.16 223.8-14c10.46 4.896 22.45-3.105 22.45-14.65l.0001-357.6C575.1 77.97 568.8 66.31 557.4 61.29z"]
351
351
  };
352
+ var faBullseye = {
353
+ prefix: 'fas',
354
+ iconName: 'bullseye',
355
+ icon: [512, 512, [], "f140", "M288 256C288 273.7 273.7 288 256 288C238.3 288 224 273.7 224 256C224 238.3 238.3 224 256 224C273.7 224 288 238.3 288 256zM112 256C112 176.5 176.5 112 256 112C335.5 112 400 176.5 400 256C400 335.5 335.5 400 256 400C176.5 400 112 335.5 112 256zM256 336C300.2 336 336 300.2 336 256C336 211.8 300.2 176 256 176C211.8 176 176 211.8 176 256C176 300.2 211.8 336 256 336zM512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256zM256 64C149.1 64 64 149.1 64 256C64 362 149.1 448 256 448C362 448 448 362 448 256C448 149.1 362 64 256 64z"]
356
+ };
352
357
  var faCircleQuestion = {
353
358
  prefix: 'fas',
354
359
  iconName: 'circle-question',
@@ -370,6 +375,11 @@ var faCube = {
370
375
  iconName: 'cube',
371
376
  icon: [512, 512, [], "f1b2", "M234.5 5.709C248.4 .7377 263.6 .7377 277.5 5.709L469.5 74.28C494.1 83.38 512 107.5 512 134.6V377.4C512 404.5 494.1 428.6 469.5 437.7L277.5 506.3C263.6 511.3 248.4 511.3 234.5 506.3L42.47 437.7C17 428.6 0 404.5 0 377.4V134.6C0 107.5 17 83.38 42.47 74.28L234.5 5.709zM256 65.98L82.34 128L256 190L429.7 128L256 65.98zM288 434.6L448 377.4V189.4L288 246.6V434.6z"]
372
377
  };
378
+ var faCubes = {
379
+ prefix: 'fas',
380
+ iconName: 'cubes',
381
+ icon: [576, 512, [], "f1b3", "M172.1 40.16L268.1 3.76C280.9-1.089 295.1-1.089 307.9 3.76L403.9 40.16C425.6 48.41 440 69.25 440 92.52V204.7C441.3 205.1 442.6 205.5 443.9 205.1L539.9 242.4C561.6 250.6 576 271.5 576 294.7V413.9C576 436.1 562.9 456.2 542.5 465.1L446.5 507.3C432.2 513.7 415.8 513.7 401.5 507.3L288 457.5L174.5 507.3C160.2 513.7 143.8 513.7 129.5 507.3L33.46 465.1C13.13 456.2 0 436.1 0 413.9V294.7C0 271.5 14.39 250.6 36.15 242.4L132.1 205.1C133.4 205.5 134.7 205.1 136 204.7V92.52C136 69.25 150.4 48.41 172.1 40.16V40.16zM290.8 48.64C289 47.95 286.1 47.95 285.2 48.64L206.8 78.35L287.1 109.5L369.2 78.35L290.8 48.64zM392 210.6V121L309.6 152.6V241.8L392 210.6zM154.8 250.9C153 250.2 150.1 250.2 149.2 250.9L70.81 280.6L152 311.7L233.2 280.6L154.8 250.9zM173.6 455.3L256 419.1V323.2L173.6 354.8V455.3zM342.8 280.6L424 311.7L505.2 280.6L426.8 250.9C425 250.2 422.1 250.2 421.2 250.9L342.8 280.6zM528 413.9V323.2L445.6 354.8V455.3L523.2 421.2C526.1 419.9 528 417.1 528 413.9V413.9z"]
382
+ };
373
383
  var faDatabase = {
374
384
  prefix: 'fas',
375
385
  iconName: 'database',
@@ -2862,9 +2872,11 @@ const ModelExamples = React__namespace.memo(({ data, isCollapsible = false }) =>
2862
2872
  const Model = reactErrorBoundary.withErrorBoundary(ModelComponent, { recoverableProps: ['data'] });
2863
2873
 
2864
2874
  const Docs = React__namespace.memo((_a) => {
2875
+ var _b;
2865
2876
  var { nodeType, nodeData, useNodeForRefResolving = false, refResolver, nodeHasChanged } = _a, commonProps = tslib.__rest(_a, ["nodeType", "nodeData", "useNodeForRefResolving", "refResolver", "nodeHasChanged"]);
2866
2877
  const parsedNode = useParsedData(nodeType, nodeData);
2867
2878
  if (!parsedNode) {
2879
+ (_b = commonProps.nodeUnsupported) === null || _b === void 0 ? void 0 : _b.call(commonProps, 'dataEmpty');
2868
2880
  return null;
2869
2881
  }
2870
2882
  let elem = React__namespace.createElement(ParsedDocs, Object.assign({ node: parsedNode }, commonProps));
@@ -2874,7 +2886,7 @@ const Docs = React__namespace.memo((_a) => {
2874
2886
  return React__namespace.createElement(ElementsOptionsProvider, { nodeHasChanged: nodeHasChanged }, elem);
2875
2887
  });
2876
2888
  const ParsedDocs = (_a) => {
2877
- var { node } = _a, commonProps = tslib.__rest(_a, ["node"]);
2889
+ var { node, nodeUnsupported } = _a, commonProps = tslib.__rest(_a, ["node", "nodeUnsupported"]);
2878
2890
  switch (node.type) {
2879
2891
  case 'article':
2880
2892
  return React__namespace.createElement(Article, Object.assign({ data: node.data }, commonProps));
@@ -2885,6 +2897,7 @@ const ParsedDocs = (_a) => {
2885
2897
  case 'model':
2886
2898
  return React__namespace.createElement(Model, Object.assign({ data: node.data }, commonProps));
2887
2899
  default:
2900
+ nodeUnsupported === null || nodeUnsupported === void 0 ? void 0 : nodeUnsupported('invalidType');
2888
2901
  return null;
2889
2902
  }
2890
2903
  };
@@ -3082,12 +3095,22 @@ function useFirstRender() {
3082
3095
 
3083
3096
  const NODE_TYPE_TITLE_ICON = {
3084
3097
  http_service: faCloud,
3098
+ http_operation: faBullseye,
3099
+ model: faCube,
3100
+ };
3101
+ const NODE_TITLE_ICON = {
3102
+ Schemas: faCubes,
3085
3103
  };
3086
3104
  const NODE_TYPE_META_ICON = {
3087
3105
  model: faCube,
3088
3106
  };
3089
3107
  const NODE_TYPE_ICON_COLOR = {
3090
3108
  model: 'warning',
3109
+ http_service: '#D812EA',
3110
+ http_operation: '#9747FF',
3111
+ };
3112
+ const NODE_TITLE_ICON_COLOR = {
3113
+ Schemas: 'warning',
3091
3114
  };
3092
3115
  const NODE_META_COLOR = {
3093
3116
  get: 'success',
@@ -3154,7 +3177,7 @@ function isExternalLink(item) {
3154
3177
 
3155
3178
  const ActiveIdContext = React__namespace.createContext(undefined);
3156
3179
  const LinkContext = React__namespace.createContext(undefined);
3157
- const TableOfContents = React__namespace.memo(({ tree, activeId, Link, maxDepthOpenByDefault, externalScrollbar = false, onLinkClick }) => {
3180
+ const TableOfContents = React__namespace.memo(({ tree, activeId, Link, maxDepthOpenByDefault, externalScrollbar = false, isInResponsiveMode = false, onLinkClick, }) => {
3158
3181
  const container = React__namespace.useRef(null);
3159
3182
  const child = React__namespace.useRef(null);
3160
3183
  const firstRender = useFirstRender();
@@ -3171,35 +3194,35 @@ const TableOfContents = React__namespace.memo(({ tree, activeId, Link, maxDepthO
3171
3194
  }
3172
3195
  }, 0);
3173
3196
  }, [activeId]);
3174
- return (React__namespace.createElement(mosaic.Box, { ref: container, w: "full", bg: "canvas-100", overflowY: "auto" },
3197
+ return (React__namespace.createElement(mosaic.Box, { ref: container, w: "full", bg: isInResponsiveMode ? 'canvas' : 'canvas-100', overflowY: "auto" },
3175
3198
  React__namespace.createElement(mosaic.Box, { ref: child, my: 3 },
3176
3199
  React__namespace.createElement(LinkContext.Provider, { value: Link },
3177
3200
  React__namespace.createElement(ActiveIdContext.Provider, { value: activeId }, tree.map((item, key) => {
3178
3201
  if (isDivider(item)) {
3179
- return React__namespace.createElement(Divider, { key: key, item: item });
3202
+ return React__namespace.createElement(Divider, { key: key, item: item, isInResponsiveMode: isInResponsiveMode });
3180
3203
  }
3181
- return (React__namespace.createElement(GroupItem, { key: key, item: item, depth: 0, maxDepthOpenByDefault: maxDepthOpenByDefault, onLinkClick: onLinkClick }));
3204
+ return (React__namespace.createElement(GroupItem, { key: key, item: item, depth: 0, maxDepthOpenByDefault: maxDepthOpenByDefault, onLinkClick: onLinkClick, isInResponsiveMode: isInResponsiveMode }));
3182
3205
  }))))));
3183
3206
  });
3184
- const Divider = React__namespace.memo(({ item }) => {
3185
- return (React__namespace.createElement(mosaic.Box, { pl: 4, mb: 2, mt: 6, textTransform: "uppercase", fontSize: "sm", lineHeight: "relaxed", letterSpacing: "wide", fontWeight: "bold" }, item.title));
3207
+ const Divider = React__namespace.memo(({ item, isInResponsiveMode = false }) => {
3208
+ return (React__namespace.createElement(mosaic.Box, { pl: 4, mb: 2, mt: 6, textTransform: "uppercase", fontSize: isInResponsiveMode ? 'lg' : 'sm', lineHeight: "relaxed", letterSpacing: "wide", fontWeight: "bold" }, item.title));
3186
3209
  });
3187
- const GroupItem = React__namespace.memo(({ item, depth, maxDepthOpenByDefault, onLinkClick }) => {
3210
+ const GroupItem = React__namespace.memo(({ item, depth, maxDepthOpenByDefault, isInResponsiveMode, onLinkClick }) => {
3188
3211
  if (isExternalLink(item)) {
3189
3212
  return (React__namespace.createElement(mosaic.Box, { as: "a", href: item.url, target: "_blank", rel: "noopener noreferrer", display: "block" },
3190
- React__namespace.createElement(Item, { depth: depth, title: item.title, meta: React__namespace.createElement(mosaic.Box, { as: mosaic.Icon, icon: ['fas', 'external-link'] }) })));
3213
+ React__namespace.createElement(Item, { isInResponsiveMode: isInResponsiveMode, depth: depth, title: item.title, meta: React__namespace.createElement(mosaic.Box, { as: mosaic.Icon, icon: ['fas', 'external-link'] }) })));
3191
3214
  }
3192
3215
  else if (isGroup(item) || isNodeGroup(item)) {
3193
- return React__namespace.createElement(Group, { depth: depth, item: item, maxDepthOpenByDefault: maxDepthOpenByDefault, onLinkClick: onLinkClick });
3216
+ return (React__namespace.createElement(Group, { depth: depth, item: item, maxDepthOpenByDefault: maxDepthOpenByDefault, onLinkClick: onLinkClick, isInResponsiveMode: isInResponsiveMode }));
3194
3217
  }
3195
3218
  else if (isNode(item)) {
3196
- return (React__namespace.createElement(Node, { depth: depth, item: item, onLinkClick: onLinkClick, meta: item.meta ? (React__namespace.createElement(mosaic.Box, { color: NODE_META_COLOR[item.meta], textTransform: "uppercase", fontWeight: "medium" }, item.meta)) : (NODE_TYPE_META_ICON[item.type] && (React__namespace.createElement(mosaic.Flex, { alignItems: "center" },
3219
+ return (React__namespace.createElement(Node, { depth: depth, isInResponsiveMode: isInResponsiveMode, item: item, onLinkClick: onLinkClick, meta: item.meta ? (React__namespace.createElement(mosaic.Box, { color: NODE_META_COLOR[item.meta], textTransform: "uppercase", fontWeight: "medium" }, item.meta)) : (NODE_TYPE_META_ICON[item.type] && (React__namespace.createElement(mosaic.Flex, { alignItems: "center" },
3197
3220
  item.version && React__namespace.createElement(Version, { value: item.version }),
3198
- React__namespace.createElement(mosaic.Box, { as: mosaic.Icon, color: NODE_TYPE_ICON_COLOR[item.type], icon: NODE_TYPE_META_ICON[item.type] })))) }));
3221
+ item.type !== 'model' && (React__namespace.createElement(mosaic.Box, { as: mosaic.Icon, color: NODE_TYPE_ICON_COLOR[item.type], icon: NODE_TYPE_META_ICON[item.type] }))))) }));
3199
3222
  }
3200
3223
  return null;
3201
3224
  });
3202
- const Group = React__namespace.memo(({ depth, item, maxDepthOpenByDefault, onLinkClick = () => { } }) => {
3225
+ const Group = React__namespace.memo(({ depth, item, maxDepthOpenByDefault, isInResponsiveMode, onLinkClick = () => { } }) => {
3203
3226
  const activeId = React__namespace.useContext(ActiveIdContext);
3204
3227
  const [isOpen, setIsOpen] = React__namespace.useState(() => isGroupOpenByDefault(depth, item, activeId, maxDepthOpenByDefault));
3205
3228
  const hasActive = !!activeId && hasActiveItem(item.items, activeId);
@@ -3227,25 +3250,28 @@ const Group = React__namespace.memo(({ depth, item, maxDepthOpenByDefault, onLin
3227
3250
  const showAsActive = hasActive && !isOpen;
3228
3251
  let elem;
3229
3252
  if (isNodeGroup(item)) {
3230
- elem = (React__namespace.createElement(Node, { depth: depth, item: item, meta: meta, showAsActive: showAsActive, onClick: handleClick, onLinkClick: onLinkClick }));
3253
+ elem = (React__namespace.createElement(Node, { depth: depth, item: item, meta: meta, showAsActive: showAsActive, onClick: handleClick, onLinkClick: onLinkClick, isInResponsiveMode: isInResponsiveMode }));
3231
3254
  }
3232
3255
  else {
3233
- elem = React__namespace.createElement(Item, { title: item.title, meta: meta, onClick: handleClick, depth: depth, isActive: showAsActive });
3256
+ elem = (React__namespace.createElement(Item, { isInResponsiveMode: isInResponsiveMode, title: item.title, meta: meta, onClick: handleClick, depth: depth, isActive: showAsActive, icon: NODE_TITLE_ICON[item.title] && (React__namespace.createElement(mosaic.Box, { as: mosaic.Icon, color: NODE_TITLE_ICON_COLOR[item.title], icon: NODE_TITLE_ICON[item.title] })) }));
3234
3257
  }
3235
3258
  return (React__namespace.createElement(React__namespace.Fragment, null,
3236
3259
  elem,
3237
3260
  isOpen &&
3238
3261
  item.items.map((groupItem, key) => {
3239
- return React__namespace.createElement(GroupItem, { key: key, item: groupItem, depth: depth + 1, onLinkClick: onLinkClick });
3262
+ return (React__namespace.createElement(GroupItem, { key: key, item: groupItem, depth: depth + 1, onLinkClick: onLinkClick, isInResponsiveMode: isInResponsiveMode }));
3240
3263
  })));
3241
3264
  });
3242
- const Item = React__namespace.memo(({ depth, isActive, id, title, meta, icon, onClick }) => {
3243
- return (React__namespace.createElement(mosaic.Flex, { id: id, bg: { default: isActive ? 'primary-tint' : 'canvas-100', hover: isActive ? undefined : 'canvas-200' }, cursor: "pointer", pl: 4 + depth * 4, pr: 4, h: "md", align: "center", userSelect: "none", onClick: onClick, title: title },
3265
+ const Item = React__namespace.memo(({ depth, isActive, id, title, meta, icon, isInResponsiveMode, onClick }) => {
3266
+ return (React__namespace.createElement(mosaic.Flex, { id: id, bg: {
3267
+ default: isInResponsiveMode ? 'canvas' : isActive ? 'primary-tint' : 'canvas-100',
3268
+ hover: isActive ? undefined : 'canvas-200',
3269
+ }, cursor: "pointer", pl: 4 + depth * 4, pr: 4, h: isInResponsiveMode ? 'lg' : 'md', align: "center", userSelect: "none", onClick: onClick, title: title },
3244
3270
  icon,
3245
- React__namespace.createElement(mosaic.Box, { alignItems: "center", flex: 1, mr: meta ? 1.5 : undefined, ml: icon && 1.5, textOverflow: "truncate" }, title),
3246
- React__namespace.createElement(mosaic.Flex, { alignItems: "center", fontSize: "xs" }, meta)));
3271
+ React__namespace.createElement(mosaic.Box, { alignItems: "center", flex: 1, mr: meta ? 1.5 : undefined, ml: icon && 1.5, textOverflow: "truncate", fontSize: isInResponsiveMode ? 'lg' : 'base' }, title),
3272
+ React__namespace.createElement(mosaic.Flex, { alignItems: "center", fontSize: isInResponsiveMode ? 'base' : 'xs' }, meta)));
3247
3273
  });
3248
- const Node = React__namespace.memo(({ item, depth, meta, showAsActive, onClick, onLinkClick = () => { } }) => {
3274
+ const Node = React__namespace.memo(({ item, depth, meta, showAsActive, isInResponsiveMode, onClick, onLinkClick = () => { } }) => {
3249
3275
  const activeId = React__namespace.useContext(ActiveIdContext);
3250
3276
  const isActive = activeId === item.slug || activeId === item.id;
3251
3277
  const LinkComponent = React__namespace.useContext(LinkContext);
@@ -3262,7 +3288,7 @@ const Node = React__namespace.memo(({ item, depth, meta, showAsActive, onClick,
3262
3288
  }
3263
3289
  };
3264
3290
  return (React__namespace.createElement(mosaic.Box, { as: LinkComponent, to: item.slug, display: "block", textDecoration: "no-underline", className: "ElementsTableOfContentsItem" },
3265
- React__namespace.createElement(Item, { id: getHtmlIdFromItemId(item.slug || item.id), isActive: isActive || showAsActive, depth: depth, title: item.title, icon: NODE_TYPE_TITLE_ICON[item.type] && (React__namespace.createElement(mosaic.Box, { as: mosaic.Icon, color: NODE_TYPE_ICON_COLOR[item.type], icon: NODE_TYPE_TITLE_ICON[item.type] })), meta: meta, onClick: handleClick })));
3291
+ React__namespace.createElement(Item, { id: getHtmlIdFromItemId(item.slug || item.id), isActive: isActive || showAsActive, depth: depth, title: item.title, icon: NODE_TYPE_TITLE_ICON[item.type] && (React__namespace.createElement(mosaic.Box, { as: mosaic.Icon, color: NODE_TYPE_ICON_COLOR[item.type], icon: NODE_TYPE_TITLE_ICON[item.type] })), meta: meta, isInResponsiveMode: isInResponsiveMode, onClick: handleClick })));
3266
3292
  });
3267
3293
  const Version = ({ value }) => {
3268
3294
  return (React__namespace.createElement(mosaic.Box, { mr: 2 },
package/index.mjs CHANGED
@@ -293,6 +293,11 @@ var faBookOpen = {
293
293
  iconName: 'book-open',
294
294
  icon: [576, 512, [128366, 128214], "f518", "M144.3 32.04C106.9 31.29 63.7 41.44 18.6 61.29c-11.42 5.026-18.6 16.67-18.6 29.15l0 357.6c0 11.55 11.99 19.55 22.45 14.65c126.3-59.14 219.8 11 223.8 14.01C249.1 478.9 252.5 480 256 480c12.4 0 16-11.38 16-15.98V80.04c0-5.203-2.531-10.08-6.781-13.08C263.3 65.58 216.7 33.35 144.3 32.04zM557.4 61.29c-45.11-19.79-88.48-29.61-125.7-29.26c-72.44 1.312-118.1 33.55-120.9 34.92C306.5 69.96 304 74.83 304 80.04v383.1C304 468.4 307.5 480 320 480c3.484 0 6.938-1.125 9.781-3.328c3.925-3.018 97.44-73.16 223.8-14c10.46 4.896 22.45-3.105 22.45-14.65l.0001-357.6C575.1 77.97 568.8 66.31 557.4 61.29z"]
295
295
  };
296
+ var faBullseye = {
297
+ prefix: 'fas',
298
+ iconName: 'bullseye',
299
+ icon: [512, 512, [], "f140", "M288 256C288 273.7 273.7 288 256 288C238.3 288 224 273.7 224 256C224 238.3 238.3 224 256 224C273.7 224 288 238.3 288 256zM112 256C112 176.5 176.5 112 256 112C335.5 112 400 176.5 400 256C400 335.5 335.5 400 256 400C176.5 400 112 335.5 112 256zM256 336C300.2 336 336 300.2 336 256C336 211.8 300.2 176 256 176C211.8 176 176 211.8 176 256C176 300.2 211.8 336 256 336zM512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256zM256 64C149.1 64 64 149.1 64 256C64 362 149.1 448 256 448C362 448 448 362 448 256C448 149.1 362 64 256 64z"]
300
+ };
296
301
  var faCircleQuestion = {
297
302
  prefix: 'fas',
298
303
  iconName: 'circle-question',
@@ -314,6 +319,11 @@ var faCube = {
314
319
  iconName: 'cube',
315
320
  icon: [512, 512, [], "f1b2", "M234.5 5.709C248.4 .7377 263.6 .7377 277.5 5.709L469.5 74.28C494.1 83.38 512 107.5 512 134.6V377.4C512 404.5 494.1 428.6 469.5 437.7L277.5 506.3C263.6 511.3 248.4 511.3 234.5 506.3L42.47 437.7C17 428.6 0 404.5 0 377.4V134.6C0 107.5 17 83.38 42.47 74.28L234.5 5.709zM256 65.98L82.34 128L256 190L429.7 128L256 65.98zM288 434.6L448 377.4V189.4L288 246.6V434.6z"]
316
321
  };
322
+ var faCubes = {
323
+ prefix: 'fas',
324
+ iconName: 'cubes',
325
+ icon: [576, 512, [], "f1b3", "M172.1 40.16L268.1 3.76C280.9-1.089 295.1-1.089 307.9 3.76L403.9 40.16C425.6 48.41 440 69.25 440 92.52V204.7C441.3 205.1 442.6 205.5 443.9 205.1L539.9 242.4C561.6 250.6 576 271.5 576 294.7V413.9C576 436.1 562.9 456.2 542.5 465.1L446.5 507.3C432.2 513.7 415.8 513.7 401.5 507.3L288 457.5L174.5 507.3C160.2 513.7 143.8 513.7 129.5 507.3L33.46 465.1C13.13 456.2 0 436.1 0 413.9V294.7C0 271.5 14.39 250.6 36.15 242.4L132.1 205.1C133.4 205.5 134.7 205.1 136 204.7V92.52C136 69.25 150.4 48.41 172.1 40.16V40.16zM290.8 48.64C289 47.95 286.1 47.95 285.2 48.64L206.8 78.35L287.1 109.5L369.2 78.35L290.8 48.64zM392 210.6V121L309.6 152.6V241.8L392 210.6zM154.8 250.9C153 250.2 150.1 250.2 149.2 250.9L70.81 280.6L152 311.7L233.2 280.6L154.8 250.9zM173.6 455.3L256 419.1V323.2L173.6 354.8V455.3zM342.8 280.6L424 311.7L505.2 280.6L426.8 250.9C425 250.2 422.1 250.2 421.2 250.9L342.8 280.6zM528 413.9V323.2L445.6 354.8V455.3L523.2 421.2C526.1 419.9 528 417.1 528 413.9V413.9z"]
326
+ };
317
327
  var faDatabase = {
318
328
  prefix: 'fas',
319
329
  iconName: 'database',
@@ -2806,9 +2816,11 @@ const ModelExamples = React.memo(({ data, isCollapsible = false }) => {
2806
2816
  const Model = withErrorBoundary(ModelComponent, { recoverableProps: ['data'] });
2807
2817
 
2808
2818
  const Docs = React.memo((_a) => {
2819
+ var _b;
2809
2820
  var { nodeType, nodeData, useNodeForRefResolving = false, refResolver, nodeHasChanged } = _a, commonProps = __rest(_a, ["nodeType", "nodeData", "useNodeForRefResolving", "refResolver", "nodeHasChanged"]);
2810
2821
  const parsedNode = useParsedData(nodeType, nodeData);
2811
2822
  if (!parsedNode) {
2823
+ (_b = commonProps.nodeUnsupported) === null || _b === void 0 ? void 0 : _b.call(commonProps, 'dataEmpty');
2812
2824
  return null;
2813
2825
  }
2814
2826
  let elem = React.createElement(ParsedDocs, Object.assign({ node: parsedNode }, commonProps));
@@ -2818,7 +2830,7 @@ const Docs = React.memo((_a) => {
2818
2830
  return React.createElement(ElementsOptionsProvider, { nodeHasChanged: nodeHasChanged }, elem);
2819
2831
  });
2820
2832
  const ParsedDocs = (_a) => {
2821
- var { node } = _a, commonProps = __rest(_a, ["node"]);
2833
+ var { node, nodeUnsupported } = _a, commonProps = __rest(_a, ["node", "nodeUnsupported"]);
2822
2834
  switch (node.type) {
2823
2835
  case 'article':
2824
2836
  return React.createElement(Article, Object.assign({ data: node.data }, commonProps));
@@ -2829,6 +2841,7 @@ const ParsedDocs = (_a) => {
2829
2841
  case 'model':
2830
2842
  return React.createElement(Model, Object.assign({ data: node.data }, commonProps));
2831
2843
  default:
2844
+ nodeUnsupported === null || nodeUnsupported === void 0 ? void 0 : nodeUnsupported('invalidType');
2832
2845
  return null;
2833
2846
  }
2834
2847
  };
@@ -3026,12 +3039,22 @@ function useFirstRender() {
3026
3039
 
3027
3040
  const NODE_TYPE_TITLE_ICON = {
3028
3041
  http_service: faCloud,
3042
+ http_operation: faBullseye,
3043
+ model: faCube,
3044
+ };
3045
+ const NODE_TITLE_ICON = {
3046
+ Schemas: faCubes,
3029
3047
  };
3030
3048
  const NODE_TYPE_META_ICON = {
3031
3049
  model: faCube,
3032
3050
  };
3033
3051
  const NODE_TYPE_ICON_COLOR = {
3034
3052
  model: 'warning',
3053
+ http_service: '#D812EA',
3054
+ http_operation: '#9747FF',
3055
+ };
3056
+ const NODE_TITLE_ICON_COLOR = {
3057
+ Schemas: 'warning',
3035
3058
  };
3036
3059
  const NODE_META_COLOR = {
3037
3060
  get: 'success',
@@ -3098,7 +3121,7 @@ function isExternalLink(item) {
3098
3121
 
3099
3122
  const ActiveIdContext = React.createContext(undefined);
3100
3123
  const LinkContext = React.createContext(undefined);
3101
- const TableOfContents = React.memo(({ tree, activeId, Link, maxDepthOpenByDefault, externalScrollbar = false, onLinkClick }) => {
3124
+ const TableOfContents = React.memo(({ tree, activeId, Link, maxDepthOpenByDefault, externalScrollbar = false, isInResponsiveMode = false, onLinkClick, }) => {
3102
3125
  const container = React.useRef(null);
3103
3126
  const child = React.useRef(null);
3104
3127
  const firstRender = useFirstRender();
@@ -3115,35 +3138,35 @@ const TableOfContents = React.memo(({ tree, activeId, Link, maxDepthOpenByDefaul
3115
3138
  }
3116
3139
  }, 0);
3117
3140
  }, [activeId]);
3118
- return (React.createElement(Box, { ref: container, w: "full", bg: "canvas-100", overflowY: "auto" },
3141
+ return (React.createElement(Box, { ref: container, w: "full", bg: isInResponsiveMode ? 'canvas' : 'canvas-100', overflowY: "auto" },
3119
3142
  React.createElement(Box, { ref: child, my: 3 },
3120
3143
  React.createElement(LinkContext.Provider, { value: Link },
3121
3144
  React.createElement(ActiveIdContext.Provider, { value: activeId }, tree.map((item, key) => {
3122
3145
  if (isDivider(item)) {
3123
- return React.createElement(Divider, { key: key, item: item });
3146
+ return React.createElement(Divider, { key: key, item: item, isInResponsiveMode: isInResponsiveMode });
3124
3147
  }
3125
- return (React.createElement(GroupItem, { key: key, item: item, depth: 0, maxDepthOpenByDefault: maxDepthOpenByDefault, onLinkClick: onLinkClick }));
3148
+ return (React.createElement(GroupItem, { key: key, item: item, depth: 0, maxDepthOpenByDefault: maxDepthOpenByDefault, onLinkClick: onLinkClick, isInResponsiveMode: isInResponsiveMode }));
3126
3149
  }))))));
3127
3150
  });
3128
- const Divider = React.memo(({ item }) => {
3129
- return (React.createElement(Box, { pl: 4, mb: 2, mt: 6, textTransform: "uppercase", fontSize: "sm", lineHeight: "relaxed", letterSpacing: "wide", fontWeight: "bold" }, item.title));
3151
+ const Divider = React.memo(({ item, isInResponsiveMode = false }) => {
3152
+ return (React.createElement(Box, { pl: 4, mb: 2, mt: 6, textTransform: "uppercase", fontSize: isInResponsiveMode ? 'lg' : 'sm', lineHeight: "relaxed", letterSpacing: "wide", fontWeight: "bold" }, item.title));
3130
3153
  });
3131
- const GroupItem = React.memo(({ item, depth, maxDepthOpenByDefault, onLinkClick }) => {
3154
+ const GroupItem = React.memo(({ item, depth, maxDepthOpenByDefault, isInResponsiveMode, onLinkClick }) => {
3132
3155
  if (isExternalLink(item)) {
3133
3156
  return (React.createElement(Box, { as: "a", href: item.url, target: "_blank", rel: "noopener noreferrer", display: "block" },
3134
- React.createElement(Item, { depth: depth, title: item.title, meta: React.createElement(Box, { as: Icon, icon: ['fas', 'external-link'] }) })));
3157
+ React.createElement(Item, { isInResponsiveMode: isInResponsiveMode, depth: depth, title: item.title, meta: React.createElement(Box, { as: Icon, icon: ['fas', 'external-link'] }) })));
3135
3158
  }
3136
3159
  else if (isGroup(item) || isNodeGroup(item)) {
3137
- return React.createElement(Group, { depth: depth, item: item, maxDepthOpenByDefault: maxDepthOpenByDefault, onLinkClick: onLinkClick });
3160
+ return (React.createElement(Group, { depth: depth, item: item, maxDepthOpenByDefault: maxDepthOpenByDefault, onLinkClick: onLinkClick, isInResponsiveMode: isInResponsiveMode }));
3138
3161
  }
3139
3162
  else if (isNode(item)) {
3140
- return (React.createElement(Node, { depth: depth, item: item, onLinkClick: onLinkClick, meta: item.meta ? (React.createElement(Box, { color: NODE_META_COLOR[item.meta], textTransform: "uppercase", fontWeight: "medium" }, item.meta)) : (NODE_TYPE_META_ICON[item.type] && (React.createElement(Flex, { alignItems: "center" },
3163
+ return (React.createElement(Node, { depth: depth, isInResponsiveMode: isInResponsiveMode, item: item, onLinkClick: onLinkClick, meta: item.meta ? (React.createElement(Box, { color: NODE_META_COLOR[item.meta], textTransform: "uppercase", fontWeight: "medium" }, item.meta)) : (NODE_TYPE_META_ICON[item.type] && (React.createElement(Flex, { alignItems: "center" },
3141
3164
  item.version && React.createElement(Version, { value: item.version }),
3142
- React.createElement(Box, { as: Icon, color: NODE_TYPE_ICON_COLOR[item.type], icon: NODE_TYPE_META_ICON[item.type] })))) }));
3165
+ item.type !== 'model' && (React.createElement(Box, { as: Icon, color: NODE_TYPE_ICON_COLOR[item.type], icon: NODE_TYPE_META_ICON[item.type] }))))) }));
3143
3166
  }
3144
3167
  return null;
3145
3168
  });
3146
- const Group = React.memo(({ depth, item, maxDepthOpenByDefault, onLinkClick = () => { } }) => {
3169
+ const Group = React.memo(({ depth, item, maxDepthOpenByDefault, isInResponsiveMode, onLinkClick = () => { } }) => {
3147
3170
  const activeId = React.useContext(ActiveIdContext);
3148
3171
  const [isOpen, setIsOpen] = React.useState(() => isGroupOpenByDefault(depth, item, activeId, maxDepthOpenByDefault));
3149
3172
  const hasActive = !!activeId && hasActiveItem(item.items, activeId);
@@ -3171,25 +3194,28 @@ const Group = React.memo(({ depth, item, maxDepthOpenByDefault, onLinkClick = ()
3171
3194
  const showAsActive = hasActive && !isOpen;
3172
3195
  let elem;
3173
3196
  if (isNodeGroup(item)) {
3174
- elem = (React.createElement(Node, { depth: depth, item: item, meta: meta, showAsActive: showAsActive, onClick: handleClick, onLinkClick: onLinkClick }));
3197
+ elem = (React.createElement(Node, { depth: depth, item: item, meta: meta, showAsActive: showAsActive, onClick: handleClick, onLinkClick: onLinkClick, isInResponsiveMode: isInResponsiveMode }));
3175
3198
  }
3176
3199
  else {
3177
- elem = React.createElement(Item, { title: item.title, meta: meta, onClick: handleClick, depth: depth, isActive: showAsActive });
3200
+ elem = (React.createElement(Item, { isInResponsiveMode: isInResponsiveMode, title: item.title, meta: meta, onClick: handleClick, depth: depth, isActive: showAsActive, icon: NODE_TITLE_ICON[item.title] && (React.createElement(Box, { as: Icon, color: NODE_TITLE_ICON_COLOR[item.title], icon: NODE_TITLE_ICON[item.title] })) }));
3178
3201
  }
3179
3202
  return (React.createElement(React.Fragment, null,
3180
3203
  elem,
3181
3204
  isOpen &&
3182
3205
  item.items.map((groupItem, key) => {
3183
- return React.createElement(GroupItem, { key: key, item: groupItem, depth: depth + 1, onLinkClick: onLinkClick });
3206
+ return (React.createElement(GroupItem, { key: key, item: groupItem, depth: depth + 1, onLinkClick: onLinkClick, isInResponsiveMode: isInResponsiveMode }));
3184
3207
  })));
3185
3208
  });
3186
- const Item = React.memo(({ depth, isActive, id, title, meta, icon, onClick }) => {
3187
- return (React.createElement(Flex, { id: id, bg: { default: isActive ? 'primary-tint' : 'canvas-100', hover: isActive ? undefined : 'canvas-200' }, cursor: "pointer", pl: 4 + depth * 4, pr: 4, h: "md", align: "center", userSelect: "none", onClick: onClick, title: title },
3209
+ const Item = React.memo(({ depth, isActive, id, title, meta, icon, isInResponsiveMode, onClick }) => {
3210
+ return (React.createElement(Flex, { id: id, bg: {
3211
+ default: isInResponsiveMode ? 'canvas' : isActive ? 'primary-tint' : 'canvas-100',
3212
+ hover: isActive ? undefined : 'canvas-200',
3213
+ }, cursor: "pointer", pl: 4 + depth * 4, pr: 4, h: isInResponsiveMode ? 'lg' : 'md', align: "center", userSelect: "none", onClick: onClick, title: title },
3188
3214
  icon,
3189
- React.createElement(Box, { alignItems: "center", flex: 1, mr: meta ? 1.5 : undefined, ml: icon && 1.5, textOverflow: "truncate" }, title),
3190
- React.createElement(Flex, { alignItems: "center", fontSize: "xs" }, meta)));
3215
+ React.createElement(Box, { alignItems: "center", flex: 1, mr: meta ? 1.5 : undefined, ml: icon && 1.5, textOverflow: "truncate", fontSize: isInResponsiveMode ? 'lg' : 'base' }, title),
3216
+ React.createElement(Flex, { alignItems: "center", fontSize: isInResponsiveMode ? 'base' : 'xs' }, meta)));
3191
3217
  });
3192
- const Node = React.memo(({ item, depth, meta, showAsActive, onClick, onLinkClick = () => { } }) => {
3218
+ const Node = React.memo(({ item, depth, meta, showAsActive, isInResponsiveMode, onClick, onLinkClick = () => { } }) => {
3193
3219
  const activeId = React.useContext(ActiveIdContext);
3194
3220
  const isActive = activeId === item.slug || activeId === item.id;
3195
3221
  const LinkComponent = React.useContext(LinkContext);
@@ -3206,7 +3232,7 @@ const Node = React.memo(({ item, depth, meta, showAsActive, onClick, onLinkClick
3206
3232
  }
3207
3233
  };
3208
3234
  return (React.createElement(Box, { as: LinkComponent, to: item.slug, display: "block", textDecoration: "no-underline", className: "ElementsTableOfContentsItem" },
3209
- React.createElement(Item, { id: getHtmlIdFromItemId(item.slug || item.id), isActive: isActive || showAsActive, depth: depth, title: item.title, icon: NODE_TYPE_TITLE_ICON[item.type] && (React.createElement(Box, { as: Icon, color: NODE_TYPE_ICON_COLOR[item.type], icon: NODE_TYPE_TITLE_ICON[item.type] })), meta: meta, onClick: handleClick })));
3235
+ React.createElement(Item, { id: getHtmlIdFromItemId(item.slug || item.id), isActive: isActive || showAsActive, depth: depth, title: item.title, icon: NODE_TYPE_TITLE_ICON[item.type] && (React.createElement(Box, { as: Icon, color: NODE_TYPE_ICON_COLOR[item.type], icon: NODE_TYPE_TITLE_ICON[item.type] })), meta: meta, isInResponsiveMode: isInResponsiveMode, onClick: handleClick })));
3210
3236
  });
3211
3237
  const Version = ({ value }) => {
3212
3238
  return (React.createElement(Box, { mr: 2 },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoplight/elements-core",
3
- "version": "7.10.0",
3
+ "version": "7.12.0",
4
4
  "main": "./index.js",
5
5
  "sideEffects": [
6
6
  "web-components.min.js",