@baseplate-dev/project-builder-web
Version:
Web interface for constructing project builder JSON
3 lines (2 loc) • 2.34 kB
JavaScript
import{i as a}from"./_virtual___federation_fn_import-o6aKHb82.js";import{j as e}from"./jsx-runtime-D_zvdyIk.js";import{s as h,E as p}from"./index-D_oO4W9-.js";const{createTemplateExtractorSchema:f}=await a("@baseplate-dev/project-builder-lib"),{useBlockUnsavedChangesNavigate:b,useDefinitionSchema:u,useProjectDefinition:j,useResettableForm:g}=await a("@baseplate-dev/project-builder-lib/web"),{Alert:E,AlertDescription:S,AlertTitle:T,CheckboxFieldController:v,FormActionBar:w,SectionList:A,SectionListSection:L,SectionListSectionContent:R,SectionListSectionHeader:C,SectionListSectionTitle:N,TextareaFieldController:y}=await a("@baseplate-dev/ui-components"),k=function(){const{definition:l,saveDefinitionWithFeedback:r}=j(),o=l.settings.templateExtractor??{writeMetadata:!1,fileIdRegexWhitelist:""},n=u(f),i=g({resolver:h(n),defaultValues:o}),{handleSubmit:c,control:t,reset:d}=i,s=c(m=>r(x=>{x.settings.templateExtractor=m}));return b({control:t,reset:d,onSubmit:s}),p?e.jsxs("form",{className:"relative h-full max-h-full pb-(--action-bar-height)",onSubmit:s,children:[e.jsxs("div",{className:"flex h-full max-h-full flex-1 flex-col overflow-y-auto px-6",children:[e.jsx("div",{className:"sticky top-0 border-b bg-background py-6",children:e.jsx("h1",{children:"Template Extractor"})}),e.jsx(A,{children:e.jsxs(L,{children:[e.jsx(C,{children:e.jsx(N,{children:"Settings"})}),e.jsxs(R,{className:"flex max-w-md flex-col gap-4",children:[e.jsx(v,{name:"writeMetadata",label:"Write Metadata",description:"Write metadata to the project to enable template extraction",control:t}),e.jsx(y,{name:"fileIdRegexWhitelist",label:"File ID Regex Whitelist",description:"A list of file IDs to include in the template extractor metadata for generators that have a manually assigned file IDs, e.g. files generated by generators that have multiple instances. The list is delimited by a newline and must be a valid regex.",control:t})]})]})})]}),e.jsx(w,{form:i})]}):e.jsxs(E,{variant:"error",className:"mx-auto my-16 max-w-2xl",children:[e.jsx(T,{children:"Template Extractor is disabled"}),e.jsxs(S,{children:["Template extractor is disabled in the environment. Please enable it with ",e.jsx("code",{children:"VITE_ENABLE_TEMPLATE_EXTRACTOR=true"})," to use it."]})]})};export{k as component};
//# sourceMappingURL=template-extractor-CNC2N5ui.js.map