@baseplate-dev/project-builder-web 0.2.3 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (112) hide show
  1. package/dist/assets/-constants-CyTNHADu.js +4 -0
  2. package/dist/assets/-constants-CyTNHADu.js.map +1 -0
  3. package/dist/assets/__federation_shared_@baseplate-dev/project-builder-lib/{web-BXxolMLm.js → web-dPVRSC8L.js} +2 -2
  4. package/dist/assets/__federation_shared_@baseplate-dev/project-builder-lib/{web-BXxolMLm.js.map → web-dPVRSC8L.js.map} +1 -1
  5. package/dist/assets/__federation_shared_@baseplate-dev/project-builder-lib-DnM8acZf.js +5 -0
  6. package/dist/assets/__federation_shared_@baseplate-dev/project-builder-lib-DnM8acZf.js.map +1 -0
  7. package/dist/assets/__federation_shared_@baseplate-dev/{ui-components-DGE1buQ-.js → ui-components-z-HwX7Wv.js} +4 -4
  8. package/dist/assets/__federation_shared_@baseplate-dev/ui-components-z-HwX7Wv.js.map +1 -0
  9. package/dist/assets/{_virtual___federation_fn_import-CE3p-l_2.js → _virtual___federation_fn_import-DK_YYIlv.js} +2 -2
  10. package/dist/assets/{_virtual___federation_fn_import-CE3p-l_2.js.map → _virtual___federation_fn_import-DK_YYIlv.js.map} +1 -1
  11. package/dist/assets/{backend-BAEsy0fr.js → backend-B_UhUC1z.js} +2 -2
  12. package/dist/assets/{backend-BAEsy0fr.js.map → backend-B_UhUC1z.js.map} +1 -1
  13. package/dist/assets/{badge-with-type-label-BuG6yCtf.js → badge-with-type-label-Cvf-Kq7s.js} +2 -2
  14. package/dist/assets/{badge-with-type-label-BuG6yCtf.js.map → badge-with-type-label-Cvf-Kq7s.js.map} +1 -1
  15. package/dist/assets/{edit._id-DPcGRUbG.js → edit._id-TYAWf8Zb.js} +2 -2
  16. package/dist/assets/{edit._id-DPcGRUbG.js.map → edit._id-TYAWf8Zb.js.map} +1 -1
  17. package/dist/assets/{enum-info-form-BjI1ArPU.js → enum-info-form-CfQbLUQ3.js} +2 -2
  18. package/dist/assets/{enum-info-form-BjI1ArPU.js.map → enum-info-form-CfQbLUQ3.js.map} +1 -1
  19. package/dist/assets/{graphql-DksHNLLL.js → graphql-DTRjqtIq.js} +2 -2
  20. package/dist/assets/{graphql-DksHNLLL.js.map → graphql-DTRjqtIq.js.map} +1 -1
  21. package/dist/assets/{hierarchy-BwshirJR.js → hierarchy-BDu76BxG.js} +2 -2
  22. package/dist/assets/{hierarchy-BwshirJR.js.map → hierarchy-BDu76BxG.js.map} +1 -1
  23. package/dist/assets/{immer-xieDw-3D.js → immer-BOh2djD_.js} +2 -2
  24. package/dist/assets/{immer-xieDw-3D.js.map → immer-BOh2djD_.js.map} +1 -1
  25. package/dist/assets/{index-CVRvV2mv.js → index-01LAxHjt.js} +2 -2
  26. package/dist/assets/{index-CVRvV2mv.js.map → index-01LAxHjt.js.map} +1 -1
  27. package/dist/assets/{index-gE__lQ6b.js → index-B7G2CMwL.js} +4 -4
  28. package/dist/assets/{index-gE__lQ6b.js.map → index-B7G2CMwL.js.map} +1 -1
  29. package/dist/assets/{index-BS45dlQs.js → index-BgFEd-vA.js} +2 -2
  30. package/dist/assets/{index-BS45dlQs.js.map → index-BgFEd-vA.js.map} +1 -1
  31. package/dist/assets/index-BkkIaDrq.js +2 -0
  32. package/dist/assets/index-BkkIaDrq.js.map +1 -0
  33. package/dist/assets/{index-BNK4j9mt.js → index-CKCJuR7p.js} +2 -2
  34. package/dist/assets/{index-BNK4j9mt.js.map → index-CKCJuR7p.js.map} +1 -1
  35. package/dist/assets/{index-E5Zy1ClF.js → index-Cg4QKyV6.js} +2 -2
  36. package/dist/assets/{index-E5Zy1ClF.js.map → index-Cg4QKyV6.js.map} +1 -1
  37. package/dist/assets/{index-Dp90A2TJ.js → index-D8LleqeK.js} +2 -2
  38. package/dist/assets/{index-Dp90A2TJ.js.map → index-D8LleqeK.js.map} +1 -1
  39. package/dist/assets/{index-s17MV-9f.js → index-DITwAD5X.js} +2 -2
  40. package/dist/assets/{index-s17MV-9f.js.map → index-DITwAD5X.js.map} +1 -1
  41. package/dist/assets/{index-La9rk06J.js → index-DhWOhNFS.js} +2 -2
  42. package/dist/assets/{index-La9rk06J.js.map → index-DhWOhNFS.js.map} +1 -1
  43. package/dist/assets/index-PWrncK3R.js +2 -0
  44. package/dist/assets/index-PWrncK3R.js.map +1 -0
  45. package/dist/assets/{index-C6ezfkGk.js → index-tLZ1b0Gc.js} +2 -2
  46. package/dist/assets/{index-C6ezfkGk.js.map → index-tLZ1b0Gc.js.map} +1 -1
  47. package/dist/assets/{index.esm-CyH9wtdI.js → index.esm-Bvv3vNQh.js} +2 -2
  48. package/dist/assets/{index.esm-CyH9wtdI.js.map → index.esm-Bvv3vNQh.js.map} +1 -1
  49. package/dist/assets/{model-info-form-B9t3m8Pj.js → model-info-form-tJoD-VwE.js} +2 -2
  50. package/dist/assets/{model-info-form-B9t3m8Pj.js.map → model-info-form-tJoD-VwE.js.map} +1 -1
  51. package/dist/assets/{model-merger-DL4MVNID.js → model-merger-DuBMgrZ3.js} +2 -2
  52. package/dist/assets/{model-merger-DL4MVNID.js.map → model-merger-DuBMgrZ3.js.map} +1 -1
  53. package/dist/assets/{new-app-dialog-Cd7rJ7i5.js → new-app-dialog-CFhp6QLe.js} +2 -2
  54. package/dist/assets/{new-app-dialog-Cd7rJ7i5.js.map → new-app-dialog-CFhp6QLe.js.map} +1 -1
  55. package/dist/assets/{new-enum-dialog-Z3aWnnBr.js → new-enum-dialog-BxDxXwX_.js} +2 -2
  56. package/dist/assets/{new-enum-dialog-Z3aWnnBr.js.map → new-enum-dialog-BxDxXwX_.js.map} +1 -1
  57. package/dist/assets/new-model-dialog-D4pnLGR_.js +2 -0
  58. package/dist/assets/new-model-dialog-D4pnLGR_.js.map +1 -0
  59. package/dist/assets/{route-B2oYTZT4.js → route-BGYla1q4.js} +2 -2
  60. package/dist/assets/{route-B2oYTZT4.js.map → route-BGYla1q4.js.map} +1 -1
  61. package/dist/assets/{route-B6DRGm3t.js → route-BILZA_nq.js} +2 -2
  62. package/dist/assets/{route-B6DRGm3t.js.map → route-BILZA_nq.js.map} +1 -1
  63. package/dist/assets/{route-BzTxfPrV.js → route-BLMjDHl_.js} +2 -2
  64. package/dist/assets/{route-BzTxfPrV.js.map → route-BLMjDHl_.js.map} +1 -1
  65. package/dist/assets/{route-BwqWBMDI.js → route-CO2y2T3j.js} +2 -2
  66. package/dist/assets/{route-BwqWBMDI.js.map → route-CO2y2T3j.js.map} +1 -1
  67. package/dist/assets/route-DSICQIL3.js +2 -0
  68. package/dist/assets/{route-C8YLDv4I.js.map → route-DSICQIL3.js.map} +1 -1
  69. package/dist/assets/{route-BxjC9xAo.js → route-DYHQ0t6P.js} +2 -2
  70. package/dist/assets/{route-BxjC9xAo.js.map → route-DYHQ0t6P.js.map} +1 -1
  71. package/dist/assets/{route-_AecKyFO.js → route-DvbGaH6v.js} +2 -2
  72. package/dist/assets/{route-_AecKyFO.js.map → route-DvbGaH6v.js.map} +1 -1
  73. package/dist/assets/{route-DrufP1-c.js → route-MA2rDgPd.js} +2 -2
  74. package/dist/assets/{route-DrufP1-c.js.map → route-MA2rDgPd.js.map} +1 -1
  75. package/dist/assets/{route-BOOZxY6E.js → route-rzAviP-P.js} +2 -2
  76. package/dist/assets/{route-BOOZxY6E.js.map → route-rzAviP-P.js.map} +1 -1
  77. package/dist/assets/{sections-D-GS6uoS.js → sections-BSA71xrl.js} +2 -2
  78. package/dist/assets/{sections-D-GS6uoS.js.map → sections-BSA71xrl.js.map} +1 -1
  79. package/dist/assets/{sections._sectionKey-Bj4VmUuM.js → sections._sectionKey-DSatzih8.js} +2 -2
  80. package/dist/assets/{sections._sectionKey-Bj4VmUuM.js.map → sections._sectionKey-DSatzih8.js.map} +1 -1
  81. package/dist/assets/{service-C6FdRXxU.js → service-C0mRE7Wd.js} +2 -2
  82. package/dist/assets/{service-C6FdRXxU.js.map → service-C0mRE7Wd.js.map} +1 -1
  83. package/dist/assets/{template-extractor-D2LqkpO5.js → template-extractor-1dzSeRMo.js} +2 -2
  84. package/dist/assets/{template-extractor-D2LqkpO5.js.map → template-extractor-1dzSeRMo.js.map} +1 -1
  85. package/dist/assets/{theme-builder-_PghOvuC.js → theme-builder-NSOA1xIw.js} +2 -2
  86. package/dist/assets/{theme-builder-_PghOvuC.js.map → theme-builder-NSOA1xIw.js.map} +1 -1
  87. package/dist/assets/{use-definition-schema-B2FBXmC_.js → use-definition-schema-DOTr2MSB.js} +2 -2
  88. package/dist/assets/{use-definition-schema-B2FBXmC_.js.map → use-definition-schema-DOTr2MSB.js.map} +1 -1
  89. package/dist/assets/{use-enum-form-DQza9C6Q.js → use-enum-form-Bon-b8Oc.js} +2 -2
  90. package/dist/assets/{use-enum-form-DQza9C6Q.js.map → use-enum-form-Bon-b8Oc.js.map} +1 -1
  91. package/dist/assets/use-model-form-Bjm8n0m8.js +2 -0
  92. package/dist/assets/use-model-form-Bjm8n0m8.js.map +1 -0
  93. package/dist/assets/{utils-CH9UxfXa.js → utils-BGrwv_U7.js} +2 -2
  94. package/dist/assets/{utils-CH9UxfXa.js.map → utils-BGrwv_U7.js.map} +1 -1
  95. package/dist/assets/{web-C6Idxok-.js → web-B598C4Bq.js} +2 -2
  96. package/dist/assets/{web-C6Idxok-.js.map → web-B598C4Bq.js.map} +1 -1
  97. package/dist/index.html +5 -5
  98. package/package.json +6 -6
  99. package/dist/assets/-constants-gwObfy2j.js +0 -4
  100. package/dist/assets/-constants-gwObfy2j.js.map +0 -1
  101. package/dist/assets/__federation_shared_@baseplate-dev/project-builder-lib-CDWHycLw.js +0 -5
  102. package/dist/assets/__federation_shared_@baseplate-dev/project-builder-lib-CDWHycLw.js.map +0 -1
  103. package/dist/assets/__federation_shared_@baseplate-dev/ui-components-DGE1buQ-.js.map +0 -1
  104. package/dist/assets/index-B6qfP-Zp.js +0 -2
  105. package/dist/assets/index-B6qfP-Zp.js.map +0 -1
  106. package/dist/assets/index-CwavzuOe.js +0 -2
  107. package/dist/assets/index-CwavzuOe.js.map +0 -1
  108. package/dist/assets/new-model-dialog-uEX7hTid.js +0 -2
  109. package/dist/assets/new-model-dialog-uEX7hTid.js.map +0 -1
  110. package/dist/assets/route-C8YLDv4I.js +0 -2
  111. package/dist/assets/use-model-form-D4qoaVd7.js +0 -2
  112. package/dist/assets/use-model-form-D4qoaVd7.js.map +0 -1
