@backstage/plugin-search-react 1.7.3 → 1.7.4-next.1

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,10 +1,32 @@
1
1
  # @backstage/plugin-search-react
2
2
 
3
- ## 1.7.3
3
+ ## 1.7.4-next.1
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - 43a3ce18947c: Removed `@backstage/frontend-app-api` dependency.
7
+ - a5a04739e1: Internal refactor of alpha exports due to a change in how extension factories are defined.
8
+ - Updated dependencies
9
+ - @backstage/frontend-plugin-api@0.4.0-next.1
10
+ - @backstage/core-components@0.13.9-next.1
11
+ - @backstage/core-plugin-api@1.8.1-next.1
12
+ - @backstage/theme@0.5.0-next.0
13
+ - @backstage/types@1.1.1
14
+ - @backstage/version-bridge@1.0.7
15
+ - @backstage/plugin-search-common@1.2.8
16
+
17
+ ## 1.7.4-next.0
18
+
19
+ ### Patch Changes
20
+
21
+ - 84dabc5363: Removed `@backstage/frontend-app-api` dependency.
22
+ - Updated dependencies
23
+ - @backstage/core-plugin-api@1.8.1-next.0
24
+ - @backstage/core-components@0.13.9-next.0
25
+ - @backstage/theme@0.5.0-next.0
26
+ - @backstage/frontend-plugin-api@0.3.1-next.0
27
+ - @backstage/types@1.1.1
28
+ - @backstage/version-bridge@1.0.7
29
+ - @backstage/plugin-search-common@1.2.8
8
30
 
9
31
  ## 1.7.2
10
32
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-search-react",
3
- "version": "1.7.3",
3
+ "version": "1.7.4-next.1",
4
4
  "main": "../dist/alpha.esm.js",
5
5
  "module": "../dist/alpha.esm.js",
6
6
  "types": "../dist/alpha.d.ts"
