@backstage/plugin-config-schema 0.1.67-next.0 → 0.1.67

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/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @backstage/plugin-config-schema
2
2
 
3
+ ## 0.1.67
4
+
5
+ ### Patch Changes
6
+
7
+ - a47fd39: Removes instances of default React imports, a necessary update for the upcoming React 19 migration.
8
+
9
+ <https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html>
10
+
11
+ - Updated dependencies
12
+ - @backstage/core-components@0.17.1
13
+ - @backstage/core-plugin-api@1.10.6
14
+ - @backstage/errors@1.2.7
15
+ - @backstage/types@1.2.1
16
+
17
+ ## 0.1.67-next.1
18
+
19
+ ### Patch Changes
20
+
21
+ - a47fd39: Removes instances of default React imports, a necessary update for the upcoming React 19 migration.
22
+
23
+ <https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html>
24
+
25
+ - Updated dependencies
26
+ - @backstage/core-components@0.17.1-next.1
27
+ - @backstage/core-plugin-api@1.10.6-next.0
28
+ - @backstage/errors@1.2.7
29
+ - @backstage/types@1.2.1
30
+
3
31
  ## 0.1.67-next.0
4
32
 
5
33
  ### Patch Changes
@@ -1,4 +1,5 @@
1
- import React, { useMemo } from 'react';
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
2
+ import { useMemo } from 'react';
2
3
  import useObservable from 'react-use/esm/useObservable';
3
4
  import { configSchemaApiRef } from '../../api/types.esm.js';
4
5
  import 'zen-observable';
@@ -16,14 +17,17 @@ const ConfigSchemaPage = () => {
16
17
  let content;
17
18
  if (schemaResult) {
18
19
  if (schemaResult.schema) {
19
- content = /* @__PURE__ */ React.createElement(SchemaViewer, { schema: schemaResult.schema });
20
+ content = /* @__PURE__ */ jsx(SchemaViewer, { schema: schemaResult.schema });
20
21
  } else {
21
- content = /* @__PURE__ */ React.createElement(Typography, { variant: "h4" }, "No configuration schema available");
22
+ content = /* @__PURE__ */ jsx(Typography, { variant: "h4", children: "No configuration schema available" });
22
23
  }
23
24
  } else {
24
- content = /* @__PURE__ */ React.createElement(Progress, null);
25
+ content = /* @__PURE__ */ jsx(Progress, {});
25
26
  }
26
- return /* @__PURE__ */ React.createElement(Page, { themeId: "tool" }, /* @__PURE__ */ React.createElement(Header, { title: "Configuration Reference" }), /* @__PURE__ */ React.createElement(Content, { stretch: true }, content));
27
+ return /* @__PURE__ */ jsxs(Page, { themeId: "tool", children: [
28
+ /* @__PURE__ */ jsx(Header, { title: "Configuration Reference" }),
29
+ /* @__PURE__ */ jsx(Content, { stretch: true, children: content })
30
+ ] });
27
31
  };
28
32
 
29
33
  export { ConfigSchemaPage };
