@backstage/plugin-techdocs-react 1.3.16-next.1 → 1.4.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,35 @@
1
1
  # @backstage/plugin-techdocs-react
2
2
 
3
+ ## 1.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 4d4f987: Add engine abstraction layer for multi-engine TechDocs support. Introduces `--engine` flag, engine config map, generator registry with `backstage.io/techdocs-engine` annotation support, `engine` field in `techdocs_metadata.json`, `serve:raw` command, and live-reload adapter interface. MkDocs remains the default with no behavior change.
8
+
9
+ The built-in generator is now registered under `mkdocs`; the previous `techdocs` key is kept as an alias, so existing `generators.register('techdocs', ...)` calls continue to work. The CLI's `--engine` flag takes precedence over the `backstage.io/techdocs-engine` annotation for all commands, and `serve:mkdocs` and the `--mkdocs-parameter-*` flags now print deprecation warnings.
10
+
11
+ ### Patch Changes
12
+
13
+ - f624dc6: Fixed Material UI styles for TechDocs addons in module-federated applications.
14
+ - 450dd64: Isolated TechDocs addons in individual Suspense boundaries so that a lazy addon no longer hides the surrounding reader while it loads.
15
+ - 7a4f545: Prevented TechDocs content from briefly appearing before page styles load.
16
+ - Updated dependencies
17
+ - @backstage/frontend-plugin-api@0.18.2
18
+ - @backstage/config@1.3.10
19
+ - @backstage/core-components@0.18.15
20
+ - @backstage/plugin-techdocs-common@0.1.2
21
+ - @backstage/catalog-model@1.10.2
22
+ - @backstage/core-plugin-api@1.12.11
23
+
24
+ ## 1.3.16-next.2
25
+
26
+ ### Patch Changes
27
+
28
+ - 450dd64: Isolated TechDocs addons in individual Suspense boundaries so that a lazy addon no longer hides the surrounding reader while it loads.
29
+ - Updated dependencies
30
+ - @backstage/core-components@0.18.15-next.2
31
+ - @backstage/plugin-techdocs-common@0.1.2-next.0
32
+
3
33
  ## 1.3.16-next.1
4
34
 
5
35
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  import { jsx } from 'react/jsx-runtime';
2
- import { useCallback } from 'react';
2
+ import { useCallback, Suspense } from 'react';
3
3
  import { useOutlet } from 'react-router-dom';
4
4
  import { attachComponentData, createReactExtension, useElementFilter } from '@backstage/core-plugin-api';
5
5
 
