@backstage/plugin-scaffolder 1.34.0-next.1 → 1.34.0-next.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,40 @@
1
1
  # @backstage/plugin-scaffolder
2
2
 
3
+ ## 1.34.0-next.3
4
+
5
+ ### Minor Changes
6
+
7
+ - b1c0696: Add resizable panels width for the editor and preview panels in the template editor and template form playground layouts. Users can now resize these panels by dragging the divider between the two areas.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies
12
+ - @backstage/frontend-plugin-api@0.11.0-next.2
13
+ - @backstage/core-compat-api@0.5.0-next.3
14
+ - @backstage/core-components@0.17.5-next.2
15
+
16
+ ## 1.34.0-next.2
17
+
18
+ ### Patch Changes
19
+
20
+ - e4ddf22: Internal update to align with new blueprint parameter naming in the new frontend system.
21
+ - Updated dependencies
22
+ - @backstage/frontend-plugin-api@0.11.0-next.1
23
+ - @backstage/core-compat-api@0.5.0-next.2
24
+ - @backstage/plugin-catalog-react@1.20.0-next.2
25
+ - @backstage/core-components@0.17.5-next.1
26
+ - @backstage/catalog-client@1.11.0-next.0
27
+ - @backstage/catalog-model@1.7.5
28
+ - @backstage/core-plugin-api@1.10.9
29
+ - @backstage/errors@1.2.7
30
+ - @backstage/integration@1.17.1
31
+ - @backstage/integration-react@1.2.9
32
+ - @backstage/types@1.2.1
33
+ - @backstage/plugin-catalog-common@1.1.5
34
+ - @backstage/plugin-permission-react@0.4.36
35
+ - @backstage/plugin-scaffolder-common@1.7.0-next.0
36
+ - @backstage/plugin-scaffolder-react@1.19.0-next.1
37
+
3
38
  ## 1.34.0-next.1
4
39
 
5
40
  ### Minor Changes
@@ -27,7 +27,7 @@ const formDecoratorsApi = ApiBlueprint.makeWithOverrides({
27
27
  (e) => e.get(FormDecoratorBlueprint.dataRefs.formDecoratorLoader)
28
28
  );
29
29
  return originalFactory(
30
- (define) => define({
30
+ (defineParams) => defineParams({
31
31
  api: formDecoratorsApiRef,
32
32
  deps: {},
33
33
  factory: () => DefaultScaffolderFormDecoratorsApi.create({
@@ -1 +1 @@
1
- {"version":3,"file":"FormDecoratorsApi.esm.js","sources":["../../../src/alpha/api/FormDecoratorsApi.ts"],"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\nimport {\n ApiBlueprint,\n createExtensionInput,\n} from '@backstage/frontend-plugin-api';\nimport { ScaffolderFormDecoratorsApi } from './types';\nimport { ScaffolderFormDecorator } from '@backstage/plugin-scaffolder-react/alpha';\nimport { formDecoratorsApiRef } from './ref';\nimport { FormDecoratorBlueprint } from '@backstage/plugin-scaffolder-react/alpha';\n\n/** @alpha */\nexport class DefaultScaffolderFormDecoratorsApi\n implements ScaffolderFormDecoratorsApi\n{\n private constructor(\n private readonly options: {\n decorators: Array<ScaffolderFormDecorator>;\n },\n ) {}\n\n static create(options?: { decorators: ScaffolderFormDecorator[] }) {\n return new DefaultScaffolderFormDecoratorsApi(\n options ?? { decorators: [] },\n );\n }\n\n async getFormDecorators(): Promise<ScaffolderFormDecorator[]> {\n return this.options.decorators;\n }\n}\n\n/** @alpha */\nexport const formDecoratorsApi = ApiBlueprint.makeWithOverrides({\n name: 'form-decorators',\n inputs: {\n formDecorators: createExtensionInput([\n FormDecoratorBlueprint.dataRefs.formDecoratorLoader,\n ]),\n },\n factory(originalFactory, { inputs }) {\n const formDecorators = inputs.formDecorators.map(e =>\n e.get(FormDecoratorBlueprint.dataRefs.formDecoratorLoader),\n );\n\n return originalFactory(define =>\n define({\n api: formDecoratorsApiRef,\n deps: {},\n factory: () =>\n DefaultScaffolderFormDecoratorsApi.create({\n decorators: formDecorators,\n }),\n }),\n );\n },\n});\n"],"names":[],"mappings":";;;;AA0BO,MAAM,kCAEb,CAAA;AAAA,EACU,YACW,OAGjB,EAAA;AAHiB,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAAA;AAGhB,EAEH,OAAO,OAAO,OAAqD,EAAA;AACjE,IAAA,OAAO,IAAI,kCAAA;AAAA,MACT,OAAW,IAAA,EAAE,UAAY,EAAA,EAAG;AAAA,KAC9B;AAAA;AACF,EAEA,MAAM,iBAAwD,GAAA;AAC5D,IAAA,OAAO,KAAK,OAAQ,CAAA,UAAA;AAAA;AAExB;AAGa,MAAA,iBAAA,GAAoB,aAAa,iBAAkB,CAAA;AAAA,EAC9D,IAAM,EAAA,iBAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,gBAAgB,oBAAqB,CAAA;AAAA,MACnC,uBAAuB,QAAS,CAAA;AAAA,KACjC;AAAA,GACH;AAAA,EACA,OAAQ,CAAA,eAAA,EAAiB,EAAE,MAAA,EAAU,EAAA;AACnC,IAAM,MAAA,cAAA,GAAiB,OAAO,cAAe,CAAA,GAAA;AAAA,MAAI,CAC/C,CAAA,KAAA,CAAA,CAAE,GAAI,CAAA,sBAAA,CAAuB,SAAS,mBAAmB;AAAA,KAC3D;AAEA,IAAO,OAAA,eAAA;AAAA,MAAgB,YACrB,MAAO,CAAA;AAAA,QACL,GAAK,EAAA,oBAAA;AAAA,QACL,MAAM,EAAC;AAAA,QACP,OAAA,EAAS,MACP,kCAAA,CAAmC,MAAO,CAAA;AAAA,UACxC,UAAY,EAAA;AAAA,SACb;AAAA,OACJ;AAAA,KACH;AAAA;AAEJ,CAAC;;;;"}
1
+ {"version":3,"file":"FormDecoratorsApi.esm.js","sources":["../../../src/alpha/api/FormDecoratorsApi.ts"],"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\nimport {\n ApiBlueprint,\n createExtensionInput,\n} from '@backstage/frontend-plugin-api';\nimport { ScaffolderFormDecoratorsApi } from './types';\nimport { ScaffolderFormDecorator } from '@backstage/plugin-scaffolder-react/alpha';\nimport { formDecoratorsApiRef } from './ref';\nimport { FormDecoratorBlueprint } from '@backstage/plugin-scaffolder-react/alpha';\n\n/** @alpha */\nexport class DefaultScaffolderFormDecoratorsApi\n implements ScaffolderFormDecoratorsApi\n{\n private constructor(\n private readonly options: {\n decorators: Array<ScaffolderFormDecorator>;\n },\n ) {}\n\n static create(options?: { decorators: ScaffolderFormDecorator[] }) {\n return new DefaultScaffolderFormDecoratorsApi(\n options ?? { decorators: [] },\n );\n }\n\n async getFormDecorators(): Promise<ScaffolderFormDecorator[]> {\n return this.options.decorators;\n }\n}\n\n/** @alpha */\nexport const formDecoratorsApi = ApiBlueprint.makeWithOverrides({\n name: 'form-decorators',\n inputs: {\n formDecorators: createExtensionInput([\n FormDecoratorBlueprint.dataRefs.formDecoratorLoader,\n ]),\n },\n factory(originalFactory, { inputs }) {\n const formDecorators = inputs.formDecorators.map(e =>\n e.get(FormDecoratorBlueprint.dataRefs.formDecoratorLoader),\n );\n\n return originalFactory(defineParams =>\n defineParams({\n api: formDecoratorsApiRef,\n deps: {},\n factory: () =>\n DefaultScaffolderFormDecoratorsApi.create({\n decorators: formDecorators,\n }),\n }),\n );\n },\n});\n"],"names":[],"mappings":";;;;AA0BO,MAAM,kCAEb,CAAA;AAAA,EACU,YACW,OAGjB,EAAA;AAHiB,IAAA,IAAA,CAAA,OAAA,GAAA,OAAA;AAAA;AAGhB,EAEH,OAAO,OAAO,OAAqD,EAAA;AACjE,IAAA,OAAO,IAAI,kCAAA;AAAA,MACT,OAAW,IAAA,EAAE,UAAY,EAAA,EAAG;AAAA,KAC9B;AAAA;AACF,EAEA,MAAM,iBAAwD,GAAA;AAC5D,IAAA,OAAO,KAAK,OAAQ,CAAA,UAAA;AAAA;AAExB;AAGa,MAAA,iBAAA,GAAoB,aAAa,iBAAkB,CAAA;AAAA,EAC9D,IAAM,EAAA,iBAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,gBAAgB,oBAAqB,CAAA;AAAA,MACnC,uBAAuB,QAAS,CAAA;AAAA,KACjC;AAAA,GACH;AAAA,EACA,OAAQ,CAAA,eAAA,EAAiB,EAAE,MAAA,EAAU,EAAA;AACnC,IAAM,MAAA,cAAA,GAAiB,OAAO,cAAe,CAAA,GAAA;AAAA,MAAI,CAC/C,CAAA,KAAA,CAAA,CAAE,GAAI,CAAA,sBAAA,CAAuB,SAAS,mBAAmB;AAAA,KAC3D;AAEA,IAAO,OAAA,eAAA;AAAA,MAAgB,kBACrB,YAAa,CAAA;AAAA,QACX,GAAK,EAAA,oBAAA;AAAA,QACL,MAAM,EAAC;AAAA,QACP,OAAA,EAAS,MACP,kCAAA,CAAmC,MAAO,CAAA;AAAA,UACxC,UAAY,EAAA;AAAA,SACb;AAAA,OACJ;AAAA,KACH;AAAA;AAEJ,CAAC;;;;"}
@@ -5,7 +5,7 @@ import { useRouteRef } from '@backstage/core-plugin-api';
5
5
  import { editRouteRef } from '../../../routes.esm.js';
6
6
  import { useTemplateDirectory } from './useTemplateDirectory.esm.js';
7
7
  import { DirectoryEditorProvider } from './DirectoryEditorContext.esm.js';
8
- import { TemplateEditorLayout, TemplateEditorLayoutToolbar, TemplateEditorLayoutBrowser, TemplateEditorLayoutFiles, TemplateEditorLayoutPreview, TemplateEditorLayoutConsole } from './TemplateEditorLayout.esm.js';
8
+ import { TemplateEditorLayout, TemplateEditorLayoutToolbar, TemplateEditorLayoutBrowser, TemplateEditorPanels, TemplateEditorLayoutFiles, TemplateEditorLayoutPreview, TemplateEditorLayoutConsole } from './TemplateEditorLayout.esm.js';
9
9
  import { TemplateEditorToolbar } from './TemplateEditorToolbar.esm.js';
10
10
  import { TemplateEditorToolbarFileMenu } from './TemplateEditorToolbarFileMenu.esm.js';
11
11
  import { TemplateEditorBrowser } from './TemplateEditorBrowser.esm.js';
@@ -38,16 +38,22 @@ const TemplateEditor = (props) => {
38
38
  }
39
39
  ) }) }),
40
40
  /* @__PURE__ */ jsx(TemplateEditorLayoutBrowser, { children: /* @__PURE__ */ jsx(TemplateEditorBrowser, { onClose: closeDirectory }) }),
41
- /* @__PURE__ */ jsx(TemplateEditorLayoutFiles, { children: /* @__PURE__ */ jsx(TemplateEditorTextArea.DirectoryEditor, { errorText }) }),
42
- /* @__PURE__ */ jsx(TemplateEditorLayoutPreview, { children: /* @__PURE__ */ jsx(
43
- TemplateEditorForm.DirectoryEditorDryRun,
41
+ /* @__PURE__ */ jsx(
42
+ TemplateEditorPanels,
44
43
  {
45
- setErrorText,
46
- fieldExtensions,
47
- layouts,
48
- formProps
44
+ autoSaveId: "template-editor",
45
+ files: /* @__PURE__ */ jsx(TemplateEditorLayoutFiles, { children: /* @__PURE__ */ jsx(TemplateEditorTextArea.DirectoryEditor, { errorText }) }),
46
+ preview: /* @__PURE__ */ jsx(TemplateEditorLayoutPreview, { children: /* @__PURE__ */ jsx(
47
+ TemplateEditorForm.DirectoryEditorDryRun,
48
+ {
49
+ setErrorText,
50
+ fieldExtensions,
51
+ layouts,
52
+ formProps
53
+ }
54
+ ) })
49
55
  }
50
- ) }),
56
+ ),
51
57
  /* @__PURE__ */ jsx(TemplateEditorLayoutConsole, { children: /* @__PURE__ */ jsx(DryRunResults, {}) })
52
58
  ] }) }) });