@@ -0,0 +1,2 @@
1
+ import{i as r}from"./_virtual___federation_fn_import-DK_YYIlv.js";import{j as e}from"./index.esm-Bvv3vNQh.js";import{b as v,c as N,L as y,l as k,I as E,t as S}from"./index-B7G2CMwL.js";import{D as I}from"./index-BgFEd-vA.js";import{l as D}from"./utils-BGrwv_U7.js";function $(d,n,t){return`/api/plugins/${d}/${n}/static/${t}`}const{pluginEntityType:A,PluginUtils:F,webConfigSpec:b}=await r("@baseplate-dev/project-builder-lib"),{useProjectDefinition:W}=await r("@baseplate-dev/project-builder-lib/web"),{Button:f,Card:M,CardContent:L,CardDescription:T,CardHeader:z,CardTitle:H}=await r("@baseplate-dev/ui-components");function P({className:d,plugin:n,isActive:t}){const{currentProjectId:a}=v(),{saveDefinitionWithFeedbackSync:m,schemaParserContext:g,definitionContainer:p,pluginContainer:u,isSavingDefinition:o}=W(),l=N();function i(){const c=D(g.pluginStore,n,p.definition);if(c.getPluginSpec(b).getWebConfigComponent(n.id)){l({to:`/plugins/edit/${n.id}`}).catch(k);return}m(h=>{h.plugins=(h.plugins??[]).filter(x=>x.packageName!==n.packageName||x.name!==n.name),F.setPluginConfig(h,n,{},c)},{successMessage:`Enabled ${n.displayName}!`})}function s(){m(c=>{c.plugins=(c.plugins??[]).filter(j=>j.id!==A.idFromKey(n.id))},{successMessage:`Disabled ${n.displayName}!`})}const w=u.getPluginSpec(b).getWebConfigComponent(n.id);return e.jsxs(M,{className:d,children:[e.jsx(z,{children:e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center space-x-4",children:[e.jsx("div",{className:"rounded-xl border",children:n.icon&&a?e.jsx("img",{src:$(a,n.id,n.icon),className:"size-12 rounded-xl bg-muted",alt:`${n.displayName} logo`}):e.jsx(I,{className:"size-12 bg-muted p-2"})}),e.jsxs("div",{children:[e.jsx(H,{children:n.displayName}),e.jsx(T,{children:n.packageName})]})]}),e.jsx("div",{children:t?w?e.jsx(y,{to:"/plugins/edit/$id",from:"/",params:{id:n.id},children:e.jsx(f,{variant:"secondary",children:"Configure"})}):e.jsx(f,{variant:"secondary",onClick:s,disabled:o,children:"Disable"}):e.jsx(f,{variant:"secondary",onClick:i,disabled:o,children:"Enable"})})]})}),e.jsx(L,{children:e.jsx("div",{className:"text-sm",children:e.jsx("p",{children:n.description})})})]})}const{useProjectDefinition:R}=await r("@baseplate-dev/project-builder-lib/web"),{EmptyDisplay:U,ErrorableLoader:B}=await r("@baseplate-dev/ui-components"),{useEffect:K,useState:C}=await r("react"),Q=function(){const{currentProjectId:n}=v(),[t,a]=C(null),{definition:m}=R(),[g,p]=C(null);if(K(()=>{if(a(null),!!n){if(E){a([]);return}S.plugins.getAvailablePlugins.mutate({projectId:n}).then(a).catch(p)}},[n]),!t)return e.jsx(B,{error:g});if(t.length===0)return e.jsx(U,{header:"No plugins available.",subtitle:"Please install plugins via package.json."});const u=m.plugins??[],o=t.filter(i=>u.some(s=>s.packageName===i.packageName&&s.name===i.name)),l=t.filter(i=>!i.hidden&&!u.some(s=>s.packageName===i.packageName&&s.name===i.name));return e.jsxs("div",{className:"max-w-2xl space-y-4 p-4",children:[e.jsx("h1",{children:"Manage Plugins"}),e.jsx("p",{children:"Plugins are a way to extend the functionality of your project, such as adding authentication. You can enable, disable, and manage plugins from this page."}),e.jsxs("p",{children:["To add additional plugins, you can install them to your root package with ",e.jsx("strong",{children:"pnpm"}),"."]}),o.length===0?null:e.jsxs(e.Fragment,{children:[e.jsxs("h3",{children:["Active Plugins (",o.length,")"]}),o.map(i=>e.jsx(P,{plugin:i,isActive:!0},i.id))]}),l.length===0?null:e.jsxs(e.Fragment,{children:[e.jsxs("h3",{children:["Available Plugins (",l.length,")"]}),l.map(i=>e.jsx(P,{plugin:i,isActive:!1},i.id))]})]})};export{Q as component};
2
+ //# sourceMappingURL=index-BkkIaDrq.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-BkkIaDrq.js","sources":["../../src/services/plugins.ts","../../src/routes/plugins/-components/plugin-card.tsx","../../src/routes/plugins/index.tsx?tsr-split=component"],"sourcesContent":["export function getPluginStaticUrl(\n projectId: string,\n pluginId: string,\n path: string,\n): string {\n return `/api/plugins/${projectId}/${pluginId}/static/${path}`;\n}\n","import type { PluginMetadataWithPaths } from '@baseplate-dev/project-builder-lib';\nimport type React from 'react';\n\nimport {\n pluginEntityType,\n PluginUtils,\n webConfigSpec,\n} from '@baseplate-dev/project-builder-lib';\nimport { useProjectDefinition } from '@baseplate-dev/project-builder-lib/web';\nimport {\n Button,\n Card,\n CardContent,\n CardDescription,\n CardHeader,\n CardTitle,\n} from '@baseplate-dev/ui-components';\nimport { Link, useNavigate } from '@tanstack/react-router';\nimport { MdExtension } from 'react-icons/md';\n\nimport { useProjects } from '#src/hooks/use-projects.js';\nimport { logAndFormatError } from '#src/services/error-formatter.js';\nimport { getPluginStaticUrl } from '#src/services/plugins.js';\n\nimport { loadPluginImplementationStoreWithNewPlugin } from './utils.js';\n\ninterface PluginCardProps {\n className?: string;\n plugin: PluginMetadataWithPaths;\n isActive: boolean;\n}\n\nexport function PluginCard({\n className,\n plugin,\n isActive,\n}: PluginCardProps): React.JSX.Element {\n const { currentProjectId } = useProjects();\n const {\n saveDefinitionWithFeedbackSync,\n schemaParserContext,\n definitionContainer,\n pluginContainer,\n isSavingDefinition,\n } = useProjectDefinition();\n const navigate = useNavigate();\n\n function enablePlugin(): void {\n const implementations = loadPluginImplementationStoreWithNewPlugin(\n schemaParserContext.pluginStore,\n plugin,\n definitionContainer.definition,\n );\n const webConfigImplementation =\n implementations.getPluginSpec(webConfigSpec);\n const webConfig = webConfigImplementation.getWebConfigComponent(plugin.id);\n if (webConfig) {\n // redirect to plugin config page\n navigate({ to: `/plugins/edit/${plugin.id}` }).catch(logAndFormatError);\n return;\n }\n saveDefinitionWithFeedbackSync(\n (draft) => {\n // Remove any existing instance of this plugin\n draft.plugins = (draft.plugins ?? []).filter(\n (p) => p.packageName !== plugin.packageName || p.name !== plugin.name,\n );\n\n // Add the plugin with proper schema version\n PluginUtils.setPluginConfig(draft, plugin, {}, implementations);\n },\n {\n successMessage: `Enabled ${plugin.displayName}!`,\n },\n );\n }\n\n function disablePlugin(): void {\n saveDefinitionWithFeedbackSync(\n (draft) => {\n draft.plugins = (draft.plugins ?? []).filter(\n (p) => p.id !== pluginEntityType.idFromKey(plugin.id),\n );\n },\n {\n successMessage: `Disabled ${plugin.displayName}!`,\n },\n );\n }\n\n const webConfigImplementation = pluginContainer.getPluginSpec(webConfigSpec);\n const webConfig = webConfigImplementation.getWebConfigComponent(plugin.id);\n\n return (\n <Card className={className}>\n <CardHeader>\n <div className=\"flex items-center justify-between gap-4\">\n <div className=\"flex items-center space-x-4\">\n <div className=\"rounded-xl border\">\n {plugin.icon && currentProjectId ? (\n <img\n src={getPluginStaticUrl(\n currentProjectId,\n plugin.id,\n plugin.icon,\n )}\n className=\"size-12 rounded-xl bg-muted\"\n alt={`${plugin.displayName} logo`}\n />\n ) : (\n <MdExtension className=\"size-12 bg-muted p-2\" />\n )}\n </div>\n <div>\n <CardTitle>{plugin.displayName}</CardTitle>\n <CardDescription>{plugin.packageName}</CardDescription>\n </div>\n </div>\n <div>\n {(() => {\n if (!isActive) {\n return (\n <Button\n variant=\"secondary\"\n onClick={enablePlugin}\n disabled={isSavingDefinition}\n >\n Enable\n </Button>\n );\n } else if (webConfig) {\n return (\n <Link\n to={`/plugins/edit/$id`}\n from=\"/\"\n params={{ id: plugin.id }}\n >\n <Button variant=\"secondary\">Configure</Button>\n </Link>\n );\n } else {\n return (\n <Button\n variant=\"secondary\"\n onClick={disablePlugin}\n disabled={isSavingDefinition}\n >\n Disable\n </Button>\n );\n }\n })()}\n </div>\n </div>\n </CardHeader>\n <CardContent>\n <div className=\"text-sm\">\n <p>{plugin.description}</p>\n </div>\n </CardContent>\n </Card>\n );\n}\n","import type { PluginMetadataWithPaths } from '@baseplate-dev/project-builder-lib';\nimport type React from 'react';\n\nimport { useProjectDefinition } from '@baseplate-dev/project-builder-lib/web';\nimport { EmptyDisplay, ErrorableLoader } from '@baseplate-dev/ui-components';\nimport { createFileRoute } from '@tanstack/react-router';\nimport { useEffect, useState } from 'react';\n\nimport { useProjects } from '#src/hooks/use-projects.js';\nimport { IS_PREVIEW } from '#src/services/config.js';\nimport { trpc } from '#src/services/trpc.js';\n\nimport { PluginCard } from './-components/plugin-card.js';\n\nexport const Route = createFileRoute('/plugins/')({\n component: PluginsHomePage,\n});\n\nfunction PluginsHomePage(): React.JSX.Element {\n const { currentProjectId } = useProjects();\n const [plugins, setPlugins] = useState<PluginMetadataWithPaths[] | null>(\n null,\n );\n const { definition } = useProjectDefinition();\n const [error, setError] = useState<unknown>(null);\n\n useEffect(() => {\n setPlugins(null);\n if (!currentProjectId) {\n return;\n }\n if (IS_PREVIEW) {\n setPlugins([]);\n return;\n }\n trpc.plugins.getAvailablePlugins\n .mutate({ projectId: currentProjectId })\n .then(setPlugins)\n .catch(setError);\n }, [currentProjectId]);\n\n if (!plugins) {\n return <ErrorableLoader error={error} />;\n }\n\n if (plugins.length === 0) {\n return (\n <EmptyDisplay\n header=\"No plugins available.\"\n subtitle=\"Please install plugins via package.json.\"\n />\n );\n }\n\n const pluginConfig = definition.plugins ?? [];\n const installedPlugins = plugins.filter((plugin) =>\n pluginConfig.some(\n (config) =>\n config.packageName === plugin.packageName &&\n config.name === plugin.name,\n ),\n );\n const uninstalledPlugins = plugins.filter(\n (plugin) =>\n !plugin.hidden &&\n !pluginConfig.some(\n (config) =>\n config.packageName === plugin.packageName &&\n config.name === plugin.name,\n ),\n );\n\n return (\n <div className=\"max-w-2xl space-y-4 p-4\">\n <h1>Manage Plugins</h1>\n <p>\n Plugins are a way to extend the functionality of your project, such as\n adding authentication. You can enable, disable, and manage plugins from\n this page.\n </p>\n <p>\n To add additional plugins, you can install them to your root package\n with <strong>pnpm</strong>.\n </p>\n {installedPlugins.length === 0 ? null : (\n <>\n <h3>Active Plugins ({installedPlugins.length})</h3>\n {installedPlugins.map((plugin) => (\n <PluginCard key={plugin.id} plugin={plugin} isActive />\n ))}\n </>\n )}\n {uninstalledPlugins.length === 0 ? null : (\n <>\n <h3>Available Plugins ({uninstalledPlugins.length})</h3>\n {uninstalledPlugins.map((plugin) => (\n <PluginCard key={plugin.id} plugin={plugin} isActive={false} />\n ))}\n </>\n )}\n </div>\n );\n}\n"],"names":["getPluginStaticUrl","projectId","pluginId","path","pluginEntityType","PluginUtils","webConfigSpec","importShared","useProjectDefinition","Button","Card","CardContent","CardDescription","CardHeader","CardTitle","PluginCard","className","plugin","isActive","currentProjectId","useProjects","saveDefinitionWithFeedbackSync","schemaParserContext","definitionContainer","pluginContainer","isSavingDefinition","navigate","useNavigate","enablePlugin","implementations","loadPluginImplementationStoreWithNewPlugin","logAndFormatError","draft","p","disablePlugin","webConfig","jsxs","jsx","MdExtension","Link","EmptyDisplay","ErrorableLoader","useEffect","useState","SplitComponent","plugins","setPlugins","definition","error","setError","IS_PREVIEW","getAvailablePlugins","mutate","then","catch","length","pluginConfig","installedPlugins","filter","some","config","packageName","name","uninstalledPlugins","hidden","Fragment","map","id"],"mappings":"yQAAgB,SAAAA,EACdC,EACAC,EACAC,EACQ,CACR,MAAO,gBAAgBF,CAAS,IAAIC,CAAQ,WAAWC,CAAI,EAC7D,CCHA,KAAA,CAAA,iBAAAC,EAAA,YAAAC,EAAA,cAAAC,CAAA,EAAA,MAAAC,EAAA,oCAAA,EAKA,CAAA,qBAAAC,CAAA,EAAA,MAAAD,EAAA,wCAAA,EACA,CAAA,OAAAE,EAAA,KAAAC,EAAA,YAAAC,EAAA,gBAAAC,EAAA,WAAAC,EAAA,UAAAC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mBAAiBqB,EAAiBF,OAAO,GAAA,EAAC,EAC7CE,EAAiBS,IAAKjD,GACpBoB,EAAA,IAAAtB,EAAA,CAA2B,OAAAE,EAAgB,SAAQ,IAAnCA,EAAOkD,EAA4B,CACrD,CAAA,EACH,EAEDJ,EAAmBR,SAAW,EAAI,KAE/BnB,EAAAA,KAAA6B,EAAAA,SAAA,CAAA,SAAA,CAAA7B,OAAC,KAAG,CAAA,SAAA,CAAA,sBAAoB2B,EAAmBR,OAAO,GAAA,EAAC,EAClDQ,EAAmBG,IAAKjD,GACtBoB,EAAA,IAAAtB,EAAA,CAA2B,OAAAE,EAAgB,SAAU,IAArCA,EAAOkD,GACzB,CAAA,CACH,CAAA,CAAA,EAEJ,CAEJ"}
@@ -1,2 +1,2 @@
1
- import{i as n}from"./_virtual___federation_fn_import-CE3p-l_2.js";import{j as e}from"./index.esm-CyH9wtdI.js";import{N as s}from"./new-enum-dialog-Z3aWnnBr.js";const{Button:a}=await n("@baseplate-dev/ui-components"),c=function(){return e.jsxs("div",{className:"max-w-4xl space-y-4 p-4 text-style-prose",children:[e.jsx("h1",{children:"Enums"}),e.jsxs("p",{children:["Enums are a way to define a set of named values. They can be used to define a type that can only have a certain set of values. For example, you might have an enum called ",e.jsx("strong",{children:"Color"})," with values"," ",e.jsx("code",{children:"RED"}),", ",e.jsx("code",{children:"GREEN"}),", and ",e.jsx("code",{children:"BLUE"}),"."]}),e.jsxs("p",{children:["Choose an enum to edit from the sidebar or"," ",e.jsx(s,{children:e.jsx(a,{variant:"link",size:"none",children:"create a new enum"})}),"."]})]})};export{c as component};
2
- //# sourceMappingURL=index-BNK4j9mt.js.map
1
+ import{i as n}from"./_virtual___federation_fn_import-DK_YYIlv.js";import{j as e}from"./index.esm-Bvv3vNQh.js";import{N as s}from"./new-enum-dialog-BxDxXwX_.js";const{Button:a}=await n("@baseplate-dev/ui-components"),c=function(){return e.jsxs("div",{className:"max-w-4xl space-y-4 p-4 text-style-prose",children:[e.jsx("h1",{children:"Enums"}),e.jsxs("p",{children:["Enums are a way to define a set of named values. They can be used to define a type that can only have a certain set of values. For example, you might have an enum called ",e.jsx("strong",{children:"Color"})," with values"," ",e.jsx("code",{children:"RED"}),", ",e.jsx("code",{children:"GREEN"}),", and ",e.jsx("code",{children:"BLUE"}),"."]}),e.jsxs("p",{children:["Choose an enum to edit from the sidebar or"," ",e.jsx(s,{children:e.jsx(a,{variant:"link",size:"none",children:"create a new enum"})}),"."]})]})};export{c as component};
2
+ //# sourceMappingURL=index-CKCJuR7p.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-BNK4j9mt.js","sources":["../../src/routes/data/enums/index.tsx?tsr-split=component"],"sourcesContent":["import type React from 'react';\n\nimport { Button } from '@baseplate-dev/ui-components';\nimport { createFileRoute } from '@tanstack/react-router';\n\nimport { NewEnumDialog } from './-components/new-enum-dialog.js';\n\nexport const Route = createFileRoute('/data/enums/')({\n component: EnumsListPage,\n});\n\nfunction EnumsListPage(): React.JSX.Element {\n return (\n <div className=\"max-w-4xl space-y-4 p-4 text-style-prose\">\n <h1>Enums</h1>\n <p>\n Enums are a way to define a set of named values. They can be used to\n define a type that can only have a certain set of values. For example,\n you might have an enum called <strong>Color</strong> with values{' '}\n <code>RED</code>, <code>GREEN</code>, and <code>BLUE</code>.\n </p>\n <p>\n Choose an enum to edit from the sidebar or{' '}\n <NewEnumDialog>\n <Button variant=\"link\" size=\"none\">\n create a new enum\n </Button>\n </NewEnumDialog>\n .\n </p>\n </div>\n );\n}\n"],"names":["Button","importShared","SplitComponent","jsxs","jsx","NewEnumDialog"],"mappings":"gKAEA,KAAA,CAAA,OAAAA,CAAA,EAAA,MAAAC,EAAA,8BAAA,EAGiEC,EAAA,UAMrB,CAExC,OAAAC,EAAA,KAAC,MAAI,CAAA,UAAU,2CACb,SAAA,CAAAC,EAAAA,IAAC,MAAG,SAAK,OAAA,CAAA,SACR,IAAC,CAAA,SAAA,CAAA,6KAG8BA,EAAAA,IAAC,UAAO,SAAK,OAAA,CAAA,EAAS,eAAa,IACjEA,EAAAA,IAAC,QAAK,SAAG,KAAA,CAAA,EAAO,KAAEA,EAAAA,IAAC,QAAK,SAAK,OAAA,CAAA,EAAO,SAAMA,EAAAA,IAAC,QAAK,SAAI,MAAA,CAAA,EAAO,GAAA,EAC7D,SACC,IAAC,CAAA,SAAA,CAAA,6CAC2C,IAC3CA,EAAAA,IAACC,GACC,SAACD,EAAA,IAAAJ,EAAA,CAAO,QAAQ,OAAO,KAAK,OAAM,SAAA,mBAAA,CAElC,CACF,CAAA,EAAe,GAAA,CAEjB,CAAA,CAAA,EACF,CAEJ"}
1
+ {"version":3,"file":"index-CKCJuR7p.js","sources":["../../src/routes/data/enums/index.tsx?tsr-split=component"],"sourcesContent":["import type React from 'react';\n\nimport { Button } from '@baseplate-dev/ui-components';\nimport { createFileRoute } from '@tanstack/react-router';\n\nimport { NewEnumDialog } from './-components/new-enum-dialog.js';\n\nexport const Route = createFileRoute('/data/enums/')({\n component: EnumsListPage,\n});\n\nfunction EnumsListPage(): React.JSX.Element {\n return (\n <div className=\"max-w-4xl space-y-4 p-4 text-style-prose\">\n <h1>Enums</h1>\n <p>\n Enums are a way to define a set of named values. They can be used to\n define a type that can only have a certain set of values. For example,\n you might have an enum called <strong>Color</strong> with values{' '}\n <code>RED</code>, <code>GREEN</code>, and <code>BLUE</code>.\n </p>\n <p>\n Choose an enum to edit from the sidebar or{' '}\n <NewEnumDialog>\n <Button variant=\"link\" size=\"none\">\n create a new enum\n </Button>\n </NewEnumDialog>\n .\n </p>\n </div>\n );\n}\n"],"names":["Button","importShared","SplitComponent","jsxs","jsx","NewEnumDialog"],"mappings":"gKAEA,KAAA,CAAA,OAAAA,CAAA,EAAA,MAAAC,EAAA,8BAAA,EAGiEC,EAAA,UAMrB,CAExC,OAAAC,EAAA,KAAC,MAAI,CAAA,UAAU,2CACb,SAAA,CAAAC,EAAAA,IAAC,MAAG,SAAK,OAAA,CAAA,SACR,IAAC,CAAA,SAAA,CAAA,6KAG8BA,EAAAA,IAAC,UAAO,SAAK,OAAA,CAAA,EAAS,eAAa,IACjEA,EAAAA,IAAC,QAAK,SAAG,KAAA,CAAA,EAAO,KAAEA,EAAAA,IAAC,QAAK,SAAK,OAAA,CAAA,EAAO,SAAMA,EAAAA,IAAC,QAAK,SAAI,MAAA,CAAA,EAAO,GAAA,EAC7D,SACC,IAAC,CAAA,SAAA,CAAA,6CAC2C,IAC3CA,EAAAA,IAACC,GACC,SAACD,EAAA,IAAAJ,EAAA,CAAO,QAAQ,OAAO,KAAK,OAAM,SAAA,mBAAA,CAElC,CACF,CAAA,EAAe,GAAA,CAEjB,CAAA,CAAA,EACF,CAEJ"}
@@ -1,2 +1,2 @@
1
- import{i as n}from"./_virtual___federation_fn_import-CE3p-l_2.js";import{j as e}from"./index.esm-CyH9wtdI.js";import{q as v,s as w}from"./index-gE__lQ6b.js";import{u as A}from"./use-definition-schema-B2FBXmC_.js";const{authConfigSpec:L,createAdminAppSchema:R}=await n("@baseplate-dev/project-builder-lib"),{useBlockUnsavedChangesNavigate:k,useProjectDefinition:D,useResettableForm:F}=await n("@baseplate-dev/project-builder-lib/web"),{FormActionBar:P,InputFieldController:p,MultiComboboxFieldController:N,SectionList:y,SectionListSection:m,SectionListSectionContent:d,SectionListSectionDescription:u,SectionListSectionHeader:h,SectionListSectionTitle:x}=await n("@baseplate-dev/ui-components"),H=function(){const{adminDefinition:t}=v.useRouteContext(),{definition:j,saveDefinitionWithFeedback:S,pluginContainer:b}=D(),f=A(R),s=F({resolver:w(f),values:t}),{control:i,handleSubmit:g,reset:C}=s,a=g(o=>S(l=>{l.apps=l.apps.map(r=>r.id===t.id?o:r)}));k({control:i,reset:C,onSubmit:a});const c=b.getPluginSpecOptional(L)?.getAuthRoles(j).map(o=>({label:o.name,value:o.id}));return e.jsxs("form",{className:"w-full max-w-7xl space-y-4 p-4",onSubmit:a,children:[e.jsxs(y,{children:[e.jsxs(m,{children:[e.jsxs(h,{children:[e.jsx(x,{children:"General"}),e.jsx(u,{children:"Basic configuration for your admin application."})]}),e.jsxs(d,{className:"space-y-6",children:[e.jsx(p,{label:"Name",control:i,name:"name"}),e.jsx(p,{label:"Package Location (optional)",placeholder:"e.g. packages/admin",control:i,name:"packageLocation"})]})]}),c&&e.jsxs(m,{children:[e.jsxs(h,{children:[e.jsx(x,{children:"Access Control"}),e.jsx(u,{children:"Configure which user roles can access the admin application."})]}),e.jsx(d,{children:e.jsx(N,{label:"Allowed Roles",control:i,options:c,name:"allowedRoles"})})]})]}),e.jsx(P,{form:s})]})};export{H as component};
2
- //# sourceMappingURL=index-E5Zy1ClF.js.map
1
+ import{i as n}from"./_virtual___federation_fn_import-DK_YYIlv.js";import{j as e}from"./index.esm-Bvv3vNQh.js";import{q as v,s as w}from"./index-B7G2CMwL.js";import{u as A}from"./use-definition-schema-DOTr2MSB.js";const{authConfigSpec:L,createAdminAppSchema:R}=await n("@baseplate-dev/project-builder-lib"),{useBlockUnsavedChangesNavigate:k,useProjectDefinition:D,useResettableForm:F}=await n("@baseplate-dev/project-builder-lib/web"),{FormActionBar:P,InputFieldController:p,MultiComboboxFieldController:N,SectionList:y,SectionListSection:m,SectionListSectionContent:d,SectionListSectionDescription:u,SectionListSectionHeader:h,SectionListSectionTitle:x}=await n("@baseplate-dev/ui-components"),H=function(){const{adminDefinition:t}=v.useRouteContext(),{definition:j,saveDefinitionWithFeedback:S,pluginContainer:b}=D(),f=A(R),s=F({resolver:w(f),values:t}),{control:i,handleSubmit:g,reset:C}=s,a=g(o=>S(l=>{l.apps=l.apps.map(r=>r.id===t.id?o:r)}));k({control:i,reset:C,onSubmit:a});const c=b.getPluginSpecOptional(L)?.getAuthRoles(j).map(o=>({label:o.name,value:o.id}));return e.jsxs("form",{className:"w-full max-w-7xl space-y-4 p-4",onSubmit:a,children:[e.jsxs(y,{children:[e.jsxs(m,{children:[e.jsxs(h,{children:[e.jsx(x,{children:"General"}),e.jsx(u,{children:"Basic configuration for your admin application."})]}),e.jsxs(d,{className:"space-y-6",children:[e.jsx(p,{label:"Name",control:i,name:"name"}),e.jsx(p,{label:"Package Location (optional)",placeholder:"e.g. packages/admin",control:i,name:"packageLocation"})]})]}),c&&e.jsxs(m,{children:[e.jsxs(h,{children:[e.jsx(x,{children:"Access Control"}),e.jsx(u,{children:"Configure which user roles can access the admin application."})]}),e.jsx(d,{children:e.jsx(N,{label:"Allowed Roles",control:i,options:c,name:"allowedRoles"})})]})]}),e.jsx(P,{form:s})]})};export{H as component};
2
+ //# sourceMappingURL=index-Cg4QKyV6.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-E5Zy1ClF.js","sources":["../../src/routes/apps/edit.$key/admin/index.tsx?tsr-split=component"],"sourcesContent":["import type React from 'react';\n\nimport {\n authConfigSpec,\n createAdminAppSchema,\n} from '@baseplate-dev/project-builder-lib';\nimport {\n useBlockUnsavedChangesNavigate,\n useProjectDefinition,\n useResettableForm,\n} from '@baseplate-dev/project-builder-lib/web';\nimport {\n FormActionBar,\n InputFieldController,\n MultiComboboxFieldController,\n SectionList,\n SectionListSection,\n SectionListSectionContent,\n SectionListSectionDescription,\n SectionListSectionHeader,\n SectionListSectionTitle,\n} from '@baseplate-dev/ui-components';\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { createFileRoute } from '@tanstack/react-router';\n\nimport { useDefinitionSchema } from '#src/hooks/use-definition-schema.js';\n\nexport const Route = createFileRoute('/apps/edit/$key/admin/')({\n component: AdminAppEditPage,\n});\n\nfunction AdminAppEditPage(): React.JSX.Element {\n const { adminDefinition } = Route.useRouteContext();\n const { definition, saveDefinitionWithFeedback, pluginContainer } =\n useProjectDefinition();\n const adminAppSchema = useDefinitionSchema(createAdminAppSchema);\n\n const formProps = useResettableForm({\n resolver: zodResolver(adminAppSchema),\n values: adminDefinition,\n });\n const { control, handleSubmit, reset } = formProps;\n\n const onSubmit = handleSubmit((data) =>\n saveDefinitionWithFeedback((draftConfig) => {\n draftConfig.apps = draftConfig.apps.map((app) =>\n app.id === adminDefinition.id ? data : app,\n );\n }),\n );\n\n useBlockUnsavedChangesNavigate({ control, reset, onSubmit });\n\n const roleOptions = pluginContainer\n .getPluginSpecOptional(authConfigSpec)\n ?.getAuthRoles(definition)\n .map((role) => ({\n label: role.name,\n value: role.id,\n }));\n\n return (\n <form className=\"w-full max-w-7xl space-y-4 p-4\" onSubmit={onSubmit}>\n <SectionList>\n <SectionListSection>\n <SectionListSectionHeader>\n <SectionListSectionTitle>General</SectionListSectionTitle>\n <SectionListSectionDescription>\n Basic configuration for your admin application.\n </SectionListSectionDescription>\n </SectionListSectionHeader>\n <SectionListSectionContent className=\"space-y-6\">\n <InputFieldController label=\"Name\" control={control} name=\"name\" />\n <InputFieldController\n label=\"Package Location (optional)\"\n placeholder=\"e.g. packages/admin\"\n control={control}\n name=\"packageLocation\"\n />\n </SectionListSectionContent>\n </SectionListSection>\n\n {roleOptions && (\n <SectionListSection>\n <SectionListSectionHeader>\n <SectionListSectionTitle>Access Control</SectionListSectionTitle>\n <SectionListSectionDescription>\n Configure which user roles can access the admin application.\n </SectionListSectionDescription>\n </SectionListSectionHeader>\n <SectionListSectionContent>\n <MultiComboboxFieldController\n label=\"Allowed Roles\"\n control={control}\n options={roleOptions}\n name=\"allowedRoles\"\n />\n </SectionListSectionContent>\n </SectionListSection>\n )}\n </SectionList>\n <FormActionBar form={formProps} />\n </form>\n );\n}\n"],"names":["authConfigSpec","createAdminAppSchema","importShared","useBlockUnsavedChangesNavigate","useProjectDefinition","useResettableForm","FormActionBar","InputFieldController","MultiComboboxFieldController","SectionList","SectionListSection","SectionListSectionContent","SectionListSectionDescription","SectionListSectionHeader","SectionListSectionTitle","SplitComponent","adminDefinition","Route","useRouteContext","definition","saveDefinitionWithFeedback","pluginContainer","adminAppSchema","useDefinitionSchema","formProps","resolver","zodResolver","values","control","handleSubmit","reset","onSubmit","draftConfig","apps","map","app","id","data","roleOptions","getPluginSpecOptional","getAuthRoles","role","label","name","value","jsxs","jsx"],"mappings":"qNAEA,KAAA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AChCgC,EAAAA,IAAClC,GAA6B,SAE9B,iDAAA,CAAA,CAAA,EACF,EACAiC,EAAAA,KAAClC,EAA0B,CAAA,UAAU,YACnC,SAAA,CAAAmC,EAAA,IAACvC,EAAqB,CAAA,MAAM,OAAO,QAAAqB,EAAkB,KAAK,OAAM,EAChEkB,MAACvC,GACC,MAAM,8BACN,YAAY,sBACZ,QAAAqB,EACA,KAAK,iBAAiB,CAAA,CAAA,CAE1B,CAAA,CAAA,EACF,EAECU,UACE5B,EACC,CAAA,SAAA,CAAAmC,OAAChC,EACC,CAAA,SAAA,CAAAiC,EAAAA,IAAChC,GAAwB,SAAc,gBAAA,CAAA,EACvCgC,EAAAA,IAAClC,GAA6B,SAE9B,8DAAA,CAAA,CAAA,EACF,EACAkC,EAAAA,IAACnC,EACC,CAAA,SAAAmC,EAAA,IAACtC,EACC,CAAA,MAAM,gBACN,QAAAoB,EACA,QAASU,EACT,KAAK,cAAc,CAAA,CAEvB,CAAA,CAAA,CACF,CAAA,CAAA,EAEJ,EACAQ,EAAAA,IAACxC,EAAc,CAAA,KAAMkB,CAAU,CAAA,CAAA,EACjC,CAEJ"}
1
+ {"version":3,"file":"index-Cg4QKyV6.js","sources":["../../src/routes/apps/edit.$key/admin/index.tsx?tsr-split=component"],"sourcesContent":["import type React from 'react';\n\nimport {\n authConfigSpec,\n createAdminAppSchema,\n} from '@baseplate-dev/project-builder-lib';\nimport {\n useBlockUnsavedChangesNavigate,\n useProjectDefinition,\n useResettableForm,\n} from '@baseplate-dev/project-builder-lib/web';\nimport {\n FormActionBar,\n InputFieldController,\n MultiComboboxFieldController,\n SectionList,\n SectionListSection,\n SectionListSectionContent,\n SectionListSectionDescription,\n SectionListSectionHeader,\n SectionListSectionTitle,\n} from '@baseplate-dev/ui-components';\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { createFileRoute } from '@tanstack/react-router';\n\nimport { useDefinitionSchema } from '#src/hooks/use-definition-schema.js';\n\nexport const Route = createFileRoute('/apps/edit/$key/admin/')({\n component: AdminAppEditPage,\n});\n\nfunction AdminAppEditPage(): React.JSX.Element {\n const { adminDefinition } = Route.useRouteContext();\n const { definition, saveDefinitionWithFeedback, pluginContainer } =\n useProjectDefinition();\n const adminAppSchema = useDefinitionSchema(createAdminAppSchema);\n\n const formProps = useResettableForm({\n resolver: zodResolver(adminAppSchema),\n values: adminDefinition,\n });\n const { control, handleSubmit, reset } = formProps;\n\n const onSubmit = handleSubmit((data) =>\n saveDefinitionWithFeedback((draftConfig) => {\n draftConfig.apps = draftConfig.apps.map((app) =>\n app.id === adminDefinition.id ? data : app,\n );\n }),\n );\n\n useBlockUnsavedChangesNavigate({ control, reset, onSubmit });\n\n const roleOptions = pluginContainer\n .getPluginSpecOptional(authConfigSpec)\n ?.getAuthRoles(definition)\n .map((role) => ({\n label: role.name,\n value: role.id,\n }));\n\n return (\n <form className=\"w-full max-w-7xl space-y-4 p-4\" onSubmit={onSubmit}>\n <SectionList>\n <SectionListSection>\n <SectionListSectionHeader>\n <SectionListSectionTitle>General</SectionListSectionTitle>\n <SectionListSectionDescription>\n Basic configuration for your admin application.\n </SectionListSectionDescription>\n </SectionListSectionHeader>\n <SectionListSectionContent className=\"space-y-6\">\n <InputFieldController label=\"Name\" control={control} name=\"name\" />\n <InputFieldController\n label=\"Package Location (optional)\"\n placeholder=\"e.g. packages/admin\"\n control={control}\n name=\"packageLocation\"\n />\n </SectionListSectionContent>\n </SectionListSection>\n\n {roleOptions && (\n <SectionListSection>\n <SectionListSectionHeader>\n <SectionListSectionTitle>Access Control</SectionListSectionTitle>\n <SectionListSectionDescription>\n Configure which user roles can access the admin application.\n </SectionListSectionDescription>\n </SectionListSectionHeader>\n <SectionListSectionContent>\n <MultiComboboxFieldController\n label=\"Allowed Roles\"\n control={control}\n options={roleOptions}\n name=\"allowedRoles\"\n />\n </SectionListSectionContent>\n </SectionListSection>\n )}\n </SectionList>\n <FormActionBar form={formProps} />\n </form>\n );\n}\n"],"names":["authConfigSpec","createAdminAppSchema","importShared","useBlockUnsavedChangesNavigate","useProjectDefinition","useResettableForm","FormActionBar","InputFieldController","MultiComboboxFieldController","SectionList","SectionListSection","SectionListSectionContent","SectionListSectionDescription","SectionListSectionHeader","SectionListSectionTitle","SplitComponent","adminDefinition","Route","useRouteContext","definition","saveDefinitionWithFeedback","pluginContainer","adminAppSchema","useDefinitionSchema","formProps","resolver","zodResolver","values","control","handleSubmit","reset","onSubmit","draftConfig","apps","map","app","id","data","roleOptions","getPluginSpecOptional","getAuthRoles","role","label","name","value","jsxs","jsx"],"mappings":"qNAEA,KAAA,CAAA,eAAAA,EAAA,qBAAAC,CAAA,EAAA,MAAAC,EAAA,oCAAA,EAIA,CAAA,+BAAAC,EAAA,qBAAAC,EAAA,kBAAAC,CAAA,EAAA,MAAAH,EAAA,wCAAA,EAKA,CAAA,cAAAI,EAAA,qBAAAC,EAAA,6BAAAC,EAAA,YAAAC,EAAA,mBAAAC,EAAA,0BAAAC,EAAA,8BAAAC,EAAA,yBAAAC,EAAA,wBAAAC,CAAA,EAAA,MAAAZ,EAAA,8BAAA,EAc0Ea,EAAA,UAM3B,CACvC,KAAA,CAAEC,gBAAAA,CAAAA,EAAoBC,EAAMC,gBAAgB,EAC5C,CAAEC,WAAAA,EAAYC,2BAAAA,EAA4BC,gBAAAA,GAC9CjB,EAAqB,EACjBkB,EAAiBC,EAAoBtB,CAAoB,EAEzDuB,EAAYnB,EAAkB,CAClCoB,SAAUC,EAAYJ,CAAc,EACpCK,OAAQX,CAAAA,CACT,EACK,CAAEY,QAAAA,EAASC,aAAAA,EAAcC,MAAAA,CAAAA,EAAUN,EAEnCO,EAAWF,EACfT,GAAAA,EAA4CY,GAAA,CAC9BC,EAAAA,KAAOD,EAAYC,KAAKC,IAAKC,GACvCA,EAAIC,KAAOpB,EAAgBoB,GAAKC,EAAOF,CACzC,CAAA,CACD,CACH,EAE+BhC,EAAA,CAAEyB,QAAAA,EAASE,MAAAA,EAAOC,SAAAA,CAAAA,CAAU,EAErDO,MAAAA,EAAcjB,EACjBkB,sBAAsBvC,CAAc,GACnCwC,aAAarB,CAAU,EACxBe,IAAeO,IAAA,CACdC,MAAOD,EAAKE,KACZC,MAAOH,EAAKL,EAAAA,EACZ,EAEJ,OACGS,EAAAA,KAAA,OAAA,CAAK,UAAU,iCAAiC,SAAAd,EAC/C,SAAA,CAAAc,OAACpC,EACC,CAAA,SAAA,CAAAoC,OAACnC,EACC,CAAA,SAAA,CAAAmC,OAAChC,EACC,CAAA,SAAA,CAAAiC,EAAAA,IAAChC,GAAwB,SAAO,SAAA,CAAA,EAChCgC,EAAAA,IAAClC,GAA6B,SAE9B,iDAAA,CAAA,CAAA,EACF,EACAiC,EAAAA,KAAClC,EAA0B,CAAA,UAAU,YACnC,SAAA,CAAAmC,EAAA,IAACvC,EAAqB,CAAA,MAAM,OAAO,QAAAqB,EAAkB,KAAK,OAAM,EAChEkB,MAACvC,GACC,MAAM,8BACN,YAAY,sBACZ,QAAAqB,EACA,KAAK,iBAAiB,CAAA,CAAA,CAE1B,CAAA,CAAA,EACF,EAECU,UACE5B,EACC,CAAA,SAAA,CAAAmC,OAAChC,EACC,CAAA,SAAA,CAAAiC,EAAAA,IAAChC,GAAwB,SAAc,gBAAA,CAAA,EACvCgC,EAAAA,IAAClC,GAA6B,SAE9B,8DAAA,CAAA,CAAA,EACF,EACAkC,EAAAA,IAACnC,EACC,CAAA,SAAAmC,EAAA,IAACtC,EACC,CAAA,MAAM,gBACN,QAAAoB,EACA,QAASU,EACT,KAAK,cAAc,CAAA,CAEvB,CAAA,CAAA,CACF,CAAA,CAAA,EAEJ,EACAQ,EAAAA,IAACxC,EAAc,CAAA,KAAMkB,CAAU,CAAA,CAAA,EACjC,CAEJ"}
@@ -1,2 +1,2 @@
1
- import{i}from"./_virtual___federation_fn_import-CE3p-l_2.js";import{j as e}from"./index.esm-CyH9wtdI.js";import{L as p}from"./index-gE__lQ6b.js";import{h as c}from"./index-BS45dlQs.js";import{N as n}from"./new-app-dialog-Cd7rJ7i5.js";import{s as d}from"./immer-xieDw-3D.js";const{appEntityType:l}=await i("@baseplate-dev/project-builder-lib"),{useProjectDefinition:m}=await i("@baseplate-dev/project-builder-lib/web"),{Button:t,Card:h,EmptyDisplay:x}=await i("@baseplate-dev/ui-components"),v=function(){const{definition:r}=m(),{apps:o}=r,a=d(o,[s=>s.name]);return a.length===0?e.jsx(x,{icon:c,header:"No Apps",subtitle:"You haven't created any apps yet",actions:e.jsx(n,{children:e.jsx(t,{children:"New App"})})}):e.jsxs("div",{className:"space-y-4 p-4",children:[e.jsx("h1",{children:"Apps"}),e.jsx("p",{children:"These are the apps that are defined in your project. You can edit them here."}),e.jsx(n,{children:e.jsx(t,{children:"New App"})}),e.jsx("div",{className:"max-w-xl space-y-4",children:a.map(s=>e.jsxs(h,{className:"flex justify-between space-x-4 p-4",children:[e.jsxs("div",{children:[e.jsxs("h3",{children:[s.name," (",s.type,")"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.packageLocation})]}),e.jsx(p,{to:"/apps/edit/$key",from:"/",params:{key:l.keyFromId(s.id)},className:"inline-block",children:e.jsx(t,{variant:"secondary",children:"Edit"})})]},s.id))})]})};export{v as component};
2
- //# sourceMappingURL=index-Dp90A2TJ.js.map
1
+ import{i}from"./_virtual___federation_fn_import-DK_YYIlv.js";import{j as e}from"./index.esm-Bvv3vNQh.js";import{L as p}from"./index-B7G2CMwL.js";import{h as c}from"./index-BgFEd-vA.js";import{N as n}from"./new-app-dialog-CFhp6QLe.js";import{s as d}from"./immer-BOh2djD_.js";const{appEntityType:l}=await i("@baseplate-dev/project-builder-lib"),{useProjectDefinition:m}=await i("@baseplate-dev/project-builder-lib/web"),{Button:t,Card:h,EmptyDisplay:x}=await i("@baseplate-dev/ui-components"),v=function(){const{definition:r}=m(),{apps:o}=r,a=d(o,[s=>s.name]);return a.length===0?e.jsx(x,{icon:c,header:"No Apps",subtitle:"You haven't created any apps yet",actions:e.jsx(n,{children:e.jsx(t,{children:"New App"})})}):e.jsxs("div",{className:"space-y-4 p-4",children:[e.jsx("h1",{children:"Apps"}),e.jsx("p",{children:"These are the apps that are defined in your project. You can edit them here."}),e.jsx(n,{children:e.jsx(t,{children:"New App"})}),e.jsx("div",{className:"max-w-xl space-y-4",children:a.map(s=>e.jsxs(h,{className:"flex justify-between space-x-4 p-4",children:[e.jsxs("div",{children:[e.jsxs("h3",{children:[s.name," (",s.type,")"]}),e.jsx("p",{className:"text-xs text-muted-foreground",children:s.packageLocation})]}),e.jsx(p,{to:"/apps/edit/$key",from:"/",params:{key:l.keyFromId(s.id)},className:"inline-block",children:e.jsx(t,{variant:"secondary",children:"Edit"})})]},s.id))})]})};export{v as component};
2
+ //# sourceMappingURL=index-D8LleqeK.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-Dp90A2TJ.js","sources":["../../src/routes/apps/index.tsx?tsr-split=component"],"sourcesContent":["import type React from 'react';\n\nimport { appEntityType } from '@baseplate-dev/project-builder-lib';\nimport { useProjectDefinition } from '@baseplate-dev/project-builder-lib/web';\nimport { Button, Card, EmptyDisplay } from '@baseplate-dev/ui-components';\nimport { createFileRoute, Link } from '@tanstack/react-router';\nimport { sortBy } from 'es-toolkit';\nimport { MdApps } from 'react-icons/md';\n\nimport NewAppDialog from './-components/new-app-dialog.js';\n\nexport const Route = createFileRoute('/apps/')({\n component: AppsListPage,\n});\n\nfunction AppsListPage(): React.JSX.Element {\n const { definition } = useProjectDefinition();\n\n const { apps } = definition;\n const sortedApps = sortBy(apps, [(app) => app.name]);\n\n if (sortedApps.length === 0) {\n return (\n <EmptyDisplay\n icon={MdApps}\n header=\"No Apps\"\n subtitle=\"You haven't created any apps yet\"\n actions={\n <NewAppDialog>\n <Button>New App</Button>\n </NewAppDialog>\n }\n />\n );\n }\n\n return (\n <div className=\"space-y-4 p-4\">\n <h1>Apps</h1>\n <p>\n These are the apps that are defined in your project. You can edit them\n here.\n </p>\n <NewAppDialog>\n <Button>New App</Button>\n </NewAppDialog>\n <div className=\"max-w-xl space-y-4\">\n {sortedApps.map((app) => (\n <Card key={app.id} className=\"flex justify-between space-x-4 p-4\">\n <div>\n <h3>\n {app.name} ({app.type})\n </h3>\n <p className=\"text-xs text-muted-foreground\">\n {app.packageLocation}\n </p>\n </div>\n <Link\n to=\"/apps/edit/$key\"\n from=\"/\"\n params={{ key: appEntityType.keyFromId(app.id) }}\n className=\"inline-block\"\n >\n <Button variant=\"secondary\">Edit</Button>\n </Link>\n </Card>\n ))}\n </div>\n </div>\n );\n}\n"],"names":["appEntityType","importShared","useProjectDefinition","Button","Card","EmptyDisplay","SplitComponent","definition","apps","sortedApps","sortBy","app","name","length","jsx","MdApps","NewAppDialog","jsxs","map","type","packageLocation","Link","key","keyFromId","id"],"mappings":"kRAEA,KAAA,CAAA,cAAAA,CAAA,EAAA,MAAAC,EAAA,oCAAA,EACA,CAAA,qBAAAC,CAAA,EAAA,MAAAD,EAAA,wCAAA,EACA,CAAA,OAAAE,EAAA,KAAAC,EAAA,aAAAC,CAAA,EAAA,MAAAJ,EAAA,8BAAA,EAK2DK,EAAA,UAMhB,CACnC,KAAA,CAAEC,WAAAA,GAAeL,EAAqB,EAEtC,CAAEM,KAAAA,CAAAA,EAASD,EACXE,EAAaC,EAAOF,EAAM,CAAUG,GAAAA,EAAIC,IAAI,CAAC,EAE/CH,OAAAA,EAAWI,SAAW,EAErBC,EAAA,IAAAT,EAAA,CACC,KAAMU,EACN,OAAO,UACP,SAAS,mCACT,cACGC,EACC,CAAA,SAAAF,EAAAA,IAACX,EAAO,CAAA,SAAA,SAAA,CAAO,CACjB,CAAA,EAEF,EAKJc,EAAA,KAAC,MAAI,CAAA,UAAU,gBACb,SAAA,CAAAH,EAAAA,IAAC,MAAG,SAAI,MAAA,CAAA,EACRA,EAAAA,IAAC,KAAC,SAGF,8EAAA,CAAA,EACCA,MAAAE,EAAA,CACC,SAACF,EAAA,IAAAX,EAAA,CAAO,kBAAO,CAAA,EACjB,EACAW,EAAA,IAAC,MAAI,CAAA,UAAU,qBACZL,SAAAA,EAAWS,IACVP,GAAAM,EAAA,KAACb,EAAkB,CAAA,UAAU,qCAC3B,SAAA,CAAAa,OAAC,MACC,CAAA,SAAA,CAAAA,OAAC,KACEN,CAAAA,SAAAA,CAAIC,EAAAA,KAAK,KAAGD,EAAIQ,KAAK,GAAA,EACxB,EACCL,EAAA,IAAA,IAAA,CAAE,UAAU,gCACVH,WAAIS,eACP,CAAA,CAAA,EACF,QACCC,EACC,CAAA,GAAG,kBACH,KAAK,IACL,OAAQ,CAAEC,IAAKtB,EAAcuB,UAAUZ,EAAIa,EAAE,CAAE,EAC/C,UAAU,eAEV,SAAAV,MAACX,GAAO,QAAQ,YAAY,eAAI,CAAA,CAClC,CAAA,CAAA,GAhBSQ,EAAIa,EAiBf,CACD,CACH,CAAA,CAAA,EACF,CAEJ"}
1
+ {"version":3,"file":"index-D8LleqeK.js","sources":["../../src/routes/apps/index.tsx?tsr-split=component"],"sourcesContent":["import type React from 'react';\n\nimport { appEntityType } from '@baseplate-dev/project-builder-lib';\nimport { useProjectDefinition } from '@baseplate-dev/project-builder-lib/web';\nimport { Button, Card, EmptyDisplay } from '@baseplate-dev/ui-components';\nimport { createFileRoute, Link } from '@tanstack/react-router';\nimport { sortBy } from 'es-toolkit';\nimport { MdApps } from 'react-icons/md';\n\nimport NewAppDialog from './-components/new-app-dialog.js';\n\nexport const Route = createFileRoute('/apps/')({\n component: AppsListPage,\n});\n\nfunction AppsListPage(): React.JSX.Element {\n const { definition } = useProjectDefinition();\n\n const { apps } = definition;\n const sortedApps = sortBy(apps, [(app) => app.name]);\n\n if (sortedApps.length === 0) {\n return (\n <EmptyDisplay\n icon={MdApps}\n header=\"No Apps\"\n subtitle=\"You haven't created any apps yet\"\n actions={\n <NewAppDialog>\n <Button>New App</Button>\n </NewAppDialog>\n }\n />\n );\n }\n\n return (\n <div className=\"space-y-4 p-4\">\n <h1>Apps</h1>\n <p>\n These are the apps that are defined in your project. You can edit them\n here.\n </p>\n <NewAppDialog>\n <Button>New App</Button>\n </NewAppDialog>\n <div className=\"max-w-xl space-y-4\">\n {sortedApps.map((app) => (\n <Card key={app.id} className=\"flex justify-between space-x-4 p-4\">\n <div>\n <h3>\n {app.name} ({app.type})\n </h3>\n <p className=\"text-xs text-muted-foreground\">\n {app.packageLocation}\n </p>\n </div>\n <Link\n to=\"/apps/edit/$key\"\n from=\"/\"\n params={{ key: appEntityType.keyFromId(app.id) }}\n className=\"inline-block\"\n >\n <Button variant=\"secondary\">Edit</Button>\n </Link>\n </Card>\n ))}\n </div>\n </div>\n );\n}\n"],"names":["appEntityType","importShared","useProjectDefinition","Button","Card","EmptyDisplay","SplitComponent","definition","apps","sortedApps","sortBy","app","name","length","jsx","MdApps","NewAppDialog","jsxs","map","type","packageLocation","Link","key","keyFromId","id"],"mappings":"kRAEA,KAAA,CAAA,cAAAA,CAAA,EAAA,MAAAC,EAAA,oCAAA,EACA,CAAA,qBAAAC,CAAA,EAAA,MAAAD,EAAA,wCAAA,EACA,CAAA,OAAAE,EAAA,KAAAC,EAAA,aAAAC,CAAA,EAAA,MAAAJ,EAAA,8BAAA,EAK2DK,EAAA,UAMhB,CACnC,KAAA,CAAEC,WAAAA,GAAeL,EAAqB,EAEtC,CAAEM,KAAAA,CAAAA,EAASD,EACXE,EAAaC,EAAOF,EAAM,CAAUG,GAAAA,EAAIC,IAAI,CAAC,EAE/CH,OAAAA,EAAWI,SAAW,EAErBC,EAAA,IAAAT,EAAA,CACC,KAAMU,EACN,OAAO,UACP,SAAS,mCACT,cACGC,EACC,CAAA,SAAAF,EAAAA,IAACX,EAAO,CAAA,SAAA,SAAA,CAAO,CACjB,CAAA,EAEF,EAKJc,EAAA,KAAC,MAAI,CAAA,UAAU,gBACb,SAAA,CAAAH,EAAAA,IAAC,MAAG,SAAI,MAAA,CAAA,EACRA,EAAAA,IAAC,KAAC,SAGF,8EAAA,CAAA,EACCA,MAAAE,EAAA,CACC,SAACF,EAAA,IAAAX,EAAA,CAAO,kBAAO,CAAA,EACjB,EACAW,EAAA,IAAC,MAAI,CAAA,UAAU,qBACZL,SAAAA,EAAWS,IACVP,GAAAM,EAAA,KAACb,EAAkB,CAAA,UAAU,qCAC3B,SAAA,CAAAa,OAAC,MACC,CAAA,SAAA,CAAAA,OAAC,KACEN,CAAAA,SAAAA,CAAIC,EAAAA,KAAK,KAAGD,EAAIQ,KAAK,GAAA,EACxB,EACCL,EAAA,IAAA,IAAA,CAAE,UAAU,gCACVH,WAAIS,eACP,CAAA,CAAA,EACF,QACCC,EACC,CAAA,GAAG,kBACH,KAAK,IACL,OAAQ,CAAEC,IAAKtB,EAAcuB,UAAUZ,EAAIa,EAAE,CAAE,EAC/C,UAAU,eAEV,SAAAV,MAACX,GAAO,QAAQ,YAAY,eAAI,CAAA,CAClC,CAAA,CAAA,GAhBSQ,EAAIa,EAiBf,CACD,CACH,CAAA,CAAA,EACF,CAEJ"}
@@ -1,2 +1,2 @@
1
- import{i as c}from"./_virtual___federation_fn_import-CE3p-l_2.js";import{j as e,f as S,e as j}from"./index.esm-CyH9wtdI.js";import{S as v,o as f,a as L}from"./index-gE__lQ6b.js";import{u as y}from"./use-enum-form-DQza9C6Q.js";import{K as C,c as N}from"./index-BS45dlQs.js";const{SectionListSection:b,SectionListSectionContent:g,SectionListSectionHeader:w,SectionListSectionTitle:E,SwitchFieldController:V}=await c("@baseplate-dev/ui-components");function F({control:s}){return e.jsxs(b,{children:[e.jsx(w,{children:e.jsx(E,{children:"GraphQL"})}),e.jsx(g,{className:"space-y-4",children:e.jsx(V,{label:"Expose in GraphQL schema",control:s,name:"isExposed",description:"Whether to expose this enum in the GraphQL schema"})})]})}function A(s){return s.split("_").map(n=>n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()).join(" ")}const{modelEnumValueEntityType:T}=await c("@baseplate-dev/project-builder-lib"),{Button:d,InputFieldController:u,Label:p,SectionListSection:$,SectionListSectionContent:I,SectionListSectionDescription:k,SectionListSectionHeader:B,SectionListSectionTitle:D}=await c("@baseplate-dev/ui-components");function G({control:s,setValue:l}){const{fields:t,remove:n,append:r,move:a}=S({control:s,name:"values"}),o=j({control:s,name:"values"}),m="grid grid-cols-[repeat(2,minmax(130px,1fr))_80px] gap-3",x=t.map((h,i)=>({id:h.id,element:e.jsxs("div",{className:m,children:[e.jsx(u,{control:s,name:`values.${i}.name`}),e.jsx(u,{control:s,name:`values.${i}.friendlyName`,onFocus:()=>{!o[i].friendlyName&&o[i].name&&l(`values.${i}.friendlyName`,A(o[i].name))}}),e.jsxs(d,{variant:"ghost",size:"icon",onClick:()=>{n(i)},children:[e.jsx(C,{}),e.jsx("div",{className:"sr-only",children:"Delete Enum"})]})]})}));return e.jsxs($,{children:[e.jsxs(B,{children:[e.jsx(D,{children:"Values"}),e.jsx(k,{children:"Configure the allowed values for this enum."})]}),e.jsxs(I,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:N(m,"pl-12"),children:[e.jsx(p,{children:"Value Name, e.g. ACTIVE"}),e.jsx(p,{children:"Value Friendly Name, e.g. Active"}),e.jsx("div",{})]}),t.length===0?e.jsx("p",{className:"pt-4 text-style-muted",children:"Add some values to get started"}):e.jsx(v,{listItems:x,sortItems:a})]}),e.jsx(d,{size:"sm",variant:"secondary",onClick:()=>{r({id:T.generateNewId(),name:"",friendlyName:""})},children:"Add Value"})]})]})}const{useBlockUnsavedChangesNavigate:Q}=await c("@baseplate-dev/project-builder-lib/web"),{FormActionBar:H,SectionList:R}=await c("@baseplate-dev/ui-components"),_=function(){const{key:l}=f.useParams(),{form:t,onSubmit:n,isSavingDefinition:r}=y({omit:["name","featureRef"],enumKey:l}),{control:a,setValue:o}=t;return Q({control:a,reset:t.reset,onSubmit:n}),e.jsx(L,{children:e.jsxs("form",{onSubmit:n,className:"mx-4 max-w-7xl min-w-[700px] flex-1 space-y-4 pb-4",children:[e.jsxs(R,{children:[e.jsx(F,{control:a}),e.jsx(G,{control:a,setValue:o})]}),e.jsx(H,{form:t,disabled:r})]})})};export{_ as component};
2
- //# sourceMappingURL=index-s17MV-9f.js.map
1
+ import{i as c}from"./_virtual___federation_fn_import-DK_YYIlv.js";import{j as e,f as S,e as j}from"./index.esm-Bvv3vNQh.js";import{S as v,o as f,a as L}from"./index-B7G2CMwL.js";import{u as y}from"./use-enum-form-Bon-b8Oc.js";import{K as C,c as N}from"./index-BgFEd-vA.js";const{SectionListSection:b,SectionListSectionContent:g,SectionListSectionHeader:w,SectionListSectionTitle:E,SwitchFieldController:V}=await c("@baseplate-dev/ui-components");function F({control:s}){return e.jsxs(b,{children:[e.jsx(w,{children:e.jsx(E,{children:"GraphQL"})}),e.jsx(g,{className:"space-y-4",children:e.jsx(V,{label:"Expose in GraphQL schema",control:s,name:"isExposed",description:"Whether to expose this enum in the GraphQL schema"})})]})}function A(s){return s.split("_").map(n=>n.charAt(0).toUpperCase()+n.slice(1).toLowerCase()).join(" ")}const{modelEnumValueEntityType:T}=await c("@baseplate-dev/project-builder-lib"),{Button:d,InputFieldController:u,Label:p,SectionListSection:$,SectionListSectionContent:I,SectionListSectionDescription:k,SectionListSectionHeader:B,SectionListSectionTitle:D}=await c("@baseplate-dev/ui-components");function G({control:s,setValue:l}){const{fields:t,remove:n,append:r,move:a}=S({control:s,name:"values"}),o=j({control:s,name:"values"}),m="grid grid-cols-[repeat(2,minmax(130px,1fr))_80px] gap-3",x=t.map((h,i)=>({id:h.id,element:e.jsxs("div",{className:m,children:[e.jsx(u,{control:s,name:`values.${i}.name`}),e.jsx(u,{control:s,name:`values.${i}.friendlyName`,onFocus:()=>{!o[i].friendlyName&&o[i].name&&l(`values.${i}.friendlyName`,A(o[i].name))}}),e.jsxs(d,{variant:"ghost",size:"icon",onClick:()=>{n(i)},children:[e.jsx(C,{}),e.jsx("div",{className:"sr-only",children:"Delete Enum"})]})]})}));return e.jsxs($,{children:[e.jsxs(B,{children:[e.jsx(D,{children:"Values"}),e.jsx(k,{children:"Configure the allowed values for this enum."})]}),e.jsxs(I,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsxs("div",{className:N(m,"pl-12"),children:[e.jsx(p,{children:"Value Name, e.g. ACTIVE"}),e.jsx(p,{children:"Value Friendly Name, e.g. Active"}),e.jsx("div",{})]}),t.length===0?e.jsx("p",{className:"pt-4 text-style-muted",children:"Add some values to get started"}):e.jsx(v,{listItems:x,sortItems:a})]}),e.jsx(d,{size:"sm",variant:"secondary",onClick:()=>{r({id:T.generateNewId(),name:"",friendlyName:""})},children:"Add Value"})]})]})}const{useBlockUnsavedChangesNavigate:Q}=await c("@baseplate-dev/project-builder-lib/web"),{FormActionBar:H,SectionList:R}=await c("@baseplate-dev/ui-components"),_=function(){const{key:l}=f.useParams(),{form:t,onSubmit:n,isSavingDefinition:r}=y({omit:["name","featureRef"],enumKey:l}),{control:a,setValue:o}=t;return Q({control:a,reset:t.reset,onSubmit:n}),e.jsx(L,{children:e.jsxs("form",{onSubmit:n,className:"mx-4 max-w-7xl min-w-[700px] flex-1 space-y-4 pb-4",children:[e.jsxs(R,{children:[e.jsx(F,{control:a}),e.jsx(G,{control:a,setValue:o})]}),e.jsx(H,{form:t,disabled:r})]})})};export{_ as component};
2
+ //# sourceMappingURL=index-DITwAD5X.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-s17MV-9f.js","sources":["../../src/routes/data/enums/edit.$key/-components/enum-graph-ql-section.tsx","../../src/utils/casing.ts","../../src/routes/data/enums/edit.$key/-components/enum-values-section.tsx","../../src/routes/data/enums/edit.$key/index.tsx?tsr-split=component"],"sourcesContent":["import type { EnumConfig } from '@baseplate-dev/project-builder-lib';\nimport type React from 'react';\nimport type { Control } from 'react-hook-form';\n\nimport {\n SectionListSection,\n SectionListSectionContent,\n SectionListSectionHeader,\n SectionListSectionTitle,\n SwitchFieldController,\n} from '@baseplate-dev/ui-components';\n\nexport function EnumGraphQLSection({\n control,\n}: {\n control: Control<EnumConfig>;\n}): React.JSX.Element {\n return (\n <SectionListSection>\n <SectionListSectionHeader>\n <SectionListSectionTitle>GraphQL</SectionListSectionTitle>\n </SectionListSectionHeader>\n <SectionListSectionContent className=\"space-y-4\">\n <SwitchFieldController\n label=\"Expose in GraphQL schema\"\n control={control}\n name=\"isExposed\"\n description=\"Whether to expose this enum in the GraphQL schema\"\n />\n </SectionListSectionContent>\n </SectionListSection>\n );\n}\n","export function underscoreToTitleCase(str: string): string {\n // Split the string into an array of words\n const words = str.split('_');\n\n // Capitalize the first letter of each word and join them back together\n const titleCase = words\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n .join(' ');\n\n return titleCase;\n}\n","import type { EnumConfig } from '@baseplate-dev/project-builder-lib';\nimport type React from 'react';\nimport type { Control, UseFormSetValue } from 'react-hook-form';\n\nimport { modelEnumValueEntityType } from '@baseplate-dev/project-builder-lib';\nimport {\n Button,\n InputFieldController,\n Label,\n SectionListSection,\n SectionListSectionContent,\n SectionListSectionDescription,\n SectionListSectionHeader,\n SectionListSectionTitle,\n} from '@baseplate-dev/ui-components';\nimport clsx from 'clsx';\nimport { useFieldArray, useWatch } from 'react-hook-form';\nimport { MdDeleteOutline } from 'react-icons/md';\n\nimport { SortableList } from '#src/components/index.js';\nimport { underscoreToTitleCase } from '#src/utils/casing.js';\n\nexport function EnumValuesSection({\n control,\n setValue,\n}: {\n control: Control<EnumConfig>;\n setValue: UseFormSetValue<EnumConfig>;\n}): React.JSX.Element {\n const {\n fields: valueFields,\n remove: removeValue,\n append: appendValue,\n move: sortValues,\n } = useFieldArray({\n control,\n name: 'values',\n });\n\n const values = useWatch({ control, name: 'values' });\n\n const gridClassNames =\n 'grid grid-cols-[repeat(2,minmax(130px,1fr))_80px] gap-3';\n\n const valueListItems = valueFields.map((field, i) => ({\n id: field.id,\n element: (\n <div className={gridClassNames}>\n <InputFieldController control={control} name={`values.${i}.name`} />\n <InputFieldController\n control={control}\n name={`values.${i}.friendlyName`}\n onFocus={() => {\n if (!values[i].friendlyName && values[i].name) {\n setValue(\n `values.${i}.friendlyName`,\n underscoreToTitleCase(values[i].name),\n );\n }\n }}\n />\n <Button\n variant=\"ghost\"\n size=\"icon\"\n onClick={() => {\n removeValue(i);\n }}\n >\n <MdDeleteOutline />\n <div className=\"sr-only\">Delete Enum</div>\n </Button>\n </div>\n ),\n }));\n\n return (\n <SectionListSection>\n <SectionListSectionHeader>\n <SectionListSectionTitle>Values</SectionListSectionTitle>\n <SectionListSectionDescription>\n Configure the allowed values for this enum.\n </SectionListSectionDescription>\n </SectionListSectionHeader>\n <SectionListSectionContent className=\"space-y-4\">\n <div className=\"space-y-2\">\n <div\n className={clsx(\n gridClassNames,\n // account for handle in sortable list\n 'pl-12',\n )}\n >\n <Label>Value Name, e.g. ACTIVE</Label>\n <Label>Value Friendly Name, e.g. Active</Label>\n <div />\n </div>\n {valueFields.length === 0 ? (\n <p className=\"pt-4 text-style-muted\">\n Add some values to get started\n </p>\n ) : (\n <SortableList listItems={valueListItems} sortItems={sortValues} />\n )}\n </div>\n <Button\n size=\"sm\"\n variant=\"secondary\"\n onClick={() => {\n appendValue({\n id: modelEnumValueEntityType.generateNewId(),\n name: '',\n friendlyName: '',\n });\n }}\n >\n Add Value\n </Button>\n </SectionListSectionContent>\n </SectionListSection>\n );\n}\n","import type React from 'react';\n\nimport { useBlockUnsavedChangesNavigate } from '@baseplate-dev/project-builder-lib/web';\nimport { FormActionBar, SectionList } from '@baseplate-dev/ui-components';\nimport { createFileRoute } from '@tanstack/react-router';\n\nimport { ErrorBoundary } from '#src/components/index.js';\n\nimport { useEnumForm } from '../-hooks/use-enum-form.js';\nimport { EnumGraphQLSection } from './-components/enum-graph-ql-section.js';\nimport { EnumValuesSection } from './-components/enum-values-section.js';\n\nexport const Route = createFileRoute('/data/enums/edit/$key/')({\n component: EnumEditPage,\n});\n\nfunction EnumEditPage(): React.JSX.Element {\n const { key } = Route.useParams();\n const { form, onSubmit, isSavingDefinition } = useEnumForm({\n omit: ['name', 'featureRef'],\n enumKey: key,\n });\n const { control, setValue } = form;\n\n useBlockUnsavedChangesNavigate({ control, reset: form.reset, onSubmit });\n\n return (\n <ErrorBoundary>\n <form\n onSubmit={onSubmit}\n className=\"mx-4 max-w-7xl min-w-[700px] flex-1 space-y-4 pb-4\"\n >\n <SectionList>\n <EnumGraphQLSection control={control} />\n <EnumValuesSection control={control} setValue={setValue} />\n </SectionList>\n <FormActionBar form={form} disabled={isSavingDefinition} />\n </form>\n </ErrorBoundary>\n );\n}\n"],"names":["SectionListSection","SectionListSectionContent","SectionListSectionHeader","SectionListSectionTitle","SwitchFieldController","importShared","EnumGraphQLSection","control","jsx","underscoreToTitleCase","str","word","modelEnumValueEntityType","Button","InputFieldController","Label","SectionListSectionDescription","EnumValuesSection","setValue","valueFields","removeValue","appendValue","sortValues","useFieldArray","values","useWatch","gridClassNames","valueListItems","field","jsxs","MdDeleteOutline","clsx","SortableList","useBlockUnsavedChangesNavigate","FormActionBar","SectionList","SplitComponent","key","Route","useParams","form","onSubmit","isSavingDefinition","useEnumForm","omit","enumKey","reset","ErrorBoundary"],"mappings":"iRAIA,KAAA,oBAAAA,EAAA,0BAAAC,EAAA,yBAAAC,EAAAC,wBAAAA,EAAA,sBAAAC,CAAA,EAAA,MAAAC,EAAA,8BAAA,EAQO,SAASC,EAAmB,CACjC,QAAAC,CACF,EAEsB,CACpB,cACGP,EACC,CAAA,SAAA,CAAAQ,MAACN,EACC,CAAA,SAAAM,EAAA,IAACL,EAAwB,CAAA,SAAA,SAAO,CAAA,EAClC,EACAK,EAAAA,IAACP,EAA0B,CAAA,UAAU,YACnC,SAAAO,EAAA,IAACJ,EAAA,CACC,MAAM,2BACN,QAAAG,EACA,KAAK,YACL,YAAY,mDAAA,CAAA,CAEhB,CAAA,CAAA,EACF,CAEJ,CChCO,SAASE,EAAsBC,EAAqB,CASlD,OAPOA,EAAI,MAAM,GAAG,EAIxB,IAAKC,GAASA,EAAK,OAAO,CAAC,EAAE,cAAgBA,EAAK,MAAM,CAAC,EAAE,aAAa,EACxE,KAAK,GAAG,CAG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AEV,SAAA,CAAAZ,OAACM,EACC,CAAA,SAAA,CAAA3B,MAACF,GAAmB,QAAAC,EAAiB,EACrCC,EAAAA,IAACS,EAAkB,CAAA,QAAAV,EAAkB,SAAAW,CAAmB,CAAA,CAAA,EAC1D,EACCV,EAAAA,IAAA0B,EAAA,CAAc,KAAAM,EAAY,SAAUE,CAAmB,CAAA,CAAA,CAAA,CAC1D,CACF,CAAA,CAEJ"}
1
+ {"version":3,"file":"index-DITwAD5X.js","sources":["../../src/routes/data/enums/edit.$key/-components/enum-graph-ql-section.tsx","../../src/utils/casing.ts","../../src/routes/data/enums/edit.$key/-components/enum-values-section.tsx","../../src/routes/data/enums/edit.$key/index.tsx?tsr-split=component"],"sourcesContent":["import type { EnumConfig } from '@baseplate-dev/project-builder-lib';\nimport type React from 'react';\nimport type { Control } from 'react-hook-form';\n\nimport {\n SectionListSection,\n SectionListSectionContent,\n SectionListSectionHeader,\n SectionListSectionTitle,\n SwitchFieldController,\n} from '@baseplate-dev/ui-components';\n\nexport function EnumGraphQLSection({\n control,\n}: {\n control: Control<EnumConfig>;\n}): React.JSX.Element {\n return (\n <SectionListSection>\n <SectionListSectionHeader>\n <SectionListSectionTitle>GraphQL</SectionListSectionTitle>\n </SectionListSectionHeader>\n <SectionListSectionContent className=\"space-y-4\">\n <SwitchFieldController\n label=\"Expose in GraphQL schema\"\n control={control}\n name=\"isExposed\"\n description=\"Whether to expose this enum in the GraphQL schema\"\n />\n </SectionListSectionContent>\n </SectionListSection>\n );\n}\n","export function underscoreToTitleCase(str: string): string {\n // Split the string into an array of words\n const words = str.split('_');\n\n // Capitalize the first letter of each word and join them back together\n const titleCase = words\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase())\n .join(' ');\n\n return titleCase;\n}\n","import type { EnumConfig } from '@baseplate-dev/project-builder-lib';\nimport type React from 'react';\nimport type { Control, UseFormSetValue } from 'react-hook-form';\n\nimport { modelEnumValueEntityType } from '@baseplate-dev/project-builder-lib';\nimport {\n Button,\n InputFieldController,\n Label,\n SectionListSection,\n SectionListSectionContent,\n SectionListSectionDescription,\n SectionListSectionHeader,\n SectionListSectionTitle,\n} from '@baseplate-dev/ui-components';\nimport clsx from 'clsx';\nimport { useFieldArray, useWatch } from 'react-hook-form';\nimport { MdDeleteOutline } from 'react-icons/md';\n\nimport { SortableList } from '#src/components/index.js';\nimport { underscoreToTitleCase } from '#src/utils/casing.js';\n\nexport function EnumValuesSection({\n control,\n setValue,\n}: {\n control: Control<EnumConfig>;\n setValue: UseFormSetValue<EnumConfig>;\n}): React.JSX.Element {\n const {\n fields: valueFields,\n remove: removeValue,\n append: appendValue,\n move: sortValues,\n } = useFieldArray({\n control,\n name: 'values',\n });\n\n const values = useWatch({ control, name: 'values' });\n\n const gridClassNames =\n 'grid grid-cols-[repeat(2,minmax(130px,1fr))_80px] gap-3';\n\n const valueListItems = valueFields.map((field, i) => ({\n id: field.id,\n element: (\n <div className={gridClassNames}>\n <InputFieldController control={control} name={`values.${i}.name`} />\n <InputFieldController\n control={control}\n name={`values.${i}.friendlyName`}\n onFocus={() => {\n if (!values[i].friendlyName && values[i].name) {\n setValue(\n `values.${i}.friendlyName`,\n underscoreToTitleCase(values[i].name),\n );\n }\n }}\n />\n <Button\n variant=\"ghost\"\n size=\"icon\"\n onClick={() => {\n removeValue(i);\n }}\n >\n <MdDeleteOutline />\n <div className=\"sr-only\">Delete Enum</div>\n </Button>\n </div>\n ),\n }));\n\n return (\n <SectionListSection>\n <SectionListSectionHeader>\n <SectionListSectionTitle>Values</SectionListSectionTitle>\n <SectionListSectionDescription>\n Configure the allowed values for this enum.\n </SectionListSectionDescription>\n </SectionListSectionHeader>\n <SectionListSectionContent className=\"space-y-4\">\n <div className=\"space-y-2\">\n <div\n className={clsx(\n gridClassNames,\n // account for handle in sortable list\n 'pl-12',\n )}\n >\n <Label>Value Name, e.g. ACTIVE</Label>\n <Label>Value Friendly Name, e.g. Active</Label>\n <div />\n </div>\n {valueFields.length === 0 ? (\n <p className=\"pt-4 text-style-muted\">\n Add some values to get started\n </p>\n ) : (\n <SortableList listItems={valueListItems} sortItems={sortValues} />\n )}\n </div>\n <Button\n size=\"sm\"\n variant=\"secondary\"\n onClick={() => {\n appendValue({\n id: modelEnumValueEntityType.generateNewId(),\n name: '',\n friendlyName: '',\n });\n }}\n >\n Add Value\n </Button>\n </SectionListSectionContent>\n </SectionListSection>\n );\n}\n","import type React from 'react';\n\nimport { useBlockUnsavedChangesNavigate } from '@baseplate-dev/project-builder-lib/web';\nimport { FormActionBar, SectionList } from '@baseplate-dev/ui-components';\nimport { createFileRoute } from '@tanstack/react-router';\n\nimport { ErrorBoundary } from '#src/components/index.js';\n\nimport { useEnumForm } from '../-hooks/use-enum-form.js';\nimport { EnumGraphQLSection } from './-components/enum-graph-ql-section.js';\nimport { EnumValuesSection } from './-components/enum-values-section.js';\n\nexport const Route = createFileRoute('/data/enums/edit/$key/')({\n component: EnumEditPage,\n});\n\nfunction EnumEditPage(): React.JSX.Element {\n const { key } = Route.useParams();\n const { form, onSubmit, isSavingDefinition } = useEnumForm({\n omit: ['name', 'featureRef'],\n enumKey: key,\n });\n const { control, setValue } = form;\n\n useBlockUnsavedChangesNavigate({ control, reset: form.reset, onSubmit });\n\n return (\n <ErrorBoundary>\n <form\n onSubmit={onSubmit}\n className=\"mx-4 max-w-7xl min-w-[700px] flex-1 space-y-4 pb-4\"\n >\n <SectionList>\n <EnumGraphQLSection control={control} />\n <EnumValuesSection control={control} setValue={setValue} />\n </SectionList>\n <FormActionBar form={form} disabled={isSavingDefinition} />\n </form>\n </ErrorBoundary>\n );\n}\n"],"names":["SectionListSection","SectionListSectionContent","SectionListSectionHeader","SectionListSectionTitle","SwitchFieldController","importShared","EnumGraphQLSection","control","jsx","underscoreToTitleCase","str","word","modelEnumValueEntityType","Button","InputFieldController","Label","SectionListSectionDescription","EnumValuesSection","setValue","valueFields","removeValue","appendValue","sortValues","useFieldArray","values","useWatch","gridClassNames","valueListItems","field","jsxs","MdDeleteOutline","clsx","SortableList","useBlockUnsavedChangesNavigate","FormActionBar","SectionList","SplitComponent","key","Route","useParams","form","onSubmit","isSavingDefinition","useEnumForm","omit","enumKey","reset","ErrorBoundary"],"mappings":"iRAIA,KAAA,oBAAAA,EAAA,0BAAAC,EAAA,yBAAAC,EAAAC,wBAAAA,EAAA,sBAAAC,CAAA,EAAA,MAAAC,EAAA,8BAAA,EAQO,SAASC,EAAmB,CACjC,QAAAC,CACF,EAEsB,CACpB,cACGP,EACC,CAAA,SAAA,CAAAQ,MAACN,EACC,CAAA,SAAAM,EAAA,IAACL,EAAwB,CAAA,SAAA,SAAO,CAAA,EAClC,EACAK,EAAAA,IAACP,EAA0B,CAAA,UAAU,YACnC,SAAAO,EAAA,IAACJ,EAAA,CACC,MAAM,2BACN,QAAAG,EACA,KAAK,YACL,YAAY,mDAAA,CAAA,CAEhB,CAAA,CAAA,EACF,CAEJ,CChCO,SAASE,EAAsBC,EAAqB,CASlD,OAPOA,EAAI,MAAM,GAAG,EAIxB,IAAKC,GAASA,EAAK,OAAO,CAAC,EAAE,cAAgBA,EAAK,MAAM,CAAC,EAAE,aAAa,EACxE,KAAK,GAAG,CAGb,CCNA,KAAA,CAAA,yBAAAC,CAAA,EAAA,MAAAP,EAAA,oCAAA,EACA,CAAA,OAAAQ,EAAA,qBAAAC,EAAA,MAAAC,EAAA,mBAAAf,EAAA,0BAAAC,EAAA,8BAAAe,EAAA,yBAAAd,EAAA,wBAAAC,CAAA,EAAA,MAAAE,EAAA,8BAAA,EAiBO,SAASY,EAAkB,CAChC,QAAAV,EACA,SAAAW,CACF,EAGsB,CACd,KAAA,CACJ,OAAQC,EACR,OAAQC,EACR,OAAQC,EACR,KAAMC,GACJC,EAAc,CAChB,QAAAhB,EACA,KAAM,QAAA,CACP,EAEKiB,EAASC,EAAS,CAAE,QAAAlB,EAAS,KAAM,SAAU,EAE7CmB,EACJ,0DAEIC,EAAiBR,EAAY,IAAI,CAACS,EAAO,KAAO,CACpD,GAAI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,EAAA,IAACK,EAAA,CACC,KAAK,KACL,QAAQ,YACR,QAAS,IAAM,CACDQ,EAAA,CACV,GAAIT,EAAyB,cAAc,EAC3C,KAAM,GACN,aAAc,EAAA,CACf,CACH,EACD,SAAA,WAAA,CAAA,CAED,CACF,CAAA,CAAA,EACF,CAEJ,CCtHA,KAAA,CAAA,+BAAAqB,CAAA,EAAA,MAAA5B,EAAA,wCAAA,EACA,CAAA,cAAA6B,EAAA,YAAAC,CAAA,EAAA,MAAA9B,EAAA,8BAAA,EAOyE+B,EAAA,UAM9B,CACnC,KAAA,CAAEC,IAAAA,CAAAA,EAAQC,EAAMC,UAAU,EAC1B,CAAEC,KAAAA,EAAMC,SAAAA,EAAUC,mBAAAA,GAAuBC,EAAY,CACzDC,KAAM,CAAC,OAAQ,YAAY,EAC3BC,QAASR,CAAAA,CACV,EACK,CAAE9B,QAAAA,EAASW,SAAAA,CAAAA,EAAasB,EAEC,OAAAP,EAAA,CAAE1B,QAAAA,EAASuC,MAAON,EAAKM,MAAOL,SAAAA,CAAAA,CAAU,QAGpEM,EACC,CAAA,SAAAlB,EAAA,KAAC,OACC,CAAA,SAAAY,EACA,UAAU,qDAEV,SAAA,CAAAZ,OAACM,EACC,CAAA,SAAA,CAAA3B,MAACF,GAAmB,QAAAC,EAAiB,EACrCC,EAAAA,IAACS,EAAkB,CAAA,QAAAV,EAAkB,SAAAW,CAAmB,CAAA,CAAA,EAC1D,EACCV,EAAAA,IAAA0B,EAAA,CAAc,KAAAM,EAAY,SAAUE,CAAmB,CAAA,CAAA,CAAA,CAC1D,CACF,CAAA,CAEJ"}
@@ -1,2 +1,2 @@
1
- import{i as o}from"./_virtual___federation_fn_import-CE3p-l_2.js";import{j as e}from"./index.esm-CyH9wtdI.js";import{s as d}from"./index-gE__lQ6b.js";const{generalSettingsSchema:h}=await o("@baseplate-dev/project-builder-lib"),{useBlockUnsavedChangesNavigate:f,useProjectDefinition:j,useResettableForm:u}=await o("@baseplate-dev/project-builder-lib/web"),{FormActionBar:g,InputFieldController:s,SectionList:x,SectionListSection:b,SectionListSectionContent:S,SectionListSectionHeader:v,SectionListSectionTitle:w}=await o("@baseplate-dev/ui-components"),L=function(){const{definition:n,saveDefinitionWithFeedback:r}=j(),i=u({resolver:d(h),defaultValues:n.settings.general}),{handleSubmit:l,control:t,reset:c}=i,a=l(p=>r(m=>{m.settings.general=p}));return f({control:t,reset:c,onSubmit:a}),e.jsxs("form",{className:"relative h-full max-h-full pb-(--action-bar-height)",onSubmit:a,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:"Project settings"})}),e.jsx(x,{children:e.jsxs(b,{children:[e.jsx(v,{children:e.jsx(w,{children:"Settings"})}),e.jsxs(S,{className:"flex max-w-80 flex-col gap-4",children:[e.jsx(s,{name:"name",label:"Project Name",description:"Lowercase letters and dashes, e.g. my-project",control:t,placeholder:"e.g. my-project"}),e.jsx(s,{name:"portOffset",label:"Port Offset",description:"Multiple of 1000, e.g. 4000. This will offset the ports used by the project, e.g. API at 4001, database at 4432, to avoid conflicts with other projects.",control:t,registerOptions:{valueAsNumber:!0}}),e.jsx(s,{label:"Package Scope",name:"packageScope",description:"The scope for packages in this project, e.g. my-project will result in @my-project/app-name",control:t})]})]})})]}),e.jsx(g,{form:i})]})};export{L as component};
2
- //# sourceMappingURL=index-La9rk06J.js.map
1
+ import{i as o}from"./_virtual___federation_fn_import-DK_YYIlv.js";import{j as e}from"./index.esm-Bvv3vNQh.js";import{s as d}from"./index-B7G2CMwL.js";const{generalSettingsSchema:h}=await o("@baseplate-dev/project-builder-lib"),{useBlockUnsavedChangesNavigate:f,useProjectDefinition:j,useResettableForm:u}=await o("@baseplate-dev/project-builder-lib/web"),{FormActionBar:g,InputFieldController:s,SectionList:x,SectionListSection:b,SectionListSectionContent:S,SectionListSectionHeader:v,SectionListSectionTitle:w}=await o("@baseplate-dev/ui-components"),L=function(){const{definition:n,saveDefinitionWithFeedback:r}=j(),i=u({resolver:d(h),defaultValues:n.settings.general}),{handleSubmit:l,control:t,reset:c}=i,a=l(p=>r(m=>{m.settings.general=p}));return f({control:t,reset:c,onSubmit:a}),e.jsxs("form",{className:"relative h-full max-h-full pb-(--action-bar-height)",onSubmit:a,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:"Project settings"})}),e.jsx(x,{children:e.jsxs(b,{children:[e.jsx(v,{children:e.jsx(w,{children:"Settings"})}),e.jsxs(S,{className:"flex max-w-80 flex-col gap-4",children:[e.jsx(s,{name:"name",label:"Project Name",description:"Lowercase letters and dashes, e.g. my-project",control:t,placeholder:"e.g. my-project"}),e.jsx(s,{name:"portOffset",label:"Port Offset",description:"Multiple of 1000, e.g. 4000. This will offset the ports used by the project, e.g. API at 4001, database at 4432, to avoid conflicts with other projects.",control:t,registerOptions:{valueAsNumber:!0}}),e.jsx(s,{label:"Package Scope",name:"packageScope",description:"The scope for packages in this project, e.g. my-project will result in @my-project/app-name",control:t})]})]})})]}),e.jsx(g,{form:i})]})};export{L as component};
2
+ //# sourceMappingURL=index-DhWOhNFS.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-La9rk06J.js","sources":["../../src/routes/settings/index.tsx?tsr-split=component"],"sourcesContent":["import type React from 'react';\n\nimport { generalSettingsSchema } from '@baseplate-dev/project-builder-lib';\nimport {\n useBlockUnsavedChangesNavigate,\n useProjectDefinition,\n useResettableForm,\n} from '@baseplate-dev/project-builder-lib/web';\nimport {\n FormActionBar,\n InputFieldController,\n SectionList,\n SectionListSection,\n SectionListSectionContent,\n SectionListSectionHeader,\n SectionListSectionTitle,\n} from '@baseplate-dev/ui-components';\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { createFileRoute } from '@tanstack/react-router';\n\nexport const Route = createFileRoute('/settings/')({\n component: ProjectSettingsPage,\n beforeLoad: () => ({\n getTitle: () => 'Project Settings',\n }),\n});\n\nfunction ProjectSettingsPage(): React.JSX.Element {\n const { definition, saveDefinitionWithFeedback } = useProjectDefinition();\n\n const form = useResettableForm({\n resolver: zodResolver(generalSettingsSchema),\n defaultValues: definition.settings.general,\n });\n\n const { handleSubmit, control, reset } = form;\n\n const onSubmit = handleSubmit((data) =>\n saveDefinitionWithFeedback((draftConfig) => {\n draftConfig.settings.general = data;\n }),\n );\n\n useBlockUnsavedChangesNavigate({ control, reset, onSubmit });\n\n return (\n <form\n className=\"relative h-full max-h-full pb-(--action-bar-height)\"\n onSubmit={onSubmit}\n >\n <div className=\"flex h-full max-h-full flex-1 flex-col overflow-y-auto px-6\">\n <div className=\"sticky top-0 border-b bg-background py-6\">\n <h1>Project settings</h1>\n </div>\n <SectionList>\n <SectionListSection>\n <SectionListSectionHeader>\n <SectionListSectionTitle>Settings</SectionListSectionTitle>\n </SectionListSectionHeader>\n <SectionListSectionContent className=\"flex max-w-80 flex-col gap-4\">\n <InputFieldController\n name=\"name\"\n label=\"Project Name\"\n description=\"Lowercase letters and dashes, e.g. my-project\"\n control={control}\n placeholder=\"e.g. my-project\"\n />\n <InputFieldController\n name=\"portOffset\"\n label=\"Port Offset\"\n description=\"Multiple of 1000, e.g. 4000. This will offset the ports used by the project, e.g. API at 4001, database at 4432, to avoid conflicts with other projects.\"\n control={control}\n registerOptions={{ valueAsNumber: true }}\n />\n <InputFieldController\n label=\"Package Scope\"\n name=\"packageScope\"\n description=\"The scope for packages in this project, e.g. my-project will result in @my-project/app-name\"\n control={control}\n />\n </SectionListSectionContent>\n </SectionListSection>\n </SectionList>\n </div>\n <FormActionBar form={form} />\n </form>\n );\n}\n"],"names":["generalSettingsSchema","importShared","useBlockUnsavedChangesNavigate","useProjectDefinition","useResettableForm","FormActionBar","InputFieldController","SectionList","SectionListSection","SectionListSectionContent","SectionListSectionHeader","SectionListSectionTitle","SplitComponent","definition","saveDefinitionWithFeedback","form","resolver","zodResolver","defaultValues","settings","general","handleSubmit","control","reset","onSubmit","draftConfig","data","jsxs","jsx","valueAsNumber"],"mappings":"sJAEA,KAAA,CAAA,sBAAAA,CAAA,EAAA,MAAAC,EAAA,oCAAA,EACA,CAAA,+BAAAC,EAAA,qBAAAC,EAAA,kBAAAC,CAAA,EAAA,MAAAH,EAAA,wCAAA,EAKA,CAAA,cAAAI,EAAA,qBAAAC,EAAA,YAAAC,EAAA,mBAAAC,EAAA,0BAAAC,EAAA,yBAAAC,EAAA,wBAAAC,CAAA,EAAA,MAAAV,EAAA,8BAAA,EASsDW,EAAA,UAUJ,CAC1C,KAAA,CAAEC,WAAAA,EAAYC,2BAAAA,GAA+BX,EAAqB,EAElEY,EAAOX,EAAkB,CAC7BY,SAAUC,EAAYjB,CAAqB,EAC3CkB,cAAeL,EAAWM,SAASC,OAAAA,CACpC,EAEK,CAAEC,aAAAA,EAAcC,QAAAA,EAASC,MAAAA,CAAAA,EAAUR,EAEnCS,EAAWH,EACfP,GAAAA,EAA4CW,GAAA,CAC1CA,EAAYN,SAASC,QAAUM,CAAAA,CAChC,CACH,EAE+B,OAAAxB,EAAA,CAAEoB,QAAAA,EAASC,MAAAA,EAAOC,SAAAA,CAAAA,CAAU,EAGxDG,EAAAA,KAAA,OAAA,CACC,UAAU,sDACV,SAAAH,EAEA,SAAA,CAACG,EAAAA,KAAA,MAAA,CAAI,UAAU,8DACb,SAAA,CAAAC,EAAAA,IAAC,OAAI,UAAU,2CACb,SAACA,MAAA,KAAA,CAAG,4BAAgB,CACtB,CAAA,EACAA,EAAA,IAACrB,EACC,CAAA,SAAAoB,EAAAA,KAACnB,EACC,CAAA,SAAA,CAAAoB,MAAClB,EACC,CAAA,SAAAkB,EAAA,IAACjB,EAAwB,CAAA,SAAA,UAAQ,CAAA,EACnC,EACAgB,EAAAA,KAAClB,EAA0B,CAAA,UAAU,+BACnC,SAAA,CAACmB,EAAAA,IAAAtB,EAAA,CACC,KAAK,OACL,MAAM,eACN,YAAY,gDACZ,QAAAgB,EACA,YAAY,iBAAiB,CAAA,EAE/BM,EAAAA,IAACtB,GACC,KAAK,aACL,MAAM,cACN,YAAY,2JACZ,QAAAgB,EACA,gBAAiB,CAAEO,cAAe,EAAA,EAAO,EAE3CD,MAACtB,GACC,MAAM,gBACN,KAAK,eACL,YAAY,8FACZ,QAAAgB,CAAiB,CAAA,CAAA,CAErB,CAAA,CAAA,CAAA,CACF,CACF,CAAA,CAAA,EACF,EACAM,MAACvB,GAAc,KAAAU,CAAW,CAAA,CAAA,EAC5B,CAEJ"}
1
+ {"version":3,"file":"index-DhWOhNFS.js","sources":["../../src/routes/settings/index.tsx?tsr-split=component"],"sourcesContent":["import type React from 'react';\n\nimport { generalSettingsSchema } from '@baseplate-dev/project-builder-lib';\nimport {\n useBlockUnsavedChangesNavigate,\n useProjectDefinition,\n useResettableForm,\n} from '@baseplate-dev/project-builder-lib/web';\nimport {\n FormActionBar,\n InputFieldController,\n SectionList,\n SectionListSection,\n SectionListSectionContent,\n SectionListSectionHeader,\n SectionListSectionTitle,\n} from '@baseplate-dev/ui-components';\nimport { zodResolver } from '@hookform/resolvers/zod';\nimport { createFileRoute } from '@tanstack/react-router';\n\nexport const Route = createFileRoute('/settings/')({\n component: ProjectSettingsPage,\n beforeLoad: () => ({\n getTitle: () => 'Project Settings',\n }),\n});\n\nfunction ProjectSettingsPage(): React.JSX.Element {\n const { definition, saveDefinitionWithFeedback } = useProjectDefinition();\n\n const form = useResettableForm({\n resolver: zodResolver(generalSettingsSchema),\n defaultValues: definition.settings.general,\n });\n\n const { handleSubmit, control, reset } = form;\n\n const onSubmit = handleSubmit((data) =>\n saveDefinitionWithFeedback((draftConfig) => {\n draftConfig.settings.general = data;\n }),\n );\n\n useBlockUnsavedChangesNavigate({ control, reset, onSubmit });\n\n return (\n <form\n className=\"relative h-full max-h-full pb-(--action-bar-height)\"\n onSubmit={onSubmit}\n >\n <div className=\"flex h-full max-h-full flex-1 flex-col overflow-y-auto px-6\">\n <div className=\"sticky top-0 border-b bg-background py-6\">\n <h1>Project settings</h1>\n </div>\n <SectionList>\n <SectionListSection>\n <SectionListSectionHeader>\n <SectionListSectionTitle>Settings</SectionListSectionTitle>\n </SectionListSectionHeader>\n <SectionListSectionContent className=\"flex max-w-80 flex-col gap-4\">\n <InputFieldController\n name=\"name\"\n label=\"Project Name\"\n description=\"Lowercase letters and dashes, e.g. my-project\"\n control={control}\n placeholder=\"e.g. my-project\"\n />\n <InputFieldController\n name=\"portOffset\"\n label=\"Port Offset\"\n description=\"Multiple of 1000, e.g. 4000. This will offset the ports used by the project, e.g. API at 4001, database at 4432, to avoid conflicts with other projects.\"\n control={control}\n registerOptions={{ valueAsNumber: true }}\n />\n <InputFieldController\n label=\"Package Scope\"\n name=\"packageScope\"\n description=\"The scope for packages in this project, e.g. my-project will result in @my-project/app-name\"\n control={control}\n />\n </SectionListSectionContent>\n </SectionListSection>\n </SectionList>\n </div>\n <FormActionBar form={form} />\n </form>\n );\n}\n"],"names":["generalSettingsSchema","importShared","useBlockUnsavedChangesNavigate","useProjectDefinition","useResettableForm","FormActionBar","InputFieldController","SectionList","SectionListSection","SectionListSectionContent","SectionListSectionHeader","SectionListSectionTitle","SplitComponent","definition","saveDefinitionWithFeedback","form","resolver","zodResolver","defaultValues","settings","general","handleSubmit","control","reset","onSubmit","draftConfig","data","jsxs","jsx","valueAsNumber"],"mappings":"sJAEA,KAAA,CAAA,sBAAAA,CAAA,EAAA,MAAAC,EAAA,oCAAA,EACA,CAAA,+BAAAC,EAAA,qBAAAC,EAAA,kBAAAC,CAAA,EAAA,MAAAH,EAAA,wCAAA,EAKA,CAAA,cAAAI,EAAA,qBAAAC,EAAA,YAAAC,EAAA,mBAAAC,EAAA,0BAAAC,EAAA,yBAAAC,EAAA,wBAAAC,CAAA,EAAA,MAAAV,EAAA,8BAAA,EASsDW,EAAA,UAUJ,CAC1C,KAAA,CAAEC,WAAAA,EAAYC,2BAAAA,GAA+BX,EAAqB,EAElEY,EAAOX,EAAkB,CAC7BY,SAAUC,EAAYjB,CAAqB,EAC3CkB,cAAeL,EAAWM,SAASC,OAAAA,CACpC,EAEK,CAAEC,aAAAA,EAAcC,QAAAA,EAASC,MAAAA,CAAAA,EAAUR,EAEnCS,EAAWH,EACfP,GAAAA,EAA4CW,GAAA,CAC1CA,EAAYN,SAASC,QAAUM,CAAAA,CAChC,CACH,EAE+B,OAAAxB,EAAA,CAAEoB,QAAAA,EAASC,MAAAA,EAAOC,SAAAA,CAAAA,CAAU,EAGxDG,EAAAA,KAAA,OAAA,CACC,UAAU,sDACV,SAAAH,EAEA,SAAA,CAACG,EAAAA,KAAA,MAAA,CAAI,UAAU,8DACb,SAAA,CAAAC,EAAAA,IAAC,OAAI,UAAU,2CACb,SAACA,MAAA,KAAA,CAAG,4BAAgB,CACtB,CAAA,EACAA,EAAA,IAACrB,EACC,CAAA,SAAAoB,EAAAA,KAACnB,EACC,CAAA,SAAA,CAAAoB,MAAClB,EACC,CAAA,SAAAkB,EAAA,IAACjB,EAAwB,CAAA,SAAA,UAAQ,CAAA,EACnC,EACAgB,EAAAA,KAAClB,EAA0B,CAAA,UAAU,+BACnC,SAAA,CAACmB,EAAAA,IAAAtB,EAAA,CACC,KAAK,OACL,MAAM,eACN,YAAY,gDACZ,QAAAgB,EACA,YAAY,iBAAiB,CAAA,EAE/BM,EAAAA,IAACtB,GACC,KAAK,aACL,MAAM,cACN,YAAY,2JACZ,QAAAgB,EACA,gBAAiB,CAAEO,cAAe,EAAA,EAAO,EAE3CD,MAACtB,GACC,MAAM,gBACN,KAAK,eACL,YAAY,8FACZ,QAAAgB,CAAiB,CAAA,CAAA,CAErB,CAAA,CAAA,CAAA,CACF,CACF,CAAA,CAAA,EACF,EACAM,MAACvB,GAAc,KAAAU,CAAW,CAAA,CAAA,EAC5B,CAEJ"}
@@ -0,0 +1,2 @@
1
+ import{i as f}from"./_virtual___federation_fn_import-DK_YYIlv.js";import{j as e,u as I,b as ie,e as le,f as Se}from"./index.esm-Bvv3vNQh.js";import{s as te,m as U,e as ne,S as $e,n as Ne,a as Fe,r as se}from"./index-B7G2CMwL.js";import{u as g,S as Me,E as Ie}from"./-constants-CyTNHADu.js";import{u as Le}from"./use-model-form-Bjm8n0m8.js";import{q as Te,c as w,L as Ee,N as Oe,O as Ue,P as qe,I as ve,K as be,B as Ce}from"./index-BgFEd-vA.js";import{i as Pe}from"./inflection-C1nKqrJS.js";import{c as Ae}from"./capitalize-gOJXDbsR.js";const Be=/\p{Lu}?\p{Ll}+|[0-9]+|\p{Lu}+(?!\p{Ll})|\p{Emoji_Presentation}|\p{Extended_Pictographic}|\p{L}+/gu;function Ke(d){return Array.from(d.match(Be)??[])}function M(d){const t=Ke(d);if(t.length===0)return"";const[s,...l]=t;return`${s.toLowerCase()}${l.map(r=>Ae(r)).join("")}`}const{modelScalarFieldEntityType:ae}=await f("@baseplate-dev/project-builder-lib"),{Button:re,ButtonGroup:ze,DropdownMenu:Ve,DropdownMenuContent:ke,DropdownMenuItem:He,DropdownMenuTrigger:_e}=await f("@baseplate-dev/ui-components"),{useMemo:We}=await f("react");function Ge({className:d,appendField:t,setValue:s}){const l=g(i=>i.model.fields.map(a=>a.name)),r=g(i=>i.model.primaryKeyFieldRefs.length),n=We(()=>{const i=[];r||i.push({name:"ID (uuid)",fields:[{name:"id",type:"uuid",options:{genUuid:!0},isPrimaryKey:!0}]});const a=l.includes("createdAt"),m=l.includes("updatedAt");return(!a||!m)&&i.push({name:"Timestamps",fields:[{name:"createdAt",type:"dateTime",options:{defaultToNow:!0}},{name:"updatedAt",type:"dateTime",options:{updatedAt:!0,defaultToNow:!0}}]}),i},[l,r]),o=i=>{for(const{isPrimaryKey:a,...m}of i.fields){const c=ae.generateNewId();l.includes(m.name)||t({id:c,...m}),a&&s("model.primaryKeyFieldRefs",[c],{shouldDirty:!0})}};return e.jsxs(ze,{className:d,children:[e.jsx(re,{variant:"secondary",onClick:()=>{t({id:ae.generateNewId(),name:"",type:"string",isOptional:!0,options:{default:""}})},size:"sm",children:"Add Field"}),e.jsxs(Ve,{children:[e.jsx(_e,{disabled:n.length===0,asChild:!0,children:e.jsx(re,{variant:"secondary",size:"sm",children:e.jsx(Te,{})})}),e.jsx(ke,{children:n.map(i=>e.jsx(He,{onClick:()=>{o(i)},children:i.name},i.name))})]})]})}const{Button:de,DialogClose:Ye,DialogFooter:Xe,MultiComboboxFieldController:Je}=await f("@baseplate-dev/ui-components"),{useId:Qe}=await f("react"),{z:W}=await f("zod"),Ze=W.object({fields:W.array(W.string()).min(1,"At least one primary key is required")});function en({className:d,control:t,onSubmitSuccess:s}){const l=g(c=>c.model.fields),{field:{value:r=[],onChange:n}}=I({name:"model.primaryKeyFieldRefs",control:t}),{control:o,handleSubmit:i}=ie({resolver:te(Ze),values:{fields:r}}),a=i(c=>{n(c.fields),s?.()}),m=Qe();return e.jsxs("form",{className:w("space-y-4",d),onSubmit:c=>(c.stopPropagation(),a(c)),id:m,children:[e.jsx(Je,{control:o,name:"fields",options:l.map(c=>({value:c.id,label:c.name})),placeholder:"Select fields to use as primary keys"}),e.jsxs(Xe,{children:[e.jsx(Ye,{asChild:!0,children:e.jsx(de,{variant:"secondary",children:"Cancel"})}),e.jsx(de,{type:"submit",form:m,children:"Save"})]})]})}const{Dialog:nn,DialogContent:tn,DialogDescription:sn,DialogHeader:on,DialogTitle:ln,DialogTrigger:an,useControlledState:rn}=await f("@baseplate-dev/ui-components");function we({control:d,children:t,asChild:s,open:l,onOpenChange:r}){const[n,o]=rn(l,r,!1);return e.jsxs(nn,{open:n,onOpenChange:o,children:[t&&e.jsx(an,{asChild:s,children:t}),e.jsxs(tn,{children:[e.jsxs(on,{children:[e.jsx(ln,{children:"Primary Keys"}),e.jsx(sn,{children:"Select the fields that will be used as the primary key for this model"})]}),e.jsx(en,{control:d,onSubmitSuccess:()=>{o(!1)}})]})]})}const{BadgeWithIcon:dn}=await f("@baseplate-dev/ui-components"),{useState:cn}=await f("react");function mn({className:d,control:t,autoCollapse:s}){const[l,r]=cn(!1),n=!s||l;return e.jsx(we,{control:t,children:e.jsx(dn,{icon:Ee,variant:"secondary",className:d,onMouseEnter:()=>{r(!0)},onMouseLeave:()=>{r(!1)},"aria-label":"Primary Key",title:"Primary Key",children:n&&"Primary"})})}const{createModelRelationFieldSchema:un,ModelFieldUtils:fn,modelForeignRelationEntityType:pn,modelLocalRelationEntityType:hn,ModelUtils:ce}=await f("@baseplate-dev/project-builder-lib"),{useDefinitionSchema:xn,useProjectDefinition:jn}=await f("@baseplate-dev/project-builder-lib/web"),{Button:G,ComboboxField:gn,ComboboxFieldController:Y,DialogClose:yn,DialogFooter:vn,InputFieldController:me,SelectFieldController:bn,toast:ue}=await f("@baseplate-dev/ui-components"),De=await f("react"),{useId:Cn,useMemo:wn}=De;function Dn(d,t,s){if(!s)return;const l=s.replace(/Id$/,""),r=a=>d.models.find(m=>m.id!==t.id&&a(m))?.id,n=r(a=>a.name.toLowerCase()===l.toLowerCase());if(n)return n;const o=r(a=>a.featureRef===a.featureRef&&a.name.toLowerCase().includes(l.toLowerCase()));return o||r(a=>a.name.toLowerCase().includes(l.toLowerCase()))}function fe(d,t,s,l){const r=(()=>{if(s.name)return s.name;if(s.modelRef){const i=ce.byIdOrThrow(d,s.modelRef);return M(i.name)}})(),n=(()=>{if(!s.modelRef)return;const{model:{fields:i,primaryKeyFieldRefs:a},name:m}=ce.byIdOrThrow(d,s.modelRef),c=i.filter(x=>a.includes(x.id)),p=s.references??[];return c.map((x,h)=>{const D=h===0&&l?l:c.length===1?`${M(m)}Id`:x.name;return{localRef:p[h]?.localRef??t.model.fields.find(y=>y.name===D)?.id,foreignRef:x.id}})})(),o=(()=>{if(!n)return;if(s.foreignRelationName)return s.foreignRelationName;const i=n.every(a=>a.localRef)&&fn.areScalarsUnique(t,n.map(a=>a.localRef));return M(i?t.name:Pe.pluralize(t.name))})();return{name:r??"",foreignRelationName:o??"",references:n??[]}}function Rn({className:d,control:t,onSubmitSuccess:s,relationId:l,defaultFieldName:r}){const{definition:n}=jn(),o=g(u=>u),i=o.name,{fields:a}=o.model,{field:{value:m=[],onChange:c}}=I({name:"model.relations",control:t}),p=n.models.map(u=>({label:u.name,value:u.id})),x=l===void 0?void 0:m.find(u=>u.id===l),h=wn(()=>{if(x)return x;const u=Dn(n,o,r);return{id:hn.generateNewId(),foreignId:pn.generateNewId(),modelRef:u??"",onDelete:"Restrict",onUpdate:"Restrict",...fe(n,o,{modelRef:u},r)}},[x,r,n,o]),D=xn(un),{control:b,handleSubmit:y,setError:H,watch:P,setValue:L}=ie({resolver:te(D),defaultValues:h}),S=P(),$=S.modelRef?n.models.find(u=>u.id===S.modelRef):void 0,T=$?.model.fields,_=a.map(u=>({label:u.name,value:u.id})),A=T?.map(u=>({label:u.name,value:u.id}))??[],j=S.references.some(u=>a.find(C=>C.id===u.localRef)?.isOptional),R=()=>{c(m.filter(u=>u.id!==l)),s?.()},Re=y(u=>{const{id:C}=u;if(a.some(v=>v.name===u.name)||m.some(v=>v.name===u.name&&v.id!==u.id)){H("name",{message:"The relation name cannot be the same as a field/relation name"});return}const O=u.references.map(v=>v.localRef);if(new Set(O).size!==O.length){ue.error("Local fields must be unique");return}const B=u.references.map(v=>v.foreignRef);if(new Set(B).size!==B.length){ue.error("Foreign fields must be unique");return}m.some(v=>v.id===C)?c(m.map(v=>v.id===C?u:v)):c([...m,u]),s?.()}),oe=Cn(),E=!!$;return e.jsxs("form",{className:w("space-y-4",d),onSubmit:u=>(u.stopPropagation(),Re(u)),id:oe,children:[e.jsxs("div",{className:"grid grid-cols-2 gap-x-8 gap-y-2",children:[e.jsx(gn,{options:[{label:i,value:i}],value:i,disabled:!0,label:"Local Model"}),e.jsx(Y,{control:b,name:"modelRef",options:p,label:"Foreign Model",onChange:u=>{if(!u)return;const{foreignRelationName:C,name:O,references:B}=fe(n,o,{...S,modelRef:u},r);C&&L("foreignRelationName",C),O&&L("name",O),L("references",B)}})]}),e.jsxs("div",{className:w("grid grid-cols-2 gap-x-8 gap-y-2",!E&&"pointer-events-none opacity-50"),children:[e.jsx(me,{control:b,disabled:!E,name:"name",label:"Local Relation Name",description:e.jsxs("span",{children:["Name of the relation, e.g. ",M(i),".",e.jsx("strong",{children:$?.name?M($.name):"user"})]})}),e.jsx(me,{control:b,disabled:!E,name:"foreignRelationName",label:"Foreign Relation Name",description:e.jsxs("span",{children:["Name of the relation on the foreign model, e.g."," ",M($?.name??"post"),".",e.jsx("strong",{children:h.foreignRelationName||"user"})]})}),e.jsx("div",{className:"text-sm font-medium",children:"Local Field"}),e.jsx("div",{className:"text-sm font-medium",children:"Foreign Field"}),S.references.map((u,C)=>e.jsxs(De.Fragment,{children:[e.jsx(Y,{disabled:!E,control:b,name:`references.${C}.localRef`,options:_}),e.jsx(Y,{control:b,name:`references.${C}.foreignRef`,options:A,disabled:!0})]},C))]}),e.jsx("div",{className:"grid grid-cols-2 gap-x-8 gap-y-2 border-t pt-4",children:e.jsx(bn,{label:"On Delete",control:b,options:[{label:"Cascade (delete entire local row)",value:"Cascade"},{label:"Restrict (throw error)",value:"Restrict"},...j?[{label:"Set Null (set local field to null)",value:"SetNull"}]:[]],name:"onDelete",description:"What to do when the foreign row is deleted"})}),e.jsx(vn,{children:e.jsxs("div",{className:"flex w-full justify-between",children:[l&&e.jsx(G,{variant:"secondary",onClick:u=>{u.preventDefault(),R()},children:"Delete"}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(yn,{asChild:!0,children:e.jsx(G,{variant:"secondary",children:"Cancel"})}),e.jsx(G,{type:"submit",form:oe,disabled:!E,children:"Save"})]})]})})]})}const{Dialog:Sn,DialogContent:$n,DialogDescription:Nn,DialogHeader:Fn,DialogTitle:Mn,DialogTrigger:In,useControlledState:Ln}=await f("@baseplate-dev/ui-components");function V({control:d,children:t,asChild:s,open:l,onOpenChange:r,relationId:n,defaultFieldName:o}){const[i,a]=Ln(l,r,!1);return e.jsxs(Sn,{open:i,onOpenChange:a,children:[t&&e.jsx(In,{asChild:s,children:t}),e.jsxs($n,{width:"lg",children:[e.jsxs(Fn,{children:[e.jsx(Mn,{children:n?"Edit Relation":"Create Relation"}),e.jsx(Nn,{children:"Set up the relation between this model and another model"})]}),e.jsx(Rn,{control:d,onSubmitSuccess:()=>{a(!1)},relationId:n,defaultFieldName:o})]})]})}const{useProjectDefinition:Tn}=await f("@baseplate-dev/project-builder-lib/web"),{BadgeWithIcon:En}=await f("@baseplate-dev/ui-components"),{useState:On}=await f("react");function Un({className:d,control:t,relation:s,autoCollapse:l}){const{definitionContainer:r}=Tn(),[n,o]=On(!1),i=!l||n;return e.jsx(V,{control:t,relationId:s.id,children:e.jsx(En,{icon:Oe,variant:"secondary",className:w("max-w-[100px]",d),onMouseEnter:()=>{o(!0)},onMouseLeave:()=>{o(!1)},"aria-label":"Relation",title:"Relation",children:i&&`${r.nameFromId(s.modelRef)} ${s.references.length>1?`(${s.references.length})`:""}`})})}const{modelUniqueConstraintEntityType:qn}=await f("@baseplate-dev/project-builder-lib"),{Button:X,DialogClose:Pn,DialogFooter:An,MultiComboboxFieldController:Bn}=await f("@baseplate-dev/ui-components"),{useId:Kn}=await f("react"),{z:K}=await f("zod"),zn=K.object({id:K.string().optional(),fields:K.array(K.string()).min(1,"At least one field is required")});function Vn({className:d,control:t,onSubmitSuccess:s,constraintId:l}){const r=g(h=>h.model.fields),{field:{value:n=[],onChange:o}}=I({name:"model.uniqueConstraints",control:t}),i=l===void 0?void 0:n.find(h=>h.id===l),{control:a,handleSubmit:m}=ie({resolver:te(zn),values:i?{id:i.id,fields:i.fields.map(h=>h.fieldRef)}:{fields:[]}}),c=()=>{o(n.filter(h=>h.id!==l)),s?.()},p=m(h=>{const D={id:h.id??qn.generateNewId(),fields:h.fields.map(y=>({fieldRef:y}))},{id:b}=D;n.some(y=>y.id===b)?o(n.map(y=>y.id===b?D:y)):o([...n,D]),s?.()}),x=Kn();return e.jsxs("form",{className:w("space-y-4",d),onSubmit:h=>(h.stopPropagation(),p(h)),id:x,children:[e.jsx(Bn,{control:a,name:"fields",options:r.map(h=>({value:h.id,label:h.name})),placeholder:"Select fields to use as primary keys"}),e.jsx(An,{children:e.jsxs("div",{className:"flex w-full justify-between",children:[l&&e.jsx(X,{variant:"secondary",onClick:h=>{h.preventDefault(),c()},children:"Delete"}),e.jsxs("div",{className:"flex gap-4",children:[e.jsx(Pn,{asChild:!0,children:e.jsx(X,{variant:"secondary",children:"Cancel"})}),e.jsx(X,{type:"submit",form:x,children:"Save"})]})]})})]})}const{Dialog:kn,DialogContent:Hn,DialogDescription:_n,DialogHeader:Wn,DialogTitle:Gn,DialogTrigger:Yn,useControlledState:Xn}=await f("@baseplate-dev/ui-components");function k({control:d,children:t,asChild:s,open:l,onOpenChange:r,constraintId:n}){const[o,i]=Xn(l,r,!1);return e.jsxs(kn,{open:o,onOpenChange:i,children:[t&&e.jsx(Yn,{asChild:s,children:t}),e.jsxs(Hn,{children:[e.jsxs(Wn,{children:[e.jsx(Gn,{children:"Unique Constraint"}),e.jsx(_n,{children:"Select the fields that will be part of this unique constraint."})]}),e.jsx(Vn,{control:d,onSubmitSuccess:()=>{i(!1)},constraintId:n})]})]})}const{BadgeWithIcon:Jn}=await f("@baseplate-dev/ui-components"),{useState:Qn}=await f("react");function Zn({className:d,control:t,constraintId:s,autoCollapse:l}){const[r,n]=Qn(!1),o=!l||r,i=g(a=>a.model.uniqueConstraints?.find(m=>m.id===s)?.fields.length??0);return e.jsx(k,{control:t,constraintId:s,children:e.jsx(Jn,{variant:"secondary",icon:Ue,className:w("",d),onMouseEnter:()=>{n(!0)},onMouseLeave:()=>{n(!1)},"aria-label":"Unique Constraint",title:"Unique Constraint",children:o&&`Unique ${i>1?`(${i})`:""}`})})}function ei({className:d,control:t,idx:s}){const l=g(c=>c.model.fields[s]),r=g(c=>c.model.primaryKeyFieldRefs.includes(l.id)),n=g(c=>c.model.uniqueConstraints?.filter(p=>p.fields.some(x=>x.fieldRef===l.id)).map(p=>p.id)??[]),o=g(({model:c})=>{const p=c.fields[s];return c.relations?.filter(x=>x.references.some(h=>h.localRef===p.id))??[]}),a=(r?1:0)+n.length+o.length>2,m=[r&&e.jsx(mn,{control:t,autoCollapse:a},"primary"),...n.map(c=>e.jsx(Zn,{control:t,constraintId:c,autoCollapse:a},c)),...o.map(c=>e.jsx(Un,{control:t,relation:c,autoCollapse:a},c.id))];return e.jsx("div",{className:w("flex gap-4",d),children:m})}const{EnumUtils:ni}=await f("@baseplate-dev/project-builder-lib"),{useProjectDefinition:ii}=await f("@baseplate-dev/project-builder-lib/web"),{Button:N,ComboboxField:ti,DropdownMenu:pe,DropdownMenuContent:he,DropdownMenuGroup:xe,DropdownMenuItem:J,DropdownMenuTrigger:je,InputField:ge,InputFieldController:Q,SelectFieldController:si}=await f("@baseplate-dev/ui-components");function oi({control:d,idx:t,setValue:s}){const{definition:l}=ii(),r=le({control:d,name:`model.fields.${t}.type`}),{field:{value:n,onChange:o}}=I({name:`model.fields.${t}.options`,control:d}),i=le({control:d,name:`model.fields.${t}.options.default`});if(r==="boolean")return e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(si,{control:d,className:"flex-1",name:`model.fields.${t}.options.default`,options:[{label:"True",value:"true"},{label:"False",value:"false"}],placeholder:"NULL"}),i&&e.jsx(N,{title:"Reset",onClick:()=>{s(`model.fields.${t}.options.default`,"",{shouldDirty:!0})},variant:"ghost",size:"icon",children:e.jsx(U,{})})]});if(["string","int","float"].includes(r))return e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Q,{control:d,placeholder:"NULL",name:`model.fields.${t}.options.default`,className:"flex-1"}),i&&e.jsx(N,{title:"Reset",onClick:()=>{s(`model.fields.${t}.options.default`,void 0,{shouldDirty:!0})},variant:"ghost",size:"icon",children:e.jsx(U,{})})]});if(r==="uuid")return n?.genUuid?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ge,{disabled:!0,value:"Random UUID v4",className:"flex-1"}),e.jsx(N,{title:"Reset",onClick:()=>{o({...n,genUuid:!1})},variant:"ghost",size:"icon",children:e.jsx(U,{})})]}):e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(Q,{control:d,placeholder:"NULL",name:`model.fields.${t}.options.default`,className:"flex-1"}),e.jsxs(pe,{children:[e.jsx(je,{asChild:!0,children:e.jsx(N,{title:"Options",variant:"ghost",size:"icon",children:e.jsx(ne,{})})}),e.jsx(he,{children:e.jsx(xe,{children:e.jsx(J,{onSelect:()=>{o({...n,genUuid:!0})},children:"Random UUID v4"})})})]})]});if(r==="dateTime"||r==="date"){const{defaultToNow:a,updatedAt:m}=n??{};return a??m?e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(ge,{disabled:!0,value:m?"Last Updated":"Now",className:"flex-1"}),e.jsx(N,{title:"Reset",onClick:()=>{o({...n,defaultToNow:!1,updatedAt:!1})},variant:"ghost",size:"icon",children:e.jsx(U,{})})]}):e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(Q,{placeholder:"NULL",control:d,name:`model.fields.${t}.options.default`,className:"flex-1"}),e.jsxs(pe,{children:[e.jsx(je,{asChild:!0,children:e.jsx(N,{title:"Options",variant:"ghost",size:"icon",children:e.jsx(ne,{})})}),e.jsx(he,{children:e.jsxs(xe,{children:[e.jsx(J,{onSelect:()=>{o({...n,defaultToNow:!0,updatedAt:!1})},children:"Now"}),e.jsx(J,{onSelect:()=>{o({...n,defaultToNow:!0,updatedAt:!0})},children:"Last Updated At"})]})})]})]})}if(r==="enum"&&n?.enumRef){const m=ni.byIdOrThrow(l,n.enumRef).values.map(c=>({label:c.friendlyName,value:c.id}));return e.jsxs("div",{className:"flex items-center space-x-1",children:[e.jsx(ti,{placeholder:"NULL",value:n.defaultEnumValueRef??null,onChange:c=>{o({...n,defaultEnumValueRef:c||void 0})},options:m,className:"flex-1"}),n.defaultEnumValueRef&&e.jsx(N,{title:"Reset",onClick:()=>{o({...n,defaultEnumValueRef:""})},variant:"ghost",size:"icon",children:e.jsx(U,{})})]})}return e.jsx("div",{})}const{SCALAR_FIELD_TYPES:li}=await f("@baseplate-dev/project-builder-lib"),{useProjectDefinition:ai}=await f("@baseplate-dev/project-builder-lib/web"),{ComboboxField:ri}=await f("@baseplate-dev/ui-components");function di({control:d,idx:t}){const{definition:s}=ai(),l=(s.enums??[]).map(p=>({label:p.name,value:`enum-${p.id}`,description:"Enum type"})),r=[...li.filter(p=>p!=="enum").map(p=>Me[p]),...l],{field:{value:n,onChange:o}}=I({name:`model.fields.${t}.type`,control:d}),{field:{value:i,onChange:a}}=I({name:`model.fields.${t}.options`,control:d}),m=p=>{if(p?.startsWith("enum-")){const x=p.replace("enum-","");a({enumRef:x}),o("enum")}else o(p)},c=i?.enumRef;return e.jsx("div",{className:"space-y-2",children:e.jsx(ri,{value:n==="enum"&&c?`enum-${c}`:n,onChange:m,options:r,renderItemLabel:p=>e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{children:p.label}),e.jsx("div",{className:"text-xs text-muted-foreground",children:p.description})]})})})}const{modelUniqueConstraintEntityType:ci}=await f("@baseplate-dev/project-builder-lib"),{Button:ye,DropdownMenu:mi,DropdownMenuContent:ui,DropdownMenuGroup:fi,DropdownMenuItem:F,DropdownMenuTrigger:pi,InputFieldController:hi,SwitchFieldController:xi,toast:ji}=await f("@baseplate-dev/ui-components"),{useState:q}=await f("react");function gi({className:d,control:t,idx:s,setValue:l,onRemove:r}){const n=g(j=>j.model.fields[s]),o=g(j=>j.model.relations),i=g(j=>j.model.primaryKeyFieldRefs),a=g(j=>j.model.uniqueConstraints)??[],m=i.includes(n.id),c=i.length>1,p=a.filter(j=>j.fields.some(R=>R.fieldRef===n.id)),x=o?.filter(j=>j.references.some(R=>R.localRef===n.id))??[],h=(()=>{if(x.length>0)return`Unable to remove field as it is being used in relations ${x.map(j=>j.name).join(", ")}`;if(m&&c)return"Unable to remove field as it is being used in in the primary key";if(a.some(j=>j.fields.some(R=>R.fieldRef===n.id)))return"Unable to remove field as it is being used in in a unique constraint"})();function D(){if(h){ji.error(h);return}r(s),m&&!c&&l("model.primaryKeyFieldRefs",[],{shouldDirty:!0})}const[b,y]=q(!1),[H,P]=q(!1),[L,S]=q(),[$,T]=q(!1),[_,A]=q();return e.jsxs("div",{className:w("items-center",d),children:[e.jsx("div",{children:e.jsx(hi,{control:t,name:`model.fields.${s}.name`})}),e.jsx("div",{children:e.jsx(di,{control:t,idx:s})}),e.jsx("div",{children:e.jsx(xi,{control:t,name:`model.fields.${s}.isOptional`})}),e.jsx("div",{className:"mr-4",children:e.jsx(oi,{control:t,idx:s,setValue:l})}),e.jsx("div",{children:e.jsx(ei,{control:t,idx:s})}),e.jsx("div",{children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(mi,{children:[e.jsx(pi,{asChild:!0,children:e.jsx(ye,{variant:"ghost",size:"icon",children:e.jsx(ne,{})})}),e.jsx(ui,{children:e.jsxs(fi,{children:[x.length===0&&e.jsx(F,{onSelect:()=>{T(!0),A(void 0)},children:"Add Relation"}),x.length>0&&x.map(j=>e.jsxs(F,{onSelect:()=>{T(!0),A(j.id)},children:["Edit Relation ",x.length>1&&j.name]},j.id)),!c&&!m&&e.jsx(F,{onSelect:()=>{l("model.primaryKeyFieldRefs",[n.id],{shouldDirty:!0})},children:"Set as Primary Key"}),m&&e.jsx(F,{onSelect:()=>{y(!0)},children:"Edit Primary Key"}),p.length===0&&(c||!m)&&e.jsx(F,{onSelect:()=>{l("model.uniqueConstraints",[...a,{id:ci.generateNewId(),fields:[{fieldRef:n.id}]}],{shouldDirty:!0})},children:"Make Unique"}),p.length>0&&p.map((j,R)=>e.jsxs(F,{onSelect:()=>{S(j.id),P(!0)},children:["Edit Unique Constraint"," ",p.length>1&&R+1]},j.id))]})})]}),e.jsx(we,{control:t,open:b,onOpenChange:y}),e.jsx(k,{control:t,open:H,onOpenChange:P,constraintId:L}),e.jsx(V,{control:t,open:$,onOpenChange:T,relationId:_,defaultFieldName:n.name}),e.jsx(ye,{variant:"ghost",onClick:()=>{D()},size:"icon",children:e.jsx(qe,{})})]})})]})}function yi({className:d,control:t,setValue:s}){const{fields:l,remove:r,append:n,move:o}=Se({control:t,name:"model.fields"}),i="grid grid-cols-[repeat(2,minmax(130px,1fr))_60px_minmax(130px,1fr)_minmax(100px,1fr)_80px] gap-3",a=l.map((m,c)=>({id:m.id,element:e.jsx(gi,{className:i,control:t,setValue:s,idx:c,onRemove:r},m.id)}));return e.jsxs("div",{className:w("space-y-4",d),children:[l.length===0?e.jsx("p",{className:"pt-4 text-style-muted",children:"Add some fields to get started"}):e.jsxs("div",{className:"flex w-full flex-col gap-2 bg-white",children:[e.jsxs("div",{className:w(i,"sticky -top-0 z-10 bg-white py-2 text-sm font-semibold","pl-12"),children:[e.jsx("div",{children:"Name"}),e.jsx("div",{children:"Type"}),e.jsx("div",{children:"Optional"}),e.jsx("div",{children:"Default Value"}),e.jsx("div",{className:"sr-only",children:"Badges"}),e.jsx("div",{className:"sr-only",children:"Actions"})]}),e.jsx($e,{listItems:a,sortItems:o})]}),e.jsx(Ge,{appendField:n,setValue:s})]})}const{useProjectDefinition:vi}=await f("@baseplate-dev/project-builder-lib/web"),{Button:Z,RecordView:bi,RecordViewActions:Ci,RecordViewItem:z,RecordViewItemList:wi,SectionListSection:Di,SectionListSectionContent:Ri,SectionListSectionDescription:Si,SectionListSectionHeader:$i,SectionListSectionTitle:Ni,useConfirmDialog:Fi}=await f("@baseplate-dev/ui-components");function Mi({control:d,setValue:t}){const{requestConfirm:s}=Fi(),{definitionContainer:l}=vi(),r=g(({model:i})=>i.relations??[]),n=g(({model:i})=>Object.fromEntries(i.fields.map(a=>[a.id,a.name])));function o(i){const a=r.find(m=>m.id===i);s({title:"Delete Relation",content:`Are you sure you want to delete the relation "${a?.name??"<invalid>"}"?`,onConfirm:()=>{t("model.relations",r.filter(m=>m.id!==i))}})}return e.jsxs(Di,{children:[e.jsxs($i,{children:[e.jsx(Ni,{children:"Relations"}),e.jsx(Si,{children:"Define relations to enforce uniqueness on one or more fields."})]}),e.jsxs(Ri,{className:"space-y-4",children:[r.map(i=>e.jsxs(bi,{children:[e.jsxs(wi,{children:[e.jsx(z,{title:"Name",children:i.name}),e.jsx(z,{title:"Local Field",children:i.references.map(a=>n[a.localRef]).join(", ")}),e.jsx(z,{title:"Foreign Model",children:l.nameFromId(i.modelRef)}),e.jsx(z,{title:"On Delete",children:i.onDelete})]}),e.jsxs(Ci,{children:[e.jsx(V,{relationId:i.id,control:d,asChild:!0,children:e.jsx(Z,{variant:"ghost",size:"icon",title:"Edit",children:e.jsx(ve,{})})}),e.jsx(Z,{variant:"ghostDestructive",size:"icon",title:"Delete",onClick:()=>{o(i.id)},children:e.jsx(be,{})})]})]},i.id)),e.jsx(V,{control:d,asChild:!0,children:e.jsxs(Z,{variant:"secondary",size:"sm",children:[e.jsx(Ce,{}),"Add Relation"]})})]})]})}const{Button:ee,RecordView:Ii,RecordViewActions:Li,RecordViewItem:Ti,RecordViewItemList:Ei,SectionListSection:Oi,SectionListSectionContent:Ui,SectionListSectionDescription:qi,SectionListSectionHeader:Pi,SectionListSectionTitle:Ai,useConfirmDialog:Bi}=await f("@baseplate-dev/ui-components");function Ki({control:d,setValue:t}){const{requestConfirm:s}=Bi(),l=g(({model:o})=>o.uniqueConstraints??[]),r=g(({model:o})=>Object.fromEntries(o.fields.map(i=>[i.id,i.name])));function n(o){s({title:"Delete Unique Constraint",content:"Are you sure you want to delete this unique constraint?",onConfirm:()=>{t("model.uniqueConstraints",l.filter(i=>i.id!==o))}})}return e.jsxs(Oi,{children:[e.jsxs(Pi,{children:[e.jsx(Ai,{children:"Unique Constraints"}),e.jsx(qi,{children:"Define unique constraints to enforce uniqueness on one or more fields."})]}),e.jsxs(Ui,{className:"space-y-4",children:[l.map(o=>e.jsxs(Ii,{children:[e.jsx(Ei,{children:e.jsx(Ti,{title:"Fields",children:o.fields.map(i=>r[i.fieldRef]??"<invalid>").join(", ")})}),e.jsxs(Li,{children:[e.jsx(k,{constraintId:o.id,control:d,asChild:!0,children:e.jsx(ee,{variant:"ghost",size:"icon",title:"Edit",children:e.jsx(ve,{})})}),e.jsx(ee,{variant:"ghostDestructive",size:"icon",title:"Delete",onClick:()=>{n(o.id)},children:e.jsx(be,{})})]})]},o.id)),e.jsx(k,{control:d,asChild:!0,children:e.jsxs(ee,{variant:"secondary",size:"sm",children:[e.jsx(Ce,{}),"Add Unique Constraint"]})})]})]})}const{modelEntityType:zi,modelLocalRelationEntityType:Vi,modelScalarFieldEntityType:ki}=await f("@baseplate-dev/project-builder-lib"),{useBlockUnsavedChangesNavigate:Hi}=await f("@baseplate-dev/project-builder-lib/web"),{FormActionBar:_i,SectionList:Wi}=await f("@baseplate-dev/ui-components");se(zi,"/data/models/edit/{key}");se(ki,"/data/models/edit/{parentKey}");se(Vi,"/data/models/edit/{parentKey}");const it=function(){const{key:t}=Ne.useParams(),{form:s,onSubmit:l,originalModel:r}=Le({omit:["name","featureRef"],modelKey:t}),{control:n,watch:o,getValues:i,setValue:a,reset:m}=s;return Hi({control:n,reset:m,onSubmit:l}),e.jsx(Fe,{children:e.jsx(Ie,{originalModel:r,getValues:i,watch:o,children:e.jsxs("form",{onSubmit:l,className:"max-w-7xl min-w-[700px] flex-1 space-y-4 px-4 pb-4",children:[e.jsx(yi,{control:n,setValue:a}),e.jsxs(Wi,{children:[e.jsx(Mi,{control:n,setValue:a}),e.jsx(Ki,{control:n,setValue:a})]}),e.jsx(_i,{form:s})]})})})};export{it as component};
2
+ //# sourceMappingURL=index-PWrncK3R.js.map