@backstage/frontend-plugin-api
Advanced tools
Comparing version
# @backstage/frontend-plugin-api | ||
## 0.0.0-nightly-20231006021145 | ||
## 0.0.0-nightly-20231007021127 | ||
### Minor Changes | ||
- 06432f900c84: Extension attachment point is now configured via `attachTo: { id, input }` instead of `at: 'id/input'`. | ||
- 4461d87d5a48: Removed support for the new `useRouteRef`. | ||
### Patch Changes | ||
@@ -10,3 +15,3 @@ | ||
- Updated dependencies | ||
- @backstage/core-plugin-api@0.0.0-nightly-20231006021145 | ||
- @backstage/core-plugin-api@0.0.0-nightly-20231007021127 | ||
- @backstage/types@1.1.1 | ||
@@ -13,0 +18,0 @@ |
@@ -129,3 +129,6 @@ /// <reference types="react" /> | ||
id: string; | ||
at: string; | ||
attachTo: { | ||
id: string; | ||
input: string; | ||
}; | ||
disabled?: boolean; | ||
@@ -146,3 +149,6 @@ inputs?: TInputs; | ||
id: string; | ||
at: string; | ||
attachTo: { | ||
id: string; | ||
input: string; | ||
}; | ||
disabled: boolean; | ||
@@ -197,3 +203,6 @@ inputs: AnyExtensionInputMap; | ||
id: string; | ||
at?: string; | ||
attachTo?: { | ||
id: string; | ||
input: string; | ||
}; | ||
disabled?: boolean; | ||
@@ -224,5 +233,2 @@ inputs?: TInputs; | ||
/** @public */ | ||
declare function useRouteRef(routeRef: RouteRef<any>): () => string; | ||
export { AnyExtensionDataMap, AnyExtensionInputMap, BackstagePlugin, ConfigurableExtensionDataRef, CreateExtensionOptions, Extension, ExtensionBoundary, ExtensionBoundaryProps, ExtensionDataRef, ExtensionDataValues, ExtensionInput, ExtensionInputValues, NavTarget, PluginOptions, PortableSchema, coreExtensionData, createApiExtension, createExtension, createExtensionDataRef, createExtensionInput, createNavItemExtension, createPageExtension, createPlugin, createSchemaFromZod, createThemeExtension, useRouteRef }; | ||
export { AnyExtensionDataMap, AnyExtensionInputMap, BackstagePlugin, ConfigurableExtensionDataRef, CreateExtensionOptions, Extension, ExtensionBoundary, ExtensionBoundaryProps, ExtensionDataRef, ExtensionDataValues, ExtensionInput, ExtensionInputValues, NavTarget, PluginOptions, PortableSchema, coreExtensionData, createApiExtension, createExtension, createExtensionDataRef, createExtensionInput, createNavItemExtension, createPageExtension, createPlugin, createSchemaFromZod, createThemeExtension }; |
@@ -1,6 +0,4 @@ | ||
import React, { useContext, useMemo } from 'react'; | ||
import React from 'react'; | ||
import { z } from 'zod'; | ||
import zodToJsonSchema from 'zod-to-json-schema'; | ||
import { RoutingContext } from '@backstage/frontend-app-api/src/routing/RoutingContext'; | ||
import { useLocation } from 'react-router-dom'; | ||
@@ -73,3 +71,3 @@ function ExtensionBoundary(props) { | ||
id: `apis.${apiRef.id}`, | ||
at: "core/apis", | ||
attachTo: { id: "core", input: "apis" }, | ||
inputs: extensionInputs, | ||
@@ -126,3 +124,3 @@ configSchema, | ||
id: options.id, | ||
at: (_a = options.at) != null ? _a : "core.routes/routes", | ||
attachTo: (_a = options.attachTo) != null ? _a : { id: "core.routes", input: "routes" }, | ||
disabled: options.disabled, | ||
@@ -153,3 +151,3 @@ output: { | ||
id, | ||
at: "core.nav/items", | ||
attachTo: { id: "core.nav", input: "items" }, | ||
configSchema: createSchemaFromZod( | ||
@@ -178,3 +176,3 @@ (z) => z.object({ | ||
id: `themes.${theme.id}`, | ||
at: "core/themes", | ||
attachTo: { id: "core", input: "themes" }, | ||
output: { | ||
@@ -189,16 +187,3 @@ theme: coreExtensionData.theme | ||
function useRouteRef(routeRef) { | ||
const { pathname } = useLocation(); | ||
const resolver = useContext(RoutingContext); | ||
const routeFunc = useMemo( | ||
() => resolver && resolver.resolve(routeRef, { pathname }), | ||
[resolver, routeRef, pathname] | ||
); | ||
if (!routeFunc) { | ||
throw new Error(`Failed to resolve routeRef ${routeRef}`); | ||
} | ||
return routeFunc; | ||
} | ||
export { ExtensionBoundary, coreExtensionData, createApiExtension, createExtension, createExtensionDataRef, createExtensionInput, createNavItemExtension, createPageExtension, createPlugin, createSchemaFromZod, createThemeExtension, useRouteRef }; | ||
export { ExtensionBoundary, coreExtensionData, createApiExtension, createExtension, createExtensionDataRef, createExtensionInput, createNavItemExtension, createPageExtension, createPlugin, createSchemaFromZod, createThemeExtension }; | ||
//# sourceMappingURL=index.esm.js.map |
{ | ||
"name": "@backstage/frontend-plugin-api", | ||
"version": "0.0.0-nightly-20231006021145", | ||
"version": "0.0.0-nightly-20231007021127", | ||
"main": "dist/index.esm.js", | ||
@@ -26,5 +26,5 @@ "types": "dist/index.d.ts", | ||
"devDependencies": { | ||
"@backstage/cli": "^0.0.0-nightly-20231006021145", | ||
"@backstage/frontend-app-api": "^0.0.0-nightly-20231006021145", | ||
"@backstage/test-utils": "^0.0.0-nightly-20231006021145", | ||
"@backstage/cli": "^0.0.0-nightly-20231007021127", | ||
"@backstage/frontend-app-api": "^0.0.0-nightly-20231007021127", | ||
"@backstage/test-utils": "^0.0.0-nightly-20231007021127", | ||
"@testing-library/jest-dom": "^5.10.1", | ||
@@ -41,3 +41,3 @@ "@testing-library/react": "^12.1.3" | ||
"dependencies": { | ||
"@backstage/core-plugin-api": "^0.0.0-nightly-20231006021145", | ||
"@backstage/core-plugin-api": "^0.0.0-nightly-20231007021127", | ||
"@backstage/types": "^1.1.1", | ||
@@ -44,0 +44,0 @@ "@types/react": "^16.13.1 || ^17.0.0", |
Sorry, the diff of this file is not supported yet
42471
-3.85%391
-1.76%