@@ -1 +1 @@
1
- {"version":3,"file":"ConfigSchemaPage.esm.js","sources":["../../../src/components/ConfigSchemaPage/ConfigSchemaPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { useMemo } from 'react';\nimport useObservable from 'react-use/esm/useObservable';\nimport { configSchemaApiRef } from '../../api';\nimport { SchemaViewer } from '../SchemaViewer';\nimport Typography from '@material-ui/core/Typography';\n\nimport { Header, Page, Content, Progress } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\n\nexport const ConfigSchemaPage = () => {\n const configSchemaApi = useApi(configSchemaApiRef);\n const schemaResult = useObservable(\n useMemo(() => configSchemaApi.schema$(), [configSchemaApi]),\n );\n\n let content;\n if (schemaResult) {\n if (schemaResult.schema) {\n content = <SchemaViewer schema={schemaResult.schema} />;\n } else {\n content = (\n <Typography variant=\"h4\">No configuration schema available</Typography>\n );\n }\n } else {\n content = <Progress />;\n }\n\n return (\n <Page themeId=\"tool\">\n <Header title=\"Configuration Reference\" />\n <Content stretch>{content}</Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAwBO,MAAM,mBAAmB,MAAM;AACpC,EAAM,MAAA,eAAA,GAAkB,OAAO,kBAAkB,CAAA;AACjD,EAAA,MAAM,YAAe,GAAA,aAAA;AAAA,IACnB,QAAQ,MAAM,eAAA,CAAgB,SAAW,EAAA,CAAC,eAAe,CAAC;AAAA,GAC5D;AAEA,EAAI,IAAA,OAAA;AACJ,EAAA,IAAI,YAAc,EAAA;AAChB,IAAA,IAAI,aAAa,MAAQ,EAAA;AACvB,MAAA,OAAA,mBAAW,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,EAAa,MAAQ,EAAA,YAAA,CAAa,MAAQ,EAAA,CAAA;AAAA,KAChD,MAAA;AACL,MAAA,OAAA,mBACG,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,IAAA,EAAA,EAAK,mCAAiC,CAAA;AAAA;AAE9D,GACK,MAAA;AACL,IAAA,OAAA,uCAAW,QAAS,EAAA,IAAA,CAAA;AAAA;AAGtB,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,IAAA,EAAA,EAAK,OAAQ,EAAA,MAAA,EAAA,sCACX,MAAO,EAAA,EAAA,KAAA,EAAM,yBAA0B,EAAA,CAAA,kBACvC,KAAA,CAAA,aAAA,CAAA,OAAA,EAAA,EAAQ,OAAO,EAAA,IAAA,EAAA,EAAE,OAAQ,CAC5B,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ConfigSchemaPage.esm.js","sources":["../../../src/components/ConfigSchemaPage/ConfigSchemaPage.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useMemo } from 'react';\nimport useObservable from 'react-use/esm/useObservable';\nimport { configSchemaApiRef } from '../../api';\nimport { SchemaViewer } from '../SchemaViewer';\nimport Typography from '@material-ui/core/Typography';\n\nimport { Header, Page, Content, Progress } from '@backstage/core-components';\nimport { useApi } from '@backstage/core-plugin-api';\n\nexport const ConfigSchemaPage = () => {\n const configSchemaApi = useApi(configSchemaApiRef);\n const schemaResult = useObservable(\n useMemo(() => configSchemaApi.schema$(), [configSchemaApi]),\n );\n\n let content;\n if (schemaResult) {\n if (schemaResult.schema) {\n content = <SchemaViewer schema={schemaResult.schema} />;\n } else {\n content = (\n <Typography variant=\"h4\">No configuration schema available</Typography>\n );\n }\n } else {\n content = <Progress />;\n }\n\n return (\n <Page themeId=\"tool\">\n <Header title=\"Configuration Reference\" />\n <Content stretch>{content}</Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAwBO,MAAM,mBAAmB,MAAM;AACpC,EAAM,MAAA,eAAA,GAAkB,OAAO,kBAAkB,CAAA;AACjD,EAAA,MAAM,YAAe,GAAA,aAAA;AAAA,IACnB,QAAQ,MAAM,eAAA,CAAgB,SAAW,EAAA,CAAC,eAAe,CAAC;AAAA,GAC5D;AAEA,EAAI,IAAA,OAAA;AACJ,EAAA,IAAI,YAAc,EAAA;AAChB,IAAA,IAAI,aAAa,MAAQ,EAAA;AACvB,MAAA,OAAA,mBAAW,GAAA,CAAA,YAAA,EAAA,EAAa,MAAQ,EAAA,YAAA,CAAa,MAAQ,EAAA,CAAA;AAAA,KAChD,MAAA;AACL,MAAA,OAAA,mBACG,GAAA,CAAA,UAAA,EAAA,EAAW,OAAQ,EAAA,IAAA,EAAK,QAAiC,EAAA,mCAAA,EAAA,CAAA;AAAA;AAE9D,GACK,MAAA;AACL,IAAA,OAAA,uBAAW,QAAS,EAAA,EAAA,CAAA;AAAA;AAGtB,EACE,uBAAA,IAAA,CAAC,IAAK,EAAA,EAAA,OAAA,EAAQ,MACZ,EAAA,QAAA,EAAA;AAAA,oBAAC,GAAA,CAAA,MAAA,EAAA,EAAO,OAAM,yBAA0B,EAAA,CAAA;AAAA,oBACvC,GAAA,CAAA,OAAA,EAAA,EAAQ,OAAO,EAAA,IAAA,EAAE,QAAQ,EAAA,OAAA,EAAA;AAAA,GAC5B,EAAA,CAAA;AAEJ;;;;"}
@@ -1,9 +1,10 @@
1
+ import { jsx, Fragment } from 'react/jsx-runtime';
1
2
  import { withStyles, createStyles, alpha } from '@material-ui/core/styles';
2
3
  import ChevronRightIcon from '@material-ui/icons/ChevronRight';
3
4
  import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
4
5
  import TreeItem from '@material-ui/lab/TreeItem';
5
6
  import TreeView from '@material-ui/lab/TreeView';
6
- import React, { useRef, useMemo } from 'react';
7
+ import { useRef, useMemo } from 'react';
7
8
  import { useScrollTargets } from '../ScrollTargetsContext/ScrollTargetsContext.esm.js';
8
9
 
9
10
  const StyledTreeItem = withStyles(
@@ -17,7 +18,7 @@ const StyledTreeItem = withStyles(
17
18
  borderLeft: `1px solid ${alpha(theme.palette.text.primary, 0.15)}`
18
19
  }
19
20
  })
20
- )((props) => /* @__PURE__ */ React.createElement(TreeItem, { ...props }));
21
+ )((props) => /* @__PURE__ */ jsx(TreeItem, { ...props }));
21
22
  function createSchemaBrowserItems(expanded, schema, path = "", depth = 0) {
22
23
  let matchArr;
23
24
  if (schema.anyOf) {
@@ -31,19 +32,19 @@ function createSchemaBrowserItems(expanded, schema, path = "", depth = 0) {
31
32
  return matchArr.map((childSchema, index) => {
32
33
  const childPath = `${path}/${index + 1}`;
33
34
  if (depth > 0) expanded.push(childPath);
34
- return /* @__PURE__ */ React.createElement(
35
+ return /* @__PURE__ */ jsx(
35
36
  StyledTreeItem,
36
37
  {
37
- key: childPath,
38
38
  nodeId: childPath,
39
- label: `<Option ${index + 1}>`
39
+ label: `<Option ${index + 1}>`,
40
+ children: createSchemaBrowserItems(
41
+ expanded,
42
+ childSchema,
43
+ childPath,
44
+ depth + 1
45
+ )
40
46
  },
41
- createSchemaBrowserItems(
42
- expanded,
43
- childSchema,
44
- childPath,
45
- depth + 1
46
- )
47
+ childPath
47
48
  );
48
49
  });
49
50
  }
@@ -51,12 +52,12 @@ function createSchemaBrowserItems(expanded, schema, path = "", depth = 0) {
51
52
  case "array": {
52
53
  const childPath = `${path}[]`;
53
54
  if (depth > 0) expanded.push(childPath);
54
- return /* @__PURE__ */ React.createElement(StyledTreeItem, { nodeId: childPath, label: "[]" }, schema.items && createSchemaBrowserItems(
55
+ return /* @__PURE__ */ jsx(StyledTreeItem, { nodeId: childPath, label: "[]", children: schema.items && createSchemaBrowserItems(
55
56
  expanded,
56
57
  schema.items,
57
58
  childPath,
58
59
  depth + 1
59
- ));
60
+ ) });
60
61
  }
61
62
  case "object":
62
63
  case void 0: {
@@ -66,12 +67,12 @@ function createSchemaBrowserItems(expanded, schema, path = "", depth = 0) {
66
67
  ...Object.entries(schema.properties).map(([name, childSchema]) => {
67
68
  const childPath = path ? `${path}.${name}` : name;
68
69
  if (depth > 0) expanded.push(childPath);
69
- return /* @__PURE__ */ React.createElement(StyledTreeItem, { key: childPath, nodeId: childPath, label: name }, createSchemaBrowserItems(
70
+ return /* @__PURE__ */ jsx(StyledTreeItem, { nodeId: childPath, label: name, children: createSchemaBrowserItems(
70
71
  expanded,
71
72
  childSchema,
72
73
  childPath,
73
74
  depth + 1
74
- ));
75
+ ) }, childPath);
75
76
  })
76
77
  );
77
78
  }
@@ -81,19 +82,19 @@ function createSchemaBrowserItems(expanded, schema, path = "", depth = 0) {
81
82
  ([name, childSchema]) => {
82
83
  const childPath = `${path}.<${name}>`;
83
84
  if (depth > 0) expanded.push(childPath);
84
- return /* @__PURE__ */ React.createElement(
85
+ return /* @__PURE__ */ jsx(
85
86
  StyledTreeItem,
86
87
  {
87
- key: childPath,
88
88
  nodeId: childPath,
89
- label: `<${name}>`
89
+ label: `<${name}>`,
90
+ children: createSchemaBrowserItems(
91
+ expanded,
92
+ childSchema,
93
+ childPath,
94
+ depth + 1
95
+ )
90
96
  },
91
- createSchemaBrowserItems(
92
- expanded,
93
- childSchema,
94
- childPath,
95
- depth + 1
96
- )
97
+ childPath
97
98
  );
98
99
  }
99
100
  )
@@ -103,15 +104,15 @@ function createSchemaBrowserItems(expanded, schema, path = "", depth = 0) {
103
104
  const childPath = `${path}.*`;
104
105
  if (depth > 0) expanded.push(childPath);
105
106
  children.push(
106
- /* @__PURE__ */ React.createElement(StyledTreeItem, { key: childPath, nodeId: childPath, label: "*" }, createSchemaBrowserItems(
107
+ /* @__PURE__ */ jsx(StyledTreeItem, { nodeId: childPath, label: "*", children: createSchemaBrowserItems(
107
108
  expanded,
108
109
  schema.additionalProperties,
109
110
  childPath,
110
111
  depth + 1
111
- ))
112
+ ) }, childPath)
112
113
  );
113
114
  }
114
- return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
115
+ return /* @__PURE__ */ jsx(Fragment, { children });
115
116
  }
116
117
  default:
117
118
  return null;
@@ -136,16 +137,16 @@ function SchemaBrowser({ schema }) {
136
137
  scroll.scrollTo(nodeId);
137
138
  }
138
139
  };
139
- return /* @__PURE__ */ React.createElement(
140
+ return /* @__PURE__ */ jsx(
140
141
  TreeView,
141
142
  {
142
143
  defaultExpanded: data.expanded,
143
- defaultCollapseIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon, null),
144
- defaultExpandIcon: /* @__PURE__ */ React.createElement(ChevronRightIcon, null),
144
+ defaultCollapseIcon: /* @__PURE__ */ jsx(ExpandMoreIcon, {}),
145
+ defaultExpandIcon: /* @__PURE__ */ jsx(ChevronRightIcon, {}),
145
146
  onNodeToggle: handleToggle,
146
- onNodeSelect: handleSelect
147
- },
148
- data.items
147
+ onNodeSelect: handleSelect,
148
+ children: data.items
149
+ }
149
150
  );
150
151
  }
151
152
 
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaBrowser.esm.js","sources":["../../../src/components/SchemaBrowser/SchemaBrowser.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { alpha } from '@material-ui/core/styles';\nimport { createStyles, withStyles } from '@material-ui/core/styles';\nimport ChevronRightIcon from '@material-ui/icons/ChevronRight';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport TreeItem, { TreeItemProps } from '@material-ui/lab/TreeItem';\nimport TreeView from '@material-ui/lab/TreeView';\nimport { Schema } from 'jsonschema';\nimport React, { ReactNode, useMemo, useRef } from 'react';\nimport { useScrollTargets } from '../ScrollTargetsContext';\n\nconst StyledTreeItem = withStyles(theme =>\n createStyles({\n label: {\n userSelect: 'none',\n },\n group: {\n marginLeft: 7,\n paddingLeft: theme.spacing(1),\n borderLeft: `1px solid ${alpha(theme.palette.text.primary, 0.15)}`,\n },\n }),\n)((props: TreeItemProps) => <TreeItem {...props} />);\n\nexport function createSchemaBrowserItems(\n expanded: string[],\n schema: Schema,\n path: string = '',\n depth: number = 0,\n): ReactNode {\n let matchArr;\n if (schema.anyOf) {\n matchArr = schema.anyOf;\n } else if (schema.oneOf) {\n matchArr = schema.oneOf;\n } else if (schema.allOf) {\n matchArr = schema.allOf;\n }\n if (matchArr) {\n return matchArr.map((childSchema, index) => {\n const childPath = `${path}/${index + 1}`;\n if (depth > 0) expanded.push(childPath);\n return (\n <StyledTreeItem\n key={childPath}\n nodeId={childPath}\n label={`<Option ${index + 1}>`}\n >\n {createSchemaBrowserItems(\n expanded,\n childSchema,\n childPath,\n depth + 1,\n )}\n </StyledTreeItem>\n );\n });\n }\n\n switch (schema.type) {\n case 'array': {\n const childPath = `${path}[]`;\n if (depth > 0) expanded.push(childPath);\n return (\n <StyledTreeItem nodeId={childPath} label=\"[]\">\n {schema.items &&\n createSchemaBrowserItems(\n expanded,\n schema.items as Schema,\n childPath,\n depth + 1,\n )}\n </StyledTreeItem>\n );\n }\n case 'object':\n case undefined: {\n const children = [];\n\n if (schema.properties) {\n children.push(\n ...Object.entries(schema.properties).map(([name, childSchema]) => {\n const childPath = path ? `${path}.${name}` : name;\n if (depth > 0) expanded.push(childPath);\n return (\n <StyledTreeItem key={childPath} nodeId={childPath} label={name}>\n {createSchemaBrowserItems(\n expanded,\n childSchema,\n childPath,\n depth + 1,\n )}\n </StyledTreeItem>\n );\n }),\n );\n }\n\n if (schema.patternProperties) {\n children.push(\n ...Object.entries(schema.patternProperties).map(\n ([name, childSchema]) => {\n const childPath = `${path}.<${name}>`;\n if (depth > 0) expanded.push(childPath);\n return (\n <StyledTreeItem\n key={childPath}\n nodeId={childPath}\n label={`<${name}>`}\n >\n {createSchemaBrowserItems(\n expanded,\n childSchema,\n childPath,\n depth + 1,\n )}\n </StyledTreeItem>\n );\n },\n ),\n );\n }\n\n if (schema.additionalProperties && schema.additionalProperties !== true) {\n const childPath = `${path}.*`;\n if (depth > 0) expanded.push(childPath);\n children.push(\n <StyledTreeItem key={childPath} nodeId={childPath} label=\"*\">\n {createSchemaBrowserItems(\n expanded,\n schema.additionalProperties,\n childPath,\n depth + 1,\n )}\n </StyledTreeItem>,\n );\n }\n\n return <>{children}</>;\n }\n\n default:\n return null;\n }\n}\n\nexport function SchemaBrowser({ schema }: { schema: Schema }) {\n const scroll = useScrollTargets();\n const expandedRef = useRef<string[]>([]);\n const data = useMemo(() => {\n const expanded = new Array<string>();\n\n const items = createSchemaBrowserItems(expanded, schema);\n\n return { items, expanded };\n }, [schema]);\n\n if (!scroll) {\n throw new Error('No scroll handler available');\n }\n\n const handleToggle = (_event: unknown, expanded: string[]) => {\n expandedRef.current = expanded;\n };\n\n const handleSelect = (_event: unknown, nodeId: string) => {\n if (expandedRef.current.includes(nodeId)) {\n scroll.scrollTo(nodeId);\n }\n };\n\n return (\n <TreeView\n defaultExpanded={data.expanded}\n defaultCollapseIcon={<ExpandMoreIcon />}\n defaultExpandIcon={<ChevronRightIcon />}\n onNodeToggle={handleToggle}\n onNodeSelect={handleSelect}\n >\n {data.items}\n </TreeView>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AA0BA,MAAM,cAAiB,GAAA,UAAA;AAAA,EAAW,WAChC,YAAa,CAAA;AAAA,IACX,KAAO,EAAA;AAAA,MACL,UAAY,EAAA;AAAA,KACd;AAAA,IACA,KAAO,EAAA;AAAA,MACL,UAAY,EAAA,CAAA;AAAA,MACZ,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,MAC5B,UAAA,EAAY,aAAa,KAAM,CAAA,KAAA,CAAM,QAAQ,IAAK,CAAA,OAAA,EAAS,IAAI,CAAC,CAAA;AAAA;AAClE,GACD;AACH,CAAA,CAAE,CAAC,KAAyB,qBAAA,KAAA,CAAA,aAAA,CAAC,QAAU,EAAA,EAAA,GAAG,OAAO,CAAE,CAAA;AAE5C,SAAS,yBACd,QACA,EAAA,MAAA,EACA,IAAe,GAAA,EAAA,EACf,QAAgB,CACL,EAAA;AACX,EAAI,IAAA,QAAA;AACJ,EAAA,IAAI,OAAO,KAAO,EAAA;AAChB,IAAA,QAAA,GAAW,MAAO,CAAA,KAAA;AAAA,GACpB,MAAA,IAAW,OAAO,KAAO,EAAA;AACvB,IAAA,QAAA,GAAW,MAAO,CAAA,KAAA;AAAA,GACpB,MAAA,IAAW,OAAO,KAAO,EAAA;AACvB,IAAA,QAAA,GAAW,MAAO,CAAA,KAAA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WAAY,CAAA,OAAA,CAAQ,QAAS,CAAA,MAAM,CAAG,EAAA;AACxC,MAAA,MAAA,CAAO,SAAS,MAAM,CAAA;AAAA;AACxB,GACF;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,iBAAiB,IAAK,CAAA,QAAA;AAAA,MACtB,mBAAA,sCAAsB,cAAe,EAAA,IAAA,CAAA;AAAA,MACrC,iBAAA,sCAAoB,gBAAiB,EAAA,IAAA,CAAA;AAAA,MACrC,YAAc,EAAA,YAAA;AAAA,MACd,YAAc,EAAA;AAAA,KAAA;AAAA,IAEb,IAAK,CAAA;AAAA,GACR;AAEJ;;;;"}
1
+ {"version":3,"file":"SchemaBrowser.esm.js","sources":["../../../src/components/SchemaBrowser/SchemaBrowser.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { alpha } from '@material-ui/core/styles';\nimport { createStyles, withStyles } from '@material-ui/core/styles';\nimport ChevronRightIcon from '@material-ui/icons/ChevronRight';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport TreeItem, { TreeItemProps } from '@material-ui/lab/TreeItem';\nimport TreeView from '@material-ui/lab/TreeView';\nimport { Schema } from 'jsonschema';\nimport { ReactNode, useMemo, useRef } from 'react';\nimport { useScrollTargets } from '../ScrollTargetsContext';\n\nconst StyledTreeItem = withStyles(theme =>\n createStyles({\n label: {\n userSelect: 'none',\n },\n group: {\n marginLeft: 7,\n paddingLeft: theme.spacing(1),\n borderLeft: `1px solid ${alpha(theme.palette.text.primary, 0.15)}`,\n },\n }),\n)((props: TreeItemProps) => <TreeItem {...props} />);\n\nexport function createSchemaBrowserItems(\n expanded: string[],\n schema: Schema,\n path: string = '',\n depth: number = 0,\n): ReactNode {\n let matchArr;\n if (schema.anyOf) {\n matchArr = schema.anyOf;\n } else if (schema.oneOf) {\n matchArr = schema.oneOf;\n } else if (schema.allOf) {\n matchArr = schema.allOf;\n }\n if (matchArr) {\n return matchArr.map((childSchema, index) => {\n const childPath = `${path}/${index + 1}`;\n if (depth > 0) expanded.push(childPath);\n return (\n <StyledTreeItem\n key={childPath}\n nodeId={childPath}\n label={`<Option ${index + 1}>`}\n >\n {createSchemaBrowserItems(\n expanded,\n childSchema,\n childPath,\n depth + 1,\n )}\n </StyledTreeItem>\n );\n });\n }\n\n switch (schema.type) {\n case 'array': {\n const childPath = `${path}[]`;\n if (depth > 0) expanded.push(childPath);\n return (\n <StyledTreeItem nodeId={childPath} label=\"[]\">\n {schema.items &&\n createSchemaBrowserItems(\n expanded,\n schema.items as Schema,\n childPath,\n depth + 1,\n )}\n </StyledTreeItem>\n );\n }\n case 'object':\n case undefined: {\n const children = [];\n\n if (schema.properties) {\n children.push(\n ...Object.entries(schema.properties).map(([name, childSchema]) => {\n const childPath = path ? `${path}.${name}` : name;\n if (depth > 0) expanded.push(childPath);\n return (\n <StyledTreeItem key={childPath} nodeId={childPath} label={name}>\n {createSchemaBrowserItems(\n expanded,\n childSchema,\n childPath,\n depth + 1,\n )}\n </StyledTreeItem>\n );\n }),\n );\n }\n\n if (schema.patternProperties) {\n children.push(\n ...Object.entries(schema.patternProperties).map(\n ([name, childSchema]) => {\n const childPath = `${path}.<${name}>`;\n if (depth > 0) expanded.push(childPath);\n return (\n <StyledTreeItem\n key={childPath}\n nodeId={childPath}\n label={`<${name}>`}\n >\n {createSchemaBrowserItems(\n expanded,\n childSchema,\n childPath,\n depth + 1,\n )}\n </StyledTreeItem>\n );\n },\n ),\n );\n }\n\n if (schema.additionalProperties && schema.additionalProperties !== true) {\n const childPath = `${path}.*`;\n if (depth > 0) expanded.push(childPath);\n children.push(\n <StyledTreeItem key={childPath} nodeId={childPath} label=\"*\">\n {createSchemaBrowserItems(\n expanded,\n schema.additionalProperties,\n childPath,\n depth + 1,\n )}\n </StyledTreeItem>,\n );\n }\n\n return <>{children}</>;\n }\n\n default:\n return null;\n }\n}\n\nexport function SchemaBrowser({ schema }: { schema: Schema }) {\n const scroll = useScrollTargets();\n const expandedRef = useRef<string[]>([]);\n const data = useMemo(() => {\n const expanded = new Array<string>();\n\n const items = createSchemaBrowserItems(expanded, schema);\n\n return { items, expanded };\n }, [schema]);\n\n if (!scroll) {\n throw new Error('No scroll handler available');\n }\n\n const handleToggle = (_event: unknown, expanded: string[]) => {\n expandedRef.current = expanded;\n };\n\n const handleSelect = (_event: unknown, nodeId: string) => {\n if (expandedRef.current.includes(nodeId)) {\n scroll.scrollTo(nodeId);\n }\n };\n\n return (\n <TreeView\n defaultExpanded={data.expanded}\n defaultCollapseIcon={<ExpandMoreIcon />}\n defaultExpandIcon={<ChevronRightIcon />}\n onNodeToggle={handleToggle}\n onNodeSelect={handleSelect}\n >\n {data.items}\n </TreeView>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AA0BA,MAAM,cAAiB,GAAA,UAAA;AAAA,EAAW,WAChC,YAAa,CAAA;AAAA,IACX,KAAO,EAAA;AAAA,MACL,UAAY,EAAA;AAAA,KACd;AAAA,IACA,KAAO,EAAA;AAAA,MACL,UAAY,EAAA,CAAA;AAAA,MACZ,WAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,MAC5B,UAAA,EAAY,aAAa,KAAM,CAAA,KAAA,CAAM,QAAQ,IAAK,CAAA,OAAA,EAAS,IAAI,CAAC,CAAA;AAAA;AAClE,GACD;AACH,CAAA,CAAE,CAAC,KAAyB,qBAAA,GAAA,CAAC,QAAU,EAAA,EAAA,GAAG,OAAO,CAAE,CAAA;AAE5C,SAAS,yBACd,QACA,EA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,GAC3B,EAAG,CAAC,MAAM,CAAC,CAAA;AAEX,EAAA,IAAI,CAAC,MAAQ,EAAA;AACX,IAAM,MAAA,IAAI,MAAM,6BAA6B,CAAA;AAAA;AAG/C,EAAM,MAAA,YAAA,GAAe,CAAC,MAAA,EAAiB,QAAuB,KAAA;AAC5D,IAAA,WAAA,CAAY,OAAU,GAAA,QAAA;AAAA,GACxB;AAEA,EAAM,MAAA,YAAA,GAAe,CAAC,MAAA,EAAiB,MAAmB,KAAA;AACxD,IAAA,IAAI,WAAY,CAAA,OAAA,CAAQ,QAAS,CAAA,MAAM,CAAG,EAAA;AACxC,MAAA,MAAA,CAAO,SAAS,MAAM,CAAA;AAAA;AACxB,GACF;AAEA,EACE,uBAAA,GAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACC,iBAAiB,IAAK,CAAA,QAAA;AAAA,MACtB,mBAAA,sBAAsB,cAAe,EAAA,EAAA,CAAA;AAAA,MACrC,iBAAA,sBAAoB,gBAAiB,EAAA,EAAA,CAAA;AAAA,MACrC,YAAc,EAAA,YAAA;AAAA,MACd,YAAc,EAAA,YAAA;AAAA,MAEb,QAAK,EAAA,IAAA,CAAA;AAAA;AAAA,GACR;AAEJ;;;;"}
@@ -1,3 +1,4 @@
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
1
2
  import Box from '@material-ui/core/Box';
2
3
  import Chip from '@material-ui/core/Chip';
3
4
  import Divider from '@material-ui/core/Divider';
@@ -8,13 +9,13 @@ import TableCell from '@material-ui/core/TableCell';
8
9
  import TableRow from '@material-ui/core/TableRow';
9
10
  import Typography from '@material-ui/core/Typography';
10
11
  import { makeStyles } from '@material-ui/core/styles';
11
- import React, { useRef, useEffect } from 'react';
12
+ import { useRef, useEffect } from 'react';
12
13
  import { useScrollTargets } from '../ScrollTargetsContext/ScrollTargetsContext.esm.js';
13
14
 
14
15
  function SchemaView(props) {
15
16
  const { schema } = props;
16
17
  if (schema.anyOf) {
17
- return /* @__PURE__ */ React.createElement(
18
+ return /* @__PURE__ */ jsx(
18
19
  MatchView,
19
20
  {
20
21
  ...props,
@@ -24,7 +25,7 @@ function SchemaView(props) {
24
25
  );
25
26
  }
26
27
  if (schema.oneOf) {
27
- return /* @__PURE__ */ React.createElement(
28
+ return /* @__PURE__ */ jsx(
28
29
  MatchView,
29
30
  {
30
31
  ...props,
@@ -34,7 +35,7 @@ function SchemaView(props) {
34
35
  );
35
36
  }
36
37
  if (schema.allOf) {
37
- return /* @__PURE__ */ React.createElement(
38
+ return /* @__PURE__ */ jsx(
38
39
  MatchView,
39
40
  {
40
41
  ...props,
@@ -45,35 +46,46 @@ function SchemaView(props) {
45
46
  }
46
47
  switch (schema.type) {
47
48
  case "array":
48
- return /* @__PURE__ */ React.createElement(ArrayView, { ...props });
49
+ return /* @__PURE__ */ jsx(ArrayView, { ...props });
49
50
  case "object":
50
51
  case void 0:
51
- return /* @__PURE__ */ React.createElement(ObjectView, { ...props });
52
+ return /* @__PURE__ */ jsx(ObjectView, { ...props });
52
53
  default:
53
- return /* @__PURE__ */ React.createElement(ScalarView, { ...props });
54
+ return /* @__PURE__ */ jsx(ScalarView, { ...props });
54
55
  }
55
56
  }
56
57
  function ArrayView({ path, depth, schema }) {
57
58
  const itemDepth = depth + 1;
58
59
  const itemPath = path ? `${path}[]` : "[]";
59
60
  const itemSchema = schema.items;
60
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Box, { marginBottom: 4 }, schema.description && /* @__PURE__ */ React.createElement(Box, { marginBottom: 4 }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, schema.description)), /* @__PURE__ */ React.createElement(MetadataView, { schema })), /* @__PURE__ */ React.createElement(Typography, { variant: "overline" }, "Items"), /* @__PURE__ */ React.createElement(
61
- ChildView,
62
- {
63
- lastChild: true,
64
- path: itemPath,
65
- depth: itemDepth,
66
- schema: itemSchema
67
- }
68
- ), schema.additionalItems && schema.additionalItems !== true && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { variant: "overline" }, "Additional Items"), /* @__PURE__ */ React.createElement(
69
- ChildView,
70
- {
71
- path: itemPath,
72
- depth: itemDepth,
73
- schema: schema.additionalItems,
74
- lastChild: true
75
- }
76
- )));
61
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
62
+ /* @__PURE__ */ jsxs(Box, { marginBottom: 4, children: [
63
+ schema.description && /* @__PURE__ */ jsx(Box, { marginBottom: 4, children: /* @__PURE__ */ jsx(Typography, { variant: "body1", children: schema.description }) }),
64
+ /* @__PURE__ */ jsx(MetadataView, { schema })
65
+ ] }),
66
+ /* @__PURE__ */ jsx(Typography, { variant: "overline", children: "Items" }),
67
+ /* @__PURE__ */ jsx(
68
+ ChildView,
69
+ {
70
+ lastChild: true,
71
+ path: itemPath,
72
+ depth: itemDepth,
73
+ schema: itemSchema
74
+ }
75
+ ),
76
+ schema.additionalItems && schema.additionalItems !== true && /* @__PURE__ */ jsxs(Fragment, { children: [
77
+ /* @__PURE__ */ jsx(Typography, { variant: "overline", children: "Additional Items" }),
78
+ /* @__PURE__ */ jsx(
79
+ ChildView,
80
+ {
81
+ path: itemPath,
82
+ depth: itemDepth,
83
+ schema: schema.additionalItems,
84
+ lastChild: true
85
+ }
86
+ )
87
+ ] })
88
+ ] });
77
89
  }
78
90
  function isRequired(name, required) {
79
91
  if (required === true) {
@@ -87,35 +99,52 @@ function isRequired(name, required) {
87
99
  function ObjectView({ path, depth, schema }) {
88
100
  const properties = Object.entries(schema.properties ?? {});
89
101
  const patternProperties = Object.entries(schema.patternProperties ?? {});
90
- return /* @__PURE__ */ React.createElement(React.Fragment, null, depth > 0 && /* @__PURE__ */ React.createElement(Box, { marginBottom: 4 }, schema.description && /* @__PURE__ */ React.createElement(Box, { marginBottom: 4 }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, schema.description)), /* @__PURE__ */ React.createElement(MetadataView, { schema })), properties.length > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, depth > 0 && /* @__PURE__ */ React.createElement(Typography, { variant: "overline" }, "Properties"), properties.map(([name, propSchema], index) => /* @__PURE__ */ React.createElement(
91
- ChildView,
92
- {
93
- key: name,
94
- path: path ? `${path}.${name}` : name,
95
- depth: depth + 1,
96
- schema: propSchema,
97
- lastChild: index === properties.length - 1,
98
- required: isRequired(name, schema.required)
99
- }
100
- ))), patternProperties.length > 0 && /* @__PURE__ */ React.createElement(React.Fragment, null, depth > 0 && /* @__PURE__ */ React.createElement(Typography, { variant: "overline" }, "Pattern Properties"), patternProperties.map(([name, propSchema], index) => /* @__PURE__ */ React.createElement(
101
- ChildView,
102
- {
103
- key: name,
104
- path: path ? `${path}.<${name}>` : name,
105
- depth: depth + 1,
106
- schema: propSchema,
107
- lastChild: index === patternProperties.length - 1,
108
- required: isRequired(name, schema.required)
109
- }
110
- ))), schema.additionalProperties && schema.additionalProperties !== true && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { variant: "overline" }, "Additional Properties"), /* @__PURE__ */ React.createElement(
111
- ChildView,
112
- {
113
- path: `${path}.*`,
114
- depth: depth + 1,
115
- schema: schema.additionalProperties,
116
- lastChild: true
117
- }
118
- )));
102
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
103
+ depth > 0 && /* @__PURE__ */ jsxs(Box, { marginBottom: 4, children: [
104
+ schema.description && /* @__PURE__ */ jsx(Box, { marginBottom: 4, children: /* @__PURE__ */ jsx(Typography, { variant: "body1", children: schema.description }) }),
105
+ /* @__PURE__ */ jsx(MetadataView, { schema })
106
+ ] }),
107
+ properties.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
108
+ depth > 0 && /* @__PURE__ */ jsx(Typography, { variant: "overline", children: "Properties" }),
109
+ properties.map(([name, propSchema], index) => /* @__PURE__ */ jsx(
110
+ ChildView,
111
+ {
112
+ path: path ? `${path}.${name}` : name,
113
+ depth: depth + 1,
114
+ schema: propSchema,
115
+ lastChild: index === properties.length - 1,
116
+ required: isRequired(name, schema.required)
117
+ },
118
+ name
119
+ ))
120
+ ] }),
121
+ patternProperties.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
122
+ depth > 0 && /* @__PURE__ */ jsx(Typography, { variant: "overline", children: "Pattern Properties" }),
123
+ patternProperties.map(([name, propSchema], index) => /* @__PURE__ */ jsx(
124
+ ChildView,
125
+ {
126
+ path: path ? `${path}.<${name}>` : name,
127
+ depth: depth + 1,
128
+ schema: propSchema,
129
+ lastChild: index === patternProperties.length - 1,
130
+ required: isRequired(name, schema.required)
131
+ },
132
+ name
133
+ ))
134
+ ] }),
135
+ schema.additionalProperties && schema.additionalProperties !== true && /* @__PURE__ */ jsxs(Fragment, { children: [
136
+ /* @__PURE__ */ jsx(Typography, { variant: "overline", children: "Additional Properties" }),
137
+ /* @__PURE__ */ jsx(
138
+ ChildView,
139
+ {
140
+ path: `${path}.*`,
141
+ depth: depth + 1,
142
+ schema: schema.additionalProperties,
143
+ lastChild: true
144
+ }
145
+ )
146
+ ] })
147
+ ] });
119
148
  }