@@ -55,14 +55,15 @@ const useTechDocsAddons = () => {
55
55
  const renderComponentByName = useCallback(
56
56
  (name) => {
57
57
  const data = options.find((option) => option.name === name);
58
- return data ? findAddonByData(data) : null;
58
+ const addon = data ? findAddonByData(data) : null;
59
+ return addon ? /* @__PURE__ */ jsx(Suspense, { fallback: null, children: addon }) : null;
59
60
  },
60
61
  [options, findAddonByData]
61
62
  );
62
63
  const renderComponentsByLocation = useCallback(
63
64
  (location) => {
64
65
  const data = options.filter((option) => option.location === location);
65
- return data.length ? data.map(findAddonByData) : null;
66
+ return data.length ? data.map((option) => /* @__PURE__ */ jsx(Suspense, { fallback: null, children: findAddonByData(option) }, option.name)) : null;
66
67
  },
67
68
  [options, findAddonByData]
68
69
  );
@@ -1 +1 @@
1
- {"version":3,"file":"addons.esm.js","sources":["../src/addons.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 { PropsWithChildren, ComponentType, useCallback } from 'react';\nimport { useOutlet } from 'react-router-dom';\n\nimport {\n attachComponentData,\n createReactExtension,\n ElementCollection,\n Extension,\n useElementFilter,\n} from '@backstage/core-plugin-api';\n\nimport { TechDocsAddonLocations, TechDocsAddonOptions } from './types';\n\n/**\n * Key for each addon.\n * @public\n */\nexport const TECHDOCS_ADDONS_KEY = 'techdocs.addons.addon.v1';\n\n/**\n * Marks the `<TechDocsAddons>` registry component.\n * @public\n */\nexport const TECHDOCS_ADDONS_WRAPPER_KEY = 'techdocs.addons.wrapper.v1';\n\n/**\n * TechDocs Addon registry.\n * @public\n */\nexport const TechDocsAddons: ComponentType<PropsWithChildren<{}>> = () => null;\n\nattachComponentData(TechDocsAddons, TECHDOCS_ADDONS_WRAPPER_KEY, true);\n\nexport const getDataKeyByName = (name: string) => {\n return `${TECHDOCS_ADDONS_KEY}.${name.toLowerCase()}`;\n};\n\n/**\n * Create a TechDocs addon overload signature without props.\n * @public\n */\nexport function createTechDocsAddonExtension(\n options: TechDocsAddonOptions,\n): Extension<() => JSX.Element | null>;\n\n/**\n * Create a TechDocs addon overload signature with props.\n * @public\n */\nexport function createTechDocsAddonExtension<TComponentProps>(\n options: TechDocsAddonOptions<TComponentProps>,\n): Extension<(props: TComponentProps) => JSX.Element | null>;\n\n/**\n * Create a TechDocs addon implementation.\n * @public\n */\nexport function createTechDocsAddonExtension<\n TComponentProps extends PropsWithChildren<{}>,\n>(\n options: TechDocsAddonOptions<TComponentProps>,\n): Extension<(props: TComponentProps) => JSX.Element | null> {\n const { name, component: TechDocsAddon } = options;\n return createReactExtension({\n name,\n component: {\n sync: (props: TComponentProps) => <TechDocsAddon {...props} />,\n },\n data: {\n [TECHDOCS_ADDONS_KEY]: options,\n [getDataKeyByName(name)]: true,\n },\n });\n}\n\nconst getTechDocsAddonByName = (\n collection: ElementCollection,\n key: string,\n): JSX.Element | undefined => {\n return collection.selectByComponentData({ key }).getElements()[0];\n};\n\nconst getAllTechDocsAddons = (collection: ElementCollection) => {\n return collection\n .selectByComponentData({\n key: TECHDOCS_ADDONS_WRAPPER_KEY,\n })\n .selectByComponentData({\n key: TECHDOCS_ADDONS_KEY,\n });\n};\n\nconst getAllTechDocsAddonsData = (collection: ElementCollection) => {\n return collection\n .selectByComponentData({\n key: TECHDOCS_ADDONS_WRAPPER_KEY,\n })\n .findComponentData<TechDocsAddonOptions>({\n key: TECHDOCS_ADDONS_KEY,\n });\n};\n\n/**\n * hook to use addons in components\n * @public\n */\nexport const useTechDocsAddons = () => {\n const node = useOutlet();\n const collection = useElementFilter(node, getAllTechDocsAddons);\n const options = useElementFilter(node, getAllTechDocsAddonsData);\n\n const findAddonByData = useCallback(\n (data: TechDocsAddonOptions | undefined) => {\n if (!collection || !data) return null;\n const nameKey = getDataKeyByName(data.name);\n return getTechDocsAddonByName(collection, nameKey) ?? null;\n },\n [collection],\n );\n\n const renderComponentByName = useCallback(\n (name: string) => {\n const data = options.find(option => option.name === name);\n return data ? findAddonByData(data) : null;\n },\n [options, findAddonByData],\n );\n\n const renderComponentsByLocation = useCallback(\n (location: keyof typeof TechDocsAddonLocations) => {\n const data = options.filter(option => option.location === location);\n return data.length ? data.map(findAddonByData) : null;\n },\n [options, findAddonByData],\n );\n\n return { renderComponentByName, renderComponentsByLocation };\n};\n"],"names":[],"mappings":";;;;;AAiCO,MAAM,mBAAA,GAAsB;AAM5B,MAAM,2BAAA,GAA8B;AAMpC,MAAM,iBAAuD,MAAM;AAE1E,mBAAA,CAAoB,cAAA,EAAgB,6BAA6B,IAAI,CAAA;AAE9D,MAAM,gBAAA,GAAmB,CAAC,IAAA,KAAiB;AAChD,EAAA,OAAO,CAAA,EAAG,mBAAmB,CAAA,CAAA,EAAI,IAAA,CAAK,aAAa,CAAA,CAAA;AACrD;AAsBO,SAAS,6BAGd,OAAA,EAC2D;AAC3D,EAAA,MAAM,EAAE,IAAA,EAAM,SAAA,EAAW,aAAA,EAAc,GAAI,OAAA;AAC3C,EAAA,OAAO,oBAAA,CAAqB;AAAA,IAC1B,IAAA;AAAA,IACA,SAAA,EAAW;AAAA,MACT,MAAM,CAAC,KAAA,qBAA2B,GAAA,CAAC,aAAA,EAAA,EAAe,GAAG,KAAA,EAAO;AAAA,KAC9D;AAAA,IACA,IAAA,EAAM;AAAA,MACJ,CAAC,mBAAmB,GAAG,OAAA;AAAA,MACvB,CAAC,gBAAA,CAAiB,IAAI,CAAC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K,CAAA,MAAA,KAAU,MAAA,CAAO,SAAS,IAAI,CAAA;AACxD,MAAA,OAAO,IAAA,GAAO,eAAA,CAAgB,IAAI,CAAA,GAAI,IAAA;AAAA,IACxC,CAAA;AAAA,IACA,CAAC,SAAS,eAAe;AAAA,GAC3B;AAEA,EAAA,MAAM,0BAAA,GAA6B,WAAA;AAAA,IACjC,CAAC,QAAA,KAAkD;AACjD,MAAA,MAAM,OAAO,OAAA,CAAQ,MAAA,CAAO,CAAA,MAAA,KAAU,MAAA,CAAO,aAAa,QAAQ,CAAA;AAClE,MAAA,OAAO,IAAA,CAAK,MAAA,GAAS,IAAA,CAAK,GAAA,CAAI,eAAe,CAAA,GAAI,IAAA;AAAA,IACnD,CAAA;AAAA,IACA,CAAC,SAAS,eAAe;AAAA,GAC3B;AAEA,EAAA,OAAO,EAAE,uBAAuB,0BAAA,EAA2B;AAC7D;;"}
1
+ {"version":3,"file":"addons.esm.js","sources":["../src/addons.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 { PropsWithChildren, ComponentType, Suspense, useCallback } from 'react';\nimport { useOutlet } from 'react-router-dom';\n\nimport {\n attachComponentData,\n createReactExtension,\n ElementCollection,\n Extension,\n useElementFilter,\n} from '@backstage/core-plugin-api';\n\nimport { TechDocsAddonLocations, TechDocsAddonOptions } from './types';\n\n/**\n * Key for each addon.\n * @public\n */\nexport const TECHDOCS_ADDONS_KEY = 'techdocs.addons.addon.v1';\n\n/**\n * Marks the `<TechDocsAddons>` registry component.\n * @public\n */\nexport const TECHDOCS_ADDONS_WRAPPER_KEY = 'techdocs.addons.wrapper.v1';\n\n/**\n * TechDocs Addon registry.\n * @public\n */\nexport const TechDocsAddons: ComponentType<PropsWithChildren<{}>> = () => null;\n\nattachComponentData(TechDocsAddons, TECHDOCS_ADDONS_WRAPPER_KEY, true);\n\nexport const getDataKeyByName = (name: string) => {\n return `${TECHDOCS_ADDONS_KEY}.${name.toLowerCase()}`;\n};\n\n/**\n * Create a TechDocs addon overload signature without props.\n * @public\n */\nexport function createTechDocsAddonExtension(\n options: TechDocsAddonOptions,\n): Extension<() => JSX.Element | null>;\n\n/**\n * Create a TechDocs addon overload signature with props.\n * @public\n */\nexport function createTechDocsAddonExtension<TComponentProps>(\n options: TechDocsAddonOptions<TComponentProps>,\n): Extension<(props: TComponentProps) => JSX.Element | null>;\n\n/**\n * Create a TechDocs addon implementation.\n * @public\n */\nexport function createTechDocsAddonExtension<\n TComponentProps extends PropsWithChildren<{}>,\n>(\n options: TechDocsAddonOptions<TComponentProps>,\n): Extension<(props: TComponentProps) => JSX.Element | null> {\n const { name, component: TechDocsAddon } = options;\n return createReactExtension({\n name,\n component: {\n sync: (props: TComponentProps) => <TechDocsAddon {...props} />,\n },\n data: {\n [TECHDOCS_ADDONS_KEY]: options,\n [getDataKeyByName(name)]: true,\n },\n });\n}\n\nconst getTechDocsAddonByName = (\n collection: ElementCollection,\n key: string,\n): JSX.Element | undefined => {\n return collection.selectByComponentData({ key }).getElements()[0];\n};\n\nconst getAllTechDocsAddons = (collection: ElementCollection) => {\n return collection\n .selectByComponentData({\n key: TECHDOCS_ADDONS_WRAPPER_KEY,\n })\n .selectByComponentData({\n key: TECHDOCS_ADDONS_KEY,\n });\n};\n\nconst getAllTechDocsAddonsData = (collection: ElementCollection) => {\n return collection\n .selectByComponentData({\n key: TECHDOCS_ADDONS_WRAPPER_KEY,\n })\n .findComponentData<TechDocsAddonOptions>({\n key: TECHDOCS_ADDONS_KEY,\n });\n};\n\n/**\n * Hook to use addons in components.\n *\n * Addons rendered through this hook are isolated in individual Suspense\n * boundaries with no fallback, so a suspended addon does not hide the reader\n * or sibling addons while it loads.\n *\n * @public\n */\nexport const useTechDocsAddons = () => {\n const node = useOutlet();\n const collection = useElementFilter(node, getAllTechDocsAddons);\n const options = useElementFilter(node, getAllTechDocsAddonsData);\n\n const findAddonByData = useCallback(\n (data: TechDocsAddonOptions | undefined) => {\n if (!collection || !data) return null;\n const nameKey = getDataKeyByName(data.name);\n return getTechDocsAddonByName(collection, nameKey) ?? null;\n },\n [collection],\n );\n\n const renderComponentByName = useCallback(\n (name: string): JSX.Element | null => {\n const data = options.find(option => option.name === name);\n const addon = data ? findAddonByData(data) : null;\n return addon ? <Suspense fallback={null}>{addon}</Suspense> : null;\n },\n [options, findAddonByData],\n );\n\n const renderComponentsByLocation = useCallback(\n (\n location: keyof typeof TechDocsAddonLocations,\n ): (JSX.Element | null)[] | null => {\n const data = options.filter(option => option.location === location);\n return data.length\n ? data.map(option => (\n <Suspense key={option.name} fallback={null}>\n {findAddonByData(option)}\n </Suspense>\n ))\n : null;\n },\n [options, findAddonByData],\n );\n\n return { renderComponentByName, renderComponentsByLocation };\n};\n"],"names":[],"mappings":";;;;;AAiCO,MAAM,mBAAA,GAAsB;AAM5B,MAAM,2BAAA,GAA8B;AAMpC,MAAM,iBAAuD,MAAM;AAE1E,mBAAA,CAAoB,cAAA,EAAgB,6BAA6B,IAAI,CAAA;AAE9D,MAAM,gBAAA,GAAmB,CAAC,IAAA,KAAiB;AAChD,EAAA,OAAO,CAAA,EAAG,mBAAmB,CAAA,CAAA,EAAI,IAAA,CAAK,aAAa,CAAA,CAAA;AACrD;AAsBO,SAAS,6BAGd,OAAA,EAC2D;AAC3D,EAAA,MAAM,EAAE,IAAA,EAAM,SAAA,EAAW,aAAA,EAAc,GAAI,OAAA;AAC3C,EAAA,OAAO,oBAAA,CAAqB;AAAA,IAC1B,IAAA;AAAA,IACA,SAAA,EAAW;AAAA,MACT,MAAM,CAAC,KAAA,qBAA2B,GAAA,CAAC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AA;AAAA,IACA,CAAC,UAAU;AAAA,GACb;AAEA,EAAA,MAAM,qBAAA,GAAwB,WAAA;AAAA,IAC5B,CAAC,IAAA,KAAqC;AACpC,MAAA,MAAM,OAAO,OAAA,CAAQ,IAAA,CAAK,CAAA,MAAA,KAAU,MAAA,CAAO,SAAS,IAAI,CAAA;AACxD,MAAA,MAAM,KAAA,GAAQ,IAAA,GAAO,eAAA,CAAgB,IAAI,CAAA,GAAI,IAAA;AAC7C,MAAA,OAAO,wBAAQ,GAAA,CAAC,QAAA,EAAA,EAAS,QAAA,EAAU,IAAA,EAAO,iBAAM,CAAA,GAAc,IAAA;AAAA,IAChE,CAAA;AAAA,IACA,CAAC,SAAS,eAAe;AAAA,GAC3B;AAEA,EAAA,MAAM,0BAAA,GAA6B,WAAA;AAAA,IACjC,CACE,QAAA,KACkC;AAClC,MAAA,MAAM,OAAO,OAAA,CAAQ,MAAA,CAAO,CAAA,MAAA,KAAU,MAAA,CAAO,aAAa,QAAQ,CAAA;AAClE,MAAA,OAAO,IAAA,CAAK,MAAA,GACR,IAAA,CAAK,GAAA,CAAI,4BACP,GAAA,CAAC,QAAA,EAAA,EAA2B,QAAA,EAAU,IAAA,EACnC,0BAAgB,MAAM,CAAA,EAAA,EADV,MAAA,CAAO,IAEtB,CACD,CAAA,GACD,IAAA;AAAA,IACN,CAAA;AAAA,IACA,CAAC,SAAS,eAAe;AAAA,GAC3B;AAEA,EAAA,OAAO,EAAE,uBAAuB,0BAAA,EAA2B;AAC7D;;"}
package/dist/alpha.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
2
2
  import { ComponentType } from 'react';
3
- import { T as TechDocsAddonOptions } from './types/types.d-Bva8_FYi.js';
4
- export { a as TechDocsAddonLocations } from './types/types.d-Bva8_FYi.js';
3
+ import { T as TechDocsAddonOptions } from './types/types.d-DNS0ygON.js';
4
+ export { a as TechDocsAddonLocations } from './types/types.d-DNS0ygON.js';
5
5
  import '@backstage/catalog-model';
6
6
 
7
7
  /**
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as react from 'react';
2
2
  import { ComponentType, PropsWithChildren, Dispatch, SetStateAction, ReactNode } from 'react';
3
3
  import { Extension, RouteFunc } from '@backstage/core-plugin-api';
4
- import { T as TechDocsAddonOptions, a as TechDocsAddonLocations, b as TechDocsMetadata, c as TechDocsEntityMetadata } from './types/types.d-Bva8_FYi.js';
4
+ import { T as TechDocsAddonOptions, a as TechDocsAddonLocations, b as TechDocsMetadata, c as TechDocsEntityMetadata } from './types/types.d-DNS0ygON.js';
5
5
  import * as _backstage_frontend_plugin_api from '@backstage/frontend-plugin-api';
6
6
  import { CompoundEntityRef, Entity } from '@backstage/catalog-model';
7
7
  import * as react_jsx_runtime from 'react/jsx-runtime';
@@ -34,7 +34,12 @@ declare function createTechDocsAddonExtension(options: TechDocsAddonOptions): Ex
34
34
  */
35
35
  declare function createTechDocsAddonExtension<TComponentProps>(options: TechDocsAddonOptions<TComponentProps>): Extension<(props: TComponentProps) => JSX.Element | null>;
36
36
  /**
37
- * hook to use addons in components
37
+ * Hook to use addons in components.
38
+ *
39
+ * Addons rendered through this hook are isolated in individual Suspense
40
+ * boundaries with no fallback, so a suspended addon does not hide the reader
41
+ * or sibling addons while it loads.
42
+ *
38
43
  * @public
39
44
  */
40
45
  declare const useTechDocsAddons: () => {
@@ -9,6 +9,7 @@ import { Entity } from '@backstage/catalog-model';
9
9
  type TechDocsMetadata = {
10
10
  site_name: string;
11
11
  site_description: string;
12
+ engine?: string;
12
13
  };
13
14
  /**
14
15
  * Metadata for TechDocs Entity
@@ -1 +1 @@
1
- {"version":3,"file":"types.esm.js","sources":["../src/types.ts"],"sourcesContent":["/*\n * Copyright 2022 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 { ComponentType } from 'react';\nimport { Entity } from '@backstage/catalog-model';\n\n/**\n * Metadata for TechDocs page\n *\n * @public\n */\nexport type TechDocsMetadata = {\n site_name: string;\n site_description: string;\n};\n\n/**\n * Metadata for TechDocs Entity\n *\n * @public\n */\nexport type TechDocsEntityMetadata = Entity & {\n locationMetadata?: { type: string; target: string };\n};\n\n/**\n * Locations for which TechDocs addons may be declared and rendered.\n * @public\n */\nexport const TechDocsAddonLocations = Object.freeze({\n /**\n * These addons fill up the header from the right, on the same line as the\n * title.\n */\n Header: 'Header',\n\n /**\n * These addons appear below the header and above all content; tooling addons\n * can be inserted for convenience.\n */\n Subheader: 'Subheader',\n\n /**\n * These addons are items added to the settings menu list and are designed to make\n * the reader experience customizable, for example accessibility options\n */\n Settings: 'Settings',\n\n /**\n * These addons appear left of the content and above the navigation.\n */\n PrimarySidebar: 'PrimarySidebar',\n\n /**\n * These addons appear right of the content and above the table of contents.\n */\n SecondarySidebar: 'SecondarySidebar',\n\n /**\n * A virtual location which allows mutation of all content within the shadow\n * root by transforming DOM nodes. These addons should return null on render.\n */\n Content: 'Content',\n\n /**\n * todo(backstage/community): This is a proposed virtual location which would\n * help implement a common addon pattern in which many instances of a given\n * element in markdown would be dynamically replaced at render-time based on\n * attributes provided on that element, for example:\n *\n * ```md\n * ## For Fun\n * <TechDocsAddon>CatGif</TechDocsAddon>\n *\n * ## Component Metadata\n * <TechDocsAddon entityRef=\"default:component/some-component-name\">CatalogEntityCard</TechDocsAddon>\n *\n * ## System Metadata\n * <TechDocsAddon entityRef=\"default:system/some-system-name\">CatalogEntityCard</TechDocsAddon>\n * ```\n *\n * Could correspond to a TechDocs addon named `CatalogEntityCard` with\n * location `TechDocsAddonLocations.COMPONENT`, whose `component` would be\n * the react component that would be rendered in place of all instances of\n * the markdown illustrated above.\n *\n * The `@backstage/plugin-techdocs-react` package would need to be updated to, in\n * cases where such addons had been registered, find all instances of the\n * the `<TechDocsAddon>` tag whose `textContent` corresponded with the name of the\n * addon, then replace them with component instances of the addon component,\n * passing any attributes from the tag as props to the component.\n */\n // Component: 'Component',\n} as const);\n\n/**\n * Options for creating a TechDocs addon.\n * @public\n */\nexport type TechDocsAddonOptions<TAddonProps = {}> = {\n name: string;\n location: keyof typeof TechDocsAddonLocations;\n component: ComponentType<TAddonProps>;\n};\n"],"names":[],"mappings":"AA0CO,MAAM,sBAAA,GAAyB,OAAO,MAAA,CAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKlD,MAAA,EAAQ,QAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMR,SAAA,EAAW,WAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMX,QAAA,EAAU,UAAA;AAAA;AAAA;AAAA;AAAA,EAKV,cAAA,EAAgB,gBAAA;AAAA;AAAA;AAAA;AAAA,EAKhB,gBAAA,EAAkB,kBAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMlB,OAAA,EAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA+BX,CAAU;;"}
1
+ {"version":3,"file":"types.esm.js","sources":["../src/types.ts"],"sourcesContent":["/*\n * Copyright 2022 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 { ComponentType } from 'react';\nimport { Entity } from '@backstage/catalog-model';\n\n/**\n * Metadata for TechDocs page\n *\n * @public\n */\nexport type TechDocsMetadata = {\n site_name: string;\n site_description: string;\n engine?: string;\n};\n\n/**\n * Metadata for TechDocs Entity\n *\n * @public\n */\nexport type TechDocsEntityMetadata = Entity & {\n locationMetadata?: { type: string; target: string };\n};\n\n/**\n * Locations for which TechDocs addons may be declared and rendered.\n * @public\n */\nexport const TechDocsAddonLocations = Object.freeze({\n /**\n * These addons fill up the header from the right, on the same line as the\n * title.\n */\n Header: 'Header',\n\n /**\n * These addons appear below the header and above all content; tooling addons\n * can be inserted for convenience.\n */\n Subheader: 'Subheader',\n\n /**\n * These addons are items added to the settings menu list and are designed to make\n * the reader experience customizable, for example accessibility options\n */\n Settings: 'Settings',\n\n /**\n * These addons appear left of the content and above the navigation.\n */\n PrimarySidebar: 'PrimarySidebar',\n\n /**\n * These addons appear right of the content and above the table of contents.\n */\n SecondarySidebar: 'SecondarySidebar',\n\n /**\n * A virtual location which allows mutation of all content within the shadow\n * root by transforming DOM nodes. These addons should return null on render.\n */\n Content: 'Content',\n\n /**\n * todo(backstage/community): This is a proposed virtual location which would\n * help implement a common addon pattern in which many instances of a given\n * element in markdown would be dynamically replaced at render-time based on\n * attributes provided on that element, for example:\n *\n * ```md\n * ## For Fun\n * <TechDocsAddon>CatGif</TechDocsAddon>\n *\n * ## Component Metadata\n * <TechDocsAddon entityRef=\"default:component/some-component-name\">CatalogEntityCard</TechDocsAddon>\n *\n * ## System Metadata\n * <TechDocsAddon entityRef=\"default:system/some-system-name\">CatalogEntityCard</TechDocsAddon>\n * ```\n *\n * Could correspond to a TechDocs addon named `CatalogEntityCard` with\n * location `TechDocsAddonLocations.COMPONENT`, whose `component` would be\n * the react component that would be rendered in place of all instances of\n * the markdown illustrated above.\n *\n * The `@backstage/plugin-techdocs-react` package would need to be updated to, in\n * cases where such addons had been registered, find all instances of the\n * the `<TechDocsAddon>` tag whose `textContent` corresponded with the name of the\n * addon, then replace them with component instances of the addon component,\n * passing any attributes from the tag as props to the component.\n */\n // Component: 'Component',\n} as const);\n\n/**\n * Options for creating a TechDocs addon.\n * @public\n */\nexport type TechDocsAddonOptions<TAddonProps = {}> = {\n name: string;\n location: keyof typeof TechDocsAddonLocations;\n component: ComponentType<TAddonProps>;\n};\n"],"names":[],"mappings":"AA2CO,MAAM,sBAAA,GAAyB,OAAO,MAAA,CAAO;AAAA;AAAA;AAAA;AAAA;AAAA,EAKlD,MAAA,EAAQ,QAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMR,SAAA,EAAW,WAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMX,QAAA,EAAU,UAAA;AAAA;AAAA;AAAA;AAAA,EAKV,cAAA,EAAgB,gBAAA;AAAA;AAAA;AAAA;AAAA,EAKhB,gBAAA,EAAkB,kBAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAMlB,OAAA,EAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA+BX,CAAU;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-techdocs-react",
3
- "version": "1.3.16-next.1",
3
+ "version": "1.4.0",
4
4
  "description": "Shared frontend utilities for TechDocs and Addons",
5
5
  "backstage": {
6
6
  "role": "web-library",
@@ -66,13 +66,13 @@
66
66
  "test": "backstage-cli package test"
67
67
  },
68
68
  "dependencies": {
69
- "@backstage/catalog-model": "1.10.2-next.0",
70
- "@backstage/config": "1.3.10-next.0",
71
- "@backstage/core-components": "0.18.15-next.1",
72
- "@backstage/core-plugin-api": "1.12.11-next.0",
73
- "@backstage/frontend-plugin-api": "0.18.2-next.0",
74
- "@backstage/plugin-techdocs-common": "0.1.1",
75
- "@backstage/version-bridge": "1.0.12",
69
+ "@backstage/catalog-model": "^1.10.2",
70
+ "@backstage/config": "^1.3.10",
71
+ "@backstage/core-components": "^0.18.15",
72
+ "@backstage/core-plugin-api": "^1.12.11",
73
+ "@backstage/frontend-plugin-api": "^0.18.2",
74
+ "@backstage/plugin-techdocs-common": "^0.1.2",
75
+ "@backstage/version-bridge": "^1.0.12",
76
76
  "@material-ui/core": "^4.12.2",
77
77
  "@material-ui/styles": "^4.11.0",
78
78
  "jss": "~10.10.0",
@@ -80,9 +80,9 @@
80
80
  "react-use": "^17.2.4"
81
81
  },
82
82
  "devDependencies": {
83
- "@backstage/cli": "0.36.7-next.0",
84
- "@backstage/test-utils": "1.7.23-next.0",
85
- "@backstage/theme": "0.7.3",
83
+ "@backstage/cli": "^0.36.7",
84
+ "@backstage/test-utils": "^1.7.23",
85
+ "@backstage/theme": "^0.7.3",
86
86
  "@testing-library/dom": "^10.0.0",
87
87
  "@testing-library/jest-dom": "^6.0.0",
88
88
  "@testing-library/react": "^16.0.0",