@backstage-community/plugin-explore 1.0.0 → 1.1.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.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @backstage-community/plugin-explore
|
|
2
2
|
|
|
3
|
+
## 1.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 52ba30b: Backstage version bump to v1.56.2
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- 606ec49: Limited `@remixicon/react` dependency to versions below 4.9.0 due to a license change in that release.
|
|
12
|
+
- Updated dependencies [52ba30b]
|
|
13
|
+
- @backstage-community/plugin-explore-common@0.15.0
|
|
14
|
+
- @backstage-community/plugin-explore-react@0.15.0
|
|
15
|
+
|
|
16
|
+
## 1.0.1
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- de252c4: Fix ExploreLayout to use FullPage
|
|
21
|
+
|
|
3
22
|
## 1.0.0
|
|
4
23
|
|
|
5
24
|
### Major Changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { attachComponentData, useRouteRef, useElementFilter } from '@backstage/core-plugin-api';
|
|
3
|
-
import { PluginHeader } from '@backstage/ui';
|
|
3
|
+
import { PluginHeader, FullPage } from '@backstage/ui';
|
|
4
4
|
import { useMemo } from 'react';
|
|
5
5
|
import { useRoutes } from 'react-router-dom';
|
|
6
6
|
import { exploreRouteRef } from '../../routes.esm.js';
|
|
@@ -43,19 +43,15 @@ const ExploreLayout = (props) => {
|
|
|
43
43
|
);
|
|
44
44
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
45
45
|
/* @__PURE__ */ jsx(PluginHeader, { title: title ?? "Explore our ecosystem", tabs }),
|
|
46
|
-
/* @__PURE__ */ jsx(
|
|
46
|
+
/* @__PURE__ */ jsx(FullPage, { children: /* @__PURE__ */ jsx(
|
|
47
47
|
"div",
|
|
48
48
|
{
|
|
49
49
|
style: {
|
|
50
|
-
padding: "var(--bui-space-6)"
|
|
51
|
-
height: "100%",
|
|
52
|
-
minHeight: 0,
|
|
53
|
-
display: "flex",
|
|
54
|
-
flexDirection: "column"
|
|
50
|
+
padding: "var(--bui-space-6)"
|
|
55
51
|
},
|
|
56
52
|
children: element ?? routes[0]?.children ?? null
|
|
57
53
|
}
|
|
58
|
-
)
|
|
54
|
+
) })
|
|
59
55
|
] });
|
|
60
56
|
};
|
|
61
57
|
ExploreLayout.Route = RouteData;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExploreLayout.esm.js","sources":["../../../src/components/ExploreLayout/ExploreLayout.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 {\n attachComponentData,\n useElementFilter,\n useRouteRef,\n} from '@backstage/core-plugin-api';\nimport { HeaderTab, PluginHeader } from '@backstage/ui';\nimport React, { useMemo } from 'react';\nimport { useRoutes } from 'react-router-dom';\nimport { exploreRouteRef } from '../../routes';\n\n// TODO: This layout could be a shared based component if it was possible to create custom TabbedLayouts\n// A generalized version of createSubRoutesFromChildren, etc. would be required\n/** @public */\nexport type SubRoute = {\n path: string;\n title: string;\n children: JSX.Element;\n /**\n * @deprecated The Backstage UI `PluginHeader` does not forward extra MUI tab\n * props. This field is kept for backwards compatibility but is no longer\n * used.\n */\n tabProps?: Record<string, unknown>;\n};\n\nconst dataKey = 'plugin.explore.exploreLayoutRoute';\n\nconst RouteData: (props: SubRoute) => null = () => null;\nattachComponentData(RouteData, dataKey, true);\n\n// This causes all mount points that are discovered within this route to use the path of the route itself\nattachComponentData(RouteData, 'core.gatherMountPoints', true);\n\n/** @public */\nexport type ExploreLayoutProps = {\n title?: string;\n /**\n * @deprecated The Backstage UI `PluginHeader` does not render a subtitle.\n * This prop is kept for backwards compatibility but is no longer displayed.\n */\n subtitle?: string;\n children?: React.ReactNode;\n};\n\nconst stripLeadingSlash = (path: string) => path.replace(/^\\/+/, '');\n\nconst joinPaths = (base: string, sub: string) => {\n const trimmedBase = base.replace(/\\/+$/, '');\n const trimmedSub = stripLeadingSlash(sub);\n return trimmedSub ? `${trimmedBase}/${trimmedSub}` : trimmedBase;\n};\n\n/**\n * Explore is a compound component, which allows you to define a custom layout\n *\n * @example\n * ```jsx\n * <ExploreLayout title=\"Explore ACME's ecosystem\">\n * <ExploreLayout.Route path=\"/example\" title=\"Example tab\">\n * <div>This is rendered under /example/anything-here route</div>\n * </ExploreLayout.Route>\n * </ExploreLayout>\n * ```\n *\n * @public\n */\nexport const ExploreLayout = (props: ExploreLayoutProps) => {\n const { title, children } = props;\n\n const exploreRoutePath = useRouteRef(exploreRouteRef);\n\n const routes = useElementFilter(children, elements =>\n elements\n .selectByComponentData({\n key: dataKey,\n withStrictError:\n 'Child of ExploreLayout must be an ExploreLayout.Route',\n })\n .getElements<SubRoute>()\n .map(child => child.props),\n );\n\n const basePath = exploreRoutePath ? exploreRoutePath() : '';\n\n const tabs = useMemo<HeaderTab[]>(\n () =>\n routes.map(route => ({\n id: route.path,\n label: route.title,\n href: joinPaths(basePath, route.path),\n matchStrategy: 'prefix',\n })),\n [routes, basePath],\n );\n\n // Render the matching sub-route's content inline, falling back to the first\n // tab's content if no sub-path is present (matching the legacy RoutedTabs\n // behavior). We intentionally don't redirect, so the layout still works when\n // it is mounted at the root path.\n const element = useRoutes(\n routes.map(route => ({\n path: `${stripLeadingSlash(route.path)}/*`,\n element: route.children,\n })),\n );\n\n return (\n <>\n <PluginHeader title={title ?? 'Explore our ecosystem'} tabs={tabs} />\n <div\n
|
|
1
|
+
{"version":3,"file":"ExploreLayout.esm.js","sources":["../../../src/components/ExploreLayout/ExploreLayout.tsx"],"sourcesContent":["/*\n * Copyright 2020 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 {\n attachComponentData,\n useElementFilter,\n useRouteRef,\n} from '@backstage/core-plugin-api';\nimport { FullPage, HeaderTab, PluginHeader } from '@backstage/ui';\nimport React, { useMemo } from 'react';\nimport { useRoutes } from 'react-router-dom';\nimport { exploreRouteRef } from '../../routes';\n\n// TODO: This layout could be a shared based component if it was possible to create custom TabbedLayouts\n// A generalized version of createSubRoutesFromChildren, etc. would be required\n/** @public */\nexport type SubRoute = {\n path: string;\n title: string;\n children: JSX.Element;\n /**\n * @deprecated The Backstage UI `PluginHeader` does not forward extra MUI tab\n * props. This field is kept for backwards compatibility but is no longer\n * used.\n */\n tabProps?: Record<string, unknown>;\n};\n\nconst dataKey = 'plugin.explore.exploreLayoutRoute';\n\nconst RouteData: (props: SubRoute) => null = () => null;\nattachComponentData(RouteData, dataKey, true);\n\n// This causes all mount points that are discovered within this route to use the path of the route itself\nattachComponentData(RouteData, 'core.gatherMountPoints', true);\n\n/** @public */\nexport type ExploreLayoutProps = {\n title?: string;\n /**\n * @deprecated The Backstage UI `PluginHeader` does not render a subtitle.\n * This prop is kept for backwards compatibility but is no longer displayed.\n */\n subtitle?: string;\n children?: React.ReactNode;\n};\n\nconst stripLeadingSlash = (path: string) => path.replace(/^\\/+/, '');\n\nconst joinPaths = (base: string, sub: string) => {\n const trimmedBase = base.replace(/\\/+$/, '');\n const trimmedSub = stripLeadingSlash(sub);\n return trimmedSub ? `${trimmedBase}/${trimmedSub}` : trimmedBase;\n};\n\n/**\n * Explore is a compound component, which allows you to define a custom layout\n *\n * @example\n * ```jsx\n * <ExploreLayout title=\"Explore ACME's ecosystem\">\n * <ExploreLayout.Route path=\"/example\" title=\"Example tab\">\n * <div>This is rendered under /example/anything-here route</div>\n * </ExploreLayout.Route>\n * </ExploreLayout>\n * ```\n *\n * @public\n */\nexport const ExploreLayout = (props: ExploreLayoutProps) => {\n const { title, children } = props;\n\n const exploreRoutePath = useRouteRef(exploreRouteRef);\n\n const routes = useElementFilter(children, elements =>\n elements\n .selectByComponentData({\n key: dataKey,\n withStrictError:\n 'Child of ExploreLayout must be an ExploreLayout.Route',\n })\n .getElements<SubRoute>()\n .map(child => child.props),\n );\n\n const basePath = exploreRoutePath ? exploreRoutePath() : '';\n\n const tabs = useMemo<HeaderTab[]>(\n () =>\n routes.map(route => ({\n id: route.path,\n label: route.title,\n href: joinPaths(basePath, route.path),\n matchStrategy: 'prefix',\n })),\n [routes, basePath],\n );\n\n // Render the matching sub-route's content inline, falling back to the first\n // tab's content if no sub-path is present (matching the legacy RoutedTabs\n // behavior). We intentionally don't redirect, so the layout still works when\n // it is mounted at the root path.\n const element = useRoutes(\n routes.map(route => ({\n path: `${stripLeadingSlash(route.path)}/*`,\n element: route.children,\n })),\n );\n\n return (\n <>\n <PluginHeader title={title ?? 'Explore our ecosystem'} tabs={tabs} />\n <FullPage>\n <div\n style={{\n padding: 'var(--bui-space-6)',\n }}\n >\n {element ?? routes[0]?.children ?? null}\n </div>\n </FullPage>\n </>\n );\n};\n\nExploreLayout.Route = RouteData;\n"],"names":[],"mappings":";;;;;;;AAyCA,MAAM,OAAA,GAAU,mCAAA;AAEhB,MAAM,YAAuC,MAAM,IAAA;AACnD,mBAAA,CAAoB,SAAA,EAAW,SAAS,IAAI,CAAA;A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AAA,GACnB;AAMA,EAAA,MAAM,OAAA,GAAU,SAAA;AAAA,IACd,MAAA,CAAO,IAAI,CAAA,KAAA,MAAU;AAAA,MACnB,IAAA,EAAM,CAAA,EAAG,iBAAA,CAAkB,KAAA,CAAM,IAAI,CAAC,CAAA,EAAA,CAAA;AAAA,MACtC,SAAS,KAAA,CAAM;AAAA,KACjB,CAAE;AAAA,GACJ;AAEA,EAAA,uBACE,IAAA,CAAA,QAAA,EAAA,EACE,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,YAAA,EAAA,EAAa,KAAA,EAAO,KAAA,IAAS,uBAAA,EAAyB,IAAA,EAAY,CAAA;AAAA,wBAClE,QAAA,EAAA,EACC,QAAA,kBAAA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAO;AAAA,UACL,OAAA,EAAS;AAAA,SACX;AAAA,QAEC,QAAA,EAAA,OAAA,IAAW,MAAA,CAAO,CAAC,CAAA,EAAG,QAAA,IAAY;AAAA;AAAA,KACrC,EACF;AAAA,GAAA,EACF,CAAA;AAEJ;AAEA,aAAA,CAAc,KAAA,GAAQ,SAAA;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@backstage-community/plugin-explore",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "A Backstage plugin for building an exploration page of your software ecosystem",
|
|
5
5
|
"backstage": {
|
|
6
6
|
"role": "frontend-plugin",
|
|
@@ -69,33 +69,33 @@
|
|
|
69
69
|
"test": "backstage-cli package test"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@backstage-community/plugin-explore-common": "^0.
|
|
73
|
-
"@backstage-community/plugin-explore-react": "^0.
|
|
74
|
-
"@backstage/catalog-client": "^1.16.
|
|
75
|
-
"@backstage/catalog-model": "^1.
|
|
76
|
-
"@backstage/core-compat-api": "^0.5.
|
|
77
|
-
"@backstage/core-components": "^0.18.
|
|
78
|
-
"@backstage/core-plugin-api": "^1.12.
|
|
79
|
-
"@backstage/errors": "^1.3.
|
|
80
|
-
"@backstage/frontend-plugin-api": "^0.
|
|
81
|
-
"@backstage/plugin-catalog-react": "^3.
|
|
82
|
-
"@backstage/plugin-search-common": "^1.2.
|
|
83
|
-
"@backstage/plugin-search-react": "^1.11.
|
|
84
|
-
"@backstage/ui": "^0.
|
|
85
|
-
"@remixicon/react": "
|
|
72
|
+
"@backstage-community/plugin-explore-common": "^0.15.0",
|
|
73
|
+
"@backstage-community/plugin-explore-react": "^0.15.0",
|
|
74
|
+
"@backstage/catalog-client": "^1.16.3",
|
|
75
|
+
"@backstage/catalog-model": "^1.10.2",
|
|
76
|
+
"@backstage/core-compat-api": "^0.5.16",
|
|
77
|
+
"@backstage/core-components": "^0.18.15",
|
|
78
|
+
"@backstage/core-plugin-api": "^1.12.11",
|
|
79
|
+
"@backstage/errors": "^1.3.2",
|
|
80
|
+
"@backstage/frontend-plugin-api": "^0.18.2",
|
|
81
|
+
"@backstage/plugin-catalog-react": "^3.3.0",
|
|
82
|
+
"@backstage/plugin-search-common": "^1.2.26",
|
|
83
|
+
"@backstage/plugin-search-react": "^1.11.9",
|
|
84
|
+
"@backstage/ui": "^0.19.0",
|
|
85
|
+
"@remixicon/react": ">=4.6.0 <4.9.0",
|
|
86
86
|
"@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0",
|
|
87
87
|
"classnames": "^2.2.6",
|
|
88
88
|
"pluralize": "^8.0.0",
|
|
89
89
|
"react-use": "^17.2.4"
|
|
90
90
|
},
|
|
91
91
|
"devDependencies": {
|
|
92
|
-
"@backstage/cli": "^0.36.
|
|
93
|
-
"@backstage/core-app-api": "^1.20.
|
|
94
|
-
"@backstage/dev-utils": "^1.1.
|
|
95
|
-
"@backstage/frontend-defaults": "^0.5.
|
|
96
|
-
"@backstage/frontend-test-utils": "^0.6.
|
|
97
|
-
"@backstage/plugin-catalog": "^2.0.
|
|
98
|
-
"@backstage/test-utils": "^1.7.
|
|
92
|
+
"@backstage/cli": "^0.36.7",
|
|
93
|
+
"@backstage/core-app-api": "^1.20.6",
|
|
94
|
+
"@backstage/dev-utils": "^1.1.28",
|
|
95
|
+
"@backstage/frontend-defaults": "^0.5.7",
|
|
96
|
+
"@backstage/frontend-test-utils": "^0.6.5",
|
|
97
|
+
"@backstage/plugin-catalog": "^2.0.10",
|
|
98
|
+
"@backstage/test-utils": "^1.7.23",
|
|
99
99
|
"@testing-library/dom": "^10.0.0",
|
|
100
100
|
"@testing-library/jest-dom": "^6.0.0",
|
|
101
101
|
"@testing-library/react": "^15.0.0",
|