@backstage/frontend-plugin-api 0.6.4 → 0.6.5-next.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.
Files changed (80) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/analytics/AnalyticsContext.esm.js +31 -0
  3. package/dist/analytics/AnalyticsContext.esm.js.map +1 -0
  4. package/dist/analytics/Tracker.esm.js +93 -0
  5. package/dist/analytics/Tracker.esm.js.map +1 -0
  6. package/dist/analytics/useAnalytics.esm.js +38 -0
  7. package/dist/analytics/useAnalytics.esm.js.map +1 -0
  8. package/dist/apis/definitions/AnalyticsApi.esm.js +8 -0
  9. package/dist/apis/definitions/AnalyticsApi.esm.js.map +1 -0
  10. package/dist/apis/definitions/AppTreeApi.esm.js +6 -0
  11. package/dist/apis/definitions/AppTreeApi.esm.js.map +1 -0
  12. package/dist/apis/definitions/ComponentsApi.esm.js +12 -0
  13. package/dist/apis/definitions/ComponentsApi.esm.js.map +1 -0
  14. package/dist/apis/definitions/IconsApi.esm.js +8 -0
  15. package/dist/apis/definitions/IconsApi.esm.js.map +1 -0
  16. package/dist/apis/definitions/RouteResolutionApi.esm.js +8 -0
  17. package/dist/apis/definitions/RouteResolutionApi.esm.js.map +1 -0
  18. package/dist/components/ErrorBoundary.esm.js +38 -0
  19. package/dist/components/ErrorBoundary.esm.js.map +1 -0
  20. package/dist/components/ExtensionBoundary.esm.js +36 -0
  21. package/dist/components/ExtensionBoundary.esm.js.map +1 -0
  22. package/dist/components/coreComponentRefs.esm.js +19 -0
  23. package/dist/components/coreComponentRefs.esm.js.map +1 -0
  24. package/dist/components/createComponentRef.esm.js +12 -0
  25. package/dist/components/createComponentRef.esm.js.map +1 -0
  26. package/dist/core-plugin-api/src/analytics/Tracker.esm.js +14 -0
  27. package/dist/core-plugin-api/src/analytics/Tracker.esm.js.map +1 -0
  28. package/dist/extensions/createApiExtension.esm.js +31 -0
  29. package/dist/extensions/createApiExtension.esm.js.map +1 -0
  30. package/dist/extensions/createAppRootElementExtension.esm.js +26 -0
  31. package/dist/extensions/createAppRootElementExtension.esm.js.map +1 -0
  32. package/dist/extensions/createAppRootWrapperExtension.esm.js +35 -0
  33. package/dist/extensions/createAppRootWrapperExtension.esm.js.map +1 -0
  34. package/dist/extensions/createComponentExtension.esm.js +46 -0
  35. package/dist/extensions/createComponentExtension.esm.js.map +1 -0
  36. package/dist/extensions/createNavItemExtension.esm.js +34 -0
  37. package/dist/extensions/createNavItemExtension.esm.js.map +1 -0
  38. package/dist/extensions/createNavLogoExtension.esm.js +29 -0
  39. package/dist/extensions/createNavLogoExtension.esm.js.map +1 -0
  40. package/dist/extensions/createPageExtension.esm.js +39 -0
  41. package/dist/extensions/createPageExtension.esm.js.map +1 -0
  42. package/dist/extensions/createRouterExtension.esm.js +35 -0
  43. package/dist/extensions/createRouterExtension.esm.js.map +1 -0
  44. package/dist/extensions/createSignInPageExtension.esm.js +34 -0
  45. package/dist/extensions/createSignInPageExtension.esm.js.map +1 -0
  46. package/dist/extensions/createThemeExtension.esm.js +21 -0
  47. package/dist/extensions/createThemeExtension.esm.js.map +1 -0
  48. package/dist/extensions/createTranslationExtension.esm.js +21 -0
  49. package/dist/extensions/createTranslationExtension.esm.js.map +1 -0
  50. package/dist/index.esm.js +33 -969
  51. package/dist/index.esm.js.map +1 -1
  52. package/dist/routing/ExternalRouteRef.esm.js +32 -0
  53. package/dist/routing/ExternalRouteRef.esm.js.map +1 -0
  54. package/dist/routing/RouteRef.esm.js +86 -0
  55. package/dist/routing/RouteRef.esm.js.map +1 -0
  56. package/dist/routing/SubRouteRef.esm.js +86 -0
  57. package/dist/routing/SubRouteRef.esm.js.map +1 -0
  58. package/dist/routing/describeParentCallSite.esm.js +24 -0
  59. package/dist/routing/describeParentCallSite.esm.js.map +1 -0
  60. package/dist/routing/useRouteRef.esm.js +25 -0
  61. package/dist/routing/useRouteRef.esm.js.map +1 -0
  62. package/dist/routing/useRouteRefParams.esm.js +8 -0
  63. package/dist/routing/useRouteRefParams.esm.js.map +1 -0
  64. package/dist/schema/createSchemaFromZod.esm.js +34 -0
  65. package/dist/schema/createSchemaFromZod.esm.js.map +1 -0
  66. package/dist/wiring/coreExtensionData.esm.js +10 -0
  67. package/dist/wiring/coreExtensionData.esm.js.map +1 -0
  68. package/dist/wiring/createExtension.esm.js +52 -0
  69. package/dist/wiring/createExtension.esm.js.map +1 -0
  70. package/dist/wiring/createExtensionDataRef.esm.js +20 -0
  71. package/dist/wiring/createExtensionDataRef.esm.js.map +1 -0
  72. package/dist/wiring/createExtensionInput.esm.js +13 -0
  73. package/dist/wiring/createExtensionInput.esm.js.map +1 -0
  74. package/dist/wiring/createExtensionOverrides.esm.js +23 -0
  75. package/dist/wiring/createExtensionOverrides.esm.js.map +1 -0
  76. package/dist/wiring/createPlugin.esm.js +36 -0
  77. package/dist/wiring/createPlugin.esm.js.map +1 -0
  78. package/dist/wiring/resolveExtensionDefinition.esm.js +27 -0
  79. package/dist/wiring/resolveExtensionDefinition.esm.js.map +1 -0
  80. package/package.json +6 -6