53
59
  };
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateEditor.esm.js","sources":["../../../../src/alpha/components/TemplateEditorPage/TemplateEditor.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useCallback, useState } from 'react';\nimport { useNavigate } from 'react-router-dom';\n\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport type {\n FormProps,\n LayoutOptions,\n FieldExtensionOptions,\n} from '@backstage/plugin-scaffolder-react';\n\nimport { editRouteRef } from '../../../routes';\n\nimport { useTemplateDirectory } from './useTemplateDirectory';\nimport { DirectoryEditorProvider } from './DirectoryEditorContext';\nimport {\n TemplateEditorLayout,\n TemplateEditorLayoutToolbar,\n TemplateEditorLayoutBrowser,\n TemplateEditorLayoutFiles,\n TemplateEditorLayoutPreview,\n TemplateEditorLayoutConsole,\n} from './TemplateEditorLayout';\nimport { TemplateEditorToolbar } from './TemplateEditorToolbar';\nimport { TemplateEditorToolbarFileMenu } from './TemplateEditorToolbarFileMenu';\nimport { TemplateEditorBrowser } from './TemplateEditorBrowser';\nimport { TemplateEditorTextArea } from './TemplateEditorTextArea';\nimport { TemplateEditorForm } from './TemplateEditorForm';\nimport { DryRunProvider } from './DryRunContext';\nimport { DryRunResults } from './DryRunResults';\n\n/** @public */\nexport type ScaffolderTemplateEditorClassKey =\n | 'root'\n | 'toolbar'\n | 'browser'\n | 'editor'\n | 'preview'\n | 'results';\n\nexport const TemplateEditor = (props: {\n layouts?: LayoutOptions[];\n formProps?: FormProps;\n fieldExtensions?: FieldExtensionOptions<any, any>[];\n}) => {\n const { layouts, formProps, fieldExtensions } = props;\n const [errorText, setErrorText] = useState<string>();\n const navigate = useNavigate();\n const editLink = useRouteRef(editRouteRef);\n const {\n directory,\n openDirectory: handleOpenDirectory,\n createDirectory: handleCreateDirectory,\n closeDirectory,\n } = useTemplateDirectory();\n\n const handleCloseDirectory = useCallback(() => {\n closeDirectory().then(() => navigate(editLink()));\n }, [closeDirectory, navigate, editLink]);\n\n return (\n <DirectoryEditorProvider directory={directory}>\n <DryRunProvider>\n <TemplateEditorLayout>\n <TemplateEditorLayoutToolbar>\n <TemplateEditorToolbar fieldExtensions={fieldExtensions}>\n <TemplateEditorToolbarFileMenu\n onOpenDirectory={handleOpenDirectory}\n onCreateDirectory={handleCreateDirectory}\n onCloseDirectory={handleCloseDirectory}\n />\n </TemplateEditorToolbar>\n </TemplateEditorLayoutToolbar>\n <TemplateEditorLayoutBrowser>\n <TemplateEditorBrowser onClose={closeDirectory} />\n </TemplateEditorLayoutBrowser>\n <TemplateEditorLayoutFiles>\n <TemplateEditorTextArea.DirectoryEditor errorText={errorText} />\n </TemplateEditorLayoutFiles>\n <TemplateEditorLayoutPreview>\n <TemplateEditorForm.DirectoryEditorDryRun\n setErrorText={setErrorText}\n fieldExtensions={fieldExtensions}\n layouts={layouts}\n formProps={formProps}\n />\n </TemplateEditorLayoutPreview>\n <TemplateEditorLayoutConsole>\n <DryRunResults />\n </TemplateEditorLayoutConsole>\n </TemplateEditorLayout>\n </DryRunProvider>\n </DirectoryEditorProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAsDa,MAAA,cAAA,GAAiB,CAAC,KAIzB,KAAA;AACJ,EAAA,MAAM,EAAE,OAAA,EAAS,SAAW,EAAA,eAAA,EAAoB,GAAA,KAAA;AAChD,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,QAAiB,EAAA;AACnD,EAAA,MAAM,WAAW,WAAY,EAAA;AAC7B,EAAM,MAAA,QAAA,GAAW,YAAY,YAAY,CAAA;AACzC,EAAM,MAAA;AAAA,IACJ,SAAA;AAAA,IACA,aAAe,EAAA,mBAAA;AAAA,IACf,eAAiB,EAAA,qBAAA;AAAA,IACjB;AAAA,MACE,oBAAq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plateEditorPage/TemplateEditor.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { useCallback, useState } from 'react';\nimport { useNavigate } from 'react-router-dom';\n\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport type {\n FormProps,\n LayoutOptions,\n FieldExtensionOptions,\n} from '@backstage/plugin-scaffolder-react';\n\nimport { editRouteRef } from '../../../routes';\n\nimport { useTemplateDirectory } from './useTemplateDirectory';\nimport { DirectoryEditorProvider } from './DirectoryEditorContext';\nimport {\n TemplateEditorLayout,\n TemplateEditorLayoutToolbar,\n TemplateEditorLayoutBrowser,\n TemplateEditorLayoutFiles,\n TemplateEditorLayoutPreview,\n TemplateEditorLayoutConsole,\n TemplateEditorPanels,\n} from './TemplateEditorLayout';\nimport { TemplateEditorToolbar } from './TemplateEditorToolbar';\nimport { TemplateEditorToolbarFileMenu } from './TemplateEditorToolbarFileMenu';\nimport { TemplateEditorBrowser } from './TemplateEditorBrowser';\nimport { TemplateEditorTextArea } from './TemplateEditorTextArea';\nimport { TemplateEditorForm } from './TemplateEditorForm';\nimport { DryRunProvider } from './DryRunContext';\nimport { DryRunResults } from './DryRunResults';\n\n/** @public */\nexport type ScaffolderTemplateEditorClassKey =\n | 'root'\n | 'toolbar'\n | 'browser'\n | 'editor'\n | 'preview'\n | 'results';\n\nexport const TemplateEditor = (props: {\n layouts?: LayoutOptions[];\n formProps?: FormProps;\n fieldExtensions?: FieldExtensionOptions<any, any>[];\n}) => {\n const { layouts, formProps, fieldExtensions } = props;\n const [errorText, setErrorText] = useState<string>();\n const navigate = useNavigate();\n const editLink = useRouteRef(editRouteRef);\n const {\n directory,\n openDirectory: handleOpenDirectory,\n createDirectory: handleCreateDirectory,\n closeDirectory,\n } = useTemplateDirectory();\n\n const handleCloseDirectory = useCallback(() => {\n closeDirectory().then(() => navigate(editLink()));\n }, [closeDirectory, navigate, editLink]);\n\n return (\n <DirectoryEditorProvider directory={directory}>\n <DryRunProvider>\n <TemplateEditorLayout>\n <TemplateEditorLayoutToolbar>\n <TemplateEditorToolbar fieldExtensions={fieldExtensions}>\n <TemplateEditorToolbarFileMenu\n onOpenDirectory={handleOpenDirectory}\n onCreateDirectory={handleCreateDirectory}\n onCloseDirectory={handleCloseDirectory}\n />\n </TemplateEditorToolbar>\n </TemplateEditorLayoutToolbar>\n <TemplateEditorLayoutBrowser>\n <TemplateEditorBrowser onClose={closeDirectory} />\n </TemplateEditorLayoutBrowser>\n <TemplateEditorPanels\n autoSaveId=\"template-editor\"\n files={\n <TemplateEditorLayoutFiles>\n <TemplateEditorTextArea.DirectoryEditor errorText={errorText} />\n </TemplateEditorLayoutFiles>\n }\n preview={\n <TemplateEditorLayoutPreview>\n <TemplateEditorForm.DirectoryEditorDryRun\n setErrorText={setErrorText}\n fieldExtensions={fieldExtensions}\n layouts={layouts}\n formProps={formProps}\n />\n </TemplateEditorLayoutPreview>\n }\n />\n <TemplateEditorLayoutConsole>\n <DryRunResults />\n </TemplateEditorLayoutConsole>\n </TemplateEditorLayout>\n </DryRunProvider>\n </DirectoryEditorProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAuDa,MAAA,cAAA,GAAiB,CAAC,KAIzB,KAAA;AACJ,EAAA,MAAM,EAAE,OAAA,EAAS,SAAW,EAAA,eAAA,EAAoB,GAAA,KAAA;AAChD,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,QAAiB,EAAA;AACnD,EAAA,MAAM,WAAW,WAAY,EAAA;AAC7B,EAAM,MAAA,QAAA,GAAW,YAAY,YAAY,CAAA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AAAA,SAEJ,EAAA;AAAA;AAAA,KAEJ;AAAA,oBACC,GAAA,CAAA,2BAAA,EAAA,EACC,QAAC,kBAAA,GAAA,CAAA,aAAA,EAAA,EAAc,CACjB,EAAA;AAAA,GAAA,EACF,GACF,CACF,EAAA,CAAA;AAEJ;;;;"}
@@ -1,5 +1,7 @@
1
- import { jsx } from 'react/jsx-runtime';
2
- import { withStyles } from '@material-ui/core/styles';
1
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
2
+ import { withStyles, useTheme } from '@material-ui/core/styles';
3
+ import { PanelResizeHandle, PanelGroup, Panel } from 'react-resizable-panels';
4
+ import useMediaQuery from '@material-ui/core/useMediaQuery';
3
5
 
4
6
  const TemplateEditorLayout = withStyles(
5
7
  (theme) => ({
@@ -20,7 +22,7 @@ const TemplateEditorLayout = withStyles(
20
22
  "browser editor preview"
21
23
  "results results results"
22
24
  `,
23
- gridTemplateColumns: "1fr 3fr 2fr",
25
+ gridTemplateColumns: "1fr 5fr",
24
26
  gridTemplateRows: "auto 1fr auto"
25
27
  }
26
28
  }
@@ -48,12 +50,15 @@ const TemplateEditorLayoutBrowser = withStyles(
48
50
  { name: "ScaffolderTemplateEditorLayoutBrowser" }
49
51
  )(({ children, classes }) => /* @__PURE__ */ jsx("section", { className: classes.root, children }));
50
52
  const TemplateEditorLayoutFiles = withStyles(
51
- {
53
+ (theme) => ({
52
54
  root: {
53
55
  gridArea: "editor",
54
- overflow: "auto"
56
+ overflow: "auto",
57
+ [theme.breakpoints.up("md")]: {
58
+ height: "100%"
59
+ }
55
60
  }
56
- },
61
+ }),
57
62
  { name: "ScaffolderTemplateEditorLayoutFiles" }
58
63
  )(({ children, classes }) => /* @__PURE__ */ jsx("section", { className: classes.root, children }));
59
64
  const TemplateEditorLayoutPreview = withStyles(
@@ -63,7 +68,7 @@ const TemplateEditorLayoutPreview = withStyles(
63
68
  position: "relative",
64
69
  backgroundColor: theme.palette.background.default,
65
70
  [theme.breakpoints.up("md")]: {
66
- borderLeft: `1px solid ${theme.palette.divider}`
71
+ height: "100%"
67
72
  }
68
73
  },
69
74
  scroll: {
@@ -89,6 +94,35 @@ const TemplateEditorLayoutConsole = withStyles(
89
94
  },
90
95
  { name: "ScaffolderTemplateEditorLayoutConsole" }
91
96
  )(({ children, classes }) => /* @__PURE__ */ jsx("section", { className: classes.root, children }));
97
+ const TemplateEditorPanelResizeHandle = withStyles(
98
+ {
99
+ root: {
100
+ width: 8,
101
+ cursor: "col-resize",
102
+ background: "rgba(0,0,0,0.04)"
103
+ }
104
+ },
105
+ { name: "ScaffolderTemplateEditorPanelResizeHandle" }
106
+ )(({ classes }) => /* @__PURE__ */ jsx(PanelResizeHandle, { className: classes.root }));
107
+ function TemplateEditorPanels({
108
+ files,
109
+ preview,
110
+ autoSaveId = "template-editor-panels"
111
+ }) {
112
+ const theme = useTheme();
113
+ const isMdUp = useMediaQuery(theme.breakpoints.up("md"));
114
+ if (isMdUp) {
115
+ return /* @__PURE__ */ jsxs(PanelGroup, { direction: "horizontal", autoSaveId, children: [
116
+ /* @__PURE__ */ jsx(Panel, { minSize: 15, defaultSize: 50, children: files }),
117
+ /* @__PURE__ */ jsx(TemplateEditorPanelResizeHandle, {}),
118
+ /* @__PURE__ */ jsx(Panel, { minSize: 15, defaultSize: 50, children: preview })
119
+ ] });
120
+ }
121
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
122
+ files,
123
+ preview
124
+ ] });
125
+ }
92
126
 
93
- export { TemplateEditorLayout, TemplateEditorLayoutBrowser, TemplateEditorLayoutConsole, TemplateEditorLayoutFiles, TemplateEditorLayoutPreview, TemplateEditorLayoutToolbar };
127
+ export { TemplateEditorLayout, TemplateEditorLayoutBrowser, TemplateEditorLayoutConsole, TemplateEditorLayoutFiles, TemplateEditorLayoutPreview, TemplateEditorLayoutToolbar, TemplateEditorPanelResizeHandle, TemplateEditorPanels };
94
128
  //# sourceMappingURL=TemplateEditorLayout.esm.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateEditorLayout.esm.js","sources":["../../../../src/alpha/components/TemplateEditorPage/TemplateEditorLayout.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\nimport { PropsWithChildren } from 'react';\nimport { WithStyles, withStyles } from '@material-ui/core/styles';\n\nexport const TemplateEditorLayout = withStyles(\n theme => ({\n root: {\n height: '100%',\n gridArea: 'pageContent',\n display: 'grid',\n gridTemplateAreas: `\n \"toolbar\"\n \"browser\"\n \"editor\"\n \"preview\"\n \"results\"\n `,\n [theme.breakpoints.up('md')]: {\n gridTemplateAreas: `\n \"toolbar toolbar toolbar\"\n \"browser editor preview\"\n \"results results results\"\n `,\n gridTemplateColumns: '1fr 3fr 2fr',\n gridTemplateRows: 'auto 1fr auto',\n },\n },\n }),\n { name: 'ScaffolderTemplateEditorLayout' },\n)(({ children, classes }: PropsWithChildren<WithStyles>) => (\n <main className={classes.root}>{children}</main>\n));\n\nexport const TemplateEditorLayoutToolbar = withStyles(\n {\n root: {\n gridArea: 'toolbar',\n },\n },\n { name: 'ScaffolderTemplateEditorLayoutToolbar' },\n)(({ children, classes }: PropsWithChildren<WithStyles>) => (\n <section className={classes.root}>{children}</section>\n));\n\nexport const TemplateEditorLayoutBrowser = withStyles(\n theme => ({\n root: {\n gridArea: 'browser',\n overflow: 'auto',\n [theme.breakpoints.up('md')]: {\n borderRight: `1px solid ${theme.palette.divider}`,\n },\n },\n }),\n { name: 'ScaffolderTemplateEditorLayoutBrowser' },\n)(({ children, classes }: PropsWithChildren<WithStyles>) => (\n <section className={classes.root}>{children}</section>\n));\n\nexport const TemplateEditorLayoutFiles = withStyles(\n {\n root: {\n gridArea: 'editor',\n overflow: 'auto',\n },\n },\n { name: 'ScaffolderTemplateEditorLayoutFiles' },\n)(({ children, classes }: PropsWithChildren<WithStyles>) => (\n <section className={classes.root}>{children}</section>\n));\n\nexport const TemplateEditorLayoutPreview = withStyles(\n theme => ({\n root: {\n gridArea: 'preview',\n position: 'relative',\n backgroundColor: theme.palette.background.default,\n [theme.breakpoints.up('md')]: {\n borderLeft: `1px solid ${theme.palette.divider}`,\n },\n },\n scroll: {\n height: '100%',\n padding: theme.spacing(1),\n [theme.breakpoints.up('md')]: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n overflow: 'auto',\n },\n },\n }),\n { name: 'ScaffolderTemplateEditorLayoutPreview' },\n)(({ children, classes }: PropsWithChildren<WithStyles>) => (\n <section className={classes.root}>\n <div className={classes.scroll}>{children}</div>\n </section>\n));\n\nexport const TemplateEditorLayoutConsole = withStyles(\n {\n root: {\n gridArea: 'results',\n },\n },\n { name: 'ScaffolderTemplateEditorLayoutConsole' },\n)(({ children, classes }: PropsWithChildren<WithStyles>) => (\n <section className={classes.root}>{children}</section>\n));\n"],"names":[],"mappings":";;;AAmBO,MAAM,oBAAuB,GAAA,UAAA;AAAA,EAClC,CAAU,KAAA,MAAA;AAAA,IACR,IAAM,EAAA;AAAA,MACJ,MAAQ,EAAA,MAAA;AAAA,MACR,QAAU,EAAA,aAAA;AAAA,MACV,OAAS,EAAA,MAAA;AAAA,MACT,iBAAmB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAA,CAAA;AAAA,MAOnB,CAAC,KAAM,CAAA,WAAA,CAAY,EAAG,CAAA,IAAI,CAAC,GAAG;AAAA,QAC5B,iBAAmB,EAAA;AAAA;AAAA;AAAA;AAAA,IAAA,CAAA;AAAA,QAKnB,mBAAqB,EAAA,aAAA;AAAA,QACrB,gBAAkB,EAAA;AAAA;AACpB;AACF,GACF,CAAA;AA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AAA,EAAU,OAAQ,EAAA,qBACpB,GAAA,CAAA,SAAA,EAAA,EAAQ,SAAW,EAAA,OAAA,CAAQ,IAAO,EAAA,QAAA,EAAS,CAC7C;;;;"}
1
+ {"version":3,"file":"TemplateEditorLayout.esm.js","sources":["../../../../src/alpha/components/TemplateEditorPage/TemplateEditorLayout.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\nimport { PropsWithChildren, ReactNode } from 'react';\nimport { WithStyles, withStyles } from '@material-ui/core/styles';\nimport { PanelGroup, Panel, PanelResizeHandle } from 'react-resizable-panels';\nimport { useTheme } from '@material-ui/core/styles';\nimport useMediaQuery from '@material-ui/core/useMediaQuery';\n\nexport const TemplateEditorLayout = withStyles(\n theme => ({\n root: {\n height: '100%',\n gridArea: 'pageContent',\n display: 'grid',\n gridTemplateAreas: `\n \"toolbar\"\n \"browser\"\n \"editor\"\n \"preview\"\n \"results\"\n `,\n [theme.breakpoints.up('md')]: {\n gridTemplateAreas: `\n \"toolbar toolbar toolbar\"\n \"browser editor preview\"\n \"results results results\"\n `,\n gridTemplateColumns: '1fr 5fr',\n gridTemplateRows: 'auto 1fr auto',\n },\n },\n }),\n { name: 'ScaffolderTemplateEditorLayout' },\n)(({ children, classes }: PropsWithChildren<WithStyles>) => (\n <main className={classes.root}>{children}</main>\n));\n\nexport const TemplateEditorLayoutToolbar = withStyles(\n {\n root: {\n gridArea: 'toolbar',\n },\n },\n { name: 'ScaffolderTemplateEditorLayoutToolbar' },\n)(({ children, classes }: PropsWithChildren<WithStyles>) => (\n <section className={classes.root}>{children}</section>\n));\n\nexport const TemplateEditorLayoutBrowser = withStyles(\n theme => ({\n root: {\n gridArea: 'browser',\n overflow: 'auto',\n [theme.breakpoints.up('md')]: {\n borderRight: `1px solid ${theme.palette.divider}`,\n },\n },\n }),\n { name: 'ScaffolderTemplateEditorLayoutBrowser' },\n)(({ children, classes }: PropsWithChildren<WithStyles>) => (\n <section className={classes.root}>{children}</section>\n));\n\nexport const TemplateEditorLayoutFiles = withStyles(\n theme => ({\n root: {\n gridArea: 'editor',\n overflow: 'auto',\n [theme.breakpoints.up('md')]: {\n height: '100%',\n },\n },\n }),\n { name: 'ScaffolderTemplateEditorLayoutFiles' },\n)(({ children, classes }: PropsWithChildren<WithStyles>) => (\n <section className={classes.root}>{children}</section>\n));\n\nexport const TemplateEditorLayoutPreview = withStyles(\n theme => ({\n root: {\n gridArea: 'preview',\n position: 'relative',\n backgroundColor: theme.palette.background.default,\n [theme.breakpoints.up('md')]: {\n height: '100%',\n },\n },\n scroll: {\n height: '100%',\n padding: theme.spacing(1),\n [theme.breakpoints.up('md')]: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n overflow: 'auto',\n },\n },\n }),\n { name: 'ScaffolderTemplateEditorLayoutPreview' },\n)(({ children, classes }: PropsWithChildren<WithStyles>) => (\n <section className={classes.root}>\n <div className={classes.scroll}>{children}</div>\n </section>\n));\n\nexport const TemplateEditorLayoutConsole = withStyles(\n {\n root: {\n gridArea: 'results',\n },\n },\n { name: 'ScaffolderTemplateEditorLayoutConsole' },\n)(({ children, classes }: PropsWithChildren<WithStyles>) => (\n <section className={classes.root}>{children}</section>\n));\n\nexport const TemplateEditorPanelResizeHandle = withStyles(\n {\n root: {\n width: 8,\n cursor: 'col-resize',\n background: 'rgba(0,0,0,0.04)',\n },\n },\n { name: 'ScaffolderTemplateEditorPanelResizeHandle' },\n)(({ classes }: { classes: WithStyles['classes'] }) => (\n <PanelResizeHandle className={classes.root} />\n));\n\nexport function TemplateEditorPanels({\n files,\n preview,\n autoSaveId = 'template-editor-panels',\n}: {\n files: ReactNode;\n preview: ReactNode;\n autoSaveId?: string;\n}) {\n const theme = useTheme();\n const isMdUp = useMediaQuery(theme.breakpoints.up('md'));\n\n if (isMdUp) {\n return (\n <PanelGroup direction=\"horizontal\" autoSaveId={autoSaveId}>\n <Panel minSize={15} defaultSize={50}>\n {files}\n </Panel>\n <TemplateEditorPanelResizeHandle />\n <Panel minSize={15} defaultSize={50}>\n {preview}\n </Panel>\n </PanelGroup>\n );\n }\n // Stack as rows for small screens, just render children in a plain block\n return (\n <>\n {files}\n {preview}\n </>\n );\n}\n"],"names":[],"mappings":";;;;;AAsBO,MAAM,oBAAuB,GAAA,UAAA;AAAA,EAClC,CAAU,KAAA,MAAA;AAAA,IACR,IAAM,EAAA;AAAA,MACJ,MAAQ,EAAA,MAAA;AAAA,MACR,QAAU,EAAA,aAAA;AAAA,MACV,OAAS,EAAA,MAAA;AAAA,MACT,iBAAmB,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAA,CAAA;AAAA,MAOnB,CAAC,KAAM,CAAA,WAAA,CAAY,EAAG,CAAA,IAAI,CAAC,GAAG;AAAA,QAC5B,iBAAmB,EAAA;AAAA;AAAA;AAAA;AAAA,IAAA,CAAA;AAAA,QAKnB,mBAAqB,EAAA,SAAA;AAAA,QACrB,gBAAkB,EAAA;AAAA;AACpB;AACF,GACF,CAAA;AAAA,EACA,EAAE,MAAM,gCAAiC;AAC3C,CAAE,CAAA,CAAC,EAAE,QAAA,EAAU,OAAQ,EAAA,qBACpB,GAAA,CAAA,MAAA,EAAA,EAAK,SAAW,EAAA,OAAA,CAAQ,IAAO,EAAA,QAAA,EAAS,CAC1C;AAEM,MAAM,2BAA8B,GAAA,UAAA;AAAA,EACzC;AAAA,IACE,IAAM,EAAA;AAAA,MACJ,QAAU,EAAA;AAAA;AACZ,GACF;AAAA,EACA,EAAE,MAAM,uCAAwC;AAClD,CAAE,CAAA,CAAC,EAAE,QA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;AACd,GACF;AAAA,EACA,EAAE,MAAM,2CAA4C;AACtD,CAAE,CAAA,CAAC,EAAE,OAAQ,EAAA,yBACV,iBAAkB,EAAA,EAAA,SAAA,EAAW,OAAQ,CAAA,IAAA,EAAM,CAC7C;AAEM,SAAS,oBAAqB,CAAA;AAAA,EACnC,KAAA;AAAA,EACA,OAAA;AAAA,EACA,UAAa,GAAA;AACf,CAIG,EAAA;AACD,EAAA,MAAM,QAAQ,QAAS,EAAA;AACvB,EAAA,MAAM,SAAS,aAAc,CAAA,KAAA,CAAM,WAAY,CAAA,EAAA,CAAG,IAAI,CAAC,CAAA;AAEvD,EAAA,IAAI,MAAQ,EAAA;AACV,IAAA,uBACG,IAAA,CAAA,UAAA,EAAA,EAAW,SAAU,EAAA,YAAA,EAAa,UACjC,EAAA,QAAA,EAAA;AAAA,sBAAA,GAAA,CAAC,KAAM,EAAA,EAAA,OAAA,EAAS,EAAI,EAAA,WAAA,EAAa,IAC9B,QACH,EAAA,KAAA,EAAA,CAAA;AAAA,0BACC,+BAAgC,EAAA,EAAA,CAAA;AAAA,0BAChC,KAAM,EAAA,EAAA,OAAA,EAAS,EAAI,EAAA,WAAA,EAAa,IAC9B,QACH,EAAA,OAAA,EAAA;AAAA,KACF,EAAA,CAAA;AAAA;AAIJ,EAAA,uBAEK,IAAA,CAAA,QAAA,EAAA,EAAA,QAAA,EAAA;AAAA,IAAA,KAAA;AAAA,IACA;AAAA,GACH,EAAA,CAAA;AAEJ;;;;"}
@@ -7,7 +7,7 @@ import { makeStyles } from '@material-ui/core/styles';
7
7
  import { useApi, alertApiRef, useRouteRef } from '@backstage/core-plugin-api';
8
8
  import { catalogApiRef, humanizeEntityRef } from '@backstage/plugin-catalog-react';
9
9
  import { editRouteRef } from '../../../routes.esm.js';
10
- import { TemplateEditorLayout, TemplateEditorLayoutToolbar, TemplateEditorLayoutFiles, TemplateEditorLayoutPreview } from './TemplateEditorLayout.esm.js';
10
+ import { TemplateEditorLayout, TemplateEditorLayoutToolbar, TemplateEditorPanels, TemplateEditorLayoutFiles, TemplateEditorLayoutPreview } from './TemplateEditorLayout.esm.js';
11
11
  import { TemplateEditorToolbar } from './TemplateEditorToolbar.esm.js';
12
12
  import { TemplateEditorToolbarFileMenu } from './TemplateEditorToolbarFileMenu.esm.js';
13
13
  import { TemplateEditorToolbarTemplatesMenu } from './TemplateEditorToolbarTemplatesMenu.esm.js';
@@ -69,7 +69,7 @@ const useStyles = makeStyles(
69
69
  "textArea preview"
70
70
  `,
71
71
  gridTemplateRows: "auto 1fr",
72
- gridTemplateColumns: "1fr 1fr"
72
+ gridTemplateColumns: "1fr"
73
73
  }
74
74
  },
75
75
  files: {
@@ -148,25 +148,31 @@ const TemplateFormPreviewer = ({
148
148
  }
149
149
  )
150
150
  ] }) }),
151
- /* @__PURE__ */ jsx(TemplateEditorLayoutFiles, { classes: { root: classes.files }, children: /* @__PURE__ */ jsx(
152
- TemplateEditorTextArea,
151
+ /* @__PURE__ */ jsx(
152
+ TemplateEditorPanels,
153
153
  {
154
- content: templateYaml,
155
- onUpdate: setTemplateYaml,
156
- errorText
154
+ autoSaveId: "template-form-previewer",
155
+ files: /* @__PURE__ */ jsx(TemplateEditorLayoutFiles, { classes: { root: classes.files }, children: /* @__PURE__ */ jsx(
156
+ TemplateEditorTextArea,
157
+ {
158
+ content: templateYaml,
159
+ onUpdate: setTemplateYaml,
160
+ errorText
161
+ }
162
+ ) }),
163
+ preview: /* @__PURE__ */ jsx(TemplateEditorLayoutPreview, { children: /* @__PURE__ */ jsx(
164
+ TemplateEditorForm,
165
+ {
166
+ content: templateYaml,
167
+ contentIsSpec: true,
168
+ fieldExtensions: customFieldExtensions,
169
+ setErrorText,
170
+ layouts,
171
+ formProps
172
+ }
173
+ ) })
157
174
  }
158
- ) }),
159
- /* @__PURE__ */ jsx(TemplateEditorLayoutPreview, { children: /* @__PURE__ */ jsx(
160
- TemplateEditorForm,
161
- {
162
- content: templateYaml,
163
- contentIsSpec: true,
164
- fieldExtensions: customFieldExtensions,
165
- setErrorText,
166
- layouts,
167
- formProps
168
- }
169
- ) })
175
+ )
170
176
  ] });
171
177
  };
172
178
 
@@ -1 +1 @@
1
- {"version":3,"file":"TemplateFormPreviewer.esm.js","sources":["../../../../src/alpha/components/TemplateEditorPage/TemplateFormPreviewer.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport yaml from 'yaml';\nimport { useCallback, useState } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport useAsync from 'react-use/esm/useAsync';\n\nimport { makeStyles } from '@material-ui/core/styles';\n\nimport { alertApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport {\n catalogApiRef,\n humanizeEntityRef,\n} from '@backstage/plugin-catalog-react';\nimport {\n LayoutOptions,\n FieldExtensionOptions,\n FormProps,\n} from '@backstage/plugin-scaffolder-react';\n\nimport { editRouteRef } from '../../../routes';\n\nimport {\n TemplateEditorLayout,\n TemplateEditorLayoutToolbar,\n TemplateEditorLayoutFiles,\n TemplateEditorLayoutPreview,\n} from './TemplateEditorLayout';\nimport { TemplateEditorToolbar } from './TemplateEditorToolbar';\nimport { TemplateEditorToolbarFileMenu } from './TemplateEditorToolbarFileMenu';\nimport {\n TemplateOption,\n TemplateEditorToolbarTemplatesMenu,\n} from './TemplateEditorToolbarTemplatesMenu';\nimport { TemplateEditorForm } from './TemplateEditorForm';\nimport { TemplateEditorTextArea } from './TemplateEditorTextArea';\n\nconst EXAMPLE_TEMPLATE_PARAMS_YAML = `# Edit the template parameters below to see how they will render in the scaffolder form UI\nparameters:\n - title: Fill in some steps\n required:\n - name\n properties:\n name:\n title: Name\n type: string\n description: Unique name of the component\n owner:\n title: Owner\n type: string\n description: Owner of the component\n ui:field: OwnerPicker\n ui:options:\n catalogFilter:\n kind: Group\n - title: Choose a location\n required:\n - repoUrl\n properties:\n repoUrl:\n title: Repository Location\n type: string\n ui:field: RepoUrlPicker\n ui:options:\n allowedHosts:\n - github.com\nsteps:\n - id: fetch-base\n name: Fetch Base\n action: fetch:template\n input:\n url: ./template\n values:\n name: \\${{parameters.name}}\n`;\n\n/** @public */\nexport type ScaffolderTemplateFormPreviewerClassKey =\n | 'root'\n | 'toolbar'\n | 'controls'\n | 'textArea'\n | 'preview';\n\nconst useStyles = makeStyles(\n theme => ({\n root: {\n height: '100%',\n gridArea: 'pageContent',\n display: 'grid',\n gridTemplateAreas: `\n \"toolbar\"\n \"textArea\"\n \"preview\"\n `,\n [theme.breakpoints.up('md')]: {\n gridTemplateAreas: `\n \"toolbar toolbar\"\n \"textArea preview\"\n `,\n gridTemplateRows: 'auto 1fr',\n gridTemplateColumns: '1fr 1fr',\n },\n },\n files: {\n gridArea: 'textArea',\n },\n }),\n { name: 'ScaffolderTemplateFormPreviewer' },\n);\n\nexport const TemplateFormPreviewer = ({\n defaultPreviewTemplate = EXAMPLE_TEMPLATE_PARAMS_YAML,\n customFieldExtensions = [],\n layouts = [],\n formProps,\n}: {\n defaultPreviewTemplate?: string;\n customFieldExtensions?: FieldExtensionOptions<any, any>[];\n onClose?: () => void;\n layouts?: LayoutOptions[];\n formProps?: FormProps;\n}) => {\n const classes = useStyles();\n const alertApi = useApi(alertApiRef);\n const catalogApi = useApi(catalogApiRef);\n const navigate = useNavigate();\n const editLink = useRouteRef(editRouteRef);\n\n const [errorText, setErrorText] = useState<string>();\n const [selectedTemplate, setSelectedTemplate] = useState<TemplateOption>();\n const [templateOptions, setTemplateOptions] = useState<TemplateOption[]>([]);\n const [templateYaml, setTemplateYaml] = useState(defaultPreviewTemplate);\n\n const handleCloseDirectory = useCallback(() => {\n navigate(editLink());\n }, [navigate, editLink]);\n\n useAsync(\n () =>\n catalogApi\n .getEntities({\n filter: { kind: 'template' },\n fields: [\n 'kind',\n 'metadata.namespace',\n 'metadata.name',\n 'metadata.title',\n 'spec.parameters',\n 'spec.steps',\n 'spec.output',\n ],\n })\n .then(({ items }) =>\n setTemplateOptions(\n items.map(template => ({\n label:\n template.metadata.title ??\n humanizeEntityRef(template, { defaultKind: 'template' }),\n value: template,\n })),\n ),\n )\n .catch(e =>\n alertApi.post({\n message: `Error loading existing templates: ${e.message}`,\n severity: 'error',\n }),\n ),\n [catalogApi],\n );\n\n const handleSelectChange = useCallback(\n // TODO(Rugvip): Afaik this should be Entity, but didn't want to make runtime changes while fixing types\n (selected: TemplateOption) => {\n setSelectedTemplate(selected);\n setTemplateYaml(yaml.stringify(selected.value.spec));\n },\n [setSelectedTemplate, setTemplateYaml],\n );\n\n return (\n <TemplateEditorLayout classes={{ root: classes.root }}>\n <TemplateEditorLayoutToolbar>\n <TemplateEditorToolbar fieldExtensions={customFieldExtensions}>\n <TemplateEditorToolbarFileMenu\n onCloseDirectory={handleCloseDirectory}\n />\n <TemplateEditorToolbarTemplatesMenu\n options={templateOptions}\n selectedOption={selectedTemplate}\n onSelectOption={handleSelectChange}\n />\n </TemplateEditorToolbar>\n </TemplateEditorLayoutToolbar>\n <TemplateEditorLayoutFiles classes={{ root: classes.files }}>\n <TemplateEditorTextArea\n content={templateYaml}\n onUpdate={setTemplateYaml}\n errorText={errorText}\n />\n </TemplateEditorLayoutFiles>\n <TemplateEditorLayoutPreview>\n <TemplateEditorForm\n content={templateYaml}\n contentIsSpec\n fieldExtensions={customFieldExtensions}\n setErrorText={setErrorText}\n layouts={layouts}\n formProps={formProps}\n />\n </TemplateEditorLayoutPreview>\n </TemplateEditorLayout>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAmDA,MAAM,4BAA+B,GAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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AU,QAAS,CAAA,KAAA,CAAM,IAAI,CAAC,CAAA;AAAA,KACrD;AAAA,IACA,CAAC,qBAAqB,eAAe;AAAA,GACvC;AAEA,EAAA,4BACG,oBAAqB,EAAA,EAAA,OAAA,EAAS,EAAE,IAAM,EAAA,OAAA,CAAQ,MAC7C,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,2BACC,EAAA,EAAA,QAAA,kBAAA,IAAA,CAAC,qBAAsB,EAAA,EAAA,eAAA,EAAiB,qBACtC,EAAA,QAAA,EAAA;AAAA,sBAAA,GAAA;AAAA,QAAC,6BAAA;AAAA,QAAA;AAAA,UACC,gBAAkB,EAAA;AAAA;AAAA,OACpB;AAAA,sBACA,GAAA;AAAA,QAAC,kCAAA;AAAA,QAAA;AAAA,UACC,OAAS,EAAA,eAAA;AAAA,UACT,cAAgB,EAAA,gBAAA;AAAA,UAChB,cAAgB,EAAA;AAAA;AAAA;AAClB,KAAA,EACF,CACF,EAAA,CAAA;AAAA,wBACC,yBAA0B,EAAA,EAAA,OAAA,EAAS,EAAE,IAAM,EAAA,OAAA,CAAQ,OAClD,EAAA,QAAA,kBAAA,GAAA;AAAA,MAAC,sBAAA;AAAA,MAAA;AAAA,QACC,OAAS,EAAA,YAAA;AAAA,QACT,QAAU,EAAA,eAAA;AAAA,QACV;AAAA;AAAA,KAEJ,EAAA,CAAA;AAAA,wBACC,2BACC,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,MAAC,kBAAA;AAAA,MAAA;AAAA,QACC,OAAS,EAAA,YAAA;AAAA,QACT,aAAa,EAAA,IAAA;AAAA,QACb,eAAiB,EAAA,qBAAA;AAAA,QACjB,YAAA;AAAA,QACA,OAAA;AAAA,QACA;AAAA;AAAA,KAEJ,EAAA;AAAA,GACF,EAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"TemplateFormPreviewer.esm.js","sources":["../../../../src/alpha/components/TemplateEditorPage/TemplateFormPreviewer.tsx"],"sourcesContent":["/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport yaml from 'yaml';\nimport { useCallback, useState } from 'react';\nimport { useNavigate } from 'react-router-dom';\nimport useAsync from 'react-use/esm/useAsync';\n\nimport { makeStyles } from '@material-ui/core/styles';\n\nimport { alertApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport {\n catalogApiRef,\n humanizeEntityRef,\n} from '@backstage/plugin-catalog-react';\nimport {\n LayoutOptions,\n FieldExtensionOptions,\n FormProps,\n} from '@backstage/plugin-scaffolder-react';\n\nimport { editRouteRef } from '../../../routes';\n\nimport {\n TemplateEditorLayout,\n TemplateEditorLayoutToolbar,\n TemplateEditorLayoutFiles,\n TemplateEditorLayoutPreview,\n TemplateEditorPanels,\n} from './TemplateEditorLayout';\nimport { TemplateEditorToolbar } from './TemplateEditorToolbar';\nimport { TemplateEditorToolbarFileMenu } from './TemplateEditorToolbarFileMenu';\nimport {\n TemplateOption,\n TemplateEditorToolbarTemplatesMenu,\n} from './TemplateEditorToolbarTemplatesMenu';\nimport { TemplateEditorForm } from './TemplateEditorForm';\nimport { TemplateEditorTextArea } from './TemplateEditorTextArea';\n\nconst EXAMPLE_TEMPLATE_PARAMS_YAML = `# Edit the template parameters below to see how they will render in the scaffolder form UI\nparameters:\n - title: Fill in some steps\n required:\n - name\n properties:\n name:\n title: Name\n type: string\n description: Unique name of the component\n owner:\n title: Owner\n type: string\n description: Owner of the component\n ui:field: OwnerPicker\n ui:options:\n catalogFilter:\n kind: Group\n - title: Choose a location\n required:\n - repoUrl\n properties:\n repoUrl:\n title: Repository Location\n type: string\n ui:field: RepoUrlPicker\n ui:options:\n allowedHosts:\n - github.com\nsteps:\n - id: fetch-base\n name: Fetch Base\n action: fetch:template\n input:\n url: ./template\n values:\n name: \\${{parameters.name}}\n`;\n\n/** @public */\nexport type ScaffolderTemplateFormPreviewerClassKey =\n | 'root'\n | 'toolbar'\n | 'controls'\n | 'textArea'\n | 'preview';\n\nconst useStyles = makeStyles(\n theme => ({\n root: {\n height: '100%',\n gridArea: 'pageContent',\n display: 'grid',\n gridTemplateAreas: `\n \"toolbar\"\n \"textArea\"\n \"preview\"\n `,\n [theme.breakpoints.up('md')]: {\n gridTemplateAreas: `\n \"toolbar toolbar\"\n \"textArea preview\"\n `,\n gridTemplateRows: 'auto 1fr',\n gridTemplateColumns: '1fr',\n },\n },\n files: {\n gridArea: 'textArea',\n },\n }),\n { name: 'ScaffolderTemplateFormPreviewer' },\n);\n\nexport const TemplateFormPreviewer = ({\n defaultPreviewTemplate = EXAMPLE_TEMPLATE_PARAMS_YAML,\n customFieldExtensions = [],\n layouts = [],\n formProps,\n}: {\n defaultPreviewTemplate?: string;\n customFieldExtensions?: FieldExtensionOptions<any, any>[];\n onClose?: () => void;\n layouts?: LayoutOptions[];\n formProps?: FormProps;\n}) => {\n const classes = useStyles();\n const alertApi = useApi(alertApiRef);\n const catalogApi = useApi(catalogApiRef);\n const navigate = useNavigate();\n const editLink = useRouteRef(editRouteRef);\n\n const [errorText, setErrorText] = useState<string>();\n const [selectedTemplate, setSelectedTemplate] = useState<TemplateOption>();\n const [templateOptions, setTemplateOptions] = useState<TemplateOption[]>([]);\n const [templateYaml, setTemplateYaml] = useState(defaultPreviewTemplate);\n\n const handleCloseDirectory = useCallback(() => {\n navigate(editLink());\n }, [navigate, editLink]);\n\n useAsync(\n () =>\n catalogApi\n .getEntities({\n filter: { kind: 'template' },\n fields: [\n 'kind',\n 'metadata.namespace',\n 'metadata.name',\n 'metadata.title',\n 'spec.parameters',\n 'spec.steps',\n 'spec.output',\n ],\n })\n .then(({ items }) =>\n setTemplateOptions(\n items.map(template => ({\n label:\n template.metadata.title ??\n humanizeEntityRef(template, { defaultKind: 'template' }),\n value: template,\n })),\n ),\n )\n .catch(e =>\n alertApi.post({\n message: `Error loading existing templates: ${e.message}`,\n severity: 'error',\n }),\n ),\n [catalogApi],\n );\n\n const handleSelectChange = useCallback(\n // TODO(Rugvip): Afaik this should be Entity, but didn't want to make runtime changes while fixing types\n (selected: TemplateOption) => {\n setSelectedTemplate(selected);\n setTemplateYaml(yaml.stringify(selected.value.spec));\n },\n [setSelectedTemplate, setTemplateYaml],\n );\n\n return (\n <TemplateEditorLayout classes={{ root: classes.root }}>\n <TemplateEditorLayoutToolbar>\n <TemplateEditorToolbar fieldExtensions={customFieldExtensions}>\n <TemplateEditorToolbarFileMenu\n onCloseDirectory={handleCloseDirectory}\n />\n <TemplateEditorToolbarTemplatesMenu\n options={templateOptions}\n selectedOption={selectedTemplate}\n onSelectOption={handleSelectChange}\n />\n </TemplateEditorToolbar>\n </TemplateEditorLayoutToolbar>\n <TemplateEditorPanels\n autoSaveId=\"template-form-previewer\"\n files={\n <TemplateEditorLayoutFiles classes={{ root: classes.files }}>\n <TemplateEditorTextArea\n content={templateYaml}\n onUpdate={setTemplateYaml}\n errorText={errorText}\n />\n </TemplateEditorLayoutFiles>\n }\n preview={\n <TemplateEditorLayoutPreview>\n <TemplateEditorForm\n content={templateYaml}\n contentIsSpec\n fieldExtensions={customFieldExtensions}\n setErrorText={setErrorText}\n layouts={layouts}\n formProps={formProps}\n />\n </TemplateEditorLayoutPreview>\n }\n />\n </TemplateEditorLayout>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAoDA,MAAM,4BAA+B,GAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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,OAAA,EAAS,EAAE,IAAM,EAAA,OAAA,CAAQ,MAC7C,EAAA,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,2BACC,EAAA,EAAA,QAAA,kBAAA,IAAA,CAAC,qBAAsB,EAAA,EAAA,eAAA,EAAiB,qBACtC,EAAA,QAAA,EAAA;AAAA,sBAAA,GAAA;AAAA,QAAC,6BAAA;AAAA,QAAA;AAAA,UACC,gBAAkB,EAAA;AAAA;AAAA,OACpB;AAAA,sBACA,GAAA;AAAA,QAAC,kCAAA;AAAA,QAAA;AAAA,UACC,OAAS,EAAA,eAAA;AAAA,UACT,cAAgB,EAAA,gBAAA;AAAA,UAChB,cAAgB,EAAA;AAAA;AAAA;AAClB,KAAA,EACF,CACF,EAAA,CAAA;AAAA,oBACA,GAAA;AAAA,MAAC,oBAAA;AAAA,MAAA;AAAA,QACC,UAAW,EAAA,yBAAA;AAAA,QACX,KAAA,sBACG,yBAA0B,EAAA,EAAA,OAAA,EAAS,EAAE,IAAM,EAAA,OAAA,CAAQ,OAClD,EAAA,QAAA,kBAAA,GAAA;AAAA,UAAC,sBAAA;AAAA,UAAA;AAAA,YACC,OAAS,EAAA,YAAA;AAAA,YACT,QAAU,EAAA,eAAA;AAAA,YACV;AAAA;AAAA,SAEJ,EAAA,CAAA;AAAA,QAEF,OAAA,sBACG,2BACC,EAAA,EAAA,QAAA,kBAAA,GAAA;AAAA,UAAC,kBAAA;AAAA,UAAA;AAAA,YACC,OAAS,EAAA,YAAA;AAAA,YACT,aAAa,EAAA,IAAA;AAAA,YACb,eAAiB,EAAA,qBAAA;AAAA,YACjB,YAAA;AAAA,YACA,OAAA;AAAA,YACA;AAAA;AAAA,SAEJ,EAAA;AAAA;AAAA;AAEJ,GACF,EAAA,CAAA;AAEJ;;;;"}
@@ -20,7 +20,7 @@ const scaffolderPage = PageBlueprint.makeWithOverrides({
20
20
  );
21
21
  return originalFactory({
22
22
  routeRef: convertLegacyRouteRef(rootRouteRef),
23
- defaultPath: "/create",
23
+ path: "/create",
24
24
  loader: () => import('../components/Router/Router.esm.js').then(
25
25
  (m) => compatWrapper(
26
26
  /* @__PURE__ */ jsx(m.InternalRouter, { formFieldLoaders })
@@ -43,7 +43,7 @@ const repoUrlPickerFormField = FormFieldBlueprint.make({
43
43
  }
44
44
  });
45
45
  const scaffolderApi = ApiBlueprint.make({
46
- params: (define) => define({
46
+ params: (defineParams) => defineParams({
47
47
  api: scaffolderApiRef,
48
48
  deps: {
49
49
  discoveryApi: discoveryApiRef,
@@ -1 +1 @@
1
- {"version":3,"file":"extensions.esm.js","sources":["../../src/alpha/extensions.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 {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\nimport {\n NavItemBlueprint,\n PageBlueprint,\n ApiBlueprint,\n discoveryApiRef,\n fetchApiRef,\n identityApiRef,\n createExtensionInput,\n} from '@backstage/frontend-plugin-api';\nimport { rootRouteRef } from '../routes';\nimport CreateComponentIcon from '@material-ui/icons/AddCircleOutline';\nimport { FormFieldBlueprint } from '@backstage/plugin-scaffolder-react/alpha';\nimport { scmIntegrationsApiRef } from '@backstage/integration-react';\nimport { scaffolderApiRef } from '@backstage/plugin-scaffolder-react';\nimport { ScaffolderClient } from '../api';\n\nexport const scaffolderPage = PageBlueprint.makeWithOverrides({\n inputs: {\n formFields: createExtensionInput([\n FormFieldBlueprint.dataRefs.formFieldLoader,\n ]),\n },\n factory(originalFactory, { inputs }) {\n const formFieldLoaders = inputs.formFields.map(i =>\n i.get(FormFieldBlueprint.dataRefs.formFieldLoader),\n );\n return originalFactory({\n routeRef: convertLegacyRouteRef(rootRouteRef),\n defaultPath: '/create',\n loader: () =>\n import('../components/Router/Router').then(m =>\n compatWrapper(\n <m.InternalRouter formFieldLoaders={formFieldLoaders} />,\n ),\n ),\n });\n },\n});\n\nexport const scaffolderNavItem = NavItemBlueprint.make({\n params: {\n routeRef: convertLegacyRouteRef(rootRouteRef),\n title: 'Create...',\n icon: CreateComponentIcon,\n },\n});\n\nexport const repoUrlPickerFormField = FormFieldBlueprint.make({\n name: 'repo-url-picker',\n params: {\n field: () => import('./fields/RepoUrlPicker').then(m => m.RepoUrlPicker),\n },\n});\n\nexport const scaffolderApi = ApiBlueprint.make({\n params: define =>\n define({\n api: scaffolderApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n scmIntegrationsApi: scmIntegrationsApiRef,\n fetchApi: fetchApiRef,\n identityApi: identityApiRef,\n },\n factory: ({ discoveryApi, scmIntegrationsApi, fetchApi, identityApi }) =>\n new ScaffolderClient({\n discoveryApi,\n scmIntegrationsApi,\n fetchApi,\n identityApi,\n }),\n }),\n});\n"],"names":[],"mappings":";;;;;;;;;;AAoCa,MAAA,cAAA,GAAiB,cAAc,iBAAkB,CAAA;AAAA,EAC5D,MAAQ,EAAA;AAAA,IACN,YAAY,oBAAqB,CAAA;AAAA,MAC/B,mBAAmB,QAAS,CAAA;AAAA,KAC7B;AAAA,GACH;AAAA,EACA,OAAQ,CAAA,eAAA,EAAiB,EAAE,MAAA,EAAU,EAAA;AACnC,IAAM,MAAA,gBAAA,GAAmB,OAAO,UAAW,CAAA,GAAA;AAAA,MAAI,CAC7C,CAAA,KAAA,CAAA,CAAE,GAAI,CAAA,kBAAA,CAAmB,SAAS,eAAe;AAAA,KACnD;AACA,IAAA,OAAO,eAAgB,CAAA;AAAA,MACrB,QAAA,EAAU,sBAAsB,YAAY,CAAA;AAAA,MAC5C,WAAa,EAAA,SAAA;AAAA,MACb,MAAQ,EAAA,MACN,OAAO,oCAA6B,CAAE,CAAA,IAAA;AAAA,QAAK,CACzC,CAAA,KAAA,aAAA;AAAA,0BACG,GAAA,CAAA,CAAA,CAAE,cAAF,EAAA,EAAiB,gBAAoC,EAAA;AAAA;AACxD;AACF,KACH,CAAA;AAAA;AAEL,CAAC;AAEY,MAAA,iBAAA,GAAoB,iBAAiB,IAAK,CAAA;AAAA,EACrD,MAAQ,EAAA;AAAA,IACN,QAAA,EAAU,sBAAsB,YAAY,CAAA;AAAA,IAC5C,KAAO,EAAA,WAAA;AAAA,IACP,IAAM,EAAA;AAAA;AAEV,CAAC;AAEY,MAAA,sBAAA,GAAyB,mBAAmB,IAAK,CAAA;AAAA,EAC5D,IAAM,EAAA,iBAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,KAAA,EAAO,MAAM,OAAO,+BAAwB,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,aAAa;AAAA;AAE3E,CAAC;AAEY,MAAA,aAAA,GAAgB,aAAa,IAAK,CAAA;AAAA,EAC7C,MAAA,EAAQ,YACN,MAAO,CAAA;AAAA,IACL,GAAK,EAAA,gBAAA;AAAA,IACL,IAAM,EAAA;AAAA,MACJ,YAAc,EAAA,eAAA;AAAA,MACd,kBAAoB,EAAA,qBAAA;AAAA,MACpB,QAAU,EAAA,WAAA;AAAA,MACV,WAAa,EAAA;AAAA,KACf;AAAA,IACA,OAAA,EAAS,CAAC,EAAE,YAAA,EAAc,oBAAoB,QAAU,EAAA,WAAA,EACtD,KAAA,IAAI,gBAAiB,CAAA;AAAA,MACnB,YAAA;AAAA,MACA,kBAAA;AAAA,MACA,QAAA;AAAA,MACA;AAAA,KACD;AAAA,GACJ;AACL,CAAC;;;;"}
1
+ {"version":3,"file":"extensions.esm.js","sources":["../../src/alpha/extensions.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 {\n compatWrapper,\n convertLegacyRouteRef,\n} from '@backstage/core-compat-api';\nimport {\n NavItemBlueprint,\n PageBlueprint,\n ApiBlueprint,\n discoveryApiRef,\n fetchApiRef,\n identityApiRef,\n createExtensionInput,\n} from '@backstage/frontend-plugin-api';\nimport { rootRouteRef } from '../routes';\nimport CreateComponentIcon from '@material-ui/icons/AddCircleOutline';\nimport { FormFieldBlueprint } from '@backstage/plugin-scaffolder-react/alpha';\nimport { scmIntegrationsApiRef } from '@backstage/integration-react';\nimport { scaffolderApiRef } from '@backstage/plugin-scaffolder-react';\nimport { ScaffolderClient } from '../api';\n\nexport const scaffolderPage = PageBlueprint.makeWithOverrides({\n inputs: {\n formFields: createExtensionInput([\n FormFieldBlueprint.dataRefs.formFieldLoader,\n ]),\n },\n factory(originalFactory, { inputs }) {\n const formFieldLoaders = inputs.formFields.map(i =>\n i.get(FormFieldBlueprint.dataRefs.formFieldLoader),\n );\n return originalFactory({\n routeRef: convertLegacyRouteRef(rootRouteRef),\n path: '/create',\n loader: () =>\n import('../components/Router/Router').then(m =>\n compatWrapper(\n <m.InternalRouter formFieldLoaders={formFieldLoaders} />,\n ),\n ),\n });\n },\n});\n\nexport const scaffolderNavItem = NavItemBlueprint.make({\n params: {\n routeRef: convertLegacyRouteRef(rootRouteRef),\n title: 'Create...',\n icon: CreateComponentIcon,\n },\n});\n\nexport const repoUrlPickerFormField = FormFieldBlueprint.make({\n name: 'repo-url-picker',\n params: {\n field: () => import('./fields/RepoUrlPicker').then(m => m.RepoUrlPicker),\n },\n});\n\nexport const scaffolderApi = ApiBlueprint.make({\n params: defineParams =>\n defineParams({\n api: scaffolderApiRef,\n deps: {\n discoveryApi: discoveryApiRef,\n scmIntegrationsApi: scmIntegrationsApiRef,\n fetchApi: fetchApiRef,\n identityApi: identityApiRef,\n },\n factory: ({ discoveryApi, scmIntegrationsApi, fetchApi, identityApi }) =>\n new ScaffolderClient({\n discoveryApi,\n scmIntegrationsApi,\n fetchApi,\n identityApi,\n }),\n }),\n});\n"],"names":[],"mappings":";;;;;;;;;;AAoCa,MAAA,cAAA,GAAiB,cAAc,iBAAkB,CAAA;AAAA,EAC5D,MAAQ,EAAA;AAAA,IACN,YAAY,oBAAqB,CAAA;AAAA,MAC/B,mBAAmB,QAAS,CAAA;AAAA,KAC7B;AAAA,GACH;AAAA,EACA,OAAQ,CAAA,eAAA,EAAiB,EAAE,MAAA,EAAU,EAAA;AACnC,IAAM,MAAA,gBAAA,GAAmB,OAAO,UAAW,CAAA,GAAA;AAAA,MAAI,CAC7C,CAAA,KAAA,CAAA,CAAE,GAAI,CAAA,kBAAA,CAAmB,SAAS,eAAe;AAAA,KACnD;AACA,IAAA,OAAO,eAAgB,CAAA;AAAA,MACrB,QAAA,EAAU,sBAAsB,YAAY,CAAA;AAAA,MAC5C,IAAM,EAAA,SAAA;AAAA,MACN,MAAQ,EAAA,MACN,OAAO,oCAA6B,CAAE,CAAA,IAAA;AAAA,QAAK,CACzC,CAAA,KAAA,aAAA;AAAA,0BACG,GAAA,CAAA,CAAA,CAAE,cAAF,EAAA,EAAiB,gBAAoC,EAAA;AAAA;AACxD;AACF,KACH,CAAA;AAAA;AAEL,CAAC;AAEY,MAAA,iBAAA,GAAoB,iBAAiB,IAAK,CAAA;AAAA,EACrD,MAAQ,EAAA;AAAA,IACN,QAAA,EAAU,sBAAsB,YAAY,CAAA;AAAA,IAC5C,KAAO,EAAA,WAAA;AAAA,IACP,IAAM,EAAA;AAAA;AAEV,CAAC;AAEY,MAAA,sBAAA,GAAyB,mBAAmB,IAAK,CAAA;AAAA,EAC5D,IAAM,EAAA,iBAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,KAAA,EAAO,MAAM,OAAO,+BAAwB,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,aAAa;AAAA;AAE3E,CAAC;AAEY,MAAA,aAAA,GAAgB,aAAa,IAAK,CAAA;AAAA,EAC7C,MAAA,EAAQ,kBACN,YAAa,CAAA;AAAA,IACX,GAAK,EAAA,gBAAA;AAAA,IACL,IAAM,EAAA;AAAA,MACJ,YAAc,EAAA,eAAA;AAAA,MACd,kBAAoB,EAAA,qBAAA;AAAA,MACpB,QAAU,EAAA,WAAA;AAAA,MACV,WAAa,EAAA;AAAA,KACf;AAAA,IACA,OAAA,EAAS,CAAC,EAAE,YAAA,EAAc,oBAAoB,QAAU,EAAA,WAAA,EACtD,KAAA,IAAI,gBAAiB,CAAA;AAAA,MACnB,YAAA;AAAA,MACA,kBAAA;AAAA,MACA,QAAA;AAAA,MACA;AAAA,KACD;AAAA,GACJ;AACL,CAAC;;;;"}
package/dist/alpha.d.ts CHANGED
@@ -276,7 +276,7 @@ declare class DefaultScaffolderFormDecoratorsApi implements ScaffolderFormDecora
276
276
  declare const formDecoratorsApi: _backstage_frontend_plugin_api.ExtensionDefinition<{
277
277
  config: {};
278
278
  configInput: {};
279
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
279
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
280
280
  inputs: {
281
281
  formDecorators: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<ScaffolderFormDecorator, "scaffolder.form-decorator-loader", {}>, {
282
282
  singleton: false;
@@ -310,14 +310,14 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
310
310
  name: undefined;
311
311
  config: {};
312
312
  configInput: {};
313
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
313
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
314
314
  inputs: {};
315
315
  params: <TApi, TImpl extends TApi, TDeps extends { [name in string]: unknown; }>(params: _backstage_frontend_plugin_api.ApiFactory<TApi, TImpl, TDeps>) => _backstage_frontend_plugin_api.ExtensionBlueprintParams<_backstage_frontend_plugin_api.AnyApiFactory>;
316
316
  }>;
317
317
  "api:scaffolder/form-decorators": _backstage_frontend_plugin_api.ExtensionDefinition<{
318
318
  config: {};
319
319
  configInput: {};
320
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
320
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
321
321
  inputs: {
322
322
  formDecorators: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_plugin_scaffolder_react_alpha.ScaffolderFormDecorator, "scaffolder.form-decorator-loader", {}>, {
323
323
  singleton: false;
@@ -331,7 +331,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
331
331
  "api:scaffolder/form-fields": _backstage_frontend_plugin_api.ExtensionDefinition<{
332
332
  config: {};
333
333
  configInput: {};
334
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
334
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.AnyApiFactory, "core.api.factory", {}>;
335
335
  inputs: {
336
336
  formFields: _backstage_frontend_plugin_api.ExtensionInput<_backstage_frontend_plugin_api.ConfigurableExtensionDataRef<() => Promise<_backstage_plugin_scaffolder_react_alpha.FormField>, "scaffolder.form-field-loader", {}>, {
337
337
  singleton: false;
@@ -355,11 +355,11 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
355
355
  label?: string | undefined;
356
356
  title?: string | undefined;
357
357
  };
358
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
358
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<(entity: _backstage_catalog_model.Entity) => boolean, "catalog.entity-filter-function", {
359
359
  optional: true;
360
- }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "catalog.entity-filter-expression", {
360
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<string, "catalog.entity-filter-expression", {
361
361
  optional: true;
362
- }> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<() => _backstage_core_components.IconLinkVerticalProps, "entity-icon-link-props", {}>;
362
+ }> | _backstage_frontend_plugin_api.ExtensionDataRef<() => _backstage_core_components.IconLinkVerticalProps, "entity-icon-link-props", {}>;
363
363
  inputs: {};
364
364
  params: {
365
365
  useProps: () => Omit<_backstage_core_components.IconLinkVerticalProps, "color">;
@@ -371,7 +371,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
371
371
  name: undefined;
372
372
  config: {};
373
373
  configInput: {};
374
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<{
374
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<{
375
375
  title: string;
376
376
  icon: _backstage_core_plugin_api.IconComponent;
377
377
  routeRef: _backstage_frontend_plugin_api.RouteRef<undefined>;
@@ -390,7 +390,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
390
390
  configInput: {
391
391
  path?: string | undefined;
392
392
  };
393
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
393
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<string, "core.routing.path", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<react.JSX.Element, "core.reactElement", {}> | _backstage_frontend_plugin_api.ExtensionDataRef<_backstage_frontend_plugin_api.RouteRef<_backstage_frontend_plugin_api.AnyRouteRefParams>, "core.routing.ref", {
394
394
  optional: true;
395
395
  }>;
396
396
  inputs: {
@@ -402,7 +402,8 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
402
402
  kind: "page";
403
403
  name: undefined;
404
404
  params: {
405
- defaultPath: string;
405
+ defaultPath?: [Error: `Use the 'path' param instead`];
406
+ path: string;
406
407
  loader: () => Promise<JSX.Element>;
407
408
  routeRef?: _backstage_frontend_plugin_api.RouteRef;
408
409
  };
@@ -412,7 +413,7 @@ declare const _default: _backstage_frontend_plugin_api.FrontendPlugin<{
412
413
  name: "repo-url-picker";
413
414
  config: {};
414
415
  configInput: {};
415
- output: _backstage_frontend_plugin_api.ConfigurableExtensionDataRef<() => Promise<_backstage_plugin_scaffolder_react_alpha.FormField>, "scaffolder.form-field-loader", {}>;
416
+ output: _backstage_frontend_plugin_api.ExtensionDataRef<() => Promise<_backstage_plugin_scaffolder_react_alpha.FormField>, "scaffolder.form-field-loader", {}>;
416
417
  inputs: {};
417
418
  params: {
418
419
  field: () => Promise<_backstage_plugin_scaffolder_react_alpha.FormField>;
@@ -1,5 +1,5 @@
1
1
  var name = "@backstage/plugin-scaffolder";
2
- var version = "1.34.0-next.1";
2
+ var version = "1.34.0-next.3";
3
3
  var description = "The Backstage plugin that helps you create new things";
4
4
  var backstage = {
5
5
  role: "frontend-plugin",
@@ -95,6 +95,7 @@ var dependencies = {
95
95
  luxon: "^3.0.0",
96
96
  qs: "^6.9.4",
97
97
  "react-resizable": "^3.0.5",
98
+ "react-resizable-panels": "^3.0.4",
98
99
  "react-use": "^17.2.4",
99
100
  "react-window": "^1.8.10",
100
101
  yaml: "^2.0.0",
@@ -1 +1 @@
1
- {"version":3,"file":"package.json.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"package.json.esm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage/plugin-scaffolder",
3
- "version": "1.34.0-next.1",
3
+ "version": "1.34.0-next.3",
4
4
  "description": "The Backstage plugin that helps you create new things",
5
5
  "backstage": {
6
6
  "role": "frontend-plugin",
@@ -72,15 +72,15 @@
72
72
  "dependencies": {
73
73
  "@backstage/catalog-client": "1.11.0-next.0",
74
74
  "@backstage/catalog-model": "1.7.5",
75
- "@backstage/core-compat-api": "0.4.5-next.1",
76
- "@backstage/core-components": "0.17.5-next.0",
75
+ "@backstage/core-compat-api": "0.5.0-next.3",
76
+ "@backstage/core-components": "0.17.5-next.2",
77
77
  "@backstage/core-plugin-api": "1.10.9",
78
78
  "@backstage/errors": "1.2.7",
79
- "@backstage/frontend-plugin-api": "0.11.0-next.0",
79
+ "@backstage/frontend-plugin-api": "0.11.0-next.2",
80
80
  "@backstage/integration": "1.17.1",
81
81
  "@backstage/integration-react": "1.2.9",
82
82
  "@backstage/plugin-catalog-common": "1.1.5",
83
- "@backstage/plugin-catalog-react": "1.20.0-next.1",
83
+ "@backstage/plugin-catalog-react": "1.20.0-next.2",
84
84
  "@backstage/plugin-permission-react": "0.4.36",
85
85
  "@backstage/plugin-scaffolder-common": "1.7.0-next.0",
86
86
  "@backstage/plugin-scaffolder-react": "1.19.0-next.1",
@@ -108,6 +108,7 @@
108
108
  "luxon": "^3.0.0",
109
109
  "qs": "^6.9.4",
110
110
  "react-resizable": "^3.0.5",
111
+ "react-resizable-panels": "^3.0.4",
111
112
  "react-use": "^17.2.4",
112
113
  "react-window": "^1.8.10",
113
114
  "yaml": "^2.0.0",
@@ -115,10 +116,10 @@
115
116
  "zod-to-json-schema": "^3.20.4"
116
117
  },
117
118
  "devDependencies": {
118
- "@backstage/cli": "0.33.2-next.0",
119
+ "@backstage/cli": "0.34.0-next.2",
119
120
  "@backstage/core-app-api": "1.18.0",
120
121
  "@backstage/dev-utils": "1.1.13-next.1",
121
- "@backstage/plugin-catalog": "1.31.2-next.1",
122
+ "@backstage/plugin-catalog": "1.31.2-next.2",
122
123
  "@backstage/plugin-permission-common": "0.9.1",
123
124
  "@backstage/test-utils": "1.7.11-next.0",
124
125
  "@testing-library/dom": "^10.0.0",