120
149
  function titleVariant(depth) {
121
150
  if (depth <= 1) {
@@ -158,39 +187,47 @@ function ChildView({
158
187
  const chipProps = { size: "small", classes: { root: classes.chip } };
159
188
  if (required) {
160
189
  chips.push(
161
- /* @__PURE__ */ React.createElement(Chip, { label: "required", color: "default", key: "required", ...chipProps })
190
+ /* @__PURE__ */ jsx(Chip, { label: "required", color: "default", ...chipProps }, "required")
162
191
  );
163
192
  }
164
193
  const visibility = schema?.visibility;
165
194
  if (visibility === "frontend") {
166
195
  chips.push(
167
- /* @__PURE__ */ React.createElement(Chip, { label: "frontend", color: "primary", key: "visibility", ...chipProps })
196
+ /* @__PURE__ */ jsx(Chip, { label: "frontend", color: "primary", ...chipProps }, "visibility")
168
197
  );
169
198
  } else if (visibility === "secret") {
170
199
  chips.push(
171
- /* @__PURE__ */ React.createElement(Chip, { label: "secret", color: "secondary", key: "visibility", ...chipProps })
200
+ /* @__PURE__ */ jsx(Chip, { label: "secret", color: "secondary", ...chipProps }, "visibility")
172
201
  );
173
202
  }
174
- return /* @__PURE__ */ React.createElement(Box, { paddingBottom: lastChild ? 4 : 8, display: "flex", flexDirection: "row" }, /* @__PURE__ */ React.createElement(Divider, { orientation: "vertical", flexItem: true }), /* @__PURE__ */ React.createElement(Box, { paddingLeft: 2, flex: 1 }, /* @__PURE__ */ React.createElement(
175
- Box,
176
- {
177
- display: "flex",
178
- flexDirection: "row",
179
- marginBottom: 2,
180
- alignItems: "center"
181
- },
182
- /* @__PURE__ */ React.createElement(
183
- Typography,
184
- {
185
- ref: titleRef,
186
- variant: titleVariant(depth),
187
- classes: { root: classes.title }
188
- },
189
- path
190
- ),
191
- chips.length > 0 && /* @__PURE__ */ React.createElement(Box, { marginLeft: 1 }),
192
- chips
193
- ), schema && /* @__PURE__ */ React.createElement(SchemaView, { path, depth, schema })));
203
+ return /* @__PURE__ */ jsxs(Box, { paddingBottom: lastChild ? 4 : 8, display: "flex", flexDirection: "row", children: [
204
+ /* @__PURE__ */ jsx(Divider, { orientation: "vertical", flexItem: true }),
205
+ /* @__PURE__ */ jsxs(Box, { paddingLeft: 2, flex: 1, children: [
206
+ /* @__PURE__ */ jsxs(
207
+ Box,
208
+ {
209
+ display: "flex",
210
+ flexDirection: "row",
211
+ marginBottom: 2,
212
+ alignItems: "center",
213
+ children: [
214
+ /* @__PURE__ */ jsx(
215
+ Typography,
216
+ {
217
+ ref: titleRef,
218
+ variant: titleVariant(depth),
219
+ classes: { root: classes.title },
220
+ children: path
221
+ }
222
+ ),
223
+ chips.length > 0 && /* @__PURE__ */ jsx(Box, { marginLeft: 1 }),
224
+ chips
225
+ ]
226
+ }
227
+ ),
228
+ schema && /* @__PURE__ */ jsx(SchemaView, { path, depth, schema })
229
+ ] })
230
+ ] });
194
231
  }
195
232
  function MatchView({
196
233
  path,
@@ -198,76 +235,104 @@ function MatchView({
198
235
  schema,
199
236
  label
200
237
  }) {
201
- return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Typography, { variant: "overline" }, label), schema.map((optionSchema, index) => /* @__PURE__ */ React.createElement(
202
- ChildView,
203
- {
204
- key: index,
205
- path: `${path}/${index + 1}`,
206
- depth: depth + 1,
207
- schema: optionSchema,
208
- lastChild: index === schema.length - 1
209
- }
210
- )));
238
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
239
+ /* @__PURE__ */ jsx(Typography, { variant: "overline", children: label }),
240
+ schema.map((optionSchema, index) => /* @__PURE__ */ jsx(
241
+ ChildView,
242
+ {
243
+ path: `${path}/${index + 1}`,
244
+ depth: depth + 1,
245
+ schema: optionSchema,
246
+ lastChild: index === schema.length - 1
247
+ },
248
+ index
249
+ ))
250
+ ] });
211
251
  }
