@backstage/frontend-app-api 0.7.5-next.3 → 0.9.0-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.
- package/CHANGELOG.md +66 -0
- package/dist/core-app-api/src/apis/system/ApiRegistry.esm.js +50 -0
- package/dist/core-app-api/src/apis/system/ApiRegistry.esm.js.map +1 -0
- package/dist/extensions/Root.esm.js +19 -0
- package/dist/extensions/Root.esm.js.map +1 -0
- package/dist/frontend-plugin-api/src/wiring/createExtension.esm.js.map +1 -1
- package/dist/frontend-plugin-api/src/wiring/createExtensionOverrides.esm.js.map +1 -1
- package/dist/frontend-plugin-api/src/wiring/{createPlugin.esm.js → createFrontendPlugin.esm.js} +1 -1
- package/dist/frontend-plugin-api/src/wiring/createFrontendPlugin.esm.js.map +1 -0
- package/dist/frontend-plugin-api/src/wiring/resolveExtensionDefinition.esm.js.map +1 -1
- package/dist/index.d.ts +2 -10
- package/dist/tree/instantiateAppNodeTree.esm.js +8 -5
- package/dist/tree/instantiateAppNodeTree.esm.js.map +1 -1
- package/dist/tree/resolveAppNodeSpecs.esm.js +1 -1
- package/dist/tree/resolveAppNodeSpecs.esm.js.map +1 -1
- package/dist/tree/resolveAppTree.esm.js +40 -20
- package/dist/tree/resolveAppTree.esm.js.map +1 -1
- package/dist/wiring/createApp.esm.js +114 -165
- package/dist/wiring/createApp.esm.js.map +1 -1
- package/package.json +7 -6
- package/dist/apis/implementations/ComponentsApi/DefaultComponentsApi.esm.js +0 -30
- package/dist/apis/implementations/ComponentsApi/DefaultComponentsApi.esm.js.map +0 -1
- package/dist/apis/implementations/IconsApi/DefaultIconsApi.esm.js +0 -15
- package/dist/apis/implementations/IconsApi/DefaultIconsApi.esm.js.map +0 -1
- package/dist/app/src/components/Root/LogoFull.esm.js +0 -33
- package/dist/app/src/components/Root/LogoFull.esm.js.map +0 -1
- package/dist/app/src/components/Root/LogoIcon.esm.js +0 -33
- package/dist/app/src/components/Root/LogoIcon.esm.js.map +0 -1
- package/dist/app-defaults/src/defaults/apis.esm.js +0 -221
- package/dist/app-defaults/src/defaults/apis.esm.js.map +0 -1
- package/dist/app-defaults/src/defaults/components.esm.js +0 -46
- package/dist/app-defaults/src/defaults/components.esm.js.map +0 -1
- package/dist/app-defaults/src/defaults/icons.esm.js +0 -51
- package/dist/app-defaults/src/defaults/icons.esm.js.map +0 -1
- package/dist/core-app-api/src/apis/implementations/AppLanguageApi/AppLanguageSelector.esm.js +0 -89
- package/dist/core-app-api/src/apis/implementations/AppLanguageApi/AppLanguageSelector.esm.js.map +0 -1
- package/dist/core-app-api/src/apis/implementations/FeatureFlagsApi/LocalStorageFeatureFlags.esm.js +0 -76
- package/dist/core-app-api/src/apis/implementations/FeatureFlagsApi/LocalStorageFeatureFlags.esm.js.map +0 -1
- package/dist/core-app-api/src/apis/implementations/TranslationApi/I18nextTranslationApi.esm.js +0 -234
- package/dist/core-app-api/src/apis/implementations/TranslationApi/I18nextTranslationApi.esm.js.map +0 -1
- package/dist/core-app-api/src/app/AppThemeProvider.esm.js +0 -60
- package/dist/core-app-api/src/app/AppThemeProvider.esm.js.map +0 -1
- package/dist/core-app-api/src/app/isProtectedApp.esm.js +0 -8
- package/dist/core-app-api/src/app/isProtectedApp.esm.js.map +0 -1
- package/dist/core-app-api/src/lib/subjects.esm.js +0 -69
- package/dist/core-app-api/src/lib/subjects.esm.js.map +0 -1
- package/dist/core-plugin-api/src/translation/TranslationRef.esm.js +0 -13
- package/dist/core-plugin-api/src/translation/TranslationRef.esm.js.map +0 -1
- package/dist/core-plugin-api/src/translation/TranslationResource.esm.js +0 -13
- package/dist/core-plugin-api/src/translation/TranslationResource.esm.js.map +0 -1
- package/dist/extensions/App.esm.js +0 -42
- package/dist/extensions/App.esm.js.map +0 -1
- package/dist/extensions/AppLayout.esm.js +0 -34
- package/dist/extensions/AppLayout.esm.js.map +0 -1
- package/dist/extensions/AppNav.esm.js +0 -64
- package/dist/extensions/AppNav.esm.js.map +0 -1
- package/dist/extensions/AppRoot.esm.js +0 -124
- package/dist/extensions/AppRoot.esm.js.map +0 -1
- package/dist/extensions/AppRoutes.esm.js +0 -43
- package/dist/extensions/AppRoutes.esm.js.map +0 -1
- package/dist/extensions/components.esm.js +0 -52
- package/dist/extensions/components.esm.js.map +0 -1
- package/dist/extensions/elements.esm.js +0 -26
- package/dist/extensions/elements.esm.js.map +0 -1
- package/dist/extensions/themes.esm.js +0 -23
- package/dist/extensions/themes.esm.js.map +0 -1
- package/dist/frontend-plugin-api/src/wiring/createPlugin.esm.js.map +0 -1
- package/dist/routing/RouteTracker.esm.js +0 -69
- package/dist/routing/RouteTracker.esm.js.map +0 -1
- package/dist/tree/createAppTree.esm.js +0 -21
- package/dist/tree/createAppTree.esm.js.map +0 -1
- package/dist/wiring/InternalAppContext.esm.js +0 -6
- package/dist/wiring/InternalAppContext.esm.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AppThemeProvider.esm.js","sources":["../../../../../core-app-api/src/app/AppThemeProvider.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 React, { useMemo, useEffect, useState, PropsWithChildren } from 'react';\nimport { useApi, appThemeApiRef, AppTheme } from '@backstage/core-plugin-api';\nimport useObservable from 'react-use/esm/useObservable';\n\n// This tries to find the most accurate match, but also falls back to less\n// accurate results in order to avoid errors.\nfunction resolveTheme(\n themeId: string | undefined,\n shouldPreferDark: boolean,\n themes: AppTheme[],\n) {\n if (themeId !== undefined) {\n const selectedTheme = themes.find(theme => theme.id === themeId);\n if (selectedTheme) {\n return selectedTheme;\n }\n }\n\n if (shouldPreferDark) {\n const darkTheme = themes.find(theme => theme.variant === 'dark');\n if (darkTheme) {\n return darkTheme;\n }\n }\n\n const lightTheme = themes.find(theme => theme.variant === 'light');\n if (lightTheme) {\n return lightTheme;\n }\n\n return themes[0];\n}\n\nconst useShouldPreferDarkTheme = () => {\n const mediaQuery = useMemo(\n () => window.matchMedia('(prefers-color-scheme: dark)'),\n [],\n );\n const [shouldPreferDark, setPrefersDark] = useState(mediaQuery.matches);\n\n useEffect(() => {\n const listener = (event: MediaQueryListEvent) => {\n setPrefersDark(event.matches);\n };\n mediaQuery.addListener(listener);\n return () => {\n mediaQuery.removeListener(listener);\n };\n }, [mediaQuery]);\n\n return shouldPreferDark;\n};\n\nexport function AppThemeProvider({ children }: PropsWithChildren<{}>) {\n const appThemeApi = useApi(appThemeApiRef);\n const themeId = useObservable(\n appThemeApi.activeThemeId$(),\n appThemeApi.getActiveThemeId(),\n );\n\n // Browser feature detection won't change over time, so ignore lint rule\n const shouldPreferDark = Boolean(window.matchMedia)\n ? useShouldPreferDarkTheme() // eslint-disable-line react-hooks/rules-of-hooks\n : false;\n\n const appTheme = resolveTheme(\n themeId,\n shouldPreferDark,\n appThemeApi.getInstalledThemes(),\n );\n if (!appTheme) {\n throw new Error('App has no themes');\n }\n\n return <appTheme.Provider children={children} />;\n}\n"],"names":[],"mappings":";;;;AAsBA,SAAS,YAAA,CACP,OACA,EAAA,gBAAA,EACA,MACA,EAAA;AACA,EAAA,IAAI,YAAY,KAAW,CAAA,EAAA;AACzB,IAAA,MAAM,gBAAgB,MAAO,CAAA,IAAA,CAAK,CAAS,KAAA,KAAA,KAAA,CAAM,OAAO,OAAO,CAAA,CAAA;AAC/D,IAAA,IAAI,aAAe,EAAA;AACjB,MAAO,OAAA,aAAA,CAAA;AAAA,KACT;AAAA,GACF;AAEA,EAAA,IAAI,gBAAkB,EAAA;AACpB,IAAA,MAAM,YAAY,MAAO,CAAA,IAAA,CA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AAM,mBAAmB,OAAQ,CAAA,MAAA,CAAO,UAAU,CAAA,GAC9C,0BACA,GAAA,KAAA,CAAA;AAEJ,EAAA,MAAM,QAAW,GAAA,YAAA;AAAA,IACf,OAAA;AAAA,IACA,gBAAA;AAAA,IACA,YAAY,kBAAmB,EAAA;AAAA,GACjC,CAAA;AACA,EAAA,IAAI,CAAC,QAAU,EAAA;AACb,IAAM,MAAA,IAAI,MAAM,mBAAmB,CAAA,CAAA;AAAA,GACrC;AAEA,EAAA,uBAAQ,KAAA,CAAA,aAAA,CAAA,QAAA,CAAS,QAAT,EAAA,EAAkB,QAAoB,EAAA,CAAA,CAAA;AAChD;;;;"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
function isProtectedApp() {
|
|
2
|
-
const element = document.querySelector('meta[name="backstage-app-mode"]');
|
|
3
|
-
const appMode = element?.getAttribute("content") ?? "public";
|
|
4
|
-
return appMode === "protected";
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export { isProtectedApp };
|
|
8
|
-
//# sourceMappingURL=isProtectedApp.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isProtectedApp.esm.js","sources":["../../../../../core-app-api/src/app/isProtectedApp.tsx"],"sourcesContent":["/*\n * Copyright 2024 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\nexport function isProtectedApp() {\n const element = document.querySelector('meta[name=\"backstage-app-mode\"]');\n const appMode = element?.getAttribute('content') ?? 'public';\n return appMode === 'protected';\n}\n"],"names":[],"mappings":"AAgBO,SAAS,cAAiB,GAAA;AAC/B,EAAM,MAAA,OAAA,GAAU,QAAS,CAAA,aAAA,CAAc,iCAAiC,CAAA,CAAA;AACxE,EAAA,MAAM,OAAU,GAAA,OAAA,EAAS,YAAa,CAAA,SAAS,CAAK,IAAA,QAAA,CAAA;AACpD,EAAA,OAAO,OAAY,KAAA,WAAA,CAAA;AACrB;;;;"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import ObservableImpl from 'zen-observable';
|
|
2
|
-
|
|
3
|
-
class BehaviorSubject {
|
|
4
|
-
isClosed;
|
|
5
|
-
currentValue;
|
|
6
|
-
terminatingError;
|
|
7
|
-
observable;
|
|
8
|
-
constructor(value) {
|
|
9
|
-
this.isClosed = false;
|
|
10
|
-
this.currentValue = value;
|
|
11
|
-
this.terminatingError = void 0;
|
|
12
|
-
this.observable = new ObservableImpl((subscriber) => {
|
|
13
|
-
if (this.isClosed) {
|
|
14
|
-
if (this.terminatingError) {
|
|
15
|
-
subscriber.error(this.terminatingError);
|
|
16
|
-
} else {
|
|
17
|
-
subscriber.complete();
|
|
18
|
-
}
|
|
19
|
-
return () => {
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
subscriber.next(this.currentValue);
|
|
23
|
-
this.subscribers.add(subscriber);
|
|
24
|
-
return () => {
|
|
25
|
-
this.subscribers.delete(subscriber);
|
|
26
|
-
};
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
subscribers = /* @__PURE__ */ new Set();
|
|
30
|
-
[Symbol.observable]() {
|
|
31
|
-
return this;
|
|
32
|
-
}
|
|
33
|
-
get closed() {
|
|
34
|
-
return this.isClosed;
|
|
35
|
-
}
|
|
36
|
-
next(value) {
|
|
37
|
-
if (this.isClosed) {
|
|
38
|
-
throw new Error("BehaviorSubject is closed");
|
|
39
|
-
}
|
|
40
|
-
this.currentValue = value;
|
|
41
|
-
this.subscribers.forEach((subscriber) => subscriber.next(value));
|
|
42
|
-
}
|
|
43
|
-
error(error) {
|
|
44
|
-
if (this.isClosed) {
|
|
45
|
-
throw new Error("BehaviorSubject is closed");
|
|
46
|
-
}
|
|
47
|
-
this.isClosed = true;
|
|
48
|
-
this.terminatingError = error;
|
|
49
|
-
this.subscribers.forEach((subscriber) => subscriber.error(error));
|
|
50
|
-
}
|
|
51
|
-
complete() {
|
|
52
|
-
if (this.isClosed) {
|
|
53
|
-
throw new Error("BehaviorSubject is closed");
|
|
54
|
-
}
|
|
55
|
-
this.isClosed = true;
|
|
56
|
-
this.subscribers.forEach((subscriber) => subscriber.complete());
|
|
57
|
-
}
|
|
58
|
-
subscribe(onNext, onError, onComplete) {
|
|
59
|
-
const observer = typeof onNext === "function" ? {
|
|
60
|
-
next: onNext,
|
|
61
|
-
error: onError,
|
|
62
|
-
complete: onComplete
|
|
63
|
-
} : onNext;
|
|
64
|
-
return this.observable.subscribe(observer);
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export { BehaviorSubject };
|
|
69
|
-
//# sourceMappingURL=subjects.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"subjects.esm.js","sources":["../../../../../core-app-api/src/lib/subjects.ts"],"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 { Observable } from '@backstage/types';\nimport ObservableImpl from 'zen-observable';\n\n// TODO(Rugvip): These are stopgap and probably incomplete implementations of subjects.\n// If we add a more complete Observables library they should be replaced.\n\n/**\n * A basic implementation of ReactiveX publish subjects.\n *\n * A subject is a convenient way to create an observable when you want\n * to fan out a single value to all subscribers.\n *\n * See http://reactivex.io/documentation/subject.html\n */\nexport class PublishSubject<T>\n implements Observable<T>, ZenObservable.SubscriptionObserver<T>\n{\n private isClosed = false;\n private terminatingError?: Error;\n\n private readonly observable = new ObservableImpl<T>(subscriber => {\n if (this.isClosed) {\n if (this.terminatingError) {\n subscriber.error(this.terminatingError);\n } else {\n subscriber.complete();\n }\n return () => {};\n }\n\n this.subscribers.add(subscriber);\n return () => {\n this.subscribers.delete(subscriber);\n };\n });\n\n private readonly subscribers = new Set<\n ZenObservable.SubscriptionObserver<T>\n >();\n\n [Symbol.observable]() {\n return this;\n }\n\n get closed() {\n return this.isClosed;\n }\n\n next(value: T) {\n if (this.isClosed) {\n throw new Error('PublishSubject is closed');\n }\n this.subscribers.forEach(subscriber => subscriber.next(value));\n }\n\n error(error: Error) {\n if (this.isClosed) {\n throw new Error('PublishSubject is closed');\n }\n this.isClosed = true;\n this.terminatingError = error;\n this.subscribers.forEach(subscriber => subscriber.error(error));\n }\n\n complete() {\n if (this.isClosed) {\n throw new Error('PublishSubject is closed');\n }\n this.isClosed = true;\n this.subscribers.forEach(subscriber => subscriber.complete());\n }\n\n subscribe(observer: ZenObservable.Observer<T>): ZenObservable.Subscription;\n subscribe(\n onNext: (value: T) => void,\n onError?: (error: any) => void,\n onComplete?: () => void,\n ): ZenObservable.Subscription;\n subscribe(\n onNext: ZenObservable.Observer<T> | ((value: T) => void),\n onError?: (error: any) => void,\n onComplete?: () => void,\n ): ZenObservable.Subscription {\n const observer =\n typeof onNext === 'function'\n ? {\n next: onNext,\n error: onError,\n complete: onComplete,\n }\n : onNext;\n\n return this.observable.subscribe(observer);\n }\n}\n\n/**\n * A basic implementation of ReactiveX behavior subjects.\n *\n * A subject is a convenient way to create an observable when you want\n * to fan out a single value to all subscribers.\n *\n * The BehaviorSubject will emit the most recently emitted value or error\n * whenever a new observer subscribes to the subject.\n *\n * See http://reactivex.io/documentation/subject.html\n */\n\nexport class BehaviorSubject<T>\n implements Observable<T>, ZenObservable.SubscriptionObserver<T>\n{\n private isClosed: boolean;\n private currentValue: T;\n private terminatingError: Error | undefined;\n private readonly observable: Observable<T>;\n\n constructor(value: T) {\n this.isClosed = false;\n this.currentValue = value;\n this.terminatingError = undefined;\n this.observable = new ObservableImpl<T>(subscriber => {\n if (this.isClosed) {\n if (this.terminatingError) {\n subscriber.error(this.terminatingError);\n } else {\n subscriber.complete();\n }\n return () => {};\n }\n\n subscriber.next(this.currentValue);\n\n this.subscribers.add(subscriber);\n return () => {\n this.subscribers.delete(subscriber);\n };\n });\n }\n\n private readonly subscribers = new Set<\n ZenObservable.SubscriptionObserver<T>\n >();\n\n [Symbol.observable]() {\n return this;\n }\n\n get closed() {\n return this.isClosed;\n }\n\n next(value: T) {\n if (this.isClosed) {\n throw new Error('BehaviorSubject is closed');\n }\n this.currentValue = value;\n this.subscribers.forEach(subscriber => subscriber.next(value));\n }\n\n error(error: Error) {\n if (this.isClosed) {\n throw new Error('BehaviorSubject is closed');\n }\n this.isClosed = true;\n this.terminatingError = error;\n this.subscribers.forEach(subscriber => subscriber.error(error));\n }\n\n complete() {\n if (this.isClosed) {\n throw new Error('BehaviorSubject is closed');\n }\n this.isClosed = true;\n this.subscribers.forEach(subscriber => subscriber.complete());\n }\n\n subscribe(observer: ZenObservable.Observer<T>): ZenObservable.Subscription;\n subscribe(\n onNext: (value: T) => void,\n onError?: (error: any) => void,\n onComplete?: () => void,\n ): ZenObservable.Subscription;\n subscribe(\n onNext: ZenObservable.Observer<T> | ((value: T) => void),\n onError?: (error: any) => void,\n onComplete?: () => void,\n ): ZenObservable.Subscription {\n const observer =\n typeof onNext === 'function'\n ? {\n next: onNext,\n error: onError,\n complete: onComplete,\n }\n : onNext;\n\n return this.observable.subscribe(observer);\n }\n}\n"],"names":[],"mappings":";;AA4HO,MAAM,eAEb,CAAA;AAAA,EACU,QAAA,CAAA;AAAA,EACA,YAAA,CAAA;AAAA,EACA,gBAAA,CAAA;AAAA,EACS,UAAA,CAAA;AAAA,EAEjB,YAAY,KAAU,EAAA;AACpB,IAAA,IAAA,CAAK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AC/D;AAAA,EAEA,MAAM,KAAc,EAAA;AAClB,IAAA,IAAI,KAAK,QAAU,EAAA;AACjB,MAAM,MAAA,IAAI,MAAM,2BAA2B,CAAA,CAAA;AAAA,KAC7C;AACA,IAAA,IAAA,CAAK,QAAW,GAAA,IAAA,CAAA;AAChB,IAAA,IAAA,CAAK,gBAAmB,GAAA,KAAA,CAAA;AACxB,IAAA,IAAA,CAAK,YAAY,OAAQ,CAAA,CAAA,UAAA,KAAc,UAAW,CAAA,KAAA,CAAM,KAAK,CAAC,CAAA,CAAA;AAAA,GAChE;AAAA,EAEA,QAAW,GAAA;AACT,IAAA,IAAI,KAAK,QAAU,EAAA;AACjB,MAAM,MAAA,IAAI,MAAM,2BAA2B,CAAA,CAAA;AAAA,KAC7C;AACA,IAAA,IAAA,CAAK,QAAW,GAAA,IAAA,CAAA;AAChB,IAAA,IAAA,CAAK,WAAY,CAAA,OAAA,CAAQ,CAAc,UAAA,KAAA,UAAA,CAAW,UAAU,CAAA,CAAA;AAAA,GAC9D;AAAA,EAQA,SAAA,CACE,MACA,EAAA,OAAA,EACA,UAC4B,EAAA;AAC5B,IAAM,MAAA,QAAA,GACJ,OAAO,MAAA,KAAW,UACd,GAAA;AAAA,MACE,IAAM,EAAA,MAAA;AAAA,MACN,KAAO,EAAA,OAAA;AAAA,MACP,QAAU,EAAA,UAAA;AAAA,KAEZ,GAAA,MAAA,CAAA;AAEN,IAAO,OAAA,IAAA,CAAK,UAAW,CAAA,SAAA,CAAU,QAAQ,CAAA,CAAA;AAAA,GAC3C;AACF;;;;"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
function toInternalTranslationRef(ref) {
|
|
2
|
-
const r = ref;
|
|
3
|
-
if (r.$$type !== "@backstage/TranslationRef") {
|
|
4
|
-
throw new Error(`Invalid translation ref, bad type '${r.$$type}'`);
|
|
5
|
-
}
|
|
6
|
-
if (r.version !== "v1") {
|
|
7
|
-
throw new Error(`Invalid translation ref, bad version '${r.version}'`);
|
|
8
|
-
}
|
|
9
|
-
return r;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export { toInternalTranslationRef };
|
|
13
|
-
//# sourceMappingURL=TranslationRef.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TranslationRef.esm.js","sources":["../../../../../core-plugin-api/src/translation/TranslationRef.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 {\n createTranslationResource,\n TranslationResource,\n} from './TranslationResource';\n\n/** @alpha */\nexport interface TranslationRef<\n TId extends string = string,\n TMessages extends { [key in string]: string } = { [key in string]: string },\n> {\n $$type: '@backstage/TranslationRef';\n\n id: TId;\n\n T: TMessages;\n}\n\n/** @internal */\ntype AnyMessages = { [key in string]: string };\n\n/** @ignore */\ntype AnyNestedMessages = { [key in string]: AnyNestedMessages | string };\n\n/**\n * Flattens a nested message declaration into a flat object with dot-separated keys.\n *\n * @ignore\n */\ntype FlattenedMessages<TMessages extends AnyNestedMessages> =\n // Flatten out object keys into a union structure of objects, e.g. { a: 'a', b: 'b' } -> { a: 'a' } | { b: 'b' }\n // Any nested object will be flattened into the individual unions, e.g. { a: 'a', b: { x: 'x', y: 'y' } } -> { a: 'a' } | { 'b.x': 'x', 'b.y': 'y' }\n // We create this structure by first nesting the desired union types into the original object, and\n // then extract them by indexing with `keyof TMessages` to form the union.\n // Throughout this the objects are wrapped up in a function parameter, which allows us to have the\n // final step of flipping this unions around to an intersection by inferring the function parameter.\n {\n [TKey in keyof TMessages]: (\n _: TMessages[TKey] extends infer TValue // \"local variable\" for the value\n ? TValue extends AnyNestedMessages\n ? FlattenedMessages<TValue> extends infer TNested // Recurse into nested messages, \"local variable\" for the result\n ? {\n [TNestedKey in keyof TNested as `${TKey & string}.${TNestedKey &\n string}`]: TNested[TNestedKey];\n }\n : never\n : { [_ in TKey]: TValue } // Primitive object values are passed through with the same key\n : never,\n ) => void;\n // The `[keyof TMessages]` extracts the object values union from our flattened structure, still wrapped up in function parameters.\n // The `extends (_: infer TIntersection) => void` flips the union to an intersection, at which point we have the correct type.\n }[keyof TMessages] extends (_: infer TIntersection) => void\n ? // This object mapping just expands similar to the Expand<> utility type, providing nicer type hints\n {\n readonly [TExpandKey in keyof TIntersection]: TIntersection[TExpandKey];\n }\n : never;\n\n/** @internal */\nexport interface InternalTranslationRef<\n TId extends string = string,\n TMessages extends { [key in string]: string } = { [key in string]: string },\n> extends TranslationRef<TId, TMessages> {\n version: 'v1';\n\n getDefaultMessages(): AnyMessages;\n\n getDefaultResource(): TranslationResource | undefined;\n}\n\n/** @alpha */\nexport interface TranslationRefOptions<\n TId extends string,\n TNestedMessages extends AnyNestedMessages,\n TTranslations extends {\n [language in string]: () => Promise<{\n default: {\n [key in keyof FlattenedMessages<TNestedMessages>]: string | null;\n };\n }>;\n },\n> {\n id: TId;\n messages: TNestedMessages;\n translations?: TTranslations;\n}\n\nfunction flattenMessages(nested: AnyNestedMessages): AnyMessages {\n const entries = new Array<[string, string]>();\n\n function visit(obj: AnyNestedMessages, prefix: string): void {\n for (const [key, value] of Object.entries(obj)) {\n if (typeof value === 'string') {\n entries.push([prefix + key, value]);\n } else {\n visit(value, `${prefix}${key}.`);\n }\n }\n }\n\n visit(nested, '');\n\n return Object.fromEntries(entries);\n}\n\n/** @internal */\nclass TranslationRefImpl<\n TId extends string,\n TNestedMessages extends AnyNestedMessages,\n> implements InternalTranslationRef<TId, FlattenedMessages<TNestedMessages>>\n{\n #id: TId;\n #messages: FlattenedMessages<TNestedMessages>;\n #resources: TranslationResource | undefined;\n\n constructor(options: TranslationRefOptions<TId, TNestedMessages, any>) {\n this.#id = options.id;\n this.#messages = flattenMessages(\n options.messages,\n ) as FlattenedMessages<TNestedMessages>;\n }\n\n $$type = '@backstage/TranslationRef' as const;\n\n version = 'v1' as const;\n\n get id(): TId {\n return this.#id;\n }\n\n get T(): never {\n throw new Error('Not implemented');\n }\n\n getDefaultMessages(): AnyMessages {\n return this.#messages;\n }\n\n setDefaultResource(resources: TranslationResource): void {\n this.#resources = resources;\n }\n\n getDefaultResource(): TranslationResource | undefined {\n return this.#resources;\n }\n\n toString() {\n return `TranslationRef{id=${this.id}}`;\n }\n}\n\n/** @alpha */\nexport function createTranslationRef<\n TId extends string,\n const TNestedMessages extends AnyNestedMessages,\n TTranslations extends {\n [language in string]: () => Promise<{\n default: {\n [key in keyof FlattenedMessages<TNestedMessages>]: string | null;\n };\n }>;\n },\n>(\n config: TranslationRefOptions<TId, TNestedMessages, TTranslations>,\n): TranslationRef<TId, FlattenedMessages<TNestedMessages>> {\n const ref = new TranslationRefImpl(config);\n if (config.translations) {\n ref.setDefaultResource(\n createTranslationResource({\n ref,\n translations: config.translations as any,\n }),\n );\n }\n return ref;\n}\n\n/** @internal */\nexport function toInternalTranslationRef<\n TId extends string,\n TMessages extends AnyMessages,\n>(ref: TranslationRef<TId, TMessages>): InternalTranslationRef<TId, TMessages> {\n const r = ref as InternalTranslationRef<TId, TMessages>;\n if (r.$$type !== '@backstage/TranslationRef') {\n throw new Error(`Invalid translation ref, bad type '${r.$$type}'`);\n }\n if (r.version !== 'v1') {\n throw new Error(`Invalid translation ref, bad version '${r.version}'`);\n }\n return r;\n}\n"],"names":[],"mappings":"AAiMO,SAAS,yBAGd,GAA6E,EAAA;AAC7E,EAAA,MAAM,CAAI,GAAA,GAAA,CAAA;AACV,EAAI,IAAA,CAAA,CAAE,WAAW,2BAA6B,EAAA;AAC5C,IAAA,MAAM,IAAI,KAAA,CAAM,CAAsC,mCAAA,EAAA,CAAA,CAAE,MAAM,CAAG,CAAA,CAAA,CAAA,CAAA;AAAA,GACnE;AACA,EAAI,IAAA,CAAA,CAAE,YAAY,IAAM,EAAA;AACtB,IAAA,MAAM,IAAI,KAAA,CAAM,CAAyC,sCAAA,EAAA,CAAA,CAAE,OAAO,CAAG,CAAA,CAAA,CAAA,CAAA;AAAA,GACvE;AACA,EAAO,OAAA,CAAA,CAAA;AACT;;;;"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
function toInternalTranslationResource(resource) {
|
|
2
|
-
const r = resource;
|
|
3
|
-
if (r.$$type !== "@backstage/TranslationResource") {
|
|
4
|
-
throw new Error(`Invalid translation resource, bad type '${r.$$type}'`);
|
|
5
|
-
}
|
|
6
|
-
if (r.version !== "v1") {
|
|
7
|
-
throw new Error(`Invalid translation resource, bad version '${r.version}'`);
|
|
8
|
-
}
|
|
9
|
-
return r;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export { toInternalTranslationResource };
|
|
13
|
-
//# sourceMappingURL=TranslationResource.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TranslationResource.esm.js","sources":["../../../../../core-plugin-api/src/translation/TranslationResource.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 {\n TranslationMessages,\n TranslationRef,\n} from '@backstage/core-plugin-api/alpha';\n\n/** @alpha */\nexport interface TranslationResource<TId extends string = string> {\n $$type: '@backstage/TranslationResource';\n id: TId;\n}\n\n/** @internal */\nexport type InternalTranslationResourceLoader = () => Promise<{\n messages: { [key in string]: string | null };\n}>;\n\n/** @internal */\nexport interface InternalTranslationResource<TId extends string = string>\n extends TranslationResource<TId> {\n version: 'v1';\n resources: Array<{\n language: string;\n loader: InternalTranslationResourceLoader;\n }>;\n}\n\n/** @internal */\nexport function toInternalTranslationResource<TId extends string>(\n resource: TranslationResource<TId>,\n): InternalTranslationResource<TId> {\n const r = resource as InternalTranslationResource<TId>;\n if (r.$$type !== '@backstage/TranslationResource') {\n throw new Error(`Invalid translation resource, bad type '${r.$$type}'`);\n }\n if (r.version !== 'v1') {\n throw new Error(`Invalid translation resource, bad version '${r.version}'`);\n }\n\n return r;\n}\n\n/** @alpha */\nexport interface TranslationResourceOptions<\n TId extends string,\n TMessages extends { [key in string]: string },\n TTranslations extends {\n [language in string]: () => Promise<{\n default:\n | TranslationMessages<TId>\n | { [key in keyof TMessages]: string | null };\n }>;\n },\n> {\n ref: TranslationRef<TId, TMessages>;\n\n translations: TTranslations;\n}\n\n/** @alpha */\nexport function createTranslationResource<\n TId extends string,\n TMessages extends { [key in string]: string },\n TTranslations extends {\n [language in string]: () => Promise<{\n default:\n | TranslationMessages<TId>\n | { [key in keyof TMessages]: string | null };\n }>;\n },\n>(\n options: TranslationResourceOptions<TId, TMessages, TTranslations>,\n): TranslationResource<TId> {\n return {\n $$type: '@backstage/TranslationResource',\n version: 'v1',\n id: options.ref.id,\n resources: Object.entries(options.translations).map(\n ([language, loader]) => ({\n language,\n loader: () =>\n loader().then(m => {\n const value = m.default;\n return {\n messages:\n value?.$$type === '@backstage/TranslationMessages'\n ? value.messages\n : value,\n };\n }),\n }),\n ),\n } as InternalTranslationResource<TId>;\n}\n"],"names":[],"mappings":"AA2CO,SAAS,8BACd,QACkC,EAAA;AAClC,EAAA,MAAM,CAAI,GAAA,QAAA,CAAA;AACV,EAAI,IAAA,CAAA,CAAE,WAAW,gCAAkC,EAAA;AACjD,IAAA,MAAM,IAAI,KAAA,CAAM,CAA2C,wCAAA,EAAA,CAAA,CAAE,MAAM,CAAG,CAAA,CAAA,CAAA,CAAA;AAAA,GACxE;AACA,EAAI,IAAA,CAAA,CAAE,YAAY,IAAM,EAAA;AACtB,IAAA,MAAM,IAAI,KAAA,CAAM,CAA8C,2CAAA,EAAA,CAAA,CAAE,OAAO,CAAG,CAAA,CAAA,CAAA,CAAA;AAAA,GAC5E;AAEA,EAAO,OAAA,CAAA,CAAA;AACT;;;;"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { createExtension, createExtensionInput, createApiExtension, createThemeExtension, createComponentExtension, createTranslationExtension, IconBundleBlueprint, coreExtensionData, ExtensionBoundary } from '@backstage/frontend-plugin-api';
|
|
3
|
-
|
|
4
|
-
const App = createExtension({
|
|
5
|
-
namespace: "app",
|
|
6
|
-
attachTo: { id: "root", input: "default" },
|
|
7
|
-
// ignored
|
|
8
|
-
inputs: {
|
|
9
|
-
apis: createExtensionInput({
|
|
10
|
-
api: createApiExtension.factoryDataRef
|
|
11
|
-
}),
|
|
12
|
-
themes: createExtensionInput({
|
|
13
|
-
theme: createThemeExtension.themeDataRef
|
|
14
|
-
}),
|
|
15
|
-
components: createExtensionInput({
|
|
16
|
-
component: createComponentExtension.componentDataRef
|
|
17
|
-
}),
|
|
18
|
-
translations: createExtensionInput({
|
|
19
|
-
translation: createTranslationExtension.translationDataRef
|
|
20
|
-
}),
|
|
21
|
-
icons: createExtensionInput({
|
|
22
|
-
icon: IconBundleBlueprint.dataRefs.icons
|
|
23
|
-
}),
|
|
24
|
-
root: createExtensionInput(
|
|
25
|
-
{
|
|
26
|
-
element: coreExtensionData.reactElement
|
|
27
|
-
},
|
|
28
|
-
{ singleton: true }
|
|
29
|
-
)
|
|
30
|
-
},
|
|
31
|
-
output: {
|
|
32
|
-
root: coreExtensionData.reactElement
|
|
33
|
-
},
|
|
34
|
-
factory({ node, inputs }) {
|
|
35
|
-
return {
|
|
36
|
-
root: /* @__PURE__ */ React.createElement(ExtensionBoundary, { node }, inputs.root.output.element)
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
export { App };
|
|
42
|
-
//# sourceMappingURL=App.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"App.esm.js","sources":["../../src/extensions/App.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 from 'react';\nimport {\n ExtensionBoundary,\n coreExtensionData,\n createApiExtension,\n createComponentExtension,\n createExtension,\n createExtensionInput,\n createThemeExtension,\n createTranslationExtension,\n IconBundleBlueprint,\n} from '@backstage/frontend-plugin-api';\n\nexport const App = createExtension({\n namespace: 'app',\n attachTo: { id: 'root', input: 'default' }, // ignored\n inputs: {\n apis: createExtensionInput({\n api: createApiExtension.factoryDataRef,\n }),\n themes: createExtensionInput({\n theme: createThemeExtension.themeDataRef,\n }),\n components: createExtensionInput({\n component: createComponentExtension.componentDataRef,\n }),\n translations: createExtensionInput({\n translation: createTranslationExtension.translationDataRef,\n }),\n icons: createExtensionInput({\n icon: IconBundleBlueprint.dataRefs.icons,\n }),\n root: createExtensionInput(\n {\n element: coreExtensionData.reactElement,\n },\n { singleton: true },\n ),\n },\n output: {\n root: coreExtensionData.reactElement,\n },\n factory({ node, inputs }) {\n return {\n root: (\n <ExtensionBoundary node={node}>\n {inputs.root.output.element}\n </ExtensionBoundary>\n ),\n };\n },\n});\n"],"names":[],"mappings":";;;AA6BO,MAAM,MAAM,eAAgB,CAAA;AAAA,EACjC,SAAW,EAAA,KAAA;AAAA,EACX,QAAU,EAAA,EAAE,EAAI,EAAA,MAAA,EAAQ,OAAO,SAAU,EAAA;AAAA;AAAA,EACzC,MAAQ,EAAA;AAAA,IACN,MAAM,oBAAqB,CAAA;AAAA,MACzB,KAAK,kBAAmB,CAAA,cAAA;AAAA,KACzB,CAAA;AAAA,IACD,QAAQ,oBAAqB,CAAA;AAAA,MAC3B,OAAO,oBAAqB,CAAA,YAAA;AAAA,KAC7B,CAAA;AAAA,IACD,YAAY,oBAAqB,CAAA;AAAA,MAC/B,WAAW,wBAAyB,CAAA,gBAAA;AAAA,KACrC,CAAA;AAAA,IACD,cAAc,oBAAqB,CAAA;AAAA,MACjC,aAAa,0BAA2B,CAAA,kBAAA;AAAA,KACzC,CAAA;AAAA,IACD,OAAO,oBAAqB,CAAA;AAAA,MAC1B,IAAA,EAAM,oBAAoB,QAAS,CAAA,KAAA;AAAA,KACpC,CAAA;AAAA,IACD,IAAM,EAAA,oBAAA;AAAA,MACJ;AAAA,QACE,SAAS,iBAAkB,CAAA,YAAA;AAAA,OAC7B;AAAA,MACA,EAAE,WAAW,IAAK,EAAA;AAAA,KACpB;AAAA,GACF;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,MAAM,iBAAkB,CAAA,YAAA;AAAA,GAC1B;AAAA,EACA,OAAQ,CAAA,EAAE,IAAM,EAAA,MAAA,EAAU,EAAA;AACxB,IAAO,OAAA;AAAA,MACL,sBACG,KAAA,CAAA,aAAA,CAAA,iBAAA,EAAA,EAAkB,QAChB,MAAO,CAAA,IAAA,CAAK,OAAO,OACtB,CAAA;AAAA,KAEJ,CAAA;AAAA,GACF;AACF,CAAC;;;;"}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { createExtension, createExtensionInput, coreExtensionData } from '@backstage/frontend-plugin-api';
|
|
3
|
-
import { SidebarPage } from '@backstage/core-components';
|
|
4
|
-
|
|
5
|
-
const AppLayout = createExtension({
|
|
6
|
-
namespace: "app",
|
|
7
|
-
name: "layout",
|
|
8
|
-
attachTo: { id: "app/root", input: "children" },
|
|
9
|
-
inputs: {
|
|
10
|
-
nav: createExtensionInput(
|
|
11
|
-
{
|
|
12
|
-
element: coreExtensionData.reactElement
|
|
13
|
-
},
|
|
14
|
-
{ singleton: true }
|
|
15
|
-
),
|
|
16
|
-
content: createExtensionInput(
|
|
17
|
-
{
|
|
18
|
-
element: coreExtensionData.reactElement
|
|
19
|
-
},
|
|
20
|
-
{ singleton: true }
|
|
21
|
-
)
|
|
22
|
-
},
|
|
23
|
-
output: {
|
|
24
|
-
element: coreExtensionData.reactElement
|
|
25
|
-
},
|
|
26
|
-
factory({ inputs }) {
|
|
27
|
-
return {
|
|
28
|
-
element: /* @__PURE__ */ React.createElement(SidebarPage, null, inputs.nav.output.element, inputs.content.output.element)
|
|
29
|
-
};
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
export { AppLayout };
|
|
34
|
-
//# sourceMappingURL=AppLayout.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AppLayout.esm.js","sources":["../../src/extensions/AppLayout.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 from 'react';\nimport {\n createExtension,\n coreExtensionData,\n createExtensionInput,\n} from '@backstage/frontend-plugin-api';\nimport { SidebarPage } from '@backstage/core-components';\n\nexport const AppLayout = createExtension({\n namespace: 'app',\n name: 'layout',\n attachTo: { id: 'app/root', input: 'children' },\n inputs: {\n nav: createExtensionInput(\n {\n element: coreExtensionData.reactElement,\n },\n { singleton: true },\n ),\n content: createExtensionInput(\n {\n element: coreExtensionData.reactElement,\n },\n { singleton: true },\n ),\n },\n output: {\n element: coreExtensionData.reactElement,\n },\n factory({ inputs }) {\n return {\n element: (\n <SidebarPage>\n {inputs.nav.output.element}\n {inputs.content.output.element}\n </SidebarPage>\n ),\n };\n },\n});\n"],"names":[],"mappings":";;;;AAwBO,MAAM,YAAY,eAAgB,CAAA;AAAA,EACvC,SAAW,EAAA,KAAA;AAAA,EACX,IAAM,EAAA,QAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,UAAA,EAAY,OAAO,UAAW,EAAA;AAAA,EAC9C,MAAQ,EAAA;AAAA,IACN,GAAK,EAAA,oBAAA;AAAA,MACH;AAAA,QACE,SAAS,iBAAkB,CAAA,YAAA;AAAA,OAC7B;AAAA,MACA,EAAE,WAAW,IAAK,EAAA;AAAA,KACpB;AAAA,IACA,OAAS,EAAA,oBAAA;AAAA,MACP;AAAA,QACE,SAAS,iBAAkB,CAAA,YAAA;AAAA,OAC7B;AAAA,MACA,EAAE,WAAW,IAAK,EAAA;AAAA,KACpB;AAAA,GACF;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,SAAS,iBAAkB,CAAA,YAAA;AAAA,GAC7B;AAAA,EACA,OAAA,CAAQ,EAAE,MAAA,EAAU,EAAA;AAClB,IAAO,OAAA;AAAA,MACL,OAAA,kBACG,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA,IAAA,EACE,MAAO,CAAA,GAAA,CAAI,OAAO,OAClB,EAAA,MAAA,CAAO,OAAQ,CAAA,MAAA,CAAO,OACzB,CAAA;AAAA,KAEJ,CAAA;AAAA,GACF;AACF,CAAC;;;;"}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { createExtension, createExtensionInput, createNavItemExtension, createNavLogoExtension, coreExtensionData, useRouteRef } from '@backstage/frontend-plugin-api';
|
|
3
|
-
import { makeStyles } from '@material-ui/core/styles';
|
|
4
|
-
import { sidebarConfig, Sidebar, SidebarDivider, useSidebarOpenState, Link, SidebarItem } from '@backstage/core-components';
|
|
5
|
-
import LogoIcon from '../app/src/components/Root/LogoIcon.esm.js';
|
|
6
|
-
import LogoFull from '../app/src/components/Root/LogoFull.esm.js';
|
|
7
|
-
|
|
8
|
-
const useSidebarLogoStyles = makeStyles({
|
|
9
|
-
root: {
|
|
10
|
-
width: sidebarConfig.drawerWidthClosed,
|
|
11
|
-
height: 3 * sidebarConfig.logoHeight,
|
|
12
|
-
display: "flex",
|
|
13
|
-
flexFlow: "row nowrap",
|
|
14
|
-
alignItems: "center",
|
|
15
|
-
marginBottom: -14
|
|
16
|
-
},
|
|
17
|
-
link: {
|
|
18
|
-
width: sidebarConfig.drawerWidthClosed,
|
|
19
|
-
marginLeft: 24
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const SidebarLogo = (props) => {
|
|
23
|
-
const classes = useSidebarLogoStyles();
|
|
24
|
-
const { isOpen } = useSidebarOpenState();
|
|
25
|
-
return /* @__PURE__ */ React.createElement("div", { className: classes.root }, /* @__PURE__ */ React.createElement(Link, { to: "/", underline: "none", className: classes.link, "aria-label": "Home" }, isOpen ? props?.logoFull ?? /* @__PURE__ */ React.createElement(LogoFull, null) : props?.logoIcon ?? /* @__PURE__ */ React.createElement(LogoIcon, null)));
|
|
26
|
-
};
|
|
27
|
-
const SidebarNavItem = (props) => {
|
|
28
|
-
const { icon: Icon, title, routeRef } = props;
|
|
29
|
-
const link = useRouteRef(routeRef);
|
|
30
|
-
if (!link) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
return /* @__PURE__ */ React.createElement(SidebarItem, { to: link(), icon: Icon, text: title });
|
|
34
|
-
};
|
|
35
|
-
const AppNav = createExtension({
|
|
36
|
-
namespace: "app",
|
|
37
|
-
name: "nav",
|
|
38
|
-
attachTo: { id: "app/layout", input: "nav" },
|
|
39
|
-
inputs: {
|
|
40
|
-
items: createExtensionInput({
|
|
41
|
-
target: createNavItemExtension.targetDataRef
|
|
42
|
-
}),
|
|
43
|
-
logos: createExtensionInput(
|
|
44
|
-
{
|
|
45
|
-
elements: createNavLogoExtension.logoElementsDataRef
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
singleton: true,
|
|
49
|
-
optional: true
|
|
50
|
-
}
|
|
51
|
-
)
|
|
52
|
-
},
|
|
53
|
-
output: {
|
|
54
|
-
element: coreExtensionData.reactElement
|
|
55
|
-
},
|
|
56
|
-
factory({ inputs }) {
|
|
57
|
-
return {
|
|
58
|
-
element: /* @__PURE__ */ React.createElement(Sidebar, null, /* @__PURE__ */ React.createElement(SidebarLogo, { ...inputs.logos?.output.elements }), /* @__PURE__ */ React.createElement(SidebarDivider, null), inputs.items.map((item, index) => /* @__PURE__ */ React.createElement(SidebarNavItem, { ...item.output.target, key: index })))
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
export { AppNav };
|
|
64
|
-
//# sourceMappingURL=AppNav.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AppNav.esm.js","sources":["../../src/extensions/AppNav.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 from 'react';\nimport {\n createExtension,\n coreExtensionData,\n createExtensionInput,\n useRouteRef,\n createNavItemExtension,\n createNavLogoExtension,\n} from '@backstage/frontend-plugin-api';\nimport { makeStyles } from '@material-ui/core/styles';\nimport {\n Sidebar,\n useSidebarOpenState,\n Link,\n sidebarConfig,\n SidebarDivider,\n SidebarItem,\n} from '@backstage/core-components';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport LogoIcon from '../../../app/src/components/Root/LogoIcon';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport LogoFull from '../../../app/src/components/Root/LogoFull';\n\nconst useSidebarLogoStyles = makeStyles({\n root: {\n width: sidebarConfig.drawerWidthClosed,\n height: 3 * sidebarConfig.logoHeight,\n display: 'flex',\n flexFlow: 'row nowrap',\n alignItems: 'center',\n marginBottom: -14,\n },\n link: {\n width: sidebarConfig.drawerWidthClosed,\n marginLeft: 24,\n },\n});\n\nconst SidebarLogo = (\n props: (typeof createNavLogoExtension.logoElementsDataRef)['T'],\n) => {\n const classes = useSidebarLogoStyles();\n const { isOpen } = useSidebarOpenState();\n\n return (\n <div className={classes.root}>\n <Link to=\"/\" underline=\"none\" className={classes.link} aria-label=\"Home\">\n {isOpen\n ? props?.logoFull ?? <LogoFull />\n : props?.logoIcon ?? <LogoIcon />}\n </Link>\n </div>\n );\n};\n\nconst SidebarNavItem = (\n props: (typeof createNavItemExtension.targetDataRef)['T'],\n) => {\n const { icon: Icon, title, routeRef } = props;\n const link = useRouteRef(routeRef);\n if (!link) {\n return null;\n }\n // TODO: Support opening modal, for example, the search one\n return <SidebarItem to={link()} icon={Icon} text={title} />;\n};\n\nexport const AppNav = createExtension({\n namespace: 'app',\n name: 'nav',\n attachTo: { id: 'app/layout', input: 'nav' },\n inputs: {\n items: createExtensionInput({\n target: createNavItemExtension.targetDataRef,\n }),\n logos: createExtensionInput(\n {\n elements: createNavLogoExtension.logoElementsDataRef,\n },\n {\n singleton: true,\n optional: true,\n },\n ),\n },\n output: {\n element: coreExtensionData.reactElement,\n },\n factory({ inputs }) {\n return {\n element: (\n <Sidebar>\n <SidebarLogo {...inputs.logos?.output.elements} />\n <SidebarDivider />\n {inputs.items.map((item, index) => (\n <SidebarNavItem {...item.output.target} key={index} />\n ))}\n </Sidebar>\n ),\n };\n },\n});\n"],"names":[],"mappings":";;;;;;;AAuCA,MAAM,uBAAuB,UAAW,CAAA;AAA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;;;;"}
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import React, { Fragment, useContext, useState } from 'react';
|
|
2
|
-
import { createExtension, createExtensionInput, createRouterExtension, createSignInPageExtension, coreExtensionData, createAppRootWrapperExtension } from '@backstage/frontend-plugin-api';
|
|
3
|
-
import { useApi, configApiRef } from '@backstage/core-plugin-api';
|
|
4
|
-
import { InternalAppContext } from '../wiring/InternalAppContext.esm.js';
|
|
5
|
-
import { BrowserRouter } from 'react-router-dom';
|
|
6
|
-
import { RouteTracker } from '../routing/RouteTracker.esm.js';
|
|
7
|
-
import { getBasePath } from '../routing/getBasePath.esm.js';
|
|
8
|
-
|
|
9
|
-
const AppRoot = createExtension({
|
|
10
|
-
namespace: "app",
|
|
11
|
-
name: "root",
|
|
12
|
-
attachTo: { id: "app", input: "root" },
|
|
13
|
-
inputs: {
|
|
14
|
-
router: createExtensionInput(
|
|
15
|
-
{ component: createRouterExtension.componentDataRef },
|
|
16
|
-
{ singleton: true, optional: true }
|
|
17
|
-
),
|
|
18
|
-
signInPage: createExtensionInput(
|
|
19
|
-
{ component: createSignInPageExtension.componentDataRef },
|
|
20
|
-
{ singleton: true, optional: true }
|
|
21
|
-
),
|
|
22
|
-
children: createExtensionInput(
|
|
23
|
-
{ element: coreExtensionData.reactElement },
|
|
24
|
-
{ singleton: true }
|
|
25
|
-
),
|
|
26
|
-
elements: createExtensionInput({
|
|
27
|
-
element: coreExtensionData.reactElement
|
|
28
|
-
}),
|
|
29
|
-
wrappers: createExtensionInput({
|
|
30
|
-
component: createAppRootWrapperExtension.componentDataRef
|
|
31
|
-
})
|
|
32
|
-
},
|
|
33
|
-
output: {
|
|
34
|
-
element: coreExtensionData.reactElement
|
|
35
|
-
},
|
|
36
|
-
factory({ inputs }) {
|
|
37
|
-
let content = /* @__PURE__ */ React.createElement(React.Fragment, null, inputs.elements.map((el) => /* @__PURE__ */ React.createElement(Fragment, { key: el.node.spec.id }, el.output.element)), inputs.children.output.element);
|
|
38
|
-
for (const wrapper of inputs.wrappers) {
|
|
39
|
-
content = /* @__PURE__ */ React.createElement(wrapper.output.component, null, content);
|
|
40
|
-
}
|
|
41
|
-
return {
|
|
42
|
-
element: /* @__PURE__ */ React.createElement(
|
|
43
|
-
AppRouter,
|
|
44
|
-
{
|
|
45
|
-
SignInPageComponent: inputs.signInPage?.output.component,
|
|
46
|
-
RouterComponent: inputs.router?.output.component
|
|
47
|
-
},
|
|
48
|
-
content
|
|
49
|
-
)
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
function SignInPageWrapper({
|
|
54
|
-
component: Component,
|
|
55
|
-
appIdentityProxy,
|
|
56
|
-
children
|
|
57
|
-
}) {
|
|
58
|
-
const [identityApi, setIdentityApi] = useState();
|
|
59
|
-
const configApi = useApi(configApiRef);
|
|
60
|
-
const basePath = getBasePath(configApi);
|
|
61
|
-
if (!identityApi) {
|
|
62
|
-
return /* @__PURE__ */ React.createElement(Component, { onSignInSuccess: setIdentityApi });
|
|
63
|
-
}
|
|
64
|
-
appIdentityProxy.setTarget(identityApi, {
|
|
65
|
-
signOutTargetUrl: basePath || "/"
|
|
66
|
-
});
|
|
67
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
68
|
-
}
|
|
69
|
-
function DefaultRouter(props) {
|
|
70
|
-
const configApi = useApi(configApiRef);
|
|
71
|
-
const basePath = getBasePath(configApi);
|
|
72
|
-
return /* @__PURE__ */ React.createElement(BrowserRouter, { basename: basePath }, props.children);
|
|
73
|
-
}
|
|
74
|
-
function AppRouter(props) {
|
|
75
|
-
const {
|
|
76
|
-
children,
|
|
77
|
-
SignInPageComponent,
|
|
78
|
-
RouterComponent = DefaultRouter
|
|
79
|
-
} = props;
|
|
80
|
-
const configApi = useApi(configApiRef);
|
|
81
|
-
const basePath = getBasePath(configApi);
|
|
82
|
-
const internalAppContext = useContext(InternalAppContext);
|
|
83
|
-
if (!internalAppContext) {
|
|
84
|
-
throw new Error("AppRouter must be rendered within the AppProvider");
|
|
85
|
-
}
|
|
86
|
-
const { routeObjects, appIdentityProxy } = internalAppContext;
|
|
87
|
-
if (!SignInPageComponent) {
|
|
88
|
-
appIdentityProxy.setTarget(
|
|
89
|
-
{
|
|
90
|
-
getUserId: () => "guest",
|
|
91
|
-
getIdToken: async () => void 0,
|
|
92
|
-
getProfile: () => ({
|
|
93
|
-
email: "guest@example.com",
|
|
94
|
-
displayName: "Guest"
|
|
95
|
-
}),
|
|
96
|
-
getProfileInfo: async () => ({
|
|
97
|
-
email: "guest@example.com",
|
|
98
|
-
displayName: "Guest"
|
|
99
|
-
}),
|
|
100
|
-
getBackstageIdentity: async () => ({
|
|
101
|
-
type: "user",
|
|
102
|
-
userEntityRef: "user:default/guest",
|
|
103
|
-
ownershipEntityRefs: ["user:default/guest"]
|
|
104
|
-
}),
|
|
105
|
-
getCredentials: async () => ({}),
|
|
106
|
-
signOut: async () => {
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
{ signOutTargetUrl: basePath || "/" }
|
|
110
|
-
);
|
|
111
|
-
return /* @__PURE__ */ React.createElement(RouterComponent, null, /* @__PURE__ */ React.createElement(RouteTracker, { routeObjects }), children);
|
|
112
|
-
}
|
|
113
|
-
return /* @__PURE__ */ React.createElement(RouterComponent, null, /* @__PURE__ */ React.createElement(RouteTracker, { routeObjects }), /* @__PURE__ */ React.createElement(
|
|
114
|
-
SignInPageWrapper,
|
|
115
|
-
{
|
|
116
|
-
component: SignInPageComponent,
|
|
117
|
-
appIdentityProxy
|
|
118
|
-
},
|
|
119
|
-
children
|
|
120
|
-
));
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
export { AppRoot, AppRouter };
|
|
124
|
-
//# sourceMappingURL=AppRoot.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AppRoot.esm.js","sources":["../../src/extensions/AppRoot.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, {\n ComponentType,\n Fragment,\n PropsWithChildren,\n ReactNode,\n useContext,\n useState,\n} from 'react';\nimport {\n coreExtensionData,\n createAppRootWrapperExtension,\n createExtension,\n createExtensionInput,\n createRouterExtension,\n createSignInPageExtension,\n} from '@backstage/frontend-plugin-api';\nimport {\n IdentityApi,\n SignInPageProps,\n configApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport { InternalAppContext } from '../wiring/InternalAppContext';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { AppIdentityProxy } from '../../../core-app-api/src/apis/implementations/IdentityApi/AppIdentityProxy';\nimport { BrowserRouter } from 'react-router-dom';\nimport { RouteTracker } from '../routing/RouteTracker';\nimport { getBasePath } from '../routing/getBasePath';\n\nexport const AppRoot = createExtension({\n namespace: 'app',\n name: 'root',\n attachTo: { id: 'app', input: 'root' },\n inputs: {\n router: createExtensionInput(\n { component: createRouterExtension.componentDataRef },\n { singleton: true, optional: true },\n ),\n signInPage: createExtensionInput(\n { component: createSignInPageExtension.componentDataRef },\n { singleton: true, optional: true },\n ),\n children: createExtensionInput(\n { element: coreExtensionData.reactElement },\n { singleton: true },\n ),\n elements: createExtensionInput({\n element: coreExtensionData.reactElement,\n }),\n wrappers: createExtensionInput({\n component: createAppRootWrapperExtension.componentDataRef,\n }),\n },\n output: {\n element: coreExtensionData.reactElement,\n },\n factory({ inputs }) {\n let content: React.ReactNode = (\n <>\n {inputs.elements.map(el => (\n <Fragment key={el.node.spec.id}>{el.output.element}</Fragment>\n ))}\n {inputs.children.output.element}\n </>\n );\n\n for (const wrapper of inputs.wrappers) {\n content = <wrapper.output.component>{content}</wrapper.output.component>;\n }\n\n return {\n element: (\n <AppRouter\n SignInPageComponent={inputs.signInPage?.output.component}\n RouterComponent={inputs.router?.output.component}\n >\n {content}\n </AppRouter>\n ),\n };\n },\n});\n\n// This wraps the sign-in page and waits for sign-in to be completed before rendering the app\nfunction SignInPageWrapper({\n component: Component,\n appIdentityProxy,\n children,\n}: {\n component: ComponentType<SignInPageProps>;\n appIdentityProxy: AppIdentityProxy;\n children: ReactNode;\n}) {\n const [identityApi, setIdentityApi] = useState<IdentityApi>();\n const configApi = useApi(configApiRef);\n const basePath = getBasePath(configApi);\n\n if (!identityApi) {\n return <Component onSignInSuccess={setIdentityApi} />;\n }\n\n appIdentityProxy.setTarget(identityApi, {\n signOutTargetUrl: basePath || '/',\n });\n return <>{children}</>;\n}\n\n/**\n * Props for the {@link AppRouter} component.\n * @public\n */\nexport interface AppRouterProps {\n children?: ReactNode;\n SignInPageComponent?: ComponentType<SignInPageProps>;\n RouterComponent?: ComponentType<PropsWithChildren<{}>>;\n}\n\nfunction DefaultRouter(props: PropsWithChildren<{}>) {\n const configApi = useApi(configApiRef);\n const basePath = getBasePath(configApi);\n return <BrowserRouter basename={basePath}>{props.children}</BrowserRouter>;\n}\n\n/**\n * App router and sign-in page wrapper.\n *\n * @remarks\n *\n * The AppRouter provides the routing context and renders the sign-in page.\n * Until the user has successfully signed in, this component will render\n * the sign-in page. Once the user has signed-in, it will instead render\n * the app, while providing routing and route tracking for the app.\n */\nexport function AppRouter(props: AppRouterProps) {\n const {\n children,\n SignInPageComponent,\n RouterComponent = DefaultRouter,\n } = props;\n\n const configApi = useApi(configApiRef);\n const basePath = getBasePath(configApi);\n const internalAppContext = useContext(InternalAppContext);\n if (!internalAppContext) {\n throw new Error('AppRouter must be rendered within the AppProvider');\n }\n const { routeObjects, appIdentityProxy } = internalAppContext;\n\n // If the app hasn't configured a sign-in page, we just continue as guest.\n if (!SignInPageComponent) {\n appIdentityProxy.setTarget(\n {\n getUserId: () => 'guest',\n getIdToken: async () => undefined,\n getProfile: () => ({\n email: 'guest@example.com',\n displayName: 'Guest',\n }),\n getProfileInfo: async () => ({\n email: 'guest@example.com',\n displayName: 'Guest',\n }),\n getBackstageIdentity: async () => ({\n type: 'user',\n userEntityRef: 'user:default/guest',\n ownershipEntityRefs: ['user:default/guest'],\n }),\n getCredentials: async () => ({}),\n signOut: async () => {},\n },\n { signOutTargetUrl: basePath || '/' },\n );\n\n return (\n <RouterComponent>\n <RouteTracker routeObjects={routeObjects} />\n {children}\n </RouterComponent>\n );\n }\n\n return (\n <RouterComponent>\n <RouteTracker routeObjects={routeObjects} />\n <SignInPageWrapper\n component={SignInPageComponent}\n appIdentityProxy={appIdentityProxy}\n >\n {children}\n </SignInPageWrapper>\n </RouterComponent>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AA6CO,MAAM,UAAU,eAAgB,CAAA;AAAA,EACrC,SAAW,EAAA,KAAA;AAAA,EACX,IAAM,EAAA,MAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,KAAA,EAAO,OAAO,MAAO,EAAA;AAAA,EACrC,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA,oBAAA;AAAA,MACN,EAAE,SAAW,EAAA,qBAAA,CAAsB,gBAAiB,EAAA;AAAA,MACpD,EAAE,SAAA,EAAW,IAAM,EAAA,QAAA,EAAU,IAAK,EAAA;AAAA,KACpC;AAAA,IACA,UAAY,EAAA,oBAAA;AAAA,MACV,EAAE,SAAW,EAAA,yBAAA,CAA0B,gBAAiB,EAAA;AAAA,MACxD,EAAE,SAAA,EAAW,IAAM,EAAA,QAAA,EAAU,IAAK,EAAA;AAAA,KACpC;AAAA,IACA,QAAU,EAAA,oBAAA;AAAA,MACR,EAAE,OAAS,EAAA,iBAAA,CAAkB,YAAa,EAAA;AAAA,MAC1C,EAAE,WAAW,IAAK,EAAA;AAAA,KACpB;AAAA,IACA,UAAU,oBAAqB,CAAA;AAAA,MAC7B,SAAS,iBA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QACE,WAAW,MAAM,OAAA;AAAA,QACjB,YAAY,YAAY,KAAA,CAAA;AAAA,QACxB,YAAY,OAAO;AAAA,UACjB,KAAO,EAAA,mBAAA;AAAA,UACP,WAAa,EAAA,OAAA;AAAA,SACf,CAAA;AAAA,QACA,gBAAgB,aAAa;AAAA,UAC3B,KAAO,EAAA,mBAAA;AAAA,UACP,WAAa,EAAA,OAAA;AAAA,SACf,CAAA;AAAA,QACA,sBAAsB,aAAa;AAAA,UACjC,IAAM,EAAA,MAAA;AAAA,UACN,aAAe,EAAA,oBAAA;AAAA,UACf,mBAAA,EAAqB,CAAC,oBAAoB,CAAA;AAAA,SAC5C,CAAA;AAAA,QACA,cAAA,EAAgB,aAAa,EAAC,CAAA;AAAA,QAC9B,SAAS,YAAY;AAAA,SAAC;AAAA,OACxB;AAAA,MACA,EAAE,gBAAkB,EAAA,QAAA,IAAY,GAAI,EAAA;AAAA,KACtC,CAAA;AAEA,IAAA,2CACG,eACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,YAAa,EAAA,EAAA,YAAA,EAA4B,GACzC,QACH,CAAA,CAAA;AAAA,GAEJ;AAEA,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,eAAA,EAAA,IAAA,kBACE,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,EAAa,cAA4B,CAC1C,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,iBAAA;AAAA,IAAA;AAAA,MACC,SAAW,EAAA,mBAAA;AAAA,MACX,gBAAA;AAAA,KAAA;AAAA,IAEC,QAAA;AAAA,GAEL,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { createExtension, createExtensionInput, coreExtensionData, useComponentRef, coreComponentRefs } from '@backstage/frontend-plugin-api';
|
|
3
|
-
import { useRoutes } from 'react-router-dom';
|
|
4
|
-
|
|
5
|
-
const AppRoutes = createExtension({
|
|
6
|
-
namespace: "app",
|
|
7
|
-
name: "routes",
|
|
8
|
-
attachTo: { id: "app/layout", input: "content" },
|
|
9
|
-
inputs: {
|
|
10
|
-
routes: createExtensionInput({
|
|
11
|
-
path: coreExtensionData.routePath,
|
|
12
|
-
ref: coreExtensionData.routeRef.optional(),
|
|
13
|
-
element: coreExtensionData.reactElement
|
|
14
|
-
})
|
|
15
|
-
},
|
|
16
|
-
output: {
|
|
17
|
-
element: coreExtensionData.reactElement
|
|
18
|
-
},
|
|
19
|
-
factory({ inputs }) {
|
|
20
|
-
const Routes = () => {
|
|
21
|
-
const NotFoundErrorPage = useComponentRef(
|
|
22
|
-
coreComponentRefs.notFoundErrorPage
|
|
23
|
-
);
|
|
24
|
-
const element = useRoutes([
|
|
25
|
-
...inputs.routes.map((route) => ({
|
|
26
|
-
path: `${route.output.path}/*`,
|
|
27
|
-
element: route.output.element
|
|
28
|
-
})),
|
|
29
|
-
{
|
|
30
|
-
path: "*",
|
|
31
|
-
element: /* @__PURE__ */ React.createElement(NotFoundErrorPage, null)
|
|
32
|
-
}
|
|
33
|
-
]);
|
|
34
|
-
return element;
|
|
35
|
-
};
|
|
36
|
-
return {
|
|
37
|
-
element: /* @__PURE__ */ React.createElement(Routes, null)
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
export { AppRoutes };
|
|
43
|
-
//# sourceMappingURL=AppRoutes.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"AppRoutes.esm.js","sources":["../../src/extensions/AppRoutes.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 from 'react';\nimport {\n createExtension,\n coreExtensionData,\n createExtensionInput,\n coreComponentRefs,\n useComponentRef,\n} from '@backstage/frontend-plugin-api';\nimport { useRoutes } from 'react-router-dom';\n\nexport const AppRoutes = createExtension({\n namespace: 'app',\n name: 'routes',\n attachTo: { id: 'app/layout', input: 'content' },\n inputs: {\n routes: createExtensionInput({\n path: coreExtensionData.routePath,\n ref: coreExtensionData.routeRef.optional(),\n element: coreExtensionData.reactElement,\n }),\n },\n output: {\n element: coreExtensionData.reactElement,\n },\n factory({ inputs }) {\n const Routes = () => {\n const NotFoundErrorPage = useComponentRef(\n coreComponentRefs.notFoundErrorPage,\n );\n\n const element = useRoutes([\n ...inputs.routes.map(route => ({\n path: `${route.output.path}/*`,\n element: route.output.element,\n })),\n {\n path: '*',\n element: <NotFoundErrorPage />,\n },\n ]);\n\n return element;\n };\n\n return {\n element: <Routes />,\n };\n },\n});\n"],"names":[],"mappings":";;;;AA0BO,MAAM,YAAY,eAAgB,CAAA;AAAA,EACvC,SAAW,EAAA,KAAA;AAAA,EACX,IAAM,EAAA,QAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,YAAA,EAAc,OAAO,SAAU,EAAA;AAAA,EAC/C,MAAQ,EAAA;AAAA,IACN,QAAQ,oBAAqB,CAAA;AAAA,MAC3B,MAAM,iBAAkB,CAAA,SAAA;AAAA,MACxB,GAAA,EAAK,iBAAkB,CAAA,QAAA,CAAS,QAAS,EAAA;AAAA,MACzC,SAAS,iBAAkB,CAAA,YAAA;AAAA,KAC5B,CAAA;AAAA,GACH;AAAA,EACA,MAAQ,EAAA;AAAA,IACN,SAAS,iBAAkB,CAAA,YAAA;AAAA,GAC7B;AAAA,EACA,OAAA,CAAQ,EAAE,MAAA,EAAU,EAAA;AAClB,IAAA,MAAM,SAAS,MAAM;AACnB,MAAA,MAAM,iBAAoB,GAAA,eAAA;AAAA,QACxB,iBAAkB,CAAA,iBAAA;AAAA,OACpB,CAAA;AAEA,MAAA,MAAM,UAAU,SAAU,CAAA;AAAA,QACxB,GAAG,MAAA,CAAO,MAAO,CAAA,GAAA,CAAI,CAAU,KAAA,MAAA;AAAA,UAC7B,IAAM,EAAA,CAAA,EAAG,KAAM,CAAA,MAAA,CAAO,IAAI,CAAA,EAAA,CAAA;AAAA,UAC1B,OAAA,EAAS,MAAM,MAAO,CAAA,OAAA;AAAA,SACtB,CAAA,CAAA;AAAA,QACF;AAAA,UACE,IAAM,EAAA,GAAA;AAAA,UACN,OAAA,sCAAU,iBAAkB,EAAA,IAAA,CAAA;AAAA,SAC9B;AAAA,OACD,CAAA,CAAA;AAED,MAAO,OAAA,OAAA,CAAA;AAAA,KACT,CAAA;AAEA,IAAO,OAAA;AAAA,MACL,OAAA,sCAAU,MAAO,EAAA,IAAA,CAAA;AAAA,KACnB,CAAA;AAAA,GACF;AACF,CAAC;;;;"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Button from '@material-ui/core/Button';
|
|
3
|
-
import { createComponentExtension, coreComponentRefs } from '@backstage/frontend-plugin-api';
|
|
4
|
-
import { ErrorPanel } from '@backstage/core-components';
|
|
5
|
-
import '../app-defaults/src/defaults/apis.esm.js';
|
|
6
|
-
import { components } from '../app-defaults/src/defaults/components.esm.js';
|
|
7
|
-
import '@material-ui/icons/Apartment';
|
|
8
|
-
import '@material-ui/icons/BrokenImage';
|
|
9
|
-
import '@material-ui/icons/Category';
|
|
10
|
-
import '@material-ui/icons/CreateNewFolder';
|
|
11
|
-
import '@material-ui/icons/Subject';
|
|
12
|
-
import '@material-ui/icons/Search';
|
|
13
|
-
import '@material-ui/icons/Chat';
|
|
14
|
-
import '@material-ui/icons/Dashboard';
|
|
15
|
-
import '@material-ui/icons/Description';
|
|
16
|
-
import '@material-ui/icons/Email';
|
|
17
|
-
import '@material-ui/icons/Extension';
|
|
18
|
-
import '@material-ui/icons/GitHub';
|
|
19
|
-
import '@material-ui/icons/Help';
|
|
20
|
-
import '@material-ui/icons/LocationOn';
|
|
21
|
-
import '@material-ui/icons/Memory';
|
|
22
|
-
import '@material-ui/icons/MenuBook';
|
|
23
|
-
import '@material-ui/icons/People';
|
|
24
|
-
import '@material-ui/icons/Person';
|
|
25
|
-
import '@material-ui/icons/Warning';
|
|
26
|
-
import '@material-ui/icons/Storage';
|
|
27
|
-
import '@material-ui/icons/FeaturedPlayList';
|
|
28
|
-
import '@backstage/theme';
|
|
29
|
-
import '@material-ui/icons/Brightness2';
|
|
30
|
-
import '@material-ui/icons/WbSunny';
|
|
31
|
-
|
|
32
|
-
const DefaultProgressComponent = createComponentExtension({
|
|
33
|
-
ref: coreComponentRefs.progress,
|
|
34
|
-
loader: { sync: () => components.Progress }
|
|
35
|
-
});
|
|
36
|
-
const DefaultNotFoundErrorPageComponent = createComponentExtension({
|
|
37
|
-
ref: coreComponentRefs.notFoundErrorPage,
|
|
38
|
-
loader: { sync: () => components.NotFoundErrorPage }
|
|
39
|
-
});
|
|
40
|
-
const DefaultErrorBoundaryComponent = createComponentExtension({
|
|
41
|
-
ref: coreComponentRefs.errorBoundaryFallback,
|
|
42
|
-
loader: {
|
|
43
|
-
sync: () => (props) => {
|
|
44
|
-
const { plugin, error, resetError } = props;
|
|
45
|
-
const title = `Error in ${plugin?.id}`;
|
|
46
|
-
return /* @__PURE__ */ React.createElement(ErrorPanel, { title, error, defaultExpanded: true }, /* @__PURE__ */ React.createElement(Button, { variant: "outlined", onClick: resetError }, "Retry"));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
export { DefaultErrorBoundaryComponent, DefaultNotFoundErrorPageComponent, DefaultProgressComponent };
|
|
52
|
-
//# sourceMappingURL=components.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"components.esm.js","sources":["../../src/extensions/components.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 from 'react';\n// TODO: Dependency on MUI should be removed from core packages\nimport Button from '@material-ui/core/Button';\n\nimport {\n createComponentExtension,\n coreComponentRefs,\n} from '@backstage/frontend-plugin-api';\nimport { ErrorPanel } from '@backstage/core-components';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { components as defaultComponents } from '../../../app-defaults/src/defaults';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\n\nexport const DefaultProgressComponent = createComponentExtension({\n ref: coreComponentRefs.progress,\n loader: { sync: () => defaultComponents.Progress },\n});\n\nexport const DefaultNotFoundErrorPageComponent = createComponentExtension({\n ref: coreComponentRefs.notFoundErrorPage,\n loader: { sync: () => defaultComponents.NotFoundErrorPage },\n});\n\nexport const DefaultErrorBoundaryComponent = createComponentExtension({\n ref: coreComponentRefs.errorBoundaryFallback,\n loader: {\n sync: () => props => {\n const { plugin, error, resetError } = props;\n const title = `Error in ${plugin?.id}`;\n\n return (\n <ErrorPanel title={title} error={error} defaultExpanded>\n <Button variant=\"outlined\" onClick={resetError}>\n Retry\n </Button>\n </ErrorPanel>\n );\n },\n },\n});\n"],"names":["defaultComponents"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BO,MAAM,2BAA2B,wBAAyB,CAAA;AAAA,EAC/D,KAAK,iBAAkB,CAAA,QAAA;AAAA,EACvB,MAAQ,EAAA,EAAE,IAAM,EAAA,MAAMA,WAAkB,QAAS,EAAA;AACnD,CAAC,EAAA;AAEM,MAAM,oCAAoC,wBAAyB,CAAA;AAAA,EACxE,KAAK,iBAAkB,CAAA,iBAAA;AAAA,EACvB,MAAQ,EAAA,EAAE,IAAM,EAAA,MAAMA,WAAkB,iBAAkB,EAAA;AAC5D,CAAC,EAAA;AAEM,MAAM,gCAAgC,wBAAyB,CAAA;AAAA,EACpE,KAAK,iBAAkB,CAAA,qBAAA;AAAA,EACvB,MAAQ,EAAA;AAAA,IACN,IAAA,EAAM,MAAM,CAAS,KAAA,KAAA;AACnB,MAAA,MAAM,EAAE,MAAA,EAAQ,KAAO,EAAA,UAAA,EAAe,GAAA,KAAA,CAAA;AACtC,MAAM,MAAA,KAAA,GAAQ,CAAY,SAAA,EAAA,MAAA,EAAQ,EAAE,CAAA,CAAA,CAAA;AAEpC,MAAA,uBACG,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,KAAc,EAAA,KAAA,EAAc,eAAe,EAAA,IAAA,EAAA,kBACpD,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAO,OAAQ,EAAA,UAAA,EAAW,OAAS,EAAA,UAAA,EAAA,EAAY,OAEhD,CACF,CAAA,CAAA;AAAA,KAEJ;AAAA,GACF;AACF,CAAC;;;;"}
|