@stoplight/elements 7.3.6 → 7.3.10

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.
package/index.esm.js CHANGED
@@ -88,21 +88,24 @@ const computeAPITree = (serviceNode, config = {}) => {
88
88
  });
89
89
  });
90
90
  groups.forEach(group => {
91
- tree.push({
92
- title: group.title,
93
- items: group.items.flatMap(operationNode => {
94
- if (mergedConfig.hideInternal && operationNode.data.internal) {
95
- return [];
96
- }
97
- return {
98
- id: operationNode.uri,
99
- slug: operationNode.uri,
100
- title: operationNode.name,
101
- type: operationNode.type,
102
- meta: operationNode.data.method,
103
- };
104
- }),
91
+ const items = group.items.flatMap(operationNode => {
92
+ if (mergedConfig.hideInternal && operationNode.data.internal) {
93
+ return [];
94
+ }
95
+ return {
96
+ id: operationNode.uri,
97
+ slug: operationNode.uri,
98
+ title: operationNode.name,
99
+ type: operationNode.type,
100
+ meta: operationNode.data.method,
101
+ };
105
102
  });
103
+ if (items.length > 0) {
104
+ tree.push({
105
+ title: group.title,
106
+ items,
107
+ });
108
+ }
106
109
  });
107
110
  }
108
111
  let schemaNodes = serviceNode.children.filter(node => node.type === NodeType.Model);
@@ -157,6 +160,7 @@ const APIWithSidebarLayout = ({ serviceNode, logo, hideTryIt, hideSchemas, hideI
157
160
  const { pathname } = location;
158
161
  const isRootPath = !pathname || pathname === '/';
159
162
  const node = isRootPath ? serviceNode : serviceNode.children.find(child => child.uri === pathname);
163
+ const layoutOptions = React.useMemo(() => ({ hideTryIt: hideTryIt, hideExport: hideExport || (node === null || node === void 0 ? void 0 : node.type) !== NodeType.HttpService }), [hideTryIt, hideExport, node]);
160
164
  if (!node) {
161
165
  const firstSlug = findFirstNodeSlug(tree);
162
166
  if (firstSlug) {
@@ -178,7 +182,7 @@ const APIWithSidebarLayout = ({ serviceNode, logo, hideTryIt, hideSchemas, hideI
178
182
  React.createElement(Flex, { flexGrow: true, flexShrink: true, overflowY: "auto", direction: "col" },
179
183
  React.createElement(TableOfContents, { tree: tree, activeId: pathname, Link: Link, onLinkClick: handleTocClick })),
180
184
  React.createElement(PoweredByLink, { source: serviceNode.name, pathname: pathname, packageType: "elements" })));
181
- return (React.createElement(SidebarLayout, { ref: container, sidebar: sidebar }, node && (React.createElement(ParsedDocs, { key: pathname, uri: pathname, node: node, nodeTitle: node.name, layoutOptions: { hideTryIt: hideTryIt, hideExport: hideExport || node.type !== NodeType.HttpService }, location: location, allowRouting: true, exportProps: exportProps, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy }))));
185
+ return (React.createElement(SidebarLayout, { ref: container, sidebar: sidebar }, node && (React.createElement(ParsedDocs, { key: pathname, uri: pathname, node: node, nodeTitle: node.name, layoutOptions: layoutOptions, location: location, allowRouting: true, exportProps: exportProps, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy }))));
182
186
  };
183
187
 
184
188
  const itemMatchesHash = (hash, item) => {
package/index.js CHANGED
@@ -115,21 +115,24 @@ const computeAPITree = (serviceNode, config = {}) => {
115
115
  });
116
116
  });
117
117
  groups.forEach(group => {
118
- tree.push({
119
- title: group.title,
120
- items: group.items.flatMap(operationNode => {
121
- if (mergedConfig.hideInternal && operationNode.data.internal) {
122
- return [];
123
- }
124
- return {
125
- id: operationNode.uri,
126
- slug: operationNode.uri,
127
- title: operationNode.name,
128
- type: operationNode.type,
129
- meta: operationNode.data.method,
130
- };
131
- }),
118
+ const items = group.items.flatMap(operationNode => {
119
+ if (mergedConfig.hideInternal && operationNode.data.internal) {
120
+ return [];
121
+ }
122
+ return {
123
+ id: operationNode.uri,
124
+ slug: operationNode.uri,
125
+ title: operationNode.name,
126
+ type: operationNode.type,
127
+ meta: operationNode.data.method,
128
+ };
132
129
  });
130
+ if (items.length > 0) {
131
+ tree.push({
132
+ title: group.title,
133
+ items,
134
+ });
135
+ }
133
136
  });
134
137
  }
135
138
  let schemaNodes = serviceNode.children.filter(node => node.type === types.NodeType.Model);
@@ -184,6 +187,7 @@ const APIWithSidebarLayout = ({ serviceNode, logo, hideTryIt, hideSchemas, hideI
184
187
  const { pathname } = location;
185
188
  const isRootPath = !pathname || pathname === '/';
186
189
  const node = isRootPath ? serviceNode : serviceNode.children.find(child => child.uri === pathname);
190
+ const layoutOptions = React__namespace.useMemo(() => ({ hideTryIt: hideTryIt, hideExport: hideExport || (node === null || node === void 0 ? void 0 : node.type) !== types.NodeType.HttpService }), [hideTryIt, hideExport, node]);
187
191
  if (!node) {
188
192
  const firstSlug = findFirstNodeSlug(tree);
189
193
  if (firstSlug) {
@@ -205,7 +209,7 @@ const APIWithSidebarLayout = ({ serviceNode, logo, hideTryIt, hideSchemas, hideI
205
209
  React__namespace.createElement(mosaic.Flex, { flexGrow: true, flexShrink: true, overflowY: "auto", direction: "col" },
206
210
  React__namespace.createElement(elementsCore.TableOfContents, { tree: tree, activeId: pathname, Link: reactRouterDom.Link, onLinkClick: handleTocClick })),
207
211
  React__namespace.createElement(elementsCore.PoweredByLink, { source: serviceNode.name, pathname: pathname, packageType: "elements" })));
208
- return (React__namespace.createElement(elementsCore.SidebarLayout, { ref: container, sidebar: sidebar }, node && (React__namespace.createElement(elementsCore.ParsedDocs, { key: pathname, uri: pathname, node: node, nodeTitle: node.name, layoutOptions: { hideTryIt: hideTryIt, hideExport: hideExport || node.type !== types.NodeType.HttpService }, location: location, allowRouting: true, exportProps: exportProps, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy }))));
212
+ return (React__namespace.createElement(elementsCore.SidebarLayout, { ref: container, sidebar: sidebar }, node && (React__namespace.createElement(elementsCore.ParsedDocs, { key: pathname, uri: pathname, node: node, nodeTitle: node.name, layoutOptions: layoutOptions, location: location, allowRouting: true, exportProps: exportProps, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy }))));
209
213
  };
210
214
 
211
215
  const itemMatchesHash = (hash, item) => {
package/index.mjs CHANGED
@@ -88,21 +88,24 @@ const computeAPITree = (serviceNode, config = {}) => {
88
88
  });
89
89
  });
90
90
  groups.forEach(group => {
91
- tree.push({
92
- title: group.title,
93
- items: group.items.flatMap(operationNode => {
94
- if (mergedConfig.hideInternal && operationNode.data.internal) {
95
- return [];
96
- }
97
- return {
98
- id: operationNode.uri,
99
- slug: operationNode.uri,
100
- title: operationNode.name,
101
- type: operationNode.type,
102
- meta: operationNode.data.method,
103
- };
104
- }),
91
+ const items = group.items.flatMap(operationNode => {
92
+ if (mergedConfig.hideInternal && operationNode.data.internal) {
93
+ return [];
94
+ }
95
+ return {
96
+ id: operationNode.uri,
97
+ slug: operationNode.uri,
98
+ title: operationNode.name,
99
+ type: operationNode.type,
100
+ meta: operationNode.data.method,
101
+ };
105
102
  });
103
+ if (items.length > 0) {
104
+ tree.push({
105
+ title: group.title,
106
+ items,
107
+ });
108
+ }
106
109
  });
107
110
  }
108
111
  let schemaNodes = serviceNode.children.filter(node => node.type === NodeType.Model);
@@ -157,6 +160,7 @@ const APIWithSidebarLayout = ({ serviceNode, logo, hideTryIt, hideSchemas, hideI
157
160
  const { pathname } = location;
158
161
  const isRootPath = !pathname || pathname === '/';
159
162
  const node = isRootPath ? serviceNode : serviceNode.children.find(child => child.uri === pathname);
163
+ const layoutOptions = React.useMemo(() => ({ hideTryIt: hideTryIt, hideExport: hideExport || (node === null || node === void 0 ? void 0 : node.type) !== NodeType.HttpService }), [hideTryIt, hideExport, node]);
160
164
  if (!node) {
161
165
  const firstSlug = findFirstNodeSlug(tree);
162
166
  if (firstSlug) {
@@ -178,7 +182,7 @@ const APIWithSidebarLayout = ({ serviceNode, logo, hideTryIt, hideSchemas, hideI
178
182
  React.createElement(Flex, { flexGrow: true, flexShrink: true, overflowY: "auto", direction: "col" },
179
183
  React.createElement(TableOfContents, { tree: tree, activeId: pathname, Link: Link, onLinkClick: handleTocClick })),
180
184
  React.createElement(PoweredByLink, { source: serviceNode.name, pathname: pathname, packageType: "elements" })));
181
- return (React.createElement(SidebarLayout, { ref: container, sidebar: sidebar }, node && (React.createElement(ParsedDocs, { key: pathname, uri: pathname, node: node, nodeTitle: node.name, layoutOptions: { hideTryIt: hideTryIt, hideExport: hideExport || node.type !== NodeType.HttpService }, location: location, allowRouting: true, exportProps: exportProps, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy }))));
185
+ return (React.createElement(SidebarLayout, { ref: container, sidebar: sidebar }, node && (React.createElement(ParsedDocs, { key: pathname, uri: pathname, node: node, nodeTitle: node.name, layoutOptions: layoutOptions, location: location, allowRouting: true, exportProps: exportProps, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy }))));
182
186
  };
183
187
 
184
188
  const itemMatchesHash = (hash, item) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoplight/elements",
3
- "version": "7.3.6",
3
+ "version": "7.3.10",
4
4
  "description": "UI components for composing beautiful developer documentation.",
5
5
  "keywords": [],
6
6
  "main": "./index.js",
@@ -29,10 +29,10 @@
29
29
  "@fortawesome/fontawesome-svg-core": "^1.2.31",
30
30
  "@fortawesome/free-solid-svg-icons": "^5.14.0",
31
31
  "@fortawesome/react-fontawesome": "^0.1.11",
32
- "@stoplight/elements-core": "~7.3.6",
32
+ "@stoplight/elements-core": "~7.3.9",
33
33
  "@stoplight/http-spec": "^4.2.2",
34
34
  "@stoplight/json": "^3.10.0",
35
- "@stoplight/mosaic": "1.5.0",
35
+ "@stoplight/mosaic": "^1.8.2",
36
36
  "@stoplight/types": "^12.0.0",
37
37
  "classnames": "^2.2.6",
38
38
  "file-saver": "^2.0.5",