212
252
  function ScalarView({ schema }) {
213
- return /* @__PURE__ */ React.createElement(React.Fragment, null, schema.description && /* @__PURE__ */ React.createElement(Box, { marginBottom: 4 }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, schema.description)), /* @__PURE__ */ React.createElement(MetadataView, { schema }));
253
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
254
+ schema.description && /* @__PURE__ */ jsx(Box, { marginBottom: 4, children: /* @__PURE__ */ jsx(Typography, { variant: "body1", children: schema.description }) }),
255
+ /* @__PURE__ */ jsx(MetadataView, { schema })
256
+ ] });
214
257
  }
215
258
  function MetadataViewRow({ label, text, data }) {
216
259
  if (text === void 0 && data === void 0) {
217
260
  return null;
218
261
  }
219
- return /* @__PURE__ */ React.createElement(TableRow, null, /* @__PURE__ */ React.createElement(TableCell, { style: { width: 160 } }, /* @__PURE__ */ React.createElement(Typography, { variant: "body1", noWrap: true, style: { fontWeight: 900 } }, label)), /* @__PURE__ */ React.createElement(TableCell, null, /* @__PURE__ */ React.createElement(Typography, { variant: "body1" }, data ? JSON.stringify(data) : text)));
262
+ return /* @__PURE__ */ jsxs(TableRow, { children: [
263
+ /* @__PURE__ */ jsx(TableCell, { style: { width: 160 }, children: /* @__PURE__ */ jsx(Typography, { variant: "body1", noWrap: true, style: { fontWeight: 900 }, children: label }) }),
264
+ /* @__PURE__ */ jsx(TableCell, { children: /* @__PURE__ */ jsx(Typography, { variant: "body1", children: data ? JSON.stringify(data) : text }) })
265
+ ] });
220
266
  }