package/dist/alpha.esm.js CHANGED
@@ -25,14 +25,14 @@ function createSearchResultListItemExtension(options) {
25
25
  output: {
26
26
  item: searchResultItemExtensionData
27
27
  },
28
- factory({ config, source }) {
28
+ factory({ config, node }) {
29
29
  const ExtensionComponent = lazy(
30
30
  () => options.component({ config }).then((component) => ({ default: component }))
31
31
  );
32
32
  return {
33
33
  item: {
34
34
  predicate: options.predicate,
35
- component: (props) => /* @__PURE__ */ React.createElement(ExtensionBoundary, { id, source }, /* @__PURE__ */ React.createElement(
35
+ component: (props) => /* @__PURE__ */ React.createElement(ExtensionBoundary, { node }, /* @__PURE__ */ React.createElement(
36
36
  SearchResultListItemExtension,
37
37
  {
38
38
  rank: props.rank,
@@ -1 +1 @@
1
- {"version":3,"file":"alpha.esm.js","sources":["../src/alpha.tsx"],"sourcesContent":["/*\n * Copyright 2023 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, { lazy } from 'react';\n\nimport { ListItemProps } from '@material-ui/core';\n\nimport {\n ExtensionBoundary,\n PortableSchema,\n createExtension,\n createExtensionDataRef,\n createSchemaFromZod,\n} from '@backstage/frontend-plugin-api';\nimport { SearchDocument, SearchResult } from '@backstage/plugin-search-common';\n\nimport { SearchResultListItemExtension } from './extensions';\n\n/** @alpha */\nexport type BaseSearchResultListItemProps<T = {}> = T & {\n rank?: number;\n result?: SearchDocument;\n} & Omit<ListItemProps, 'button'>;\n\n/** @alpha */\nexport type SearchResultItemExtensionComponent = <\n P extends BaseSearchResultListItemProps,\n>(\n props: P,\n) => JSX.Element | null;\n\n/** @alpha */\nexport type SearchResultItemExtensionPredicate = (\n result: SearchResult,\n) => boolean;\n\n/** @alpha */\nexport const searchResultItemExtensionData = createExtensionDataRef<{\n predicate?: SearchResultItemExtensionPredicate;\n component: SearchResultItemExtensionComponent;\n}>('plugin.search.result.item.data');\n\n/** @alpha */\nexport type SearchResultItemExtensionOptions<\n TConfig extends { noTrack?: boolean },\n> = {\n /**\n * The extension id.\n */\n id: string;\n /**\n * The extension attachment point (e.g., search modal or page).\n */\n attachTo?: { id: string; input: string };\n /**\n * Optional extension config schema.\n */\n configSchema?: PortableSchema<TConfig>;\n /**\n * The extension component.\n */\n component: (options: {\n config: TConfig;\n }) => Promise<SearchResultItemExtensionComponent>;\n /**\n * When an extension defines a predicate, it returns true if the result should be rendered by that extension.\n * Defaults to a predicate that returns true, which means it renders all sorts of results.\n */\n predicate?: SearchResultItemExtensionPredicate;\n};\n\n/** @alpha */\nexport function createSearchResultListItemExtension<\n TConfig extends { noTrack?: boolean },\n>(options: SearchResultItemExtensionOptions<TConfig>) {\n const id = `plugin.search.result.item.${options.id}`;\n\n const configSchema =\n 'configSchema' in options\n ? options.configSchema\n : (createSchemaFromZod(z =>\n z.object({\n noTrack: z.boolean().default(false),\n }),\n ) as PortableSchema<TConfig>);\n\n return createExtension({\n id,\n attachTo: options.attachTo ?? {\n id: 'plugin.search.page',\n input: 'items',\n },\n configSchema,\n output: {\n item: searchResultItemExtensionData,\n },\n factory({ config, source }) {\n const ExtensionComponent = lazy(() =>\n options\n .component({ config })\n .then(component => ({ default: component })),\n ) as unknown as SearchResultItemExtensionComponent;\n\n return {\n item: {\n predicate: options.predicate,\n component: props => (\n <ExtensionBoundary id={id} source={source}>\n <SearchResultListItemExtension\n rank={props.rank}\n result={props.result}\n noTrack={config.noTrack}\n >\n <ExtensionComponent {...props} />\n </SearchResultListItemExtension>\n </ExtensionBoundary>\n ),\n },\n };\n },\n });\n}\n"],"names":[],"mappings":";;;;;;;;AAkDa,MAAA,6BAAA,GAAgC,uBAG1C,gCAAgC,EAAA;AAgC5B,SAAS,oCAEd,OAAoD,EAAA;AAvFtD,EAAA,IAAA,EAAA,CAAA;AAwFE,EAAM,MAAA,EAAA,GAAK,CAA6B,0BAAA,EAAA,OAAA,CAAQ,EAAE,CAAA,CAAA,CAAA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AO,EAAA,CAAA;AAAA,WAEnC,CAAA;AAAA,SAEJ;AAAA,OACF,CAAA;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"alpha.esm.js","sources":["../src/alpha.tsx"],"sourcesContent":["/*\n * Copyright 2023 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, { lazy } from 'react';\n\nimport { ListItemProps } from '@material-ui/core';\n\nimport {\n ExtensionBoundary,\n PortableSchema,\n createExtension,\n createExtensionDataRef,\n createSchemaFromZod,\n} from '@backstage/frontend-plugin-api';\nimport { SearchDocument, SearchResult } from '@backstage/plugin-search-common';\n\nimport { SearchResultListItemExtension } from './extensions';\n\n/** @alpha */\nexport type BaseSearchResultListItemProps<T = {}> = T & {\n rank?: number;\n result?: SearchDocument;\n} & Omit<ListItemProps, 'button'>;\n\n/** @alpha */\nexport type SearchResultItemExtensionComponent = <\n P extends BaseSearchResultListItemProps,\n>(\n props: P,\n) => JSX.Element | null;\n\n/** @alpha */\nexport type SearchResultItemExtensionPredicate = (\n result: SearchResult,\n) => boolean;\n\n/** @alpha */\nexport const searchResultItemExtensionData = createExtensionDataRef<{\n predicate?: SearchResultItemExtensionPredicate;\n component: SearchResultItemExtensionComponent;\n}>('plugin.search.result.item.data');\n\n/** @alpha */\nexport type SearchResultItemExtensionOptions<\n TConfig extends { noTrack?: boolean },\n> = {\n /**\n * The extension id.\n */\n id: string;\n /**\n * The extension attachment point (e.g., search modal or page).\n */\n attachTo?: { id: string; input: string };\n /**\n * Optional extension config schema.\n */\n configSchema?: PortableSchema<TConfig>;\n /**\n * The extension component.\n */\n component: (options: {\n config: TConfig;\n }) => Promise<SearchResultItemExtensionComponent>;\n /**\n * When an extension defines a predicate, it returns true if the result should be rendered by that extension.\n * Defaults to a predicate that returns true, which means it renders all sorts of results.\n */\n predicate?: SearchResultItemExtensionPredicate;\n};\n\n/** @alpha */\nexport function createSearchResultListItemExtension<\n TConfig extends { noTrack?: boolean },\n>(options: SearchResultItemExtensionOptions<TConfig>) {\n const id = `plugin.search.result.item.${options.id}`;\n\n const configSchema =\n 'configSchema' in options\n ? options.configSchema\n : (createSchemaFromZod(z =>\n z.object({\n noTrack: z.boolean().default(false),\n }),\n ) as PortableSchema<TConfig>);\n\n return createExtension({\n id,\n attachTo: options.attachTo ?? {\n id: 'plugin.search.page',\n input: 'items',\n },\n configSchema,\n output: {\n item: searchResultItemExtensionData,\n },\n factory({ config, node }) {\n const ExtensionComponent = lazy(() =>\n options\n .component({ config })\n .then(component => ({ default: component })),\n ) as unknown as SearchResultItemExtensionComponent;\n\n return {\n item: {\n predicate: options.predicate,\n component: props => (\n <ExtensionBoundary node={node}>\n <SearchResultListItemExtension\n rank={props.rank}\n result={props.result}\n noTrack={config.noTrack}\n >\n <ExtensionComponent {...props} />\n </SearchResultListItemExtension>\n </ExtensionBoundary>\n ),\n },\n };\n },\n });\n}\n"],"names":[],"mappings":";;;;;;;;AAkDa,MAAA,6BAAA,GAAgC,uBAG1C,gCAAgC,EAAA;AAgC5B,SAAS,oCAEd,OAAoD,EAAA;AAvFtD,EAAA,IAAA,EAAA,CAAA;AAwFE,EAAM,MAAA,EAAA,GAAK,CAA6B,0BAAA,EAAA,OAAA,CAAQ,EAAE,CAAA,CAAA,CAAA;AAElD,EAAA,MAAM,YACJ,GAAA,cAAA,IAAkB,OACd,GAAA,OAAA,CAAQ,YACP,GAAA,mBAAA;AAAA,IAAoB,CAAA,CAAA,KACnB,EAAE,MAAO,CAAA;AAAA,MACP,OAAS,EAAA,CAAA,CAAE,OAAQ,EAAA,CAAE,QAAQ,KAA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7.4-next.1",
4
4
  "main": "./dist/index.esm.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "license": "Apache-2.0",
@@ -43,11 +43,11 @@
43
43
  "start": "backstage-cli package start"
44
44
  },
45
45
  "dependencies": {
46
- "@backstage/core-components": "^0.13.8",
47
- "@backstage/core-plugin-api": "^1.8.0",
48
- "@backstage/frontend-plugin-api": "^0.3.0",
46
+ "@backstage/core-components": "^0.13.9-next.1",
47
+ "@backstage/core-plugin-api": "^1.8.1-next.1",
48
+ "@backstage/frontend-plugin-api": "^0.4.0-next.1",
49
49
  "@backstage/plugin-search-common": "^1.2.8",
50
- "@backstage/theme": "^0.4.4",
50
+ "@backstage/theme": "^0.5.0-next.0",
51
51
  "@backstage/types": "^1.1.1",
52
52
  "@backstage/version-bridge": "^1.0.7",
53
53
  "@material-ui/core": "^4.12.2",
@@ -64,10 +64,11 @@
64
64
  "react-router-dom": "6.0.0-beta.0 || ^6.3.0"
65
65
  },
66
66
  "devDependencies": {
67
- "@backstage/cli": "^0.24.0",
68
- "@backstage/core-app-api": "^1.11.1",
69
- "@backstage/frontend-app-api": "^0.3.0",
70
- "@backstage/test-utils": "^1.4.5",
67
+ "@backstage/cli": "^0.25.0-next.1",
68
+ "@backstage/core-app-api": "^1.11.2-next.1",
69
+ "@backstage/frontend-app-api": "^0.4.0-next.1",
70
+ "@backstage/frontend-test-utils": "^0.1.0-next.1",
71
+ "@backstage/test-utils": "^1.4.6-next.1",
71
72
  "@testing-library/dom": "^9.0.0",
72
73
  "@testing-library/jest-dom": "^6.0.0",
73
74
  "@testing-library/react": "^14.0.0",