@@ -0,0 +1,46 @@
1
+ import { lazy } from 'react';
2
+ import { createExtensionDataRef } from '../wiring/createExtensionDataRef.esm.js';
3
+ import { createExtension } from '../wiring/createExtension.esm.js';
4
+
5
+ function createComponentExtension(options) {
6
+ return createExtension({
7
+ kind: "component",
8
+ namespace: options.ref.id,
9
+ name: options.name,
10
+ attachTo: { id: "app", input: "components" },
11
+ inputs: options.inputs,
12
+ disabled: options.disabled,
13
+ configSchema: options.configSchema,
14
+ output: {
15
+ component: createComponentExtension.componentDataRef
16
+ },
17
+ factory({ config, inputs }) {
18
+ if ("sync" in options.loader) {
19
+ return {
20
+ component: {
21
+ ref: options.ref,
22
+ impl: options.loader.sync({ config, inputs })
23
+ }
24
+ };
25
+ }
26
+ const lazyLoader = options.loader.lazy;
27
+ const ExtensionComponent = lazy(
28
+ () => lazyLoader({ config, inputs }).then((Component) => ({
29
+ default: Component
30
+ }))
31
+ );
32
+ return {
33
+ component: {
34
+ ref: options.ref,
35
+ impl: ExtensionComponent
36
+ }
37
+ };
38
+ }
39
+ });
40
+ }
41
+ ((createComponentExtension2) => {
42
+ createComponentExtension2.componentDataRef = createExtensionDataRef("core.component.component");
43
+ })(createComponentExtension || (createComponentExtension = {}));
44
+
45
+ export { createComponentExtension };
46
+ //# sourceMappingURL=createComponentExtension.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createComponentExtension.esm.js","sources":["../../src/extensions/createComponentExtension.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 { lazy, ComponentType } from 'react';\nimport {\n AnyExtensionInputMap,\n ResolvedExtensionInputs,\n createExtension,\n createExtensionDataRef,\n} from '../wiring';\nimport { Expand } from '../types';\nimport { PortableSchema } from '../schema';\nimport { ComponentRef } from '../components';\n\n/** @public */\nexport function createComponentExtension<\n TProps extends {},\n TConfig extends {},\n TInputs extends AnyExtensionInputMap,\n>(options: {\n ref: ComponentRef<TProps>;\n name?: string;\n disabled?: boolean;\n inputs?: TInputs;\n configSchema?: PortableSchema<TConfig>;\n loader:\n | {\n lazy: (values: {\n config: TConfig;\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n }) => Promise<ComponentType<TProps>>;\n }\n | {\n sync: (values: {\n config: TConfig;\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n }) => ComponentType<TProps>;\n };\n}) {\n return createExtension({\n kind: 'component',\n namespace: options.ref.id,\n name: options.name,\n attachTo: { id: 'app', input: 'components' },\n inputs: options.inputs,\n disabled: options.disabled,\n configSchema: options.configSchema,\n output: {\n component: createComponentExtension.componentDataRef,\n },\n factory({ config, inputs }) {\n if ('sync' in options.loader) {\n return {\n component: {\n ref: options.ref,\n impl: options.loader.sync({ config, inputs }) as ComponentType,\n },\n };\n }\n const lazyLoader = options.loader.lazy;\n const ExtensionComponent = lazy(() =>\n lazyLoader({ config, inputs }).then(Component => ({\n default: Component,\n })),\n ) as unknown as ComponentType;\n\n return {\n component: {\n ref: options.ref,\n impl: ExtensionComponent,\n },\n };\n },\n });\n}\n\n/** @public */\nexport namespace createComponentExtension {\n export const componentDataRef = createExtensionDataRef<{\n ref: ComponentRef;\n impl: ComponentType;\n }>('core.component.component');\n}\n"],"names":["createComponentExtension"],"mappings":";;;;AA4BO,SAAS,yBAId,OAmBC,EAAA;AACD,EAAA,OAAO,eAAgB,CAAA;AAAA,IACrB,IAAM,EAAA,WAAA;AAAA,IACN,SAAA,EAAW,QAAQ,GAAI,CAAA,EAAA;AAAA,IACvB,MAAM,OAAQ,CAAA,IAAA;AAAA,IACd,QAAU,EAAA,EAAE,EAAI,EAAA,KAAA,EAAO,OAAO,YAAa,EAAA;AAAA,IAC3C,QAAQ,OAAQ,CAAA,MAAA;AAAA,IAChB,UAAU,OAAQ,CAAA,QAAA;AAAA,IAClB,cAAc,OAAQ,CAAA,YAAA;AAAA,IACtB,MAAQ,EAAA;AAAA,MACN,WAAW,wBAAyB,CAAA,gBAAA;AAAA,KACtC;AAAA,IACA,OAAQ,CAAA,EAAE,MAAQ,EAAA,MAAA,EAAU,EAAA;AAC1B,MAAI,IAAA,MAAA,IAAU,QAAQ,MAAQ,EAAA;AAC5B,QAAO,OAAA;AAAA,UACL,SAAW,EAAA;AAAA,YACT,KAAK,OAAQ,CAAA,GAAA;AAAA,YACb,MAAM,OAAQ,CAAA,MAAA,CAAO,KAAK,EAAE,MAAA,EAAQ,QAAQ,CAAA;AAAA,WAC9C;AAAA,SACF,CAAA;AAAA,OACF;AACA,MAAM,MAAA,UAAA,GAAa,QAAQ,MAAO,CAAA,IAAA,CAAA;AAClC,MAAA,MAAM,kBAAqB,GAAA,IAAA;AAAA,QAAK,MAC9B,WAAW,EAAE,MAAA,EAAQ,QAAQ,CAAA,CAAE,KAAK,CAAc,SAAA,MAAA;AAAA,UAChD,OAAS,EAAA,SAAA;AAAA,SACT,CAAA,CAAA;AAAA,OACJ,CAAA;AAEA,MAAO,OAAA;AAAA,QACL,SAAW,EAAA;AAAA,UACT,KAAK,OAAQ,CAAA,GAAA;AAAA,UACb,IAAM,EAAA,kBAAA;AAAA,SACR;AAAA,OACF,CAAA;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH,CAAA;AAAA,CAGO,CAAUA,yBAAV,KAAA;AACE,EAAMA,yBAAAA,CAAA,gBAAmB,GAAA,sBAAA,CAG7B,0BAA0B,CAAA,CAAA;AAAA,CAJd,EAAA,wBAAA,KAAA,wBAAA,GAAA,EAAA,CAAA,CAAA;;;;"}
@@ -0,0 +1,34 @@
1
+ import { createSchemaFromZod } from '../schema/createSchemaFromZod.esm.js';
2
+ import { createExtensionDataRef } from '../wiring/createExtensionDataRef.esm.js';
3
+ import { createExtension } from '../wiring/createExtension.esm.js';
4
+
5
+ function createNavItemExtension(options) {
6
+ const { routeRef, title, icon, namespace, name } = options;
7
+ return createExtension({
8
+ namespace,
9
+ name,
10
+ kind: "nav-item",
11
+ attachTo: { id: "app/nav", input: "items" },
12
+ configSchema: createSchemaFromZod(
13
+ (z) => z.object({
14
+ title: z.string().default(title)
15
+ })
16
+ ),
17
+ output: {
18
+ navTarget: createNavItemExtension.targetDataRef
19
+ },
20
+ factory: ({ config }) => ({
21
+ navTarget: {
22
+ title: config.title,
23
+ icon,
24
+ routeRef
25
+ }
26
+ })
27
+ });
28
+ }
29
+ ((createNavItemExtension2) => {
30
+ createNavItemExtension2.targetDataRef = createExtensionDataRef("core.nav-item.target");
31
+ })(createNavItemExtension || (createNavItemExtension = {}));
32
+
33
+ export { createNavItemExtension };
34
+ //# sourceMappingURL=createNavItemExtension.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createNavItemExtension.esm.js","sources":["../../src/extensions/createNavItemExtension.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 { IconComponent } from '@backstage/core-plugin-api';\nimport { createSchemaFromZod } from '../schema/createSchemaFromZod';\nimport { createExtension, createExtensionDataRef } from '../wiring';\nimport { RouteRef } from '../routing';\n\n/**\n * Helper for creating extensions for a nav item.\n * @public\n */\nexport function createNavItemExtension(options: {\n namespace?: string;\n name?: string;\n routeRef: RouteRef<undefined>;\n title: string;\n icon: IconComponent;\n}) {\n const { routeRef, title, icon, namespace, name } = options;\n return createExtension({\n namespace,\n name,\n kind: 'nav-item',\n attachTo: { id: 'app/nav', input: 'items' },\n configSchema: createSchemaFromZod(z =>\n z.object({\n title: z.string().default(title),\n }),\n ),\n output: {\n navTarget: createNavItemExtension.targetDataRef,\n },\n factory: ({ config }) => ({\n navTarget: {\n title: config.title,\n icon,\n routeRef,\n },\n }),\n });\n}\n\n/** @public */\nexport namespace createNavItemExtension {\n // TODO(Rugvip): Should this be broken apart into separate refs? title/icon/routeRef\n export const targetDataRef = createExtensionDataRef<{\n title: string;\n icon: IconComponent;\n routeRef: RouteRef<undefined>;\n }>('core.nav-item.target');\n}\n"],"names":["createNavItemExtension"],"mappings":";;;;AAyBO,SAAS,uBAAuB,OAMpC,EAAA;AACD,EAAA,MAAM,EAAE,QAAU,EAAA,KAAA,EAAO,IAAM,EAAA,SAAA,EAAW,MAAS,GAAA,OAAA,CAAA;AACnD,EAAA,OAAO,eAAgB,CAAA;AAAA,IACrB,SAAA;AAAA,IACA,IAAA;AAAA,IACA,IAAM,EAAA,UAAA;AAAA,IACN,QAAU,EAAA,EAAE,EAAI,EAAA,SAAA,EAAW,OAAO,OAAQ,EAAA;AAAA,IAC1C,YAAc,EAAA,mBAAA;AAAA,MAAoB,CAAA,CAAA,KAChC,EAAE,MAAO,CAAA;AAAA,QACP,KAAO,EAAA,CAAA,CAAE,MAAO,EAAA,CAAE,QAAQ,KAAK,CAAA;AAAA,OAChC,CAAA;AAAA,KACH;AAAA,IACA,MAAQ,EAAA;AAAA,MACN,WAAW,sBAAuB,CAAA,aAAA;AAAA,KACpC;AAAA,IACA,OAAS,EAAA,CAAC,EAAE,MAAA,EAAc,MAAA;AAAA,MACxB,SAAW,EAAA;AAAA,QACT,OAAO,MAAO,CAAA,KAAA;AAAA,QACd,IAAA;AAAA,QACA,QAAA;AAAA,OACF;AAAA,KACF,CAAA;AAAA,GACD,CAAA,CAAA;AACH,CAAA;AAAA,CAGO,CAAUA,uBAAV,KAAA;AAEE,EAAMA,uBAAAA,CAAA,aAAgB,GAAA,sBAAA,CAI1B,sBAAsB,CAAA,CAAA;AAAA,CANV,EAAA,sBAAA,KAAA,sBAAA,GAAA,EAAA,CAAA,CAAA;;;;"}
@@ -0,0 +1,29 @@
1
+ import { createExtensionDataRef } from '../wiring/createExtensionDataRef.esm.js';
2
+ import { createExtension } from '../wiring/createExtension.esm.js';
3
+
4
+ function createNavLogoExtension(options) {
5
+ const { logoIcon, logoFull } = options;
6
+ return createExtension({
7
+ kind: "nav-logo",
8
+ name: options == null ? void 0 : options.name,
9
+ namespace: options == null ? void 0 : options.namespace,
10
+ attachTo: { id: "app/nav", input: "logos" },
11
+ output: {
12
+ logos: createNavLogoExtension.logoElementsDataRef
13
+ },
14
+ factory: () => {
15
+ return {
16
+ logos: {
17
+ logoIcon,
18
+ logoFull
19
+ }
20
+ };
21
+ }
22
+ });
23
+ }
24
+ ((createNavLogoExtension2) => {
25
+ createNavLogoExtension2.logoElementsDataRef = createExtensionDataRef("core.nav-logo.logo-elements");
26
+ })(createNavLogoExtension || (createNavLogoExtension = {}));
27
+
28
+ export { createNavLogoExtension };
29
+ //# sourceMappingURL=createNavLogoExtension.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createNavLogoExtension.esm.js","sources":["../../src/extensions/createNavLogoExtension.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 { createExtension, createExtensionDataRef } from '../wiring';\n\n/**\n * Helper for creating extensions for a nav logos.\n * @public\n */\nexport function createNavLogoExtension(options: {\n name?: string;\n namespace?: string;\n logoIcon: JSX.Element;\n logoFull: JSX.Element;\n}) {\n const { logoIcon, logoFull } = options;\n return createExtension({\n kind: 'nav-logo',\n name: options?.name,\n namespace: options?.namespace,\n attachTo: { id: 'app/nav', input: 'logos' },\n output: {\n logos: createNavLogoExtension.logoElementsDataRef,\n },\n factory: () => {\n return {\n logos: {\n logoIcon,\n logoFull,\n },\n };\n },\n });\n}\n\n/** @public */\nexport namespace createNavLogoExtension {\n export const logoElementsDataRef = createExtensionDataRef<{\n logoIcon?: JSX.Element;\n logoFull?: JSX.Element;\n }>('core.nav-logo.logo-elements');\n}\n"],"names":["createNavLogoExtension"],"mappings":";;;AAsBO,SAAS,uBAAuB,OAKpC,EAAA;AACD,EAAM,MAAA,EAAE,QAAU,EAAA,QAAA,EAAa,GAAA,OAAA,CAAA;AAC/B,EAAA,OAAO,eAAgB,CAAA;AAAA,IACrB,IAAM,EAAA,UAAA;AAAA,IACN,MAAM,OAAS,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,OAAA,CAAA,IAAA;AAAA,IACf,WAAW,OAAS,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,OAAA,CAAA,SAAA;AAAA,IACpB,QAAU,EAAA,EAAE,EAAI,EAAA,SAAA,EAAW,OAAO,OAAQ,EAAA;AAAA,IAC1C,MAAQ,EAAA;AAAA,MACN,OAAO,sBAAuB,CAAA,mBAAA;AAAA,KAChC;AAAA,IACA,SAAS,MAAM;AACb,MAAO,OAAA;AAAA,QACL,KAAO,EAAA;AAAA,UACL,QAAA;AAAA,UACA,QAAA;AAAA,SACF;AAAA,OACF,CAAA;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH,CAAA;AAAA,CAGO,CAAUA,uBAAV,KAAA;AACE,EAAMA,uBAAAA,CAAA,mBAAsB,GAAA,sBAAA,CAGhC,6BAA6B,CAAA,CAAA;AAAA,CAJjB,EAAA,sBAAA,KAAA,sBAAA,GAAA,EAAA,CAAA,CAAA;;;;"}
@@ -0,0 +1,39 @@
1
+ import React, { lazy } from 'react';
2
+ import { ExtensionBoundary } from '../components/ExtensionBoundary.esm.js';
3
+ import { createSchemaFromZod } from '../schema/createSchemaFromZod.esm.js';
4
+ import { coreExtensionData } from '../wiring/coreExtensionData.esm.js';
5
+ import { createExtension } from '../wiring/createExtension.esm.js';
6
+
7
+ function createPageExtension(options) {
8
+ var _a;
9
+ const configSchema = "configSchema" in options ? options.configSchema : createSchemaFromZod(
10
+ (z) => z.object({ path: z.string().default(options.defaultPath) })
11
+ );
12
+ return createExtension({
13
+ kind: "page",
14
+ namespace: options.namespace,
15
+ name: options.name,
16
+ attachTo: (_a = options.attachTo) != null ? _a : { id: "app/routes", input: "routes" },
17
+ configSchema,
18
+ inputs: options.inputs,
19
+ disabled: options.disabled,
20
+ output: {
21
+ element: coreExtensionData.reactElement,
22
+ path: coreExtensionData.routePath,
23
+ routeRef: coreExtensionData.routeRef.optional()
24
+ },
25
+ factory({ config, inputs, node }) {
26
+ const ExtensionComponent = lazy(
27
+ () => options.loader({ config, inputs }).then((element) => ({ default: () => element }))
28
+ );
29
+ return {
30
+ path: config.path,
31
+ routeRef: options.routeRef,
32
+ element: /* @__PURE__ */ React.createElement(ExtensionBoundary, { node, routable: true }, /* @__PURE__ */ React.createElement(ExtensionComponent, null))
33
+ };
34
+ }
35
+ });
36
+ }
37
+
38
+ export { createPageExtension };
39
+ //# sourceMappingURL=createPageExtension.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createPageExtension.esm.js","sources":["../../src/extensions/createPageExtension.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';\nimport { ExtensionBoundary } from '../components';\nimport { createSchemaFromZod, PortableSchema } from '../schema';\nimport {\n coreExtensionData,\n createExtension,\n ResolvedExtensionInputs,\n AnyExtensionInputMap,\n} from '../wiring';\nimport { RouteRef } from '../routing';\nimport { Expand } from '../types';\nimport { ExtensionDefinition } from '../wiring/createExtension';\n\n/**\n * Helper for creating extensions for a routable React page component.\n *\n * @public\n */\nexport function createPageExtension<\n TConfig extends { path: string },\n TInputs extends AnyExtensionInputMap,\n>(\n options: (\n | {\n defaultPath: string;\n }\n | {\n configSchema: PortableSchema<TConfig>;\n }\n ) & {\n namespace?: string;\n name?: string;\n attachTo?: { id: string; input: string };\n disabled?: boolean;\n inputs?: TInputs;\n routeRef?: RouteRef;\n loader: (options: {\n config: TConfig;\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n }) => Promise<JSX.Element>;\n },\n): ExtensionDefinition<TConfig> {\n const configSchema =\n 'configSchema' in options\n ? options.configSchema\n : (createSchemaFromZod(z =>\n z.object({ path: z.string().default(options.defaultPath) }),\n ) as PortableSchema<TConfig>);\n\n return createExtension({\n kind: 'page',\n namespace: options.namespace,\n name: options.name,\n attachTo: options.attachTo ?? { id: 'app/routes', input: 'routes' },\n configSchema,\n inputs: options.inputs,\n disabled: options.disabled,\n output: {\n element: coreExtensionData.reactElement,\n path: coreExtensionData.routePath,\n routeRef: coreExtensionData.routeRef.optional(),\n },\n factory({ config, inputs, node }) {\n const ExtensionComponent = lazy(() =>\n options\n .loader({ config, inputs })\n .then(element => ({ default: () => element })),\n );\n\n return {\n path: config.path,\n routeRef: options.routeRef,\n element: (\n <ExtensionBoundary node={node} routable>\n <ExtensionComponent />\n </ExtensionBoundary>\n ),\n };\n },\n });\n}\n"],"names":[],"mappings":";;;;;;AAkCO,SAAS,oBAId,OAmB8B,EAAA;AAzDhC,EAAA,IAAA,EAAA,CAAA;AA0DE,EAAA,MAAM,YACJ,GAAA,cAAA,IAAkB,OACd,GAAA,OAAA,CAAQ,YACP,GAAA,mBAAA;AAAA,IAAoB,CACnB,CAAA,KAAA,CAAA,CAAE,MAAO,CAAA,EAAE,IAAM,EAAA,CAAA,CAAE,MAAO,EAAA,CAAE,OAAQ,CAAA,OAAA,CAAQ,WAAW,CAAA,EAAG,CAAA;AAAA,GAC5D,CAAA;AAEN,EAAA,OAAO,eAAgB,CAAA;AAAA,IACrB,IAAM,EAAA,MAAA;AAAA,IACN,WAAW,OAAQ,CAAA,SAAA;AAAA,IACnB,MAAM,OAAQ,CAAA,IAAA;AAAA,IACd,QAAA,EAAA,CAAU,aAAQ,QAAR,KAAA,IAAA,GAAA,EAAA,GAAoB,EAAE,EAAI,EAAA,YAAA,EAAc,OAAO,QAAS,EAAA;AAAA,IAClE,YAAA;AAAA,IACA,QAAQ,OAAQ,CAAA,MAAA;AAAA,IAChB,UAAU,OAAQ,CAAA,QAAA;AAAA,IAClB,MAAQ,EAAA;AAAA,MACN,SAAS,iBAAkB,CAAA,YAAA;AAAA,MAC3B,MAAM,iBAAkB,CAAA,SAAA;AAAA,MACxB,QAAA,EAAU,iBAAkB,CAAA,QAAA,CAAS,QAAS,EAAA;AAAA,KAChD;AAAA,IACA,OAAQ,CAAA,EAAE,MAAQ,EAAA,MAAA,EAAQ,MAAQ,EAAA;AAChC,MAAA,MAAM,kBAAqB,GAAA,IAAA;AAAA,QAAK,MAC9B,OAAA,CACG,MAAO,CAAA,EAAE,QAAQ,MAAO,EAAC,CACzB,CAAA,IAAA,CAAK,CAAY,OAAA,MAAA,EAAE,OAAS,EAAA,MAAM,SAAU,CAAA,CAAA;AAAA,OACjD,CAAA;AAEA,MAAO,OAAA;AAAA,QACL,MAAM,MAAO,CAAA,IAAA;AAAA,QACb,UAAU,OAAQ,CAAA,QAAA;AAAA,QAClB,OAAA,sCACG,iBAAkB,EAAA,EAAA,IAAA,EAAY,UAAQ,IACrC,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,wBAAmB,CACtB,CAAA;AAAA,OAEJ,CAAA;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH;;;;"}
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { createExtension } from '../wiring/createExtension.esm.js';
3
+ import { createExtensionDataRef } from '../wiring/createExtensionDataRef.esm.js';
4
+
5
+ function createRouterExtension(options) {
6
+ var _a;
7
+ return createExtension({
8
+ kind: "app-router-component",
9
+ namespace: options.namespace,
10
+ name: options.name,
11
+ attachTo: (_a = options.attachTo) != null ? _a : { id: "app/root", input: "router" },
12
+ configSchema: options.configSchema,
13
+ disabled: options.disabled,
14
+ inputs: options.inputs,
15
+ output: {
16
+ component: createRouterExtension.componentDataRef
17
+ },
18
+ factory({ inputs, config }) {
19
+ const Component = (props) => {
20
+ return /* @__PURE__ */ React.createElement(options.Component, { inputs, config }, props.children);
21
+ };
22
+ return {
23
+ component: Component
24
+ };
25
+ }
26
+ });
27
+ }
28
+ ((createRouterExtension2) => {
29
+ createRouterExtension2.componentDataRef = createExtensionDataRef(
30
+ "app.router.wrapper"
31
+ );
32
+ })(createRouterExtension || (createRouterExtension = {}));
33
+
34
+ export { createRouterExtension };
35
+ //# sourceMappingURL=createRouterExtension.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createRouterExtension.esm.js","sources":["../../src/extensions/createRouterExtension.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, { ComponentType, PropsWithChildren } from 'react';\nimport { PortableSchema } from '../schema/types';\nimport {\n AnyExtensionInputMap,\n ExtensionDefinition,\n ResolvedExtensionInputs,\n createExtension,\n} from '../wiring/createExtension';\nimport { createExtensionDataRef } from '../wiring/createExtensionDataRef';\nimport { Expand } from '../types';\n\n/**\n * Creates an extension that replaces the router implementation at the app root.\n * This is useful to be able to for example replace the BrowserRouter with a\n * MemoryRouter in tests, or to add additional props to a BrowserRouter.\n *\n * @public\n */\nexport function createRouterExtension<\n TConfig extends {},\n TInputs extends AnyExtensionInputMap,\n>(options: {\n namespace?: string;\n name?: string;\n attachTo?: { id: string; input: string };\n configSchema?: PortableSchema<TConfig>;\n disabled?: boolean;\n inputs?: TInputs;\n Component: ComponentType<\n PropsWithChildren<{\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n config: TConfig;\n }>\n >;\n}): ExtensionDefinition<TConfig> {\n return createExtension({\n kind: 'app-router-component',\n namespace: options.namespace,\n name: options.name,\n attachTo: options.attachTo ?? { id: 'app/root', input: 'router' },\n configSchema: options.configSchema,\n disabled: options.disabled,\n inputs: options.inputs,\n output: {\n component: createRouterExtension.componentDataRef,\n },\n factory({ inputs, config }) {\n const Component = (props: PropsWithChildren<{}>) => {\n return (\n <options.Component inputs={inputs} config={config}>\n {props.children}\n </options.Component>\n );\n };\n return {\n component: Component,\n };\n },\n });\n}\n\n/** @public */\nexport namespace createRouterExtension {\n export const componentDataRef =\n createExtensionDataRef<ComponentType<PropsWithChildren<{}>>>(\n 'app.router.wrapper',\n );\n}\n"],"names":["createRouterExtension"],"mappings":";;;;AAkCO,SAAS,sBAGd,OAa+B,EAAA;AAlDjC,EAAA,IAAA,EAAA,CAAA;AAmDE,EAAA,OAAO,eAAgB,CAAA;AAAA,IACrB,IAAM,EAAA,sBAAA;AAAA,IACN,WAAW,OAAQ,CAAA,SAAA;AAAA,IACnB,MAAM,OAAQ,CAAA,IAAA;AAAA,IACd,QAAA,EAAA,CAAU,aAAQ,QAAR,KAAA,IAAA,GAAA,EAAA,GAAoB,EAAE,EAAI,EAAA,UAAA,EAAY,OAAO,QAAS,EAAA;AAAA,IAChE,cAAc,OAAQ,CAAA,YAAA;AAAA,IACtB,UAAU,OAAQ,CAAA,QAAA;AAAA,IAClB,QAAQ,OAAQ,CAAA,MAAA;AAAA,IAChB,MAAQ,EAAA;AAAA,MACN,WAAW,qBAAsB,CAAA,gBAAA;AAAA,KACnC;AAAA,IACA,OAAQ,CAAA,EAAE,MAAQ,EAAA,MAAA,EAAU,EAAA;AAC1B,MAAM,MAAA,SAAA,GAAY,CAAC,KAAiC,KAAA;AAClD,QAAA,2CACG,OAAQ,CAAA,SAAA,EAAR,EAAkB,MAAgB,EAAA,MAAA,EAAA,EAChC,MAAM,QACT,CAAA,CAAA;AAAA,OAEJ,CAAA;AACA,MAAO,OAAA;AAAA,QACL,SAAW,EAAA,SAAA;AAAA,OACb,CAAA;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH,CAAA;AAAA,CAGO,CAAUA,sBAAV,KAAA;AACE,EAAMA,uBAAA,gBACX,GAAA,sBAAA;AAAA,IACE,oBAAA;AAAA,GACF,CAAA;AAAA,CAJa,EAAA,qBAAA,KAAA,qBAAA,GAAA,EAAA,CAAA,CAAA;;;;"}
@@ -0,0 +1,34 @@
1
+ import React, { lazy } from 'react';
2
+ import { ExtensionBoundary } from '../components/ExtensionBoundary.esm.js';
3
+ import { createExtensionDataRef } from '../wiring/createExtensionDataRef.esm.js';
4
+ import { createExtension } from '../wiring/createExtension.esm.js';
5
+
6
+ function createSignInPageExtension(options) {
7
+ var _a;
8
+ return createExtension({
9
+ kind: "sign-in-page",
10
+ namespace: options == null ? void 0 : options.namespace,
11
+ name: options == null ? void 0 : options.name,
12
+ attachTo: (_a = options.attachTo) != null ? _a : { id: "app/root", input: "signInPage" },
13
+ configSchema: options.configSchema,
14
+ inputs: options.inputs,
15
+ disabled: options.disabled,
16
+ output: {
17
+ component: createSignInPageExtension.componentDataRef
18
+ },
19
+ factory({ config, inputs, node }) {
20
+ const ExtensionComponent = lazy(
21
+ () => options.loader({ config, inputs }).then((component) => ({ default: component }))
22
+ );
23
+ return {
24
+ component: (props) => /* @__PURE__ */ React.createElement(ExtensionBoundary, { node, routable: true }, /* @__PURE__ */ React.createElement(ExtensionComponent, { ...props }))
25
+ };
26
+ }
27
+ });
28
+ }
29
+ ((createSignInPageExtension2) => {
30
+ createSignInPageExtension2.componentDataRef = createExtensionDataRef("core.sign-in-page.component");
31
+ })(createSignInPageExtension || (createSignInPageExtension = {}));
32
+
33
+ export { createSignInPageExtension };
34
+ //# sourceMappingURL=createSignInPageExtension.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createSignInPageExtension.esm.js","sources":["../../src/extensions/createSignInPageExtension.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, { ComponentType, lazy } from 'react';\nimport { ExtensionBoundary } from '../components';\nimport { PortableSchema } from '../schema';\nimport {\n createExtension,\n ResolvedExtensionInputs,\n AnyExtensionInputMap,\n createExtensionDataRef,\n ExtensionDefinition,\n} from '../wiring';\nimport { Expand } from '../types';\nimport { SignInPageProps } from '@backstage/core-plugin-api';\n\n/**\n *\n * @public\n */\nexport function createSignInPageExtension<\n TConfig extends {},\n TInputs extends AnyExtensionInputMap,\n>(options: {\n namespace?: string;\n name?: string;\n attachTo?: { id: string; input: string };\n configSchema?: PortableSchema<TConfig>;\n disabled?: boolean;\n inputs?: TInputs;\n loader: (options: {\n config: TConfig;\n inputs: Expand<ResolvedExtensionInputs<TInputs>>;\n }) => Promise<ComponentType<SignInPageProps>>;\n}): ExtensionDefinition<TConfig> {\n return createExtension({\n kind: 'sign-in-page',\n namespace: options?.namespace,\n name: options?.name,\n attachTo: options.attachTo ?? { id: 'app/root', input: 'signInPage' },\n configSchema: options.configSchema,\n inputs: options.inputs,\n disabled: options.disabled,\n output: {\n component: createSignInPageExtension.componentDataRef,\n },\n factory({ config, inputs, node }) {\n const ExtensionComponent = lazy(() =>\n options\n .loader({ config, inputs })\n .then(component => ({ default: component })),\n );\n\n return {\n component: props => (\n <ExtensionBoundary node={node} routable>\n <ExtensionComponent {...props} />\n </ExtensionBoundary>\n ),\n };\n },\n });\n}\n\n/** @public */\nexport namespace createSignInPageExtension {\n export const componentDataRef = createExtensionDataRef<\n ComponentType<SignInPageProps>\n >('core.sign-in-page.component');\n}\n"],"names":["createSignInPageExtension"],"mappings":";;;;;AAiCO,SAAS,0BAGd,OAW+B,EAAA;AA/CjC,EAAA,IAAA,EAAA,CAAA;AAgDE,EAAA,OAAO,eAAgB,CAAA;AAAA,IACrB,IAAM,EAAA,cAAA;AAAA,IACN,WAAW,OAAS,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,OAAA,CAAA,SAAA;AAAA,IACpB,MAAM,OAAS,IAAA,IAAA,GAAA,KAAA,CAAA,GAAA,OAAA,CAAA,IAAA;AAAA,IACf,QAAA,EAAA,CAAU,aAAQ,QAAR,KAAA,IAAA,GAAA,EAAA,GAAoB,EAAE,EAAI,EAAA,UAAA,EAAY,OAAO,YAAa,EAAA;AAAA,IACpE,cAAc,OAAQ,CAAA,YAAA;AAAA,IACtB,QAAQ,OAAQ,CAAA,MAAA;AAAA,IAChB,UAAU,OAAQ,CAAA,QAAA;AAAA,IAClB,MAAQ,EAAA;AAAA,MACN,WAAW,yBAA0B,CAAA,gBAAA;AAAA,KACvC;AAAA,IACA,OAAQ,CAAA,EAAE,MAAQ,EAAA,MAAA,EAAQ,MAAQ,EAAA;AAChC,MAAA,MAAM,kBAAqB,GAAA,IAAA;AAAA,QAAK,MAC9B,OAAA,CACG,MAAO,CAAA,EAAE,MAAQ,EAAA,MAAA,EAAQ,CAAA,CACzB,IAAK,CAAA,CAAA,SAAA,MAAc,EAAE,OAAA,EAAS,WAAY,CAAA,CAAA;AAAA,OAC/C,CAAA;AAEA,MAAO,OAAA;AAAA,QACL,SAAA,EAAW,CACT,KAAA,qBAAA,KAAA,CAAA,aAAA,CAAC,iBAAkB,EAAA,EAAA,IAAA,EAAY,QAAQ,EAAA,IAAA,EAAA,kBACpC,KAAA,CAAA,aAAA,CAAA,kBAAA,EAAA,EAAoB,GAAG,KAAA,EAAO,CACjC,CAAA;AAAA,OAEJ,CAAA;AAAA,KACF;AAAA,GACD,CAAA,CAAA;AACH,CAAA;AAAA,CAGO,CAAUA,0BAAV,KAAA;AACE,EAAMA,0BAAAA,CAAA,gBAAmB,GAAA,sBAAA,CAE9B,6BAA6B,CAAA,CAAA;AAAA,CAHhB,EAAA,yBAAA,KAAA,yBAAA,GAAA,EAAA,CAAA,CAAA;;;;"}
@@ -0,0 +1,21 @@
1
+ import { createExtensionDataRef } from '../wiring/createExtensionDataRef.esm.js';
2
+ import { createExtension } from '../wiring/createExtension.esm.js';
3
+
4
+ function createThemeExtension(theme) {
5
+ return createExtension({
6
+ kind: "theme",
7
+ namespace: "app",
8
+ name: theme.id,
9
+ attachTo: { id: "app", input: "themes" },
10
+ output: {
11
+ theme: createThemeExtension.themeDataRef
12
+ },
13
+ factory: () => ({ theme })
14
+ });
15
+ }
16
+ ((createThemeExtension2) => {
17
+ createThemeExtension2.themeDataRef = createExtensionDataRef("core.theme.theme");
18
+ })(createThemeExtension || (createThemeExtension = {}));
19
+
20
+ export { createThemeExtension };
21
+ //# sourceMappingURL=createThemeExtension.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createThemeExtension.esm.js","sources":["../../src/extensions/createThemeExtension.ts"],"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 { createExtension, createExtensionDataRef } from '../wiring';\nimport { AppTheme } from '@backstage/core-plugin-api';\n\n/** @public */\nexport function createThemeExtension(theme: AppTheme) {\n return createExtension({\n kind: 'theme',\n namespace: 'app',\n name: theme.id,\n attachTo: { id: 'app', input: 'themes' },\n output: {\n theme: createThemeExtension.themeDataRef,\n },\n factory: () => ({ theme }),\n });\n}\n\n/** @public */\nexport namespace createThemeExtension {\n export const themeDataRef =\n createExtensionDataRef<AppTheme>('core.theme.theme');\n}\n"],"names":["createThemeExtension"],"mappings":";;;AAoBO,SAAS,qBAAqB,KAAiB,EAAA;AACpD,EAAA,OAAO,eAAgB,CAAA;AAAA,IACrB,IAAM,EAAA,OAAA;AAAA,IACN,SAAW,EAAA,KAAA;AAAA,IACX,MAAM,KAAM,CAAA,EAAA;AAAA,IACZ,QAAU,EAAA,EAAE,EAAI,EAAA,KAAA,EAAO,OAAO,QAAS,EAAA;AAAA,IACvC,MAAQ,EAAA;AAAA,MACN,OAAO,oBAAqB,CAAA,YAAA;AAAA,KAC9B;AAAA,IACA,OAAA,EAAS,OAAO,EAAE,KAAM,EAAA,CAAA;AAAA,GACzB,CAAA,CAAA;AACH,CAAA;AAAA,CAGO,CAAUA,qBAAV,KAAA;AACE,EAAMA,qBAAAA,CAAA,YACX,GAAA,sBAAA,CAAiC,kBAAkB,CAAA,CAAA;AAAA,CAFtC,EAAA,oBAAA,KAAA,oBAAA,GAAA,EAAA,CAAA,CAAA;;;;"}
@@ -0,0 +1,21 @@
1
+ import { createExtensionDataRef } from '../wiring/createExtensionDataRef.esm.js';
2
+ import { createExtension } from '../wiring/createExtension.esm.js';
3
+
4
+ function createTranslationExtension(options) {
5
+ return createExtension({
6
+ kind: "translation",
7
+ namespace: options.resource.id,
8
+ name: options.name,
9
+ attachTo: { id: "app", input: "translations" },
10
+ output: {
11
+ resource: createTranslationExtension.translationDataRef
12
+ },
13
+ factory: () => ({ resource: options.resource })
14
+ });
15
+ }
16
+ ((createTranslationExtension2) => {
17
+ createTranslationExtension2.translationDataRef = createExtensionDataRef("core.translation.translation");
18
+ })(createTranslationExtension || (createTranslationExtension = {}));
19
+
20
+ export { createTranslationExtension };
21
+ //# sourceMappingURL=createTranslationExtension.esm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createTranslationExtension.esm.js","sources":["../../src/extensions/createTranslationExtension.ts"],"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 { TranslationMessages, TranslationResource } from '../translation';\nimport { createExtension, createExtensionDataRef } from '../wiring';\n\n/** @public */\nexport function createTranslationExtension(options: {\n name?: string;\n resource: TranslationResource | TranslationMessages;\n}) {\n return createExtension({\n kind: 'translation',\n namespace: options.resource.id,\n name: options.name,\n attachTo: { id: 'app', input: 'translations' },\n output: {\n resource: createTranslationExtension.translationDataRef,\n },\n factory: () => ({ resource: options.resource }),\n });\n}\n\n/** @public */\nexport namespace createTranslationExtension {\n export const translationDataRef = createExtensionDataRef<\n TranslationResource | TranslationMessages\n >('core.translation.translation');\n}\n"],"names":["createTranslationExtension"],"mappings":";;;AAoBO,SAAS,2BAA2B,OAGxC,EAAA;AACD,EAAA,OAAO,eAAgB,CAAA;AAAA,IACrB,IAAM,EAAA,aAAA;AAAA,IACN,SAAA,EAAW,QAAQ,QAAS,CAAA,EAAA;AAAA,IAC5B,MAAM,OAAQ,CAAA,IAAA;AAAA,IACd,QAAU,EAAA,EAAE,EAAI,EAAA,KAAA,EAAO,OAAO,cAAe,EAAA;AAAA,IAC7C,MAAQ,EAAA;AAAA,MACN,UAAU,0BAA2B,CAAA,kBAAA;AAAA,KACvC;AAAA,IACA,OAAS,EAAA,OAAO,EAAE,QAAA,EAAU,QAAQ,QAAS,EAAA,CAAA;AAAA,GAC9C,CAAA,CAAA;AACH,CAAA;AAAA,CAGO,CAAUA,2BAAV,KAAA;AACE,EAAMA,2BAAAA,CAAA,kBAAqB,GAAA,sBAAA,CAEhC,8BAA8B,CAAA,CAAA;AAAA,CAHjB,EAAA,0BAAA,KAAA,0BAAA,GAAA,EAAA,CAAA,CAAA;;;;"}