221
267
  function MetadataView({ schema }) {
222
- return /* @__PURE__ */ React.createElement(Paper, { variant: "outlined", square: true, style: { width: "100%" } }, /* @__PURE__ */ React.createElement(Table, { size: "small" }, /* @__PURE__ */ React.createElement(TableBody, null, /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Type", data: schema.type }), /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Allowed values", data: schema.enum }), schema.additionalProperties === true && /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Additional Properties", text: "true" }), schema.additionalItems === true && /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Additional Items", text: "true" }), /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Format", text: schema.format }), /* @__PURE__ */ React.createElement(
223
- MetadataViewRow,
224
- {
225
- label: "Pattern",
226
- text: schema.pattern && String(schema.pattern)
227
- }
228
- ), /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Minimum", data: schema.minimum }), /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Maximum", data: schema.maximum }), /* @__PURE__ */ React.createElement(
229
- MetadataViewRow,
230
- {
231
- label: "Exclusive minimum",
232
- data: schema.exclusiveMinimum
233
- }
234
- ), /* @__PURE__ */ React.createElement(
235
- MetadataViewRow,
236
- {
237
- label: "Exclusive maximum",
238
- data: schema.exclusiveMaximum
239
- }
240
- ), /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Multiple of", data: schema.multipleOf }), /* @__PURE__ */ React.createElement(
241
- MetadataViewRow,
242
- {
243
- label: "Maximum number of items",
244
- data: schema.maxItems
245
- }
246
- ), /* @__PURE__ */ React.createElement(
247
- MetadataViewRow,
248
- {
249
- label: "Minimum number of items",
250
- data: schema.minItems
251
- }
252
- ), /* @__PURE__ */ React.createElement(
253
- MetadataViewRow,
254
- {
255
- label: "Maximum number of properties",
256
- data: schema.maxProperties
257
- }
258
- ), /* @__PURE__ */ React.createElement(
259
- MetadataViewRow,
260
- {
261
- label: "Minimum number of properties",
262
- data: schema.minProperties
263
- }
264
- ), /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Maximum Length", data: schema.maxLength }), /* @__PURE__ */ React.createElement(MetadataViewRow, { label: "Minimum Length", data: schema.minLength }), /* @__PURE__ */ React.createElement(
265
- MetadataViewRow,
266
- {
267
- label: "Items must be unique",
268
- data: schema.uniqueItems
269
- }
270
- ))));
268
+ return /* @__PURE__ */ jsx(Paper, { variant: "outlined", square: true, style: { width: "100%" }, children: /* @__PURE__ */ jsx(Table, { size: "small", children: /* @__PURE__ */ jsxs(TableBody, { children: [
269
+ /* @__PURE__ */ jsx(MetadataViewRow, { label: "Type", data: schema.type }),
270
+ /* @__PURE__ */ jsx(MetadataViewRow, { label: "Allowed values", data: schema.enum }),
271
+ schema.additionalProperties === true && /* @__PURE__ */ jsx(MetadataViewRow, { label: "Additional Properties", text: "true" }),
272
+ schema.additionalItems === true && /* @__PURE__ */ jsx(MetadataViewRow, { label: "Additional Items", text: "true" }),
273
+ /* @__PURE__ */ jsx(MetadataViewRow, { label: "Format", text: schema.format }),
274
+ /* @__PURE__ */ jsx(
275
+ MetadataViewRow,
276
+ {
277
+ label: "Pattern",
278
+ text: schema.pattern && String(schema.pattern)
279
+ }
280
+ ),
281
+ /* @__PURE__ */ jsx(MetadataViewRow, { label: "Minimum", data: schema.minimum }),
282
+ /* @__PURE__ */ jsx(MetadataViewRow, { label: "Maximum", data: schema.maximum }),
283
+ /* @__PURE__ */ jsx(
284
+ MetadataViewRow,
285
+ {
286
+ label: "Exclusive minimum",
287
+ data: schema.exclusiveMinimum
288
+ }
289
+ ),
290
+ /* @__PURE__ */ jsx(
291
+ MetadataViewRow,
292
+ {
293
+ label: "Exclusive maximum",
294
+ data: schema.exclusiveMaximum
295
+ }
296
+ ),
297
+ /* @__PURE__ */ jsx(MetadataViewRow, { label: "Multiple of", data: schema.multipleOf }),
298
+ /* @__PURE__ */ jsx(
299
+ MetadataViewRow,
300
+ {
301
+ label: "Maximum number of items",
302
+ data: schema.maxItems
303
+ }
304
+ ),
305
+ /* @__PURE__ */ jsx(
306
+ MetadataViewRow,
307
+ {
308
+ label: "Minimum number of items",
309
+ data: schema.minItems
310
+ }
311
+ ),
312
+ /* @__PURE__ */ jsx(
313
+ MetadataViewRow,
314
+ {
315
+ label: "Maximum number of properties",
316
+ data: schema.maxProperties
317
+ }
318
+ ),
319
+ /* @__PURE__ */ jsx(
320
+ MetadataViewRow,
321
+ {
322
+ label: "Minimum number of properties",
323
+ data: schema.minProperties
324
+ }
325
+ ),
326
+ /* @__PURE__ */ jsx(MetadataViewRow, { label: "Maximum Length", data: schema.maxLength }),
327
+ /* @__PURE__ */ jsx(MetadataViewRow, { label: "Minimum Length", data: schema.minLength }),
328
+ /* @__PURE__ */ jsx(
329
+ MetadataViewRow,
330
+ {
331
+ label: "Items must be unique",
332
+ data: schema.uniqueItems
333
+ }
334
+ )
335
+ ] }) }) });
271
336
  }
272
337
 
273
338
  export { SchemaView };
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaView.esm.js","sources":["../../../src/components/SchemaView/SchemaView.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JsonValue } from '@backstage/types';\nimport Box from '@material-ui/core/Box';\nimport Chip from '@material-ui/core/Chip';\nimport Divider from '@material-ui/core/Divider';\nimport Paper from '@material-ui/core/Paper';\nimport Table from '@material-ui/core/Table';\nimport TableBody from '@material-ui/core/TableBody';\nimport TableCell from '@material-ui/core/TableCell';\nimport TableRow from '@material-ui/core/TableRow';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Schema } from 'jsonschema';\nimport React, { useEffect, useRef } from 'react';\nimport { useScrollTargets } from '../ScrollTargetsContext/ScrollTargetsContext';\nimport { SchemaViewProps } from './types';\n\nexport function SchemaView(props: SchemaViewProps) {\n const { schema } = props;\n if (schema.anyOf) {\n return (\n <MatchView\n {...props}\n schema={schema.anyOf}\n label=\"Any of the following\"\n />\n );\n }\n if (schema.oneOf) {\n return (\n <MatchView\n {...props}\n schema={schema.oneOf}\n label=\"One of the following\"\n />\n );\n }\n if (schema.allOf) {\n return (\n <MatchView\n {...props}\n schema={schema.allOf}\n label=\"All of the following\"\n />\n );\n }\n switch (schema.type) {\n case 'array':\n return <ArrayView {...props} />;\n case 'object':\n case undefined:\n return <ObjectView {...props} />;\n default:\n return <ScalarView {...props} />;\n }\n}\n\nfunction ArrayView({ path, depth, schema }: SchemaViewProps) {\n const itemDepth = depth + 1;\n const itemPath = path ? `${path}[]` : '[]';\n const itemSchema = schema.items;\n\n return (\n <>\n <Box marginBottom={4}>\n {schema.description && (\n <Box marginBottom={4}>\n <Typography variant=\"body1\">{schema.description}</Typography>\n </Box>\n )}\n <MetadataView schema={schema} />\n </Box>\n <Typography variant=\"overline\">Items</Typography>\n <ChildView\n lastChild\n path={itemPath}\n depth={itemDepth}\n schema={itemSchema as Schema | undefined}\n />\n {schema.additionalItems && schema.additionalItems !== true && (\n <>\n <Typography variant=\"overline\">Additional Items</Typography>\n <ChildView\n path={itemPath}\n depth={itemDepth}\n schema={schema.additionalItems}\n lastChild\n />\n </>\n )}\n </>\n );\n}\n\nfunction isRequired(name: string, required?: boolean | string[]) {\n if (required === true) {\n return true;\n }\n if (Array.isArray(required)) {\n return required.includes(name);\n }\n return false;\n}\n\nfunction ObjectView({ path, depth, schema }: SchemaViewProps) {\n const properties = Object.entries(schema.properties ?? {});\n const patternProperties = Object.entries(schema.patternProperties ?? {});\n\n return (\n <>\n {depth > 0 && (\n <Box marginBottom={4}>\n {schema.description && (\n <Box marginBottom={4}>\n <Typography variant=\"body1\">{schema.description}</Typography>\n </Box>\n )}\n <MetadataView schema={schema} />\n </Box>\n )}\n {properties.length > 0 && (\n <>\n {depth > 0 && <Typography variant=\"overline\">Properties</Typography>}\n {properties.map(([name, propSchema], index) => (\n <ChildView\n key={name}\n path={path ? `${path}.${name}` : name}\n depth={depth + 1}\n schema={propSchema}\n lastChild={index === properties.length - 1}\n required={isRequired(name, schema.required)}\n />\n ))}\n </>\n )}\n {patternProperties.length > 0 && (\n <>\n {depth > 0 && (\n <Typography variant=\"overline\">Pattern Properties</Typography>\n )}\n {patternProperties.map(([name, propSchema], index) => (\n <ChildView\n key={name}\n path={path ? `${path}.<${name}>` : name}\n depth={depth + 1}\n schema={propSchema}\n lastChild={index === patternProperties.length - 1}\n required={isRequired(name, schema.required)}\n />\n ))}\n </>\n )}\n {schema.additionalProperties && schema.additionalProperties !== true && (\n <>\n <Typography variant=\"overline\">Additional Properties</Typography>\n <ChildView\n path={`${path}.*`}\n depth={depth + 1}\n schema={schema.additionalProperties}\n lastChild\n />\n </>\n )}\n </>\n );\n}\n\ninterface MetadataViewRowProps {\n label: string;\n text?: string;\n data?: JsonValue;\n}\n\nfunction titleVariant(depth: number) {\n if (depth <= 1) {\n return 'h2';\n } else if (depth === 2) {\n return 'h3';\n } else if (depth === 3) {\n return 'h4';\n } else if (depth === 4) {\n return 'h5';\n }\n return 'h6';\n}\n\nconst useChildViewStyles = makeStyles(theme => ({\n title: {\n marginBottom: 0,\n },\n chip: {\n marginLeft: theme.spacing(1),\n marginRight: 0,\n marginBottom: 0,\n },\n}));\n\nfunction ChildView({\n path,\n depth,\n schema,\n required,\n lastChild,\n}: {\n path: string;\n depth: number;\n schema?: Schema;\n required?: boolean;\n lastChild?: boolean;\n}) {\n const classes = useChildViewStyles();\n const titleRef = useRef<HTMLElement>(null);\n const scroll = useScrollTargets();\n\n useEffect(() => {\n return scroll?.setScrollListener(path, () => {\n titleRef.current?.scrollIntoView({ behavior: 'smooth' });\n });\n }, [scroll, path]);\n\n const chips = new Array<JSX.Element>();\n const chipProps = { size: 'small' as const, classes: { root: classes.chip } };\n\n if (required) {\n chips.push(\n <Chip label=\"required\" color=\"default\" key=\"required\" {...chipProps} />,\n );\n }\n\n const visibility = (schema as { visibility?: string })?.visibility;\n if (visibility === 'frontend') {\n chips.push(\n <Chip label=\"frontend\" color=\"primary\" key=\"visibility\" {...chipProps} />,\n );\n } else if (visibility === 'secret') {\n chips.push(\n <Chip label=\"secret\" color=\"secondary\" key=\"visibility\" {...chipProps} />,\n );\n }\n\n return (\n <Box paddingBottom={lastChild ? 4 : 8} display=\"flex\" flexDirection=\"row\">\n <Divider orientation=\"vertical\" flexItem />\n <Box paddingLeft={2} flex={1}>\n <Box\n display=\"flex\"\n flexDirection=\"row\"\n marginBottom={2}\n alignItems=\"center\"\n >\n <Typography\n ref={titleRef}\n variant={titleVariant(depth)}\n classes={{ root: classes.title }}\n >\n {path}\n </Typography>\n {chips.length > 0 && <Box marginLeft={1} />}\n {chips}\n </Box>\n {schema && (\n <SchemaView path={path} depth={depth} schema={schema as Schema} />\n )}\n </Box>\n </Box>\n );\n}\n\nfunction MatchView({\n path,\n depth,\n schema,\n label,\n}: {\n path: string;\n depth: number;\n schema: Schema[];\n label: string;\n}) {\n return (\n <>\n <Typography variant=\"overline\">{label}</Typography>\n {schema.map((optionSchema, index) => (\n <ChildView\n key={index}\n path={`${path}/${index + 1}`}\n depth={depth + 1}\n schema={optionSchema}\n lastChild={index === schema.length - 1}\n />\n ))}\n </>\n );\n}\n\nfunction ScalarView({ schema }: SchemaViewProps) {\n return (\n <>\n {schema.description && (\n <Box marginBottom={4}>\n <Typography variant=\"body1\">{schema.description}</Typography>\n </Box>\n )}\n <MetadataView schema={schema} />\n </>\n );\n}\n\ninterface MetadataViewRowProps {\n label: string;\n text?: string;\n data?: JsonValue;\n}\n\nfunction MetadataViewRow({ label, text, data }: MetadataViewRowProps) {\n if (text === undefined && data === undefined) {\n return null;\n }\n return (\n <TableRow>\n <TableCell style={{ width: 160 }}>\n <Typography variant=\"body1\" noWrap style={{ fontWeight: 900 }}>\n {label}\n </Typography>\n </TableCell>\n <TableCell>\n <Typography variant=\"body1\">\n {data ? JSON.stringify(data) : text}\n </Typography>\n </TableCell>\n </TableRow>\n );\n}\n\nfunction MetadataView({ schema }: { schema: Schema }) {\n return (\n <Paper variant=\"outlined\" square style={{ width: '100%' }}>\n <Table size=\"small\">\n <TableBody>\n <MetadataViewRow label=\"Type\" data={schema.type} />\n <MetadataViewRow label=\"Allowed values\" data={schema.enum} />\n {schema.additionalProperties === true && (\n <MetadataViewRow label=\"Additional Properties\" text=\"true\" />\n )}\n {schema.additionalItems === true && (\n <MetadataViewRow label=\"Additional Items\" text=\"true\" />\n )}\n <MetadataViewRow label=\"Format\" text={schema.format} />\n <MetadataViewRow\n label=\"Pattern\"\n text={schema.pattern && String(schema.pattern)}\n />\n <MetadataViewRow label=\"Minimum\" data={schema.minimum} />\n <MetadataViewRow label=\"Maximum\" data={schema.maximum} />\n <MetadataViewRow\n label=\"Exclusive minimum\"\n data={schema.exclusiveMinimum}\n />\n <MetadataViewRow\n label=\"Exclusive maximum\"\n data={schema.exclusiveMaximum}\n />\n <MetadataViewRow label=\"Multiple of\" data={schema.multipleOf} />\n <MetadataViewRow\n label=\"Maximum number of items\"\n data={schema.maxItems}\n />\n <MetadataViewRow\n label=\"Minimum number of items\"\n data={schema.minItems}\n />\n <MetadataViewRow\n label=\"Maximum number of properties\"\n data={schema.maxProperties}\n />\n <MetadataViewRow\n label=\"Minimum number of properties\"\n data={schema.minProperties}\n />\n <MetadataViewRow label=\"Maximum Length\" data={schema.maxLength} />\n <MetadataViewRow label=\"Minimum Length\" data={schema.minLength} />\n <M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CACF,CACF,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"SchemaView.esm.js","sources":["../../../src/components/SchemaView/SchemaView.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { JsonValue } from '@backstage/types';\nimport Box from '@material-ui/core/Box';\nimport Chip from '@material-ui/core/Chip';\nimport Divider from '@material-ui/core/Divider';\nimport Paper from '@material-ui/core/Paper';\nimport Table from '@material-ui/core/Table';\nimport TableBody from '@material-ui/core/TableBody';\nimport TableCell from '@material-ui/core/TableCell';\nimport TableRow from '@material-ui/core/TableRow';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { Schema } from 'jsonschema';\nimport { useEffect, useRef } from 'react';\nimport { useScrollTargets } from '../ScrollTargetsContext/ScrollTargetsContext';\nimport { SchemaViewProps } from './types';\n\nexport function SchemaView(props: SchemaViewProps) {\n const { schema } = props;\n if (schema.anyOf) {\n return (\n <MatchView\n {...props}\n schema={schema.anyOf}\n label=\"Any of the following\"\n />\n );\n }\n if (schema.oneOf) {\n return (\n <MatchView\n {...props}\n schema={schema.oneOf}\n label=\"One of the following\"\n />\n );\n }\n if (schema.allOf) {\n return (\n <MatchView\n {...props}\n schema={schema.allOf}\n label=\"All of the following\"\n />\n );\n }\n switch (schema.type) {\n case 'array':\n return <ArrayView {...props} />;\n case 'object':\n case undefined:\n return <ObjectView {...props} />;\n default:\n return <ScalarView {...props} />;\n }\n}\n\nfunction ArrayView({ path, depth, schema }: SchemaViewProps) {\n const itemDepth = depth + 1;\n const itemPath = path ? `${path}[]` : '[]';\n const itemSchema = schema.items;\n\n return (\n <>\n <Box marginBottom={4}>\n {schema.description && (\n <Box marginBottom={4}>\n <Typography variant=\"body1\">{schema.description}</Typography>\n </Box>\n )}\n <MetadataView schema={schema} />\n </Box>\n <Typography variant=\"overline\">Items</Typography>\n <ChildView\n lastChild\n path={itemPath}\n depth={itemDepth}\n schema={itemSchema as Schema | undefined}\n />\n {schema.additionalItems && schema.additionalItems !== true && (\n <>\n <Typography variant=\"overline\">Additional Items</Typography>\n <ChildView\n path={itemPath}\n depth={itemDepth}\n schema={schema.additionalItems}\n lastChild\n />\n </>\n )}\n </>\n );\n}\n\nfunction isRequired(name: string, required?: boolean | string[]) {\n if (required === true) {\n return true;\n }\n if (Array.isArray(required)) {\n return required.includes(name);\n }\n return false;\n}\n\nfunction ObjectView({ path, depth, schema }: SchemaViewProps) {\n const properties = Object.entries(schema.properties ?? {});\n const patternProperties = Object.entries(schema.patternProperties ?? {});\n\n return (\n <>\n {depth > 0 && (\n <Box marginBottom={4}>\n {schema.description && (\n <Box marginBottom={4}>\n <Typography variant=\"body1\">{schema.description}</Typography>\n </Box>\n )}\n <MetadataView schema={schema} />\n </Box>\n )}\n {properties.length > 0 && (\n <>\n {depth > 0 && <Typography variant=\"overline\">Properties</Typography>}\n {properties.map(([name, propSchema], index) => (\n <ChildView\n key={name}\n path={path ? `${path}.${name}` : name}\n depth={depth + 1}\n schema={propSchema}\n lastChild={index === properties.length - 1}\n required={isRequired(name, schema.required)}\n />\n ))}\n </>\n )}\n {patternProperties.length > 0 && (\n <>\n {depth > 0 && (\n <Typography variant=\"overline\">Pattern Properties</Typography>\n )}\n {patternProperties.map(([name, propSchema], index) => (\n <ChildView\n key={name}\n path={path ? `${path}.<${name}>` : name}\n depth={depth + 1}\n schema={propSchema}\n lastChild={index === patternProperties.length - 1}\n required={isRequired(name, schema.required)}\n />\n ))}\n </>\n )}\n {schema.additionalProperties && schema.additionalProperties !== true && (\n <>\n <Typography variant=\"overline\">Additional Properties</Typography>\n <ChildView\n path={`${path}.*`}\n depth={depth + 1}\n schema={schema.additionalProperties}\n lastChild\n />\n </>\n )}\n </>\n );\n}\n\ninterface MetadataViewRowProps {\n label: string;\n text?: string;\n data?: JsonValue;\n}\n\nfunction titleVariant(depth: number) {\n if (depth <= 1) {\n return 'h2';\n } else if (depth === 2) {\n return 'h3';\n } else if (depth === 3) {\n return 'h4';\n } else if (depth === 4) {\n return 'h5';\n }\n return 'h6';\n}\n\nconst useChildViewStyles = makeStyles(theme => ({\n title: {\n marginBottom: 0,\n },\n chip: {\n marginLeft: theme.spacing(1),\n marginRight: 0,\n marginBottom: 0,\n },\n}));\n\nfunction ChildView({\n path,\n depth,\n schema,\n required,\n lastChild,\n}: {\n path: string;\n depth: number;\n schema?: Schema;\n required?: boolean;\n lastChild?: boolean;\n}) {\n const classes = useChildViewStyles();\n const titleRef = useRef<HTMLElement>(null);\n const scroll = useScrollTargets();\n\n useEffect(() => {\n return scroll?.setScrollListener(path, () => {\n titleRef.current?.scrollIntoView({ behavior: 'smooth' });\n });\n }, [scroll, path]);\n\n const chips = new Array<JSX.Element>();\n const chipProps = { size: 'small' as const, classes: { root: classes.chip } };\n\n if (required) {\n chips.push(\n <Chip label=\"required\" color=\"default\" key=\"required\" {...chipProps} />,\n );\n }\n\n const visibility = (schema as { visibility?: string })?.visibility;\n if (visibility === 'frontend') {\n chips.push(\n <Chip label=\"frontend\" color=\"primary\" key=\"visibility\" {...chipProps} />,\n );\n } else if (visibility === 'secret') {\n chips.push(\n <Chip label=\"secret\" color=\"secondary\" key=\"visibility\" {...chipProps} />,\n );\n }\n\n return (\n <Box paddingBottom={lastChild ? 4 : 8} display=\"flex\" flexDirection=\"row\">\n <Divider orientation=\"vertical\" flexItem />\n <Box paddingLeft={2} flex={1}>\n <Box\n display=\"flex\"\n flexDirection=\"row\"\n marginBottom={2}\n alignItems=\"center\"\n >\n <Typography\n ref={titleRef}\n variant={titleVariant(depth)}\n classes={{ root: classes.title }}\n >\n {path}\n </Typography>\n {chips.length > 0 && <Box marginLeft={1} />}\n {chips}\n </Box>\n {schema && (\n <SchemaView path={path} depth={depth} schema={schema as Schema} />\n )}\n </Box>\n </Box>\n );\n}\n\nfunction MatchView({\n path,\n depth,\n schema,\n label,\n}: {\n path: string;\n depth: number;\n schema: Schema[];\n label: string;\n}) {\n return (\n <>\n <Typography variant=\"overline\">{label}</Typography>\n {schema.map((optionSchema, index) => (\n <ChildView\n key={index}\n path={`${path}/${index + 1}`}\n depth={depth + 1}\n schema={optionSchema}\n lastChild={index === schema.length - 1}\n />\n ))}\n </>\n );\n}\n\nfunction ScalarView({ schema }: SchemaViewProps) {\n return (\n <>\n {schema.description && (\n <Box marginBottom={4}>\n <Typography variant=\"body1\">{schema.description}</Typography>\n </Box>\n )}\n <MetadataView schema={schema} />\n </>\n );\n}\n\ninterface MetadataViewRowProps {\n label: string;\n text?: string;\n data?: JsonValue;\n}\n\nfunction MetadataViewRow({ label, text, data }: MetadataViewRowProps) {\n if (text === undefined && data === undefined) {\n return null;\n }\n return (\n <TableRow>\n <TableCell style={{ width: 160 }}>\n <Typography variant=\"body1\" noWrap style={{ fontWeight: 900 }}>\n {label}\n </Typography>\n </TableCell>\n <TableCell>\n <Typography variant=\"body1\">\n {data ? JSON.stringify(data) : text}\n </Typography>\n </TableCell>\n </TableRow>\n );\n}\n\nfunction MetadataView({ schema }: { schema: Schema }) {\n return (\n <Paper variant=\"outlined\" square style={{ width: '100%' }}>\n <Table size=\"small\">\n <TableBody>\n <MetadataViewRow label=\"Type\" data={schema.type} />\n <MetadataViewRow label=\"Allowed values\" data={schema.enum} />\n {schema.additionalProperties === true && (\n <MetadataViewRow label=\"Additional Properties\" text=\"true\" />\n )}\n {schema.additionalItems === true && (\n <MetadataViewRow label=\"Additional Items\" text=\"true\" />\n )}\n <MetadataViewRow label=\"Format\" text={schema.format} />\n <MetadataViewRow\n label=\"Pattern\"\n text={schema.pattern && String(schema.pattern)}\n />\n <MetadataViewRow label=\"Minimum\" data={schema.minimum} />\n <MetadataViewRow label=\"Maximum\" data={schema.maximum} />\n <MetadataViewRow\n label=\"Exclusive minimum\"\n data={schema.exclusiveMinimum}\n />\n <MetadataViewRow\n label=\"Exclusive maximum\"\n data={schema.exclusiveMaximum}\n />\n <MetadataViewRow label=\"Multiple of\" data={schema.multipleOf} />\n <MetadataViewRow\n label=\"Maximum number of items\"\n data={schema.maxItems}\n />\n <MetadataViewRow\n label=\"Minimum number of items\"\n data={schema.minItems}\n />\n <MetadataViewRow\n label=\"Maximum number of properties\"\n data={schema.maxProperties}\n />\n <MetadataViewRow\n label=\"Minimum number of properties\"\n data={schema.minProperties}\n />\n <MetadataViewRow label=\"Maximum Length\" data={schema.maxLength} />\n <MetadataViewRow label=\"Minimum Length\" data={schema.minLength} />\n <MetadataViewRow\n label=\"Items must be unique\"\n data={schema.uniqueItems}\n />\n </TableBody>\n </Table>\n </Paper>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AAgCO,SAAS,WAAW,KAAwB,EAAA;AACjD,EAAM,MAAA,EAAE,QAAW,GAAA,KAAA;AACnB,EAAA,IAAI,OAAO,KAAO,EAAA;AAChB,IACE,uBAAA,GAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACE,GAAG,KAAA;AAAA,QACJ,QAAQ,MAAO,CAAA,KAAA;AAAA,QACf,KAAM,EAAA;AAAA;AAAA,KACR;AAAA;AAGJ,EAAA,IAAI,OAAO,KAAO,EAAA;AAChB,IACE,uBAAA,GAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACE,GAAG,KAAA;AAAA,QACJ,QAAQ,MAAO,CAAA,KAAA;AAAA,QACf,KAAM,EAAA;AAAA;AAAA,KACR;AAAA;AAGJ,EAAA,IAAI,OAAO,KAAO,EAAA;AAChB,IACE,uBAAA,GAAA;AAAA,MAAC,SAAA;AAAA,MAAA;AAAA,QACE,GAAG,KAAA;AAAA,QACJ,QAAQ,MAAO,CAAA,KAAA;AA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AAA;AAAA,QACN,MAAM,MAAO,CAAA;AAAA;AAAA,KACf;AAAA,wBACC,eAAgB,EAAA,EAAA,KAAA,EAAM,gBAAiB,EAAA,IAAA,EAAM,OAAO,SAAW,EAAA,CAAA;AAAA,wBAC/D,eAAgB,EAAA,EAAA,KAAA,EAAM,gBAAiB,EAAA,IAAA,EAAM,OAAO,SAAW,EAAA,CAAA;AAAA,oBAChE,GAAA;AAAA,MAAC,eAAA;AAAA,MAAA;AAAA,QACC,KAAM,EAAA,sBAAA;AAAA,QACN,MAAM,MAAO,CAAA;AAAA;AAAA;AACf,GAAA,EACF,GACF,CACF,EAAA,CAAA;AAEJ;;;;"}
@@ -1,12 +1,12 @@
1
+ import { jsx, jsxs } from 'react/jsx-runtime';
1
2
  import Box from '@material-ui/core/Box';
2
3
  import Paper from '@material-ui/core/Paper';
3
- import React from 'react';
4
4
  import { SchemaView } from '../SchemaView/SchemaView.esm.js';
5
5
  import { SchemaBrowser } from '../SchemaBrowser/SchemaBrowser.esm.js';
6
6
  import { ScrollTargetsProvider } from '../ScrollTargetsContext/ScrollTargetsContext.esm.js';
7
7
 
8
8
  const SchemaViewer = ({ schema }) => {
9
- return /* @__PURE__ */ React.createElement(Box, { flex: "1", position: "relative" }, /* @__PURE__ */ React.createElement(
9
+ return /* @__PURE__ */ jsx(Box, { flex: "1", position: "relative", children: /* @__PURE__ */ jsx(
10
10
  Box,
11
11
  {
12
12
  clone: true,
@@ -14,10 +14,13 @@ const SchemaViewer = ({ schema }) => {
14
14
  display: "flex",
15
15
  flexDirection: "row",
16
16
  flexWrap: "nowrap",
17
- maxHeight: "100%"
18
- },
19
- /* @__PURE__ */ React.createElement(Paper, { elevation: 3 }, /* @__PURE__ */ React.createElement(ScrollTargetsProvider, null, /* @__PURE__ */ React.createElement(Box, { padding: 1, overflow: "auto", width: 300 }, /* @__PURE__ */ React.createElement(SchemaBrowser, { schema })), /* @__PURE__ */ React.createElement(Box, { flex: "1", overflow: "auto" }, /* @__PURE__ */ React.createElement(SchemaView, { schema, path: "", depth: 0 }))))
20
- ));
17
+ maxHeight: "100%",
18
+ children: /* @__PURE__ */ jsx(Paper, { elevation: 3, children: /* @__PURE__ */ jsxs(ScrollTargetsProvider, { children: [
19
+ /* @__PURE__ */ jsx(Box, { padding: 1, overflow: "auto", width: 300, children: /* @__PURE__ */ jsx(SchemaBrowser, { schema }) }),
20
+ /* @__PURE__ */ jsx(Box, { flex: "1", overflow: "auto", children: /* @__PURE__ */ jsx(SchemaView, { schema, path: "", depth: 0 }) })
21
+ ] }) })
22
+ }
23
+ ) });
21
24
  };
22
25
 
23
26
  export { SchemaViewer };
@@ -1 +1 @@
1
- {"version":3,"file":"SchemaViewer.esm.js","sources":["../../../src/components/SchemaViewer/SchemaViewer.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Box from '@material-ui/core/Box';\nimport Paper from '@material-ui/core/Paper';\nimport { Schema } from 'jsonschema';\nimport React from 'react';\nimport { SchemaView } from '../SchemaView';\nimport { SchemaBrowser } from '../SchemaBrowser';\nimport { ScrollTargetsProvider } from '../ScrollTargetsContext/ScrollTargetsContext';\n\nexport interface SchemaViewerProps {\n schema: Schema;\n}\n\nexport const SchemaViewer = ({ schema }: SchemaViewerProps) => {\n return (\n <Box flex=\"1\" position=\"relative\">\n <Box\n clone\n position=\"absolute\"\n display=\"flex\"\n flexDirection=\"row\"\n flexWrap=\"nowrap\"\n maxHeight=\"100%\"\n >\n <Paper elevation={3}>\n <ScrollTargetsProvider>\n <Box padding={1} overflow=\"auto\" width={300}>\n <SchemaBrowser schema={schema} />\n </Box>\n\n <Box flex=\"1\" overflow=\"auto\">\n <SchemaView schema={schema} path=\"\" depth={0} />\n </Box>\n </ScrollTargetsProvider>\n </Paper>\n </Box>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA4BO,MAAM,YAAe,GAAA,CAAC,EAAE,MAAA,EAAgC,KAAA;AAC7D,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAI,IAAK,EAAA,GAAA,EAAI,UAAS,UACrB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,KAAK,EAAA,IAAA;AAAA,MACL,QAAS,EAAA,UAAA;AAAA,MACT,OAAQ,EAAA,MAAA;AAAA,MACR,aAAc,EAAA,KAAA;AAAA,MACd,QAAS,EAAA,QAAA;AAAA,MACT,SAAU,EAAA;AAAA,KAAA;AAAA,oBAET,KAAA,CAAA,aAAA,CAAA,KAAA,EAAA,EAAM,SAAW,EAAA,CAAA,EAAA,sCACf,qBACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,GAAI,EAAA,EAAA,OAAA,EAAS,GAAG,QAAS,EAAA,MAAA,EAAO,KAAO,EAAA,GAAA,EAAA,sCACrC,aAAc,EAAA,EAAA,MAAA,EAAgB,CACjC,CAAA,kBAEC,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAI,IAAK,EAAA,GAAA,EAAI,UAAS,MACrB,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,MAAA,EAAgB,MAAK,EAAG,EAAA,KAAA,EAAO,CAAG,EAAA,CAChD,CACF,CACF;AAAA,GAEJ,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"SchemaViewer.esm.js","sources":["../../../src/components/SchemaViewer/SchemaViewer.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Box from '@material-ui/core/Box';\nimport Paper from '@material-ui/core/Paper';\nimport { Schema } from 'jsonschema';\nimport { SchemaView } from '../SchemaView';\nimport { SchemaBrowser } from '../SchemaBrowser';\nimport { ScrollTargetsProvider } from '../ScrollTargetsContext/ScrollTargetsContext';\n\nexport interface SchemaViewerProps {\n schema: Schema;\n}\n\nexport const SchemaViewer = ({ schema }: SchemaViewerProps) => {\n return (\n <Box flex=\"1\" position=\"relative\">\n <Box\n clone\n position=\"absolute\"\n display=\"flex\"\n flexDirection=\"row\"\n flexWrap=\"nowrap\"\n maxHeight=\"100%\"\n >\n <Paper elevation={3}>\n <ScrollTargetsProvider>\n <Box padding={1} overflow=\"auto\" width={300}>\n <SchemaBrowser schema={schema} />\n </Box>\n\n <Box flex=\"1\" overflow=\"auto\">\n <SchemaView schema={schema} path=\"\" depth={0} />\n </Box>\n </ScrollTargetsProvider>\n </Paper>\n </Box>\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;AA2BO,MAAM,YAAe,GAAA,CAAC,EAAE,MAAA,EAAgC,KAAA;AAC7D,EAAA,uBACG,GAAA,CAAA,GAAA,EAAA,EAAI,IAAK,EAAA,GAAA,EAAI,UAAS,UACrB,EAAA,QAAA,kBAAA,GAAA;AAAA,IAAC,GAAA;AAAA,IAAA;AAAA,MACC,KAAK,EAAA,IAAA;AAAA,MACL,QAAS,EAAA,UAAA;AAAA,MACT,OAAQ,EAAA,MAAA;AAAA,MACR,aAAc,EAAA,KAAA;AAAA,MACd,QAAS,EAAA,QAAA;AAAA,MACT,SAAU,EAAA,MAAA;AAAA,MAEV,QAAC,kBAAA,GAAA,CAAA,KAAA,EAAA,EAAM,SAAW,EAAA,CAAA,EAChB,+BAAC,qBACC,EAAA,EAAA,QAAA,EAAA;AAAA,wBAAC,GAAA,CAAA,GAAA,EAAA,EAAI,OAAS,EAAA,CAAA,EAAG,QAAS,EAAA,MAAA,EAAO,OAAO,GACtC,EAAA,QAAA,kBAAA,GAAA,CAAC,aAAc,EAAA,EAAA,MAAA,EAAgB,CACjC,EAAA,CAAA;AAAA,wBAEC,GAAA,CAAA,GAAA,EAAA,EAAI,IAAK,EAAA,GAAA,EAAI,QAAS,EAAA,MAAA,EACrB,QAAC,kBAAA,GAAA,CAAA,UAAA,EAAA,EAAW,MAAgB,EAAA,IAAA,EAAK,EAAG,EAAA,KAAA,EAAO,GAAG,CAChD,EAAA;AAAA,OAAA,EACF,CACF,EAAA;AAAA;AAAA,GAEJ,EAAA,CAAA;AAEJ;;;;"}
@@ -1,4 +1,5 @@
1
- import React, { createContext, useContext } from 'react';
1
+ import { jsx } from 'react/jsx-runtime';
2
+ import { createContext, useContext } from 'react';
2
3
 
3
4
  class ScrollTargetsForwarder {
4
5
  listeners = /* @__PURE__ */ new Map();
@@ -18,7 +19,7 @@ const ScrollTargetsContext = createContext(
18
19
  void 0
19
20
  );
20
21
  function ScrollTargetsProvider({ children }) {
21
- return /* @__PURE__ */ React.createElement(
22
+ return /* @__PURE__ */ jsx(
22
23
  ScrollTargetsContext.Provider,
23
24
  {
24
25
  value: new ScrollTargetsForwarder(),
@@ -1 +1 @@
1
- {"version":3,"file":"ScrollTargetsContext.esm.js","sources":["../../../src/components/ScrollTargetsContext/ScrollTargetsContext.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { createContext, ReactNode, useContext } from 'react';\n\nclass ScrollTargetsForwarder {\n private readonly listeners = new Map<string, () => void>();\n\n setScrollListener(id: string, listener: () => void): () => void {\n this.listeners.set(id, listener);\n\n return () => {\n if (this.listeners.get(id) === listener) {\n this.listeners.delete(id);\n }\n };\n }\n\n scrollTo(id: string) {\n this.listeners.get(id)?.();\n }\n}\n\nconst ScrollTargetsContext = createContext<ScrollTargetsForwarder | undefined>(\n undefined,\n);\n\nexport function ScrollTargetsProvider({ children }: { children: ReactNode }) {\n return (\n <ScrollTargetsContext.Provider\n value={new ScrollTargetsForwarder()}\n children={children}\n />\n );\n}\n\nexport function useScrollTargets() {\n return useContext(ScrollTargetsContext);\n}\n"],"names":[],"mappings":";;AAkBA,MAAM,sBAAuB,CAAA;AAAA,EACV,SAAA,uBAAgB,GAAwB,EAAA;AAAA,EAEzD,iBAAA,CAAkB,IAAY,QAAkC,EAAA;AAC9D,IAAK,IAAA,CAAA,SAAA,CAAU,GAAI,CAAA,EAAA,EAAI,QAAQ,CAAA;AAE/B,IAAA,OAAO,MAAM;AACX,MAAA,IAAI,IAAK,CAAA,SAAA,CAAU,GAAI,CAAA,EAAE,MAAM,QAAU,EAAA;AACvC,QAAK,IAAA,CAAA,SAAA,CAAU,OAAO,EAAE,CAAA;AAAA;AAC1B,KACF;AAAA;AACF,EAEA,SAAS,EAAY,EAAA;AACnB,IAAK,IAAA,CAAA,SAAA,CAAU,GAAI,CAAA,EAAE,CAAI,IAAA;AAAA;AAE7B;AAEA,MAAM,oBAAuB,GAAA,aAAA;AAAA,EAC3B,KAAA;AACF,CAAA;AAEgB,SAAA,qBAAA,CAAsB,EAAE,QAAA,EAAqC,EAAA;AAC3E,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,oBAAqB,CAAA,QAAA;AAAA,IAArB;AAAA,MACC,KAAA,EAAO,IAAI,sBAAuB,EAAA;AAAA,MAClC;AAAA;AAAA,GACF;AAEJ;AAEO,SAAS,gBAAmB,GAAA;AACjC,EAAA,OAAO,WAAW,oBAAoB,CAAA;AACxC;;;;"}
1
+ {"version":3,"file":"ScrollTargetsContext.esm.js","sources":["../../../src/components/ScrollTargetsContext/ScrollTargetsContext.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createContext, ReactNode, useContext } from 'react';\n\nclass ScrollTargetsForwarder {\n private readonly listeners = new Map<string, () => void>();\n\n setScrollListener(id: string, listener: () => void): () => void {\n this.listeners.set(id, listener);\n\n return () => {\n if (this.listeners.get(id) === listener) {\n this.listeners.delete(id);\n }\n };\n }\n\n scrollTo(id: string) {\n this.listeners.get(id)?.();\n }\n}\n\nconst ScrollTargetsContext = createContext<ScrollTargetsForwarder | undefined>(\n undefined,\n);\n\nexport function ScrollTargetsProvider({ children }: { children: ReactNode }) {\n return (\n <ScrollTargetsContext.Provider\n value={new ScrollTargetsForwarder()}\n children={children}\n />\n );\n}\n\nexport function useScrollTargets() {\n return useContext(ScrollTargetsContext);\n}\n"],"names":[],"mappings":";;;AAkBA,MAAM,sBAAuB,CAAA;AAAA,EACV,SAAA,uBAAgB,GAAwB,EAAA;AAAA,EAEzD,iBAAA,CAAkB,IAAY,QAAkC,EAAA;AAC9D,IAAK,IAAA,CAAA,SAAA,CAAU,GAAI,CAAA,EAAA,EAAI,QAAQ,CAAA;AAE/B,IAAA,OAAO,MAAM;AACX,MAAA,IAAI,IAAK,CAAA,SAAA,CAAU,GAAI,CAAA,EAAE,MAAM,QAAU,EAAA;AACvC,QAAK,IAAA,CAAA,SAAA,CAAU,OAAO,EAAE,CAAA;AAAA;AAC1B,KACF;AAAA;AACF,EAEA,SAAS,EAAY,EAAA;AACnB,IAAK,IAAA,CAAA,SAAA,CAAU,GAAI,CAAA,EAAE,CAAI,IAAA;AAAA;AAE7B;AAEA,MAAM,oBAAuB,GAAA,aAAA;AAAA,EAC3B,KAAA;AACF,CAAA;AAEgB,SAAA,qBAAA,CAAsB,EAAE,QAAA,EAAqC,EAAA;AAC3E,EACE,uBAAA,GAAA;AAAA,IAAC,oBAAqB,CAAA,QAAA;AAAA,IAArB;AAAA,MACC,KAAA,EAAO,IAAI,sBAAuB,EAAA;AAAA,MAClC;AAAA;AAAA,GACF;AAEJ;AAEO,SAAS,gBAAmB,GAAA;AACjC,EAAA,OAAO,WAAW,oBAAoB,CAAA;AACxC;;;;"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _backstage_core_plugin_api from '@backstage/core-plugin-api';
2
2
  import { Schema } from 'jsonschema';
3
3
  import { Observable } from '@backstage/types';
4
- import * as react from 'react';
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
5
5
 
6
6
  /** @public */
7
7
  interface ConfigSchemaResult {
@@ -33,6 +33,6 @@ declare const configSchemaPlugin: _backstage_core_plugin_api.BackstagePlugin<{
33
33
  root: _backstage_core_plugin_api.RouteRef<undefined>;
34
34
  }, {}>;
35
35
  /** @public */
36
- declare const ConfigSchemaPage: () => react.JSX.Element;
36
+ declare const ConfigSchemaPage: () => react_jsx_runtime.JSX.Element;
37
37
 
38
38
  export { type ConfigSchemaApi, ConfigSchemaPage, type ConfigSchemaResult, StaticSchemaLoader, configSchemaApiRef, configSchemaPlugin };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-config-schema",
3
- "version": "0.1.67-next.0",
3
+ "version": "0.1.67",
4
4
  "description": "A Backstage plugin that lets you browse the configuration schema of your app",
5
5
  "backstage": {
6
6
  "role": "frontend-plugin",
@@ -37,10 +37,10 @@
37
37
  "test": "backstage-cli package test"
38
38
  },
39
39
  "dependencies": {
40
- "@backstage/core-components": "0.17.1-next.0",
41
- "@backstage/core-plugin-api": "1.10.5",
42
- "@backstage/errors": "1.2.7",
43
- "@backstage/types": "1.2.1",
40
+ "@backstage/core-components": "^0.17.1",
41
+ "@backstage/core-plugin-api": "^1.10.6",
42
+ "@backstage/errors": "^1.2.7",
43
+ "@backstage/types": "^1.2.1",
44
44
  "@material-ui/core": "^4.12.2",
45
45
  "@material-ui/icons": "^4.9.1",
46
46
  "@material-ui/lab": "4.0.0-alpha.61",
@@ -49,8 +49,8 @@
49
49
  "zen-observable": "^0.10.0"
50
50
  },
51
51
  "devDependencies": {
52
- "@backstage/cli": "0.32.0-next.1",
53
- "@backstage/dev-utils": "1.1.9-next.1",
52
+ "@backstage/cli": "^0.32.0",
53
+ "@backstage/dev-utils": "^1.1.9",
54
54
  "@testing-library/dom": "^10.0.0",
55
55
  "@testing-library/jest-dom": "^6.0.0",
56
56
  "@testing-library/react": "^16.0.0",
@@ -70,5 +70,12 @@
70
70
  "optional": true
71
71
  }
72
72
  },
73
+ "typesVersions": {
74
+ "*": {
75
+ "package.json": [
76
+ "package.json"
77
+ ]
78
+ }
79
+ },
73
80
  "module": "./dist/index.esm.js"
74
81
  }