@powerhousedao/vetra 6.2.3-dev.9 → 6.2.3-dev.90
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codegen/index.d.ts +26 -19
- package/dist/codegen/index.d.ts.map +1 -1
- package/dist/codegen/index.js +21 -21
- package/dist/codegen/index.js.map +1 -1
- package/dist/codegen/spec.d.ts +3 -2
- package/dist/codegen/spec.js +1 -1
- package/dist/{connect-qpJ9OUaH.js → connect-EqImHuZ2.js} +1 -1
- package/dist/{connect-qpJ9OUaH.js.map → connect-EqImHuZ2.js.map} +1 -1
- package/dist/document-models/app-module/index.d.ts +4 -12
- package/dist/document-models/app-module/index.js +4 -4
- package/dist/document-models/app-module/index.js.map +1 -1
- package/dist/document-models/document-editor/index.d.ts +4 -12
- package/dist/document-models/document-editor/index.js +4 -4
- package/dist/document-models/document-editor/index.js.map +1 -1
- package/dist/document-models/index.d.ts +7 -6
- package/dist/document-models/index.js +5 -5
- package/dist/document-models/processor-module/index.d.ts +4 -12
- package/dist/document-models/processor-module/index.js +5 -5
- package/dist/document-models/processor-module/index.js.map +1 -1
- package/dist/document-models/subgraph-module/index.d.ts +4 -12
- package/dist/document-models/subgraph-module/index.js +4 -4
- package/dist/document-models/subgraph-module/index.js.map +1 -1
- package/dist/document-models/vetra-package/index.d.ts +4 -12
- package/dist/document-models/vetra-package/index.js +3 -3
- package/dist/{editor-_0gdltOt.js → editor-BDR7IYJG.js} +5 -7
- package/dist/editor-BDR7IYJG.js.map +1 -0
- package/dist/{editor-CLbvu3pG.js → editor-CbT_8Z6A.js} +6 -8
- package/dist/editor-CbT_8Z6A.js.map +1 -0
- package/dist/{editor-CCdg1mJL.js → editor-CnfajXGg.js} +5 -7
- package/dist/{editor-CCdg1mJL.js.map → editor-CnfajXGg.js.map} +1 -1
- package/dist/{editor-Fgw7attg.js → editor-Cnk0M044.js} +70 -51
- package/dist/editor-Cnk0M044.js.map +1 -0
- package/dist/{editor-LRAwrgdQ.js → editor-D5SIbFn_.js} +10 -9
- package/dist/editor-D5SIbFn_.js.map +1 -0
- package/dist/{editor-C13SvgUy.js → editor-SJk7cr6k.js} +5 -7
- package/dist/editor-SJk7cr6k.js.map +1 -0
- package/dist/editors/components/index.d.ts +3 -3
- package/dist/editors/components/index.d.ts.map +1 -1
- package/dist/editors/components/index.js.map +1 -1
- package/dist/editors/hooks/index.d.ts +3 -3
- package/dist/editors/hooks/index.d.ts.map +1 -1
- package/dist/editors/hooks/index.js +1 -1
- package/dist/editors/index.d.ts +18 -8
- package/dist/editors/index.d.ts.map +1 -1
- package/dist/editors/index.js +1 -1
- package/dist/{factory-DMl8eB3P.js → factory-BQp6QPQO.js} +16 -12
- package/dist/factory-BQp6QPQO.js.map +1 -0
- package/dist/{factory-5eiZohiv.js → factory-BUuO4fIN.js} +12 -4
- package/dist/factory-BUuO4fIN.js.map +1 -0
- package/dist/{hooks-BIgFcbaF.js → hooks-BbxvC-C3.js} +2 -2
- package/dist/{hooks-BIgFcbaF.js.map → hooks-BbxvC-C3.js.map} +1 -1
- package/dist/index-BwHVZmO6.d.ts +43 -0
- package/dist/index-BwHVZmO6.d.ts.map +1 -0
- package/dist/{index-Dm_gN1DR.d.ts → index-C56rbYzd.d.ts} +27 -59
- package/dist/index-C56rbYzd.d.ts.map +1 -0
- package/dist/index-CDV0nUS6.d.ts +36 -0
- package/dist/index-CDV0nUS6.d.ts.map +1 -0
- package/dist/{index-f_um1g-i.d.ts → index-ChQj71kz.d.ts} +27 -62
- package/dist/index-ChQj71kz.d.ts.map +1 -0
- package/dist/index-CiPX7twW.d.ts +34 -0
- package/dist/index-CiPX7twW.d.ts.map +1 -0
- package/dist/{index-SB-AtQdU.d.ts → index-CqDvbSe4.d.ts} +31 -64
- package/dist/index-CqDvbSe4.d.ts.map +1 -0
- package/dist/index-DGhkn3As.d.ts +40 -0
- package/dist/index-DGhkn3As.d.ts.map +1 -0
- package/dist/index-DoopUfIG.d.ts +32 -0
- package/dist/index-DoopUfIG.d.ts.map +1 -0
- package/dist/{index-B5ijieNt.d.ts → index-RAhSmsFD.d.ts} +22 -55
- package/dist/index-RAhSmsFD.d.ts.map +1 -0
- package/dist/index.d.ts +56 -93
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +84 -12
- package/dist/index.js.map +1 -1
- package/dist/{logger-WHD0fyLm.js → logger-BFxMdimR.js} +1 -1
- package/dist/{logger-WHD0fyLm.js.map → logger-BFxMdimR.js.map} +1 -1
- package/dist/{module-CRq_lUkG.js → module-23VayWKe.js} +9 -9
- package/dist/module-23VayWKe.js.map +1 -0
- package/dist/{module-Chqkdq4U.js → module-2JZcvfVs.js} +3 -3
- package/dist/{module-Chqkdq4U.js.map → module-2JZcvfVs.js.map} +1 -1
- package/dist/{module-DXT-FMxU.js → module-B6S4QGOx.js} +7 -7
- package/dist/module-B6S4QGOx.js.map +1 -0
- package/dist/{module-bKT_e3CH.js → module-BktWa0rB.js} +11 -9
- package/dist/module-BktWa0rB.js.map +1 -0
- package/dist/{module-ciAK1LUC.d.ts → module-C-jL7yqs.d.ts} +38 -70
- package/dist/module-C-jL7yqs.d.ts.map +1 -0
- package/dist/{module-CRfHlbnq.js → module-FXJRy_1W.js} +2 -2
- package/dist/{module-CRfHlbnq.js.map → module-FXJRy_1W.js.map} +1 -1
- package/dist/{module-Bx1OEHxF.js → module-hLzF5tCL.js} +3 -3
- package/dist/{module-Bx1OEHxF.js.map → module-hLzF5tCL.js.map} +1 -1
- package/dist/{ph-factories-CjbIAMgT.js → ph-factories-Bgnr3mK3.js} +2 -2
- package/dist/{ph-factories-CjbIAMgT.js.map → ph-factories-Bgnr3mK3.js.map} +1 -1
- package/dist/{ph-factories-Ce8oAqs9.js → ph-factories-CgoFCmG0.js} +2 -2
- package/dist/{ph-factories-Ce8oAqs9.js.map → ph-factories-CgoFCmG0.js.map} +1 -1
- package/dist/{ph-factories-dVj6mIlR.js → ph-factories-DhLtvC7j.js} +2 -2
- package/dist/{ph-factories-dVj6mIlR.js.map → ph-factories-DhLtvC7j.js.map} +1 -1
- package/dist/{ph-factories-CljTAAVS.js → ph-factories-fEke-Nr8.js} +2 -2
- package/dist/{ph-factories-CljTAAVS.js.map → ph-factories-fEke-Nr8.js.map} +1 -1
- package/dist/powerhouse.manifest.json +76 -0
- package/dist/{processor-trJFuoHh.js → processor-C_zliXhw.js} +435 -327
- package/dist/processor-C_zliXhw.js.map +1 -0
- package/dist/processors/codegen/index.d.ts +14 -6
- package/dist/processors/codegen/index.d.ts.map +1 -1
- package/dist/processors/codegen/index.js +2 -2
- package/dist/processors/index.d.ts +2 -3
- package/dist/processors/index.d.ts.map +1 -1
- package/dist/processors/index.js +1 -1
- package/dist/processors/index.js.map +1 -1
- package/dist/processors/vetra-read-model/index.d.ts +47 -49
- package/dist/processors/vetra-read-model/index.d.ts.map +1 -1
- package/dist/processors/vetra-read-model/index.js +1 -1
- package/dist/{spec-api-DobY5TUJ.js → spec-api-BGj7gcQn.js} +24 -18
- package/dist/{spec-api-DobY5TUJ.js.map → spec-api-BGj7gcQn.js.map} +1 -1
- package/dist/{specs-BeVdfCwg.d.ts → specs-DoTSfuxN.d.ts} +7 -4
- package/dist/specs-DoTSfuxN.d.ts.map +1 -0
- package/dist/subgraph-type-lint-Dr8Wu0VB.js +94 -0
- package/dist/subgraph-type-lint-Dr8Wu0VB.js.map +1 -0
- package/dist/switchboard-DjCPLtMW.js +8 -0
- package/dist/{switchboard-Bf0uvxSu.js.map → switchboard-DjCPLtMW.js.map} +1 -1
- package/dist/{upgrade-manifest-OlS1ALVv.js → upgrade-manifest-BOZ5nmyK.js} +1 -1
- package/dist/{upgrade-manifest-OlS1ALVv.js.map → upgrade-manifest-BOZ5nmyK.js.map} +1 -1
- package/dist/{upgrade-manifest-BGuy0v65.js → upgrade-manifest-D7xKGmZc.js} +1 -1
- package/dist/{upgrade-manifest-BGuy0v65.js.map → upgrade-manifest-D7xKGmZc.js.map} +1 -1
- package/dist/{upgrade-manifest-Ck3Mgwhc.js → upgrade-manifest-DLxSL23q.js} +1 -1
- package/dist/{upgrade-manifest-Ck3Mgwhc.js.map → upgrade-manifest-DLxSL23q.js.map} +1 -1
- package/dist/{upgrade-manifest-XdOLymuP.js → upgrade-manifest-Dv62Cod7.js} +1 -1
- package/dist/{upgrade-manifest-XdOLymuP.js.map → upgrade-manifest-Dv62Cod7.js.map} +1 -1
- package/dist/{upgrade-manifest-NaS4SWk9.js → upgrade-manifest-d3LquK-H.js} +1 -1
- package/dist/{upgrade-manifest-NaS4SWk9.js.map → upgrade-manifest-d3LquK-H.js.map} +1 -1
- package/dist/{utils-DXCsvCXL.js → utils-876N1Sph.js} +2 -2
- package/dist/{utils-DXCsvCXL.js.map → utils-876N1Sph.js.map} +1 -1
- package/dist/{utils-CkxGmQ2_.js → utils-Al_SGg2a.js} +2 -2
- package/dist/{utils-CkxGmQ2_.js.map → utils-Al_SGg2a.js.map} +1 -1
- package/dist/{utils-DmOIDVQo.js → utils-BJk4_43W.js} +24 -4
- package/dist/utils-BJk4_43W.js.map +1 -0
- package/dist/{utils-B4KdjDnp.js → utils-COP7hJ-K.js} +2 -2
- package/dist/{utils-B4KdjDnp.js.map → utils-COP7hJ-K.js.map} +1 -1
- package/dist/{vetra-package-Bl6TC4wx.js → vetra-package-DSyRtkdJ.js} +2 -2
- package/dist/{vetra-package-Bl6TC4wx.js.map → vetra-package-DSyRtkdJ.js.map} +1 -1
- package/package.json +17 -14
- package/style.css +2 -0
- package/dist/document-models/app-module/index.d.ts.map +0 -1
- package/dist/document-models/document-editor/index.d.ts.map +0 -1
- package/dist/document-models/processor-module/index.d.ts.map +0 -1
- package/dist/document-models/subgraph-module/index.d.ts.map +0 -1
- package/dist/document-models/vetra-package/index.d.ts.map +0 -1
- package/dist/editor-C13SvgUy.js.map +0 -1
- package/dist/editor-CLbvu3pG.js.map +0 -1
- package/dist/editor-Fgw7attg.js.map +0 -1
- package/dist/editor-LRAwrgdQ.js.map +0 -1
- package/dist/editor-_0gdltOt.js.map +0 -1
- package/dist/factory-5eiZohiv.js.map +0 -1
- package/dist/factory-DMl8eB3P.js.map +0 -1
- package/dist/index-B5ijieNt.d.ts.map +0 -1
- package/dist/index-Dm_gN1DR.d.ts.map +0 -1
- package/dist/index-SB-AtQdU.d.ts.map +0 -1
- package/dist/index-f_um1g-i.d.ts.map +0 -1
- package/dist/module-CRq_lUkG.js.map +0 -1
- package/dist/module-DXT-FMxU.js.map +0 -1
- package/dist/module-bKT_e3CH.js.map +0 -1
- package/dist/module-ciAK1LUC.d.ts.map +0 -1
- package/dist/powerhouse.manifest.d.ts +0 -34
- package/dist/powerhouse.manifest.d.ts.map +0 -1
- package/dist/powerhouse.manifest.js +0 -86
- package/dist/powerhouse.manifest.js.map +0 -1
- package/dist/processor-trJFuoHh.js.map +0 -1
- package/dist/specs-BeVdfCwg.d.ts.map +0 -1
- package/dist/switchboard-Bf0uvxSu.js +0 -8
- package/dist/useVetraDocument-BlLdlhrQ.js +0 -30
- package/dist/useVetraDocument-BlLdlhrQ.js.map +0 -1
- package/dist/utils-DmOIDVQo.js.map +0 -1
- /package/dist/{chunk-pbuEa-1d.js → rolldown-runtime-D7D4PA-g.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../document-models/subgraph-module/v1/gen/controller.ts","../../../document-models/subgraph-module/v1/hooks.ts"],"sourcesContent":["/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { PHDocumentController } from \"document-model\";\nimport { SubgraphModule } from \"../module.js\";\nimport type { SubgraphModuleAction, SubgraphModulePHState } from \"./types.js\";\n\nexport const SubgraphModuleController = PHDocumentController.forDocumentModel<\n SubgraphModulePHState,\n SubgraphModuleAction\n>(SubgraphModule);\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentDispatch } from \"@powerhousedao/reactor-browser\";\nimport {\n useDocumentById,\n useDocumentsInSelectedDrive,\n useDocumentsInSelectedFolder,\n useSelectedDocument,\n} from \"@powerhousedao/reactor-browser\";\nimport type {\n SubgraphModuleAction,\n SubgraphModuleDocument,\n} from \"document-models/subgraph-module/v1\";\nimport {\n assertIsSubgraphModuleDocument,\n isSubgraphModuleDocument,\n} from \"./gen/document-schema.js\";\n\n/** Hook to get a SubgraphModule document by its id */\nexport function useSubgraphModuleDocumentById(\n documentId: string | null | undefined,\n):\n | [SubgraphModuleDocument, DocumentDispatch<SubgraphModuleAction>]\n | [undefined, undefined] {\n const [document, dispatch] = useDocumentById(documentId);\n if (!isSubgraphModuleDocument(document)) return [undefined, undefined];\n return [document, dispatch];\n}\n\n/** Hook to get the selected SubgraphModule document */\nexport function useSelectedSubgraphModuleDocument(): [\n SubgraphModuleDocument,\n DocumentDispatch<SubgraphModuleAction>,\n] {\n const [document, dispatch] = useSelectedDocument();\n\n assertIsSubgraphModuleDocument(document);\n return [document, dispatch] as const;\n}\n\n/** Hook to get all SubgraphModule documents in the selected drive */\nexport function useSubgraphModuleDocumentsInSelectedDrive() {\n const documentsInSelectedDrive = useDocumentsInSelectedDrive();\n return documentsInSelectedDrive?.filter(isSubgraphModuleDocument);\n}\n\n/** Hook to get all SubgraphModule documents in the selected folder */\nexport function useSubgraphModuleDocumentsInSelectedFolder() {\n const documentsInSelectedFolder = useDocumentsInSelectedFolder();\n return documentsInSelectedFolder?.filter(isSubgraphModuleDocument);\n}\n"],"mappings":";;;;;;;;;;;AAQA,MAAa,2BAA2B,qBAAqB,iBAG3D,
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../document-models/subgraph-module/v1/gen/controller.ts","../../../document-models/subgraph-module/v1/hooks.ts"],"sourcesContent":["/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport { PHDocumentController } from \"document-model\";\nimport { SubgraphModule } from \"../module.js\";\nimport type { SubgraphModuleAction, SubgraphModulePHState } from \"./types.js\";\n\nexport const SubgraphModuleController = PHDocumentController.forDocumentModel<\n SubgraphModulePHState,\n SubgraphModuleAction\n>(SubgraphModule);\n","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { DocumentDispatch } from \"@powerhousedao/reactor-browser\";\nimport {\n useDocumentById,\n useDocumentsInSelectedDrive,\n useDocumentsInSelectedFolder,\n useSelectedDocument,\n} from \"@powerhousedao/reactor-browser\";\nimport type {\n SubgraphModuleAction,\n SubgraphModuleDocument,\n} from \"document-models/subgraph-module/v1\";\nimport {\n assertIsSubgraphModuleDocument,\n isSubgraphModuleDocument,\n} from \"./gen/document-schema.js\";\n\n/** Hook to get a SubgraphModule document by its id */\nexport function useSubgraphModuleDocumentById(\n documentId: string | null | undefined,\n):\n | [SubgraphModuleDocument, DocumentDispatch<SubgraphModuleAction>]\n | [undefined, undefined] {\n const [document, dispatch] = useDocumentById(documentId);\n if (!isSubgraphModuleDocument(document)) return [undefined, undefined];\n return [document, dispatch];\n}\n\n/** Hook to get the selected SubgraphModule document */\nexport function useSelectedSubgraphModuleDocument(): [\n SubgraphModuleDocument,\n DocumentDispatch<SubgraphModuleAction>,\n] {\n const [document, dispatch] = useSelectedDocument();\n\n assertIsSubgraphModuleDocument(document);\n return [document, dispatch] as const;\n}\n\n/** Hook to get all SubgraphModule documents in the selected drive */\nexport function useSubgraphModuleDocumentsInSelectedDrive() {\n const documentsInSelectedDrive = useDocumentsInSelectedDrive();\n return documentsInSelectedDrive?.filter(isSubgraphModuleDocument);\n}\n\n/** Hook to get all SubgraphModule documents in the selected folder */\nexport function useSubgraphModuleDocumentsInSelectedFolder() {\n const documentsInSelectedFolder = useDocumentsInSelectedFolder();\n return documentsInSelectedFolder?.filter(isSubgraphModuleDocument);\n}\n"],"mappings":";;;;;;;;;;;AAQA,MAAa,2BAA2B,qBAAqB,iBAG3D,cAAc;;;;ACUhB,SAAgB,8BACd,YAGyB;CACzB,MAAM,CAAC,UAAU,YAAY,gBAAgB,UAAU;CACvD,IAAI,CAAC,yBAAyB,QAAQ,GAAG,OAAO,CAAC,KAAA,GAAW,KAAA,CAAS;CACrE,OAAO,CAAC,UAAU,QAAQ;AAC5B;;AAGA,SAAgB,oCAGd;CACA,MAAM,CAAC,UAAU,YAAY,oBAAoB;CAEjD,+BAA+B,QAAQ;CACvC,OAAO,CAAC,UAAU,QAAQ;AAC5B;;AAGA,SAAgB,4CAA4C;CAE1D,OADiC,4BACH,CAAC,EAAE,OAAO,wBAAwB;AAClE;;AAGA,SAAgB,6CAA6C;CAE3D,OADkC,6BACH,CAAC,EAAE,OAAO,wBAAwB;AACnE"}
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
declare const supportedVersions: readonly [1];
|
|
6
|
-
declare const latestVersion: 1;
|
|
7
|
-
//#endregion
|
|
8
|
-
//#region document-models/vetra-package/upgrades/upgrade-manifest.d.ts
|
|
9
|
-
declare const vetraPackageUpgradeManifest: UpgradeManifest<typeof supportedVersions>;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { AddPackageKeywordAction, AddPackageKeywordInput, AddPackageKeywordInputSchema, Author, AuthorSchema, Exact, Incremental, InputMaybe, Keyword, KeywordSchema, MakeEmpty, MakeMaybe, MakeOptional, Maybe, RemovePackageKeywordAction, RemovePackageKeywordInput, RemovePackageKeywordInputSchema, Scalars, SetPackageAuthorAction, SetPackageAuthorInput, SetPackageAuthorInputSchema, SetPackageAuthorNameAction, SetPackageAuthorNameInput, SetPackageAuthorNameInputSchema, SetPackageAuthorWebsiteAction, SetPackageAuthorWebsiteInput, SetPackageAuthorWebsiteInputSchema, SetPackageCategoryAction, SetPackageCategoryInput, SetPackageCategoryInputSchema, SetPackageDescriptionAction, SetPackageDescriptionInput, SetPackageDescriptionInputSchema, SetPackageGithubUrlAction, SetPackageGithubUrlInput, SetPackageGithubUrlInputSchema, SetPackageNameAction, SetPackageNameInput, SetPackageNameInputSchema, SetPackageNpmUrlAction, SetPackageNpmUrlInput, SetPackageNpmUrlInputSchema, VetraPackage, VetraPackageAction, VetraPackageBaseOperationsAction, VetraPackageBaseOperationsOperations, VetraPackageController, VetraPackageDocument, VetraPackageDocumentHeaderSchema, VetraPackageDocumentSchema, VetraPackageState as VetraPackageGlobalState, VetraPackageState, VetraPackageLocalState, VetraPackagePHState, VetraPackagePHStateSchema, VetraPackageStateSchema, actions, addPackageKeyword, assertIsVetraPackageDocument, assertIsVetraPackageState, createState, createVetraPackageDocument, defaultGlobalState, defaultLocalState, defaultPHState, definedNonNullAnySchema, documentModel, initialGlobalState, initialLocalState, isDefinedNonNullAny, isVetraPackageDocument, isVetraPackageState, latestVersion, reducer, removePackageKeyword, setPackageAuthor, setPackageAuthorName, setPackageAuthorWebsite, setPackageCategory, setPackageDescription, setPackageGithubUrl, setPackageName, setPackageNpmUrl, supportedVersions, useSelectedVetraPackageDocument, useVetraPackageDocumentById, useVetraPackageDocumentsInSelectedDrive, useVetraPackageDocumentsInSelectedFolder, utils, creators_d_exports as vetraPackageBaseOperationsActions, vetraPackageDocumentType, vetraPackageUpgradeManifest };
|
|
12
|
-
//# sourceMappingURL=index.d.ts.map
|
|
1
|
+
import { $ as VetraPackagePHState, A as VetraPackageDocumentHeaderSchema, At as SetPackageNameAction, B as removePackageKeyword, C as isDefinedNonNullAny, Ct as RemovePackageKeywordAction, D as defaultGlobalState, Dt as SetPackageCategoryAction, E as createVetraPackageDocument, Et as SetPackageAuthorWebsiteAction, F as isVetraPackageDocument, G as setPackageDescription, H as setPackageAuthorName, I as isVetraPackageState, J as setPackageNpmUrl, K as setPackageGithubUrl, L as documentModel, M as VetraPackagePHStateSchema, Mt as VetraPackageBaseOperationsAction, N as assertIsVetraPackageDocument, O as defaultLocalState, Ot as SetPackageDescriptionAction, P as assertIsVetraPackageState, Q as VetraPackageLocalState, R as addPackageKeyword, S as definedNonNullAnySchema, St as AddPackageKeywordAction, T as createState, Tt as SetPackageAuthorNameAction, U as setPackageAuthorWebsite, V as setPackageAuthor, W as setPackageCategory, X as VetraPackageBaseOperationsOperations, Y as VetraPackageController, Z as VetraPackageDocument, _ as SetPackageDescriptionInputSchema, _t as SetPackageGithubUrlInput, a as useVetraPackageDocumentsInSelectedDrive, at as Keyword, b as SetPackageNpmUrlInputSchema, bt as VetraPackageState, c as initialLocalState, ct as MakeOptional, d as KeywordSchema, dt as Scalars, et as AddPackageKeywordInput, f as RemovePackageKeywordInputSchema, ft as SetPackageAuthorInput, g as SetPackageCategoryInputSchema, gt as SetPackageDescriptionInput, h as SetPackageAuthorWebsiteInputSchema, ht as SetPackageCategoryInput, i as useVetraPackageDocumentById, it as InputMaybe, j as VetraPackageDocumentSchema, jt as SetPackageNpmUrlAction, k as defaultPHState, kt as SetPackageGithubUrlAction, l as AddPackageKeywordInputSchema, lt as Maybe, m as SetPackageAuthorNameInputSchema, mt as SetPackageAuthorWebsiteInput, n as utils, nt as Exact, o as useVetraPackageDocumentsInSelectedFolder, ot as MakeEmpty, p as SetPackageAuthorInputSchema, pt as SetPackageAuthorNameInput, q as setPackageName, r as useSelectedVetraPackageDocument, rt as Incremental, s as initialGlobalState, st as MakeMaybe, t as VetraPackage, tt as Author, u as AuthorSchema, ut as RemovePackageKeywordInput, v as SetPackageGithubUrlInputSchema, vt as SetPackageNameInput, w as reducer, wt as SetPackageAuthorAction, x as VetraPackageStateSchema, xt as VetraPackageAction, y as SetPackageNameInputSchema, yt as SetPackageNpmUrlInput, z as creators_d_exports } from "../../module-C-jL7yqs.js";
|
|
2
|
+
import { a as actions, i as vetraPackageDocumentType, n as latestVersion, r as supportedVersions, t as vetraPackageUpgradeManifest } from "../../index-DGhkn3As.js";
|
|
3
|
+
export { AddPackageKeywordAction, AddPackageKeywordInput, AddPackageKeywordInputSchema, Author, AuthorSchema, Exact, Incremental, InputMaybe, Keyword, KeywordSchema, MakeEmpty, MakeMaybe, MakeOptional, Maybe, RemovePackageKeywordAction, RemovePackageKeywordInput, RemovePackageKeywordInputSchema, Scalars, SetPackageAuthorAction, SetPackageAuthorInput, SetPackageAuthorInputSchema, SetPackageAuthorNameAction, SetPackageAuthorNameInput, SetPackageAuthorNameInputSchema, SetPackageAuthorWebsiteAction, SetPackageAuthorWebsiteInput, SetPackageAuthorWebsiteInputSchema, SetPackageCategoryAction, SetPackageCategoryInput, SetPackageCategoryInputSchema, SetPackageDescriptionAction, SetPackageDescriptionInput, SetPackageDescriptionInputSchema, SetPackageGithubUrlAction, SetPackageGithubUrlInput, SetPackageGithubUrlInputSchema, SetPackageNameAction, SetPackageNameInput, SetPackageNameInputSchema, SetPackageNpmUrlAction, SetPackageNpmUrlInput, SetPackageNpmUrlInputSchema, VetraPackage, VetraPackageAction, VetraPackageBaseOperationsAction, VetraPackageBaseOperationsOperations, VetraPackageController, type VetraPackageDocument, VetraPackageDocumentHeaderSchema, VetraPackageDocumentSchema, type VetraPackageState as VetraPackageGlobalState, VetraPackageState, type VetraPackageLocalState, type VetraPackagePHState, VetraPackagePHStateSchema, VetraPackageStateSchema, actions, addPackageKeyword, assertIsVetraPackageDocument, assertIsVetraPackageState, createState, createVetraPackageDocument, defaultGlobalState, defaultLocalState, defaultPHState, definedNonNullAnySchema, documentModel, initialGlobalState, initialLocalState, isDefinedNonNullAny, isVetraPackageDocument, isVetraPackageState, latestVersion, reducer, removePackageKeyword, setPackageAuthor, setPackageAuthorName, setPackageAuthorWebsite, setPackageCategory, setPackageDescription, setPackageGithubUrl, setPackageName, setPackageNpmUrl, supportedVersions, useSelectedVetraPackageDocument, useVetraPackageDocumentById, useVetraPackageDocumentsInSelectedDrive, useVetraPackageDocumentsInSelectedFolder, utils, creators_d_exports as vetraPackageBaseOperationsActions, vetraPackageDocumentType, vetraPackageUpgradeManifest };
|
|
4
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { A as KeywordSchema, B as VetraPackageStateSchema, C as setPackageCategory, D as setPackageNpmUrl, E as setPackageName, F as SetPackageCategoryInputSchema, H as isDefinedNonNullAny, I as SetPackageDescriptionInputSchema, L as SetPackageGithubUrlInputSchema, M as SetPackageAuthorInputSchema, N as SetPackageAuthorNameInputSchema, O as AddPackageKeywordInputSchema, P as SetPackageAuthorWebsiteInputSchema, R as SetPackageNameInputSchema, S as setPackageAuthorWebsite, T as setPackageGithubUrl, V as definedNonNullAnySchema, _ as addPackageKeyword, b as setPackageAuthor, c as VetraPackagePHStateSchema, d as isVetraPackageDocument, f as isVetraPackageState, g as actions, h as documentModel, i as initialLocalState, j as RemovePackageKeywordInputSchema, k as AuthorSchema, l as assertIsVetraPackageDocument, m as reducer, n as utils, o as VetraPackageDocumentHeaderSchema, p as vetraPackageDocumentType, r as initialGlobalState, s as VetraPackageDocumentSchema, t as VetraPackage, u as assertIsVetraPackageState, v as creators_exports, w as setPackageDescription, x as setPackageAuthorName, y as removePackageKeyword, z as SetPackageNpmUrlInputSchema } from "../../module-
|
|
2
|
-
import { a as createState, c as defaultLocalState, i as useVetraPackageDocumentsInSelectedFolder, l as defaultPHState, n as useVetraPackageDocumentById, o as createVetraPackageDocument, r as useVetraPackageDocumentsInSelectedDrive, s as defaultGlobalState, t as useSelectedVetraPackageDocument, u as VetraPackageController } from "../../vetra-package-
|
|
3
|
-
import { n as latestVersion, r as supportedVersions, t as vetraPackageUpgradeManifest } from "../../upgrade-manifest-
|
|
1
|
+
import { A as KeywordSchema, B as VetraPackageStateSchema, C as setPackageCategory, D as setPackageNpmUrl, E as setPackageName, F as SetPackageCategoryInputSchema, H as isDefinedNonNullAny, I as SetPackageDescriptionInputSchema, L as SetPackageGithubUrlInputSchema, M as SetPackageAuthorInputSchema, N as SetPackageAuthorNameInputSchema, O as AddPackageKeywordInputSchema, P as SetPackageAuthorWebsiteInputSchema, R as SetPackageNameInputSchema, S as setPackageAuthorWebsite, T as setPackageGithubUrl, V as definedNonNullAnySchema, _ as addPackageKeyword, b as setPackageAuthor, c as VetraPackagePHStateSchema, d as isVetraPackageDocument, f as isVetraPackageState, g as actions, h as documentModel, i as initialLocalState, j as RemovePackageKeywordInputSchema, k as AuthorSchema, l as assertIsVetraPackageDocument, m as reducer, n as utils, o as VetraPackageDocumentHeaderSchema, p as vetraPackageDocumentType, r as initialGlobalState, s as VetraPackageDocumentSchema, t as VetraPackage, u as assertIsVetraPackageState, v as creators_exports, w as setPackageDescription, x as setPackageAuthorName, y as removePackageKeyword, z as SetPackageNpmUrlInputSchema } from "../../module-FXJRy_1W.js";
|
|
2
|
+
import { a as createState, c as defaultLocalState, i as useVetraPackageDocumentsInSelectedFolder, l as defaultPHState, n as useVetraPackageDocumentById, o as createVetraPackageDocument, r as useVetraPackageDocumentsInSelectedDrive, s as defaultGlobalState, t as useSelectedVetraPackageDocument, u as VetraPackageController } from "../../vetra-package-DSyRtkdJ.js";
|
|
3
|
+
import { n as latestVersion, r as supportedVersions, t as vetraPackageUpgradeManifest } from "../../upgrade-manifest-BOZ5nmyK.js";
|
|
4
4
|
export { AddPackageKeywordInputSchema, AuthorSchema, KeywordSchema, RemovePackageKeywordInputSchema, SetPackageAuthorInputSchema, SetPackageAuthorNameInputSchema, SetPackageAuthorWebsiteInputSchema, SetPackageCategoryInputSchema, SetPackageDescriptionInputSchema, SetPackageGithubUrlInputSchema, SetPackageNameInputSchema, SetPackageNpmUrlInputSchema, VetraPackage, VetraPackageController, VetraPackageDocumentHeaderSchema, VetraPackageDocumentSchema, VetraPackagePHStateSchema, VetraPackageStateSchema, actions, addPackageKeyword, assertIsVetraPackageDocument, assertIsVetraPackageState, createState, createVetraPackageDocument, defaultGlobalState, defaultLocalState, defaultPHState, definedNonNullAnySchema, documentModel, initialGlobalState, initialLocalState, isDefinedNonNullAny, isVetraPackageDocument, isVetraPackageState, latestVersion, reducer, removePackageKeyword, setPackageAuthor, setPackageAuthorName, setPackageAuthorWebsite, setPackageCategory, setPackageDescription, setPackageGithubUrl, setPackageName, setPackageNpmUrl, supportedVersions, useSelectedVetraPackageDocument, useVetraPackageDocumentById, useVetraPackageDocumentsInSelectedDrive, useVetraPackageDocumentsInSelectedFolder, utils, creators_exports as vetraPackageBaseOperationsActions, vetraPackageDocumentType, vetraPackageUpgradeManifest };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { g as setSubgraphStatus, h as setSubgraphName } from "./utils-
|
|
1
|
+
import { g as setSubgraphStatus, h as setSubgraphName } from "./utils-Al_SGg2a.js";
|
|
2
2
|
import { StatusPill } from "./editors/components/index.js";
|
|
3
|
-
import { t as useDebounce } from "./hooks-
|
|
4
|
-
import { r as useSelectedSubgraphModuleDocument } from "./useVetraDocument-BlLdlhrQ.js";
|
|
3
|
+
import { t as useDebounce } from "./hooks-BbxvC-C3.js";
|
|
5
4
|
import { useSetPHDocumentEditorConfig } from "@powerhousedao/reactor-browser";
|
|
6
5
|
import { useCallback, useEffect, useState } from "react";
|
|
7
6
|
import { twMerge } from "tailwind-merge";
|
|
@@ -65,9 +64,8 @@ const SubgraphEditorForm = ({ subgraphName: initialSubgraphName = "", status = "
|
|
|
65
64
|
const editorConfig = { isExternalControlsEnabled: false };
|
|
66
65
|
//#endregion
|
|
67
66
|
//#region editors/subgraph-editor/editor.tsx
|
|
68
|
-
function Editor() {
|
|
67
|
+
function Editor({ document, dispatch }) {
|
|
69
68
|
useSetPHDocumentEditorConfig(editorConfig);
|
|
70
|
-
const [document, dispatch] = useSelectedSubgraphModuleDocument();
|
|
71
69
|
const onNameChange = useCallback((name) => {
|
|
72
70
|
if (name === document.state.global.name) return;
|
|
73
71
|
dispatch(setSubgraphName({ name }));
|
|
@@ -77,7 +75,7 @@ function Editor() {
|
|
|
77
75
|
}, [dispatch]);
|
|
78
76
|
return /* @__PURE__ */ jsxs("div", {
|
|
79
77
|
className: "bg-background p-6",
|
|
80
|
-
children: [/* @__PURE__ */ jsx(DocumentToolbar, {}), /* @__PURE__ */ jsx(SubgraphEditorForm, {
|
|
78
|
+
children: [/* @__PURE__ */ jsx(DocumentToolbar, { document }), /* @__PURE__ */ jsx(SubgraphEditorForm, {
|
|
81
79
|
subgraphName: document.state.global.name ?? "",
|
|
82
80
|
status: document.state.global.status,
|
|
83
81
|
onNameChange,
|
|
@@ -88,4 +86,4 @@ function Editor() {
|
|
|
88
86
|
//#endregion
|
|
89
87
|
export { Editor as default };
|
|
90
88
|
|
|
91
|
-
//# sourceMappingURL=editor-
|
|
89
|
+
//# sourceMappingURL=editor-BDR7IYJG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-BDR7IYJG.js","names":[],"sources":["../editors/subgraph-editor/components/SubgraphEditorForm.tsx","../editors/subgraph-editor/config.ts","../editors/subgraph-editor/editor.tsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\nimport { StatusPill } from \"../../components/index.js\";\nimport { useDebounce } from \"../../hooks/index.js\";\n\nexport interface SubgraphEditorFormProps {\n subgraphName?: string;\n status?: string;\n onNameChange?: (name: string) => void;\n onConfirm?: () => void;\n}\n\nexport const SubgraphEditorForm: React.FC<SubgraphEditorFormProps> = ({\n subgraphName: initialSubgraphName = \"\",\n status = \"DRAFT\",\n onNameChange,\n onConfirm,\n}) => {\n const [subgraphName, setSubgraphName] = useState(initialSubgraphName);\n const [isConfirmed, setIsConfirmed] = useState(false);\n\n // Use the debounce hook for name changes\n useDebounce(subgraphName, onNameChange, 300);\n\n // Update local state when initialSubgraphName changes\n useEffect(() => {\n // eslint-disable-next-line react-hooks-extra/set-state-in-effect\n setSubgraphName(initialSubgraphName);\n }, [initialSubgraphName]);\n\n // Reset confirmation state if status changes back to DRAFT\n useEffect(() => {\n if (status === \"DRAFT\") {\n // eslint-disable-next-line react-hooks-extra/set-state-in-effect\n setIsConfirmed(false);\n }\n }, [status]);\n\n // Check if form should be read-only\n const isReadOnly = isConfirmed || status === \"CONFIRMED\";\n\n const handleConfirm = () => {\n if (subgraphName.trim()) {\n setIsConfirmed(true); // Immediate UI update\n onConfirm?.();\n }\n };\n\n return (\n <div className=\"space-y-6 p-6\">\n <div className=\"flex items-center justify-between\">\n <h2 className=\"text-lg font-medium text-foreground\">\n Subgraph Configuration\n </h2>\n <StatusPill\n status={status === \"CONFIRMED\" ? \"confirmed\" : \"draft\"}\n label={status === \"CONFIRMED\" ? \"Confirmed\" : \"Draft\"}\n />\n </div>\n\n {/* Subgraph Name Field */}\n <div>\n <label\n htmlFor=\"subgraph-name\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Subgraph Name\n </label>\n <input\n id=\"subgraph-name\"\n type=\"text\"\n value={subgraphName}\n onChange={(e) => setSubgraphName(e.target.value)}\n disabled={isReadOnly}\n className={twMerge(\n \"w-full rounded-md border border-border px-3 py-2 text-foreground placeholder:text-muted-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none disabled:disabled-effect\",\n isReadOnly ? \"cursor-not-allowed bg-muted\" : \"\",\n )}\n placeholder=\"Enter subgraph name\"\n />\n </div>\n\n {/* Confirm Button - only show if not in read-only mode */}\n {!isReadOnly && (\n <div>\n <button\n onClick={handleConfirm}\n disabled={!subgraphName.trim()}\n className=\"rounded-md bg-primary px-4 py-2 text-primary-foreground hover:hover-effect focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-none disabled:disabled-effect\"\n >\n Confirm\n </button>\n </div>\n )}\n </div>\n );\n};\n","import type { PHDocumentEditorConfig } from \"@powerhousedao/reactor-browser\";\n\nexport const editorConfig: PHDocumentEditorConfig = {\n isExternalControlsEnabled: false,\n};\n","import { DocumentToolbar } from \"@powerhousedao/design-system/connect\";\nimport type { EditorProps } from \"@powerhousedao/shared/document-model\";\nimport type {\n SubgraphModuleAction,\n SubgraphModuleDocument,\n} from \"../../document-models/subgraph-module/index.js\";\nimport { useSetPHDocumentEditorConfig } from \"@powerhousedao/reactor-browser\";\nimport {\n setSubgraphName,\n setSubgraphStatus,\n} from \"@powerhousedao/vetra/document-models/subgraph-module\";\nimport { useCallback } from \"react\";\nimport { SubgraphEditorForm } from \"./components/SubgraphEditorForm.js\";\nimport { editorConfig } from \"./config.js\";\n\nexport default function Editor({\n document,\n dispatch,\n}: EditorProps<SubgraphModuleDocument, SubgraphModuleAction>) {\n useSetPHDocumentEditorConfig(editorConfig);\n\n const onNameChange = useCallback(\n (name: string) => {\n if (name === document.state.global.name) return;\n dispatch(setSubgraphName({ name }));\n },\n [document.state.global.name, dispatch],\n );\n\n const onConfirm = useCallback(() => {\n dispatch(setSubgraphStatus({ status: \"CONFIRMED\" }));\n }, [dispatch]);\n\n return (\n <div className=\"bg-background p-6\">\n <DocumentToolbar document={document} />\n <SubgraphEditorForm\n subgraphName={document.state.global.name ?? \"\"}\n status={document.state.global.status}\n onNameChange={onNameChange}\n onConfirm={onConfirm}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAYA,MAAa,sBAAyD,EACpE,cAAc,sBAAsB,IACpC,SAAS,SACT,cACA,gBACI;CACJ,MAAM,CAAC,cAAc,mBAAmB,SAAS,mBAAmB;CACpE,MAAM,CAAC,aAAa,kBAAkB,SAAS,KAAK;CAGpD,YAAY,cAAc,cAAc,GAAG;CAG3C,gBAAgB;EAEd,gBAAgB,mBAAmB;CACrC,GAAG,CAAC,mBAAmB,CAAC;CAGxB,gBAAgB;EACd,IAAI,WAAW,SAEb,eAAe,KAAK;CAExB,GAAG,CAAC,MAAM,CAAC;CAGX,MAAM,aAAa,eAAe,WAAW;CAE7C,MAAM,sBAAsB;EAC1B,IAAI,aAAa,KAAK,GAAG;GACvB,eAAe,IAAI;GACnB,YAAY;EACd;CACF;CAEA,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,qBAAC,OAAD;IAAK,WAAU;IAAf,UAAA,CACE,oBAAC,MAAD;KAAI,WAAU;KAAsC,UAAA;IAEhD,CAAA,GACJ,oBAAC,YAAD;KACE,QAAQ,WAAW,cAAc,cAAc;KAC/C,OAAO,WAAW,cAAc,cAAc;IAC/C,CAAA,CACE;;GAGL,qBAAC,OAAD,EAAA,UAAA,CACE,oBAAC,SAAD;IACE,SAAQ;IACR,WAAU;IACX,UAAA;GAEM,CAAA,GACP,oBAAC,SAAD;IACE,IAAG;IACH,MAAK;IACL,OAAO;IACP,WAAW,MAAM,gBAAgB,EAAE,OAAO,KAAK;IAC/C,UAAU;IACV,WAAW,QACT,wMACA,aAAa,gCAAgC,EAC/C;IACA,aAAY;GACb,CAAA,CACE,EAAA,CAAA;GAGJ,CAAC,cACA,oBAAC,OAAD,EAAA,UACE,oBAAC,UAAD;IACE,SAAS;IACT,UAAU,CAAC,aAAa,KAAK;IAC7B,WAAU;IACX,UAAA;GAEO,CAAA,EACL,CAAA;EAEJ;;AAET;;;AC9FA,MAAa,eAAuC,EAClD,2BAA2B,MAC7B;;;ACWA,SAAwB,OAAO,EAC7B,UACA,YAC4D;CAC5D,6BAA6B,YAAY;CAEzC,MAAM,eAAe,aAClB,SAAiB;EAChB,IAAI,SAAS,SAAS,MAAM,OAAO,MAAM;EACzC,SAAS,gBAAgB,EAAE,KAAK,CAAC,CAAC;CACpC,GACA,CAAC,SAAS,MAAM,OAAO,MAAM,QAAQ,CACvC;CAEA,MAAM,YAAY,kBAAkB;EAClC,SAAS,kBAAkB,EAAE,QAAQ,YAAY,CAAC,CAAC;CACrD,GAAG,CAAC,QAAQ,CAAC;CAEb,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,iBAAD,EAA2B,SAAW,CAAA,GACtC,oBAAC,oBAAD;GACE,cAAc,SAAS,MAAM,OAAO,QAAQ;GAC5C,QAAQ,SAAS,MAAM,OAAO;GAChB;GACH;EACZ,CAAA,CACE;;AAET"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as setProcessorStatus, S as setProcessorName, _ as addDocumentType, b as removeDocumentType, v as addProcessorApp, w as setProcessorType, x as removeProcessorApp } from "./utils-BJk4_43W.js";
|
|
2
2
|
import { StatusPill } from "./editors/components/index.js";
|
|
3
|
-
import { n as useAvailableDocumentTypes, t as useDebounce } from "./hooks-
|
|
4
|
-
import { n as useSelectedProcessorModuleDocument } from "./useVetraDocument-BlLdlhrQ.js";
|
|
3
|
+
import { n as useAvailableDocumentTypes, t as useDebounce } from "./hooks-BbxvC-C3.js";
|
|
5
4
|
import { useSetPHDocumentEditorConfig } from "@powerhousedao/reactor-browser";
|
|
6
5
|
import { PROCESSOR_APPS } from "@powerhousedao/shared/processors";
|
|
7
6
|
import { useCallback, useEffect, useState } from "react";
|
|
@@ -157,7 +156,7 @@ const ProcessorEditorForm = ({ processorName: initialProcessorName = "", process
|
|
|
157
156
|
checked: processorApps.includes(processorApp),
|
|
158
157
|
onChange: (event) => {
|
|
159
158
|
if (event.target.checked) {
|
|
160
|
-
setProcessorApps((processorApps) => [
|
|
159
|
+
setProcessorApps((processorApps) => [.../* @__PURE__ */ new Set([...processorApps, processorApp])]);
|
|
161
160
|
onAddProcessorApp?.(processorApp);
|
|
162
161
|
} else if (processorApps.length > 1) {
|
|
163
162
|
setProcessorApps((processorApps) => processorApps.filter((p) => p !== processorApp));
|
|
@@ -191,9 +190,8 @@ const ProcessorEditorForm = ({ processorName: initialProcessorName = "", process
|
|
|
191
190
|
const editorConfig = { isExternalControlsEnabled: false };
|
|
192
191
|
//#endregion
|
|
193
192
|
//#region editors/processor-editor/editor.tsx
|
|
194
|
-
function Editor() {
|
|
193
|
+
function Editor({ document, dispatch }) {
|
|
195
194
|
useSetPHDocumentEditorConfig(editorConfig);
|
|
196
|
-
const [document, dispatch] = useSelectedProcessorModuleDocument();
|
|
197
195
|
const onConfirm = useCallback(() => {
|
|
198
196
|
dispatch([setProcessorStatus({ status: "CONFIRMED" })]);
|
|
199
197
|
}, [dispatch]);
|
|
@@ -222,7 +220,7 @@ function Editor() {
|
|
|
222
220
|
}, [dispatch]);
|
|
223
221
|
return /* @__PURE__ */ jsxs("div", {
|
|
224
222
|
className: "bg-background p-6",
|
|
225
|
-
children: [/* @__PURE__ */ jsx(DocumentToolbar, {}), /* @__PURE__ */ jsx(ProcessorEditorForm, {
|
|
223
|
+
children: [/* @__PURE__ */ jsx(DocumentToolbar, { document }), /* @__PURE__ */ jsx(ProcessorEditorForm, {
|
|
226
224
|
onNameChange,
|
|
227
225
|
onTypeChange,
|
|
228
226
|
onAddDocumentType,
|
|
@@ -241,4 +239,4 @@ function Editor() {
|
|
|
241
239
|
//#endregion
|
|
242
240
|
export { Editor as default };
|
|
243
241
|
|
|
244
|
-
//# sourceMappingURL=editor-
|
|
242
|
+
//# sourceMappingURL=editor-CbT_8Z6A.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-CbT_8Z6A.js","names":[],"sources":["../editors/processor-editor/components/ProcessorEditorForm.tsx","../editors/processor-editor/config.ts","../editors/processor-editor/editor.tsx"],"sourcesContent":["import {\n PROCESSOR_APPS,\n type ProcessorApp,\n type ProcessorApps,\n} from \"@powerhousedao/shared/processors\";\nimport { useEffect, useState } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\nimport type { DocumentTypeItem } from \"../../../document-models/processor-module/index.js\";\nimport { StatusPill } from \"../../components/index.js\";\nimport { useAvailableDocumentTypes, useDebounce } from \"../../hooks/index.js\";\n\nexport interface ProcessorEditorFormProps {\n processorName?: string;\n processorType?: string;\n documentTypes?: DocumentTypeItem[];\n processorApps?: ProcessorApps;\n status?: string;\n onNameChange?: (name: string) => void;\n onTypeChange?: (type: string) => void;\n onAddDocumentType?: (id: string, documentType: string) => void;\n onRemoveDocumentType?: (id: string) => void;\n onAddProcessorApp?: (processorApp: ProcessorApp) => void;\n onRemoveProcessorApp?: (processorApp: ProcessorApp) => void;\n onConfirm?: () => void;\n}\n\nexport const ProcessorEditorForm: React.FC<ProcessorEditorFormProps> = ({\n processorName: initialProcessorName = \"\",\n processorType: initialProcessorType = \"\",\n documentTypes: initialDocumentTypes = [],\n processorApps: initialProcessorApps = [],\n status = \"DRAFT\",\n onNameChange,\n onTypeChange,\n onAddDocumentType,\n onRemoveDocumentType,\n onAddProcessorApp,\n onRemoveProcessorApp,\n onConfirm,\n}) => {\n const [processorName, setProcessorName] = useState(initialProcessorName);\n const [processorType, setProcessorType] = useState(initialProcessorType);\n const [documentTypes, setDocumentTypes] =\n useState<DocumentTypeItem[]>(initialDocumentTypes);\n const [selectedDocumentType, setSelectedDocumentType] = useState(\"\");\n const [processorApps, setProcessorApps] = useState(initialProcessorApps);\n const [isConfirmed, setIsConfirmed] = useState(false);\n\n // Get available document types from the hook (combines reactor and vetra drive)\n const availableDocumentTypes = useAvailableDocumentTypes();\n\n // Use the debounce hook for name and type changes\n useDebounce(processorName, onNameChange, 300);\n useDebounce(processorType, onTypeChange, 300);\n\n // Update local state when initial values change\n useEffect(() => {\n // eslint-disable-next-line react-hooks-extra/set-state-in-effect\n setProcessorName(initialProcessorName);\n }, [initialProcessorName]);\n\n useEffect(() => {\n // eslint-disable-next-line react-hooks-extra/set-state-in-effect\n setProcessorType(initialProcessorType);\n }, [initialProcessorType]);\n\n useEffect(() => {\n // eslint-disable-next-line react-hooks-extra/set-state-in-effect\n setDocumentTypes(initialDocumentTypes);\n }, [initialDocumentTypes]);\n\n useEffect(() => {\n // eslint-disable-next-line react-hooks-extra/set-state-in-effect\n setProcessorApps(initialProcessorApps);\n }, [initialProcessorApps]);\n\n // Reset confirmation state if status changes back to DRAFT\n useEffect(() => {\n if (status === \"DRAFT\") {\n // eslint-disable-next-line react-hooks-extra/set-state-in-effect\n setIsConfirmed(false);\n }\n }, [status]);\n\n // Check if form should be read-only\n const isReadOnly = isConfirmed || status === \"CONFIRMED\";\n\n const handleConfirm = () => {\n if (\n processorName.trim() &&\n processorType &&\n documentTypes.length > 0 &&\n processorApps.length > 0\n ) {\n setIsConfirmed(true); // Immediate UI update\n onConfirm?.();\n }\n };\n\n const handleRemoveDocumentType = (id: string) => {\n setDocumentTypes(documentTypes.filter((dt) => dt.id !== id));\n onRemoveDocumentType?.(id);\n };\n\n const canConfirm =\n !!processorName.trim() &&\n !!processorType &&\n documentTypes.length > 0 &&\n processorApps.length > 0;\n\n return (\n <div className=\"space-y-6 p-6\">\n <div className=\"flex items-center justify-between\">\n <h2 className=\"text-lg font-medium text-foreground\">\n Processor Configuration\n </h2>\n <StatusPill\n status={status === \"CONFIRMED\" ? \"confirmed\" : \"draft\"}\n label={status === \"CONFIRMED\" ? \"Confirmed\" : \"Draft\"}\n />\n </div>\n\n {/* Processor Name Field */}\n <div>\n <label\n htmlFor=\"processor-name\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Processor Name\n </label>\n <input\n id=\"processor-name\"\n type=\"text\"\n value={processorName}\n onChange={(e) => setProcessorName(e.target.value)}\n disabled={isReadOnly}\n className={twMerge(\n \"w-full rounded-md border border-border px-3 py-2 text-foreground placeholder:text-muted-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none disabled:disabled-effect\",\n isReadOnly\n ? \"cursor-not-allowed bg-muted text-muted-foreground\"\n : \"\",\n )}\n placeholder=\"Enter processor name\"\n />\n </div>\n\n {/* Processor Type Dropdown */}\n <div>\n <label\n htmlFor=\"processor-type\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Type\n </label>\n <select\n id=\"processor-type\"\n value={processorType}\n onChange={(e) => setProcessorType(e.target.value)}\n disabled={isReadOnly}\n className={twMerge(\n \"w-full rounded-md border border-border px-3 py-2 text-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none\",\n isReadOnly ? \"cursor-not-allowed bg-muted\" : \"\",\n )}\n >\n <option value=\"\">Select type...</option>\n <option value=\"analytics\">Analytics</option>\n <option value=\"relational\">Relational Database</option>\n </select>\n </div>\n\n {/* Document Types Field */}\n <div>\n <label\n htmlFor=\"document-types\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Document Types\n </label>\n <div className=\"space-y-2\">\n {!isReadOnly && availableDocumentTypes.length > 0 && (\n <select\n id=\"document-types\"\n value={selectedDocumentType}\n onChange={(e) => {\n const selectedValue = e.target.value;\n if (\n selectedValue &&\n !documentTypes.some((dt) => dt.documentType === selectedValue)\n ) {\n const id = Date.now().toString();\n const newType: DocumentTypeItem = {\n id,\n documentType: selectedValue,\n };\n setDocumentTypes([...documentTypes, newType]);\n onAddDocumentType?.(id, selectedValue);\n }\n setSelectedDocumentType(\"\");\n }}\n className=\"w-full rounded-md border border-border px-3 py-2 text-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none\"\n >\n <option value=\"\">Select a document type to add</option>\n {availableDocumentTypes\n .filter(\n (docType) =>\n !documentTypes.some((dt) => dt.documentType === docType),\n )\n .map((docType) => (\n <option key={docType} value={docType}>\n {docType}\n </option>\n ))}\n </select>\n )}\n <div className=\"space-y-1\">\n {documentTypes.map((type) => (\n <div key={type.id} className=\"flex items-center py-1\">\n <span className=\"text-sm text-foreground\">\n {type.documentType}\n </span>\n {!isReadOnly && (\n <button\n onClick={() => handleRemoveDocumentType(type.id)}\n className=\"ml-2 text-muted-foreground hover:hover-effect focus:outline-none\"\n >\n ×\n </button>\n )}\n </div>\n ))}\n </div>\n </div>\n </div>\n {/* Processor Apps Field */}\n <div>\n <label\n htmlFor=\"processor-apps\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Processor Apps\n </label>\n <div className=\"space-y-2\">\n {!isReadOnly && (\n <>\n {PROCESSOR_APPS.map((processorApp) => (\n <div key={processorApp} className=\"flex gap-1\">\n <input\n type=\"checkbox\"\n name={processorApp}\n id={processorApp}\n checked={processorApps.includes(processorApp)}\n onChange={(event) => {\n const isChecked = event.target.checked;\n if (isChecked) {\n setProcessorApps((processorApps) => [\n ...new Set([...processorApps, processorApp]),\n ]);\n onAddProcessorApp?.(processorApp);\n } else {\n if (processorApps.length > 1) {\n setProcessorApps((processorApps) =>\n processorApps.filter((p) => p !== processorApp),\n );\n onRemoveProcessorApp?.(processorApp);\n }\n }\n }}\n />\n <label htmlFor={processorApp} className=\"text-foreground\">\n {processorApp}\n </label>\n </div>\n ))}\n </>\n )}\n <div className=\"space-y-1\">\n {isReadOnly &&\n processorApps.map((processorApp) => (\n <span key={processorApp} className=\"text-sm text-foreground\">\n {processorApp}\n </span>\n ))}\n </div>\n </div>\n </div>\n {/* Confirm Button - only show if not in read-only mode */}\n {!isReadOnly && (\n <div>\n <button\n onClick={handleConfirm}\n disabled={!canConfirm}\n className=\"rounded-md bg-primary px-4 py-2 text-primary-foreground hover:hover-effect focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-none disabled:disabled-effect\"\n >\n Confirm\n </button>\n </div>\n )}\n </div>\n );\n};\n","import type { PHDocumentEditorConfig } from \"@powerhousedao/reactor-browser\";\n\nexport const editorConfig: PHDocumentEditorConfig = {\n isExternalControlsEnabled: false,\n};\n","import { DocumentToolbar } from \"@powerhousedao/design-system/connect\";\nimport type { EditorProps } from \"@powerhousedao/shared/document-model\";\nimport type {\n ProcessorModuleAction,\n ProcessorModuleDocument,\n} from \"../../document-models/processor-module/index.js\";\nimport { useSetPHDocumentEditorConfig } from \"@powerhousedao/reactor-browser\";\nimport type {\n ProcessorApp,\n ProcessorApps,\n} from \"@powerhousedao/shared/processors\";\nimport { useCallback } from \"react\";\nimport {\n addDocumentType,\n addProcessorApp,\n removeDocumentType,\n removeProcessorApp,\n setProcessorName,\n setProcessorStatus,\n setProcessorType,\n} from \"../../document-models/processor-module/index.js\";\nimport { ProcessorEditorForm } from \"./components/ProcessorEditorForm.js\";\nimport { editorConfig } from \"./config.js\";\n\nexport default function Editor({\n document,\n dispatch,\n}: EditorProps<ProcessorModuleDocument, ProcessorModuleAction>) {\n useSetPHDocumentEditorConfig(editorConfig);\n\n const onConfirm = useCallback(() => {\n // Dispatch all actions at once\n dispatch([setProcessorStatus({ status: \"CONFIRMED\" })]);\n }, [dispatch]);\n\n const onNameChange = useCallback(\n (name: string) => {\n if (name === document.state.global.name) return;\n dispatch(setProcessorName({ name }));\n },\n [document.state.global.name, dispatch],\n );\n\n const onTypeChange = useCallback(\n (type: string) => {\n if (type === document.state.global.type) return;\n dispatch(setProcessorType({ type }));\n },\n [document.state.global.type, dispatch],\n );\n\n const onAddDocumentType = useCallback(\n (id: string, documentType: string) => {\n dispatch(addDocumentType({ id, documentType }));\n },\n [dispatch],\n );\n\n const onRemoveDocumentType = useCallback(\n (id: string) => {\n dispatch(removeDocumentType({ id }));\n },\n [dispatch],\n );\n\n const onAddProcessorApp = useCallback(\n (processorApp: ProcessorApp) => {\n dispatch(addProcessorApp({ processorApp }));\n },\n [dispatch],\n );\n\n const onRemoveProcessorApp = useCallback(\n (processorApp: ProcessorApp) => {\n dispatch(removeProcessorApp({ processorApp }));\n },\n [dispatch],\n );\n\n return (\n <div className=\"bg-background p-6\">\n <DocumentToolbar document={document} />\n <ProcessorEditorForm\n onNameChange={onNameChange}\n onTypeChange={onTypeChange}\n onAddDocumentType={onAddDocumentType}\n onRemoveDocumentType={onRemoveDocumentType}\n onAddProcessorApp={onAddProcessorApp}\n onRemoveProcessorApp={onRemoveProcessorApp}\n status={document.state.global.status}\n processorName={document.state.global.name ?? \"\"}\n processorType={document.state.global.type ?? \"\"}\n documentTypes={document.state.global.documentTypes ?? []}\n processorApps={document.state.global.processorApps as ProcessorApps}\n onConfirm={onConfirm}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AA0BA,MAAa,uBAA2D,EACtE,eAAe,uBAAuB,IACtC,eAAe,uBAAuB,IACtC,eAAe,uBAAuB,CAAC,GACvC,eAAe,uBAAuB,CAAC,GACvC,SAAS,SACT,cACA,cACA,mBACA,sBACA,mBACA,sBACA,gBACI;CACJ,MAAM,CAAC,eAAe,oBAAoB,SAAS,oBAAoB;CACvE,MAAM,CAAC,eAAe,oBAAoB,SAAS,oBAAoB;CACvE,MAAM,CAAC,eAAe,oBACpB,SAA6B,oBAAoB;CACnD,MAAM,CAAC,sBAAsB,2BAA2B,SAAS,EAAE;CACnE,MAAM,CAAC,eAAe,oBAAoB,SAAS,oBAAoB;CACvE,MAAM,CAAC,aAAa,kBAAkB,SAAS,KAAK;CAGpD,MAAM,yBAAyB,0BAA0B;CAGzD,YAAY,eAAe,cAAc,GAAG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,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,iBAAD,EAA2B,SAAW,CAAA,GACtC,oBAAC,qBAAD;GACgB;GACA;GACK;GACG;GACH;GACG;GACtB,QAAQ,SAAS,MAAM,OAAO;GAC9B,eAAe,SAAS,MAAM,OAAO,QAAQ;GAC7C,eAAe,SAAS,MAAM,OAAO,QAAQ;GAC7C,eAAe,SAAS,MAAM,OAAO,iBAAiB,CAAC;GACvD,eAAe,SAAS,MAAM,OAAO;GAC1B;EACZ,CAAA,CACE;;AAET"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { C as setPackageCategory, D as setPackageNpmUrl, E as setPackageName, S as setPackageAuthorWebsite, T as setPackageGithubUrl, _ as addPackageKeyword, w as setPackageDescription, x as setPackageAuthorName, y as removePackageKeyword } from "./module-
|
|
2
|
-
import { t as useDebounce } from "./hooks-
|
|
3
|
-
import { t as useSelectedDriveVetraPackage } from "./useVetraDocument-BlLdlhrQ.js";
|
|
1
|
+
import { C as setPackageCategory, D as setPackageNpmUrl, E as setPackageName, S as setPackageAuthorWebsite, T as setPackageGithubUrl, _ as addPackageKeyword, w as setPackageDescription, x as setPackageAuthorName, y as removePackageKeyword } from "./module-FXJRy_1W.js";
|
|
2
|
+
import { t as useDebounce } from "./hooks-BbxvC-C3.js";
|
|
4
3
|
import { useSetPHDocumentEditorConfig } from "@powerhousedao/reactor-browser";
|
|
5
4
|
import { useCallback, useState } from "react";
|
|
6
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -234,9 +233,8 @@ const editorConfig = { isExternalControlsEnabled: false };
|
|
|
234
233
|
//#endregion
|
|
235
234
|
//#region editors/vetra-package/editor.tsx
|
|
236
235
|
function Editor(props) {
|
|
237
|
-
const { displayToolbar = true } = props;
|
|
236
|
+
const { document, dispatch, displayToolbar = true } = props;
|
|
238
237
|
useSetPHDocumentEditorConfig(editorConfig);
|
|
239
|
-
const [document, dispatch] = useSelectedDriveVetraPackage();
|
|
240
238
|
const onNameChange = useCallback((name) => {
|
|
241
239
|
if (!document.state.global.name && !name) return;
|
|
242
240
|
if (name === document.state.global.name) return;
|
|
@@ -280,7 +278,7 @@ function Editor(props) {
|
|
|
280
278
|
}, [dispatch]);
|
|
281
279
|
return /* @__PURE__ */ jsxs("div", {
|
|
282
280
|
className: "bg-background p-6",
|
|
283
|
-
children: [displayToolbar && /* @__PURE__ */ jsx(DocumentToolbar, {}), /* @__PURE__ */ jsx(MetaForm, {
|
|
281
|
+
children: [displayToolbar && /* @__PURE__ */ jsx(DocumentToolbar, { document }), /* @__PURE__ */ jsx(MetaForm, {
|
|
284
282
|
name: document.state.global.name ?? "",
|
|
285
283
|
description: document.state.global.description ?? "",
|
|
286
284
|
category: document.state.global.category ?? "",
|
|
@@ -304,4 +302,4 @@ function Editor(props) {
|
|
|
304
302
|
//#endregion
|
|
305
303
|
export { Editor as default };
|
|
306
304
|
|
|
307
|
-
//# sourceMappingURL=editor-
|
|
305
|
+
//# sourceMappingURL=editor-CnfajXGg.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-CCdg1mJL.js","names":[],"sources":["../editors/vetra-package/components/MetaForm.tsx","../editors/vetra-package/config.ts","../editors/vetra-package/editor.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport type { Keyword } from \"../../../document-models/vetra-package/index.js\";\nimport { useDebounce } from \"../../hooks/index.js\";\n\nexport interface MetaFormProps {\n name: string;\n description: string;\n category: string;\n publisher: string;\n publisherUrl: string;\n githubRepository: string;\n npmPackage: string;\n keywords: Keyword[];\n onNameChange?: (name: string) => void;\n onDescriptionChange?: (description: string) => void;\n onCategoryChange?: (category: string) => void;\n onPublisherChange?: (publisher: string) => void;\n onPublisherUrlChange?: (publisherUrl: string) => void;\n onGithubRepositoryChange?: (githubRepository: string) => void;\n onNpmPackageChange?: (npmPackage: string) => void;\n onAddKeyword?: (keyword: { id: string; label: string }) => void;\n onRemoveKeyword?: (id: string) => void;\n}\n\nexport const MetaForm: React.FC<MetaFormProps> = (props) => {\n const {\n name: initialName,\n description: initialDescription,\n category: initialCategory,\n publisher: initialPublisher,\n publisherUrl: initialPublisherUrl,\n githubRepository: initialGithubRepository,\n npmPackage: initialNpmPackage,\n keywords: initialKeywords,\n onNameChange,\n onDescriptionChange,\n onCategoryChange,\n onPublisherChange,\n onPublisherUrlChange,\n onGithubRepositoryChange,\n onNpmPackageChange,\n onAddKeyword,\n onRemoveKeyword,\n } = props;\n\n const [name, setName] = useState(initialName);\n const [description, setDescription] = useState(initialDescription);\n const [category, setCategory] = useState(initialCategory);\n const [publisher, setPublisher] = useState(initialPublisher);\n const [publisherUrl, setPublisherUrl] = useState(initialPublisherUrl);\n const [githubRepository, setGithubRepository] = useState(\n initialGithubRepository,\n );\n const [npmPackage, setNpmPackage] = useState(initialNpmPackage);\n\n // Keywords state\n const [keywords, setKeywords] = useState<Keyword[]>(initialKeywords);\n const [keywordInput, setKeywordInput] = useState(\"\");\n\n // Use the debounce hook with callbacks\n useDebounce(name, onNameChange, 300);\n useDebounce(description, onDescriptionChange, 300);\n useDebounce(publisher, onPublisherChange, 300);\n useDebounce(publisherUrl, onPublisherUrlChange, 300);\n useDebounce(githubRepository, onGithubRepositoryChange, 300);\n useDebounce(npmPackage, onNpmPackageChange, 300);\n\n return (\n <div className=\"grid grid-cols-1 gap-6 p-6 lg:grid-cols-3\">\n {/* Left Column */}\n <div className=\"space-y-6\">\n {/* Name Field */}\n <div>\n <label\n htmlFor=\"package-name\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Name\n </label>\n <input\n id=\"package-name\"\n type=\"text\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n className=\"w-full rounded-md border border-border px-3 py-2 text-foreground placeholder:text-muted-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none disabled:disabled-effect\"\n />\n </div>\n\n {/* Description Field */}\n <div>\n <label\n htmlFor=\"package-description\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Description\n </label>\n <textarea\n id=\"package-description\"\n rows={6}\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n className=\"w-full resize-none rounded-md border border-border px-3 py-2 text-foreground placeholder:text-muted-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none disabled:disabled-effect\"\n />\n </div>\n </div>\n\n {/* Middle Column */}\n <div className=\"space-y-6\">\n {/* Category Field */}\n <div>\n <label\n htmlFor=\"package-category\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Category\n </label>\n <select\n id=\"package-category\"\n value={category}\n onChange={(e) => {\n const newValue = e.target.value;\n setCategory(newValue);\n onCategoryChange?.(newValue);\n }}\n className=\"w-full rounded-md border border-border px-3 py-2 text-foreground placeholder:text-muted-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none disabled:disabled-effect\"\n >\n <option value=\"\">Not selected</option>\n <option value=\"Productivity\">Productivity</option>\n <option value=\"Governance\">Governance</option>\n <option value=\"Project Management\">Project Management</option>\n <option value=\"Finance\">Finance</option>\n <option value=\"Legal\">Legal</option>\n <option value=\"People & Culture\">People & Culture</option>\n <option value=\"Engineering\">Engineering</option>\n </select>\n </div>\n\n {/* Publisher Field */}\n <div>\n <label\n htmlFor=\"package-publisher\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Publisher\n </label>\n <input\n id=\"package-publisher\"\n type=\"text\"\n value={publisher}\n onChange={(e) => setPublisher(e.target.value)}\n className=\"w-full rounded-md border border-border px-3 py-2 text-foreground placeholder:text-muted-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none disabled:disabled-effect\"\n />\n </div>\n\n {/* Publisher URL Field */}\n <div>\n <label\n htmlFor=\"package-publisher-url\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Publisher URL\n </label>\n <input\n id=\"package-publisher-url\"\n type=\"text\"\n value={publisherUrl}\n onChange={(e) => setPublisherUrl(e.target.value)}\n className=\"w-full rounded-md border border-border px-3 py-2 text-foreground placeholder:text-muted-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none disabled:disabled-effect\"\n />\n </div>\n\n {/* Keywords Field */}\n <div>\n <label\n htmlFor=\"package-keywords\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Keywords\n </label>\n <div className=\"space-y-2\">\n <input\n id=\"package-keywords\"\n type=\"text\"\n value={keywordInput}\n onChange={(e) => setKeywordInput(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" && keywordInput.trim()) {\n e.preventDefault();\n const newKeyword = {\n id: Date.now().toString(), // Generate a unique ID\n label: keywordInput.trim(),\n };\n setKeywords([...keywords, newKeyword]);\n onAddKeyword?.(newKeyword);\n setKeywordInput(\"\");\n }\n }}\n placeholder=\"Type a keyword and press Enter\"\n className=\"w-full rounded-md border border-border px-3 py-2 text-foreground placeholder:text-muted-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none disabled:disabled-effect\"\n />\n <div className=\"flex min-h-[80px] flex-wrap gap-2 rounded-md border border-border p-3\">\n {keywords.map((keyword) => (\n <span\n key={keyword.id}\n className=\"inline-flex items-center rounded-sm border border-info bg-info/10 px-2 py-0.5 text-xs text-info\"\n >\n {keyword.label}\n <button\n onClick={() => {\n setKeywords(keywords.filter((k) => k.id !== keyword.id));\n onRemoveKeyword?.(keyword.id);\n }}\n className=\"ml-1 text-info hover:hover-effect focus:outline-none\"\n >\n ×\n </button>\n </span>\n ))}\n </div>\n </div>\n </div>\n </div>\n\n {/* Right Column */}\n <div className=\"space-y-6\">\n {/* Github Repository Field */}\n <div>\n <label\n htmlFor=\"package-github\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Github Repository\n </label>\n <input\n id=\"package-github\"\n type=\"text\"\n value={githubRepository}\n onChange={(e) => setGithubRepository(e.target.value)}\n className=\"w-full rounded-md border border-border px-3 py-2 text-foreground placeholder:text-muted-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none disabled:disabled-effect\"\n />\n </div>\n\n {/* NPM-package Field */}\n <div>\n <label\n htmlFor=\"package-npm\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n NPM-package\n </label>\n <input\n id=\"package-npm\"\n type=\"text\"\n value={npmPackage}\n onChange={(e) => setNpmPackage(e.target.value)}\n className=\"w-full rounded-md border border-border px-3 py-2 text-foreground placeholder:text-muted-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none disabled:disabled-effect\"\n />\n </div>\n\n {/* Version Field */}\n <div>\n <label\n htmlFor=\"package-version\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Version\n </label>\n <input\n id=\"package-version\"\n type=\"text\"\n placeholder=\"1.0.0-dev\"\n disabled\n className=\"w-full cursor-not-allowed rounded-md border border-border bg-background px-3 py-2 text-foreground placeholder:text-muted-foreground disabled:disabled-effect\"\n />\n </div>\n\n {/* License Field */}\n <div>\n <label\n htmlFor=\"package-license\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n License\n </label>\n <input\n id=\"package-license\"\n type=\"text\"\n placeholder=\"AGPL-3.0-only\"\n disabled\n className=\"w-full cursor-not-allowed rounded-md border border-border bg-background px-3 py-2 text-foreground placeholder:text-muted-foreground disabled:disabled-effect\"\n />\n </div>\n\n {/* Install with Field */}\n <div>\n <label\n htmlFor=\"package-install\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Install with:\n </label>\n <input\n id=\"package-install\"\n type=\"text\"\n placeholder=\"@powerhousedao/todo-demo-package\"\n disabled\n className=\"w-full cursor-not-allowed rounded-md border border-border bg-background px-3 py-2 text-foreground placeholder:text-muted-foreground disabled:disabled-effect\"\n />\n </div>\n </div>\n </div>\n );\n};\n","import type { PHDocumentEditorConfig } from \"@powerhousedao/reactor-browser\";\n\nexport const editorConfig: PHDocumentEditorConfig = {\n isExternalControlsEnabled: false,\n};\n","import { DocumentToolbar } from \"@powerhousedao/design-system/connect\";\nimport { useSetPHDocumentEditorConfig } from \"@powerhousedao/reactor-browser\";\nimport { useCallback } from \"react\";\nimport {\n addPackageKeyword,\n removePackageKeyword,\n setPackageAuthorName,\n setPackageAuthorWebsite,\n setPackageCategory,\n setPackageDescription,\n setPackageGithubUrl,\n setPackageName,\n setPackageNpmUrl,\n} from \"../../document-models/vetra-package/index.js\";\nimport { useSelectedDriveVetraPackage } from \"../hooks/useVetraDocument.js\";\nimport { MetaForm } from \"./components/MetaForm.js\";\nimport { editorConfig } from \"./config.js\";\n\nexport type EditorProps = {\n displayToolbar?: boolean;\n};\n\nexport default function Editor(props: EditorProps) {\n const { displayToolbar = true } = props;\n useSetPHDocumentEditorConfig(editorConfig);\n const [document, dispatch] = useSelectedDriveVetraPackage();\n\n const onNameChange = useCallback(\n (name: string) => {\n if (!document.state.global.name && !name) return;\n if (name === document.state.global.name) return;\n\n dispatch(setPackageName({ name }));\n },\n [document.state.global.name, dispatch],\n );\n\n const onDescriptionChange = useCallback(\n (description: string) => {\n if (!document.state.global.description && !description) return;\n if (description === document.state.global.description) return;\n\n dispatch(setPackageDescription({ description }));\n },\n [document.state.global.description, dispatch],\n );\n\n const onCategoryChange = useCallback(\n (category: string) => {\n if (!document.state.global.category && !category) return;\n if (category === document.state.global.category) return;\n\n dispatch(setPackageCategory({ category }));\n },\n [document.state.global.category, dispatch],\n );\n\n const onPublisherChange = useCallback(\n (name: string) => {\n if (!document.state.global.author.name && !name) return;\n if (name === document.state.global.author.name) return;\n\n dispatch(setPackageAuthorName({ name }));\n },\n [document.state.global.author.name, dispatch],\n );\n\n const onPublisherUrlChange = useCallback(\n (website: string) => {\n if (!document.state.global.author.website && !website) return;\n if (website === document.state.global.author.website) return;\n\n dispatch(setPackageAuthorWebsite({ website }));\n },\n [document.state.global.author.website, dispatch],\n );\n\n const onGithubRepositoryChange = useCallback(\n (url: string) => {\n if (!document.state.global.githubUrl && !url) return;\n if (url === document.state.global.githubUrl) return;\n\n dispatch(setPackageGithubUrl({ url }));\n },\n [document.state.global.githubUrl, dispatch],\n );\n\n const onNpmPackageChange = useCallback(\n (url: string) => {\n if (!document.state.global.npmUrl && !url) return;\n if (url === document.state.global.npmUrl) return;\n\n dispatch(setPackageNpmUrl({ url }));\n },\n [document.state.global.npmUrl, dispatch],\n );\n\n const onAddKeyword = useCallback(\n (keyword: { id: string; label: string }) => {\n dispatch(addPackageKeyword(keyword));\n },\n [dispatch],\n );\n\n const onRemoveKeyword = useCallback(\n (id: string) => {\n dispatch(removePackageKeyword({ id }));\n },\n [dispatch],\n );\n\n return (\n <div className=\"bg-background p-6\">\n {displayToolbar && <DocumentToolbar />}\n <MetaForm\n name={document.state.global.name ?? \"\"}\n description={document.state.global.description ?? \"\"}\n category={document.state.global.category ?? \"\"}\n publisher={document.state.global.author.name ?? \"\"}\n publisherUrl={document.state.global.author.website ?? \"\"}\n githubRepository={document.state.global.githubUrl ?? \"\"}\n npmPackage={document.state.global.npmUrl ?? \"\"}\n keywords={document.state.global.keywords}\n onNameChange={onNameChange}\n onDescriptionChange={onDescriptionChange}\n onCategoryChange={onCategoryChange}\n onPublisherChange={onPublisherChange}\n onPublisherUrlChange={onPublisherUrlChange}\n onGithubRepositoryChange={onGithubRepositoryChange}\n onNpmPackageChange={onNpmPackageChange}\n onAddKeyword={onAddKeyword}\n onRemoveKeyword={onRemoveKeyword}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAwBA,MAAa,YAAqC,UAAU;CAC1D,MAAM,EACJ,MAAM,aACN,aAAa,oBACb,UAAU,iBACV,WAAW,kBACX,cAAc,qBACd,kBAAkB,yBAClB,YAAY,mBACZ,UAAU,iBACV,cACA,qBACA,kBACA,mBACA,sBACA,0BACA,oBACA,cACA,oBACE;CAEJ,MAAM,CAAC,MAAM,WAAW,SAAS,YAAY;CAC7C,MAAM,CAAC,aAAa,kBAAkB,SAAS,mBAAmB;CAClE,MAAM,CAAC,UAAU,eAAe,SAAS,gBAAgB;CACzD,MAAM,CAAC,WAAW,gBAAgB,SAAS,iBAAiB;CAC5D,MAAM,CAA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OAAO,eAAe;GAClD,UAAU,SAAS,MAAM,OAAO,YAAY;GAC5C,WAAW,SAAS,MAAM,OAAO,OAAO,QAAQ;GAChD,cAAc,SAAS,MAAM,OAAO,OAAO,WAAW;GACtD,kBAAkB,SAAS,MAAM,OAAO,aAAa;GACrD,YAAY,SAAS,MAAM,OAAO,UAAU;GAC5C,UAAU,SAAS,MAAM,OAAO;GAClB;GACO;GACH;GACC;GACG;GACI;GACN;GACN;GACG;GACjB,CAAA,CACE"}
|
|
1
|
+
{"version":3,"file":"editor-CnfajXGg.js","names":[],"sources":["../editors/vetra-package/components/MetaForm.tsx","../editors/vetra-package/config.ts","../editors/vetra-package/editor.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport type { Keyword } from \"../../../document-models/vetra-package/index.js\";\nimport { useDebounce } from \"../../hooks/index.js\";\n\nexport interface MetaFormProps {\n name: string;\n description: string;\n category: string;\n publisher: string;\n publisherUrl: string;\n githubRepository: string;\n npmPackage: string;\n keywords: Keyword[];\n onNameChange?: (name: string) => void;\n onDescriptionChange?: (description: string) => void;\n onCategoryChange?: (category: string) => void;\n onPublisherChange?: (publisher: string) => void;\n onPublisherUrlChange?: (publisherUrl: string) => void;\n onGithubRepositoryChange?: (githubRepository: string) => void;\n onNpmPackageChange?: (npmPackage: string) => void;\n onAddKeyword?: (keyword: { id: string; label: string }) => void;\n onRemoveKeyword?: (id: string) => void;\n}\n\nexport const MetaForm: React.FC<MetaFormProps> = (props) => {\n const {\n name: initialName,\n description: initialDescription,\n category: initialCategory,\n publisher: initialPublisher,\n publisherUrl: initialPublisherUrl,\n githubRepository: initialGithubRepository,\n npmPackage: initialNpmPackage,\n keywords: initialKeywords,\n onNameChange,\n onDescriptionChange,\n onCategoryChange,\n onPublisherChange,\n onPublisherUrlChange,\n onGithubRepositoryChange,\n onNpmPackageChange,\n onAddKeyword,\n onRemoveKeyword,\n } = props;\n\n const [name, setName] = useState(initialName);\n const [description, setDescription] = useState(initialDescription);\n const [category, setCategory] = useState(initialCategory);\n const [publisher, setPublisher] = useState(initialPublisher);\n const [publisherUrl, setPublisherUrl] = useState(initialPublisherUrl);\n const [githubRepository, setGithubRepository] = useState(\n initialGithubRepository,\n );\n const [npmPackage, setNpmPackage] = useState(initialNpmPackage);\n\n // Keywords state\n const [keywords, setKeywords] = useState<Keyword[]>(initialKeywords);\n const [keywordInput, setKeywordInput] = useState(\"\");\n\n // Use the debounce hook with callbacks\n useDebounce(name, onNameChange, 300);\n useDebounce(description, onDescriptionChange, 300);\n useDebounce(publisher, onPublisherChange, 300);\n useDebounce(publisherUrl, onPublisherUrlChange, 300);\n useDebounce(githubRepository, onGithubRepositoryChange, 300);\n useDebounce(npmPackage, onNpmPackageChange, 300);\n\n return (\n <div className=\"grid grid-cols-1 gap-6 p-6 lg:grid-cols-3\">\n {/* Left Column */}\n <div className=\"space-y-6\">\n {/* Name Field */}\n <div>\n <label\n htmlFor=\"package-name\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Name\n </label>\n <input\n id=\"package-name\"\n type=\"text\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n className=\"w-full rounded-md border border-border px-3 py-2 text-foreground placeholder:text-muted-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none disabled:disabled-effect\"\n />\n </div>\n\n {/* Description Field */}\n <div>\n <label\n htmlFor=\"package-description\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Description\n </label>\n <textarea\n id=\"package-description\"\n rows={6}\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n className=\"w-full resize-none rounded-md border border-border px-3 py-2 text-foreground placeholder:text-muted-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none disabled:disabled-effect\"\n />\n </div>\n </div>\n\n {/* Middle Column */}\n <div className=\"space-y-6\">\n {/* Category Field */}\n <div>\n <label\n htmlFor=\"package-category\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Category\n </label>\n <select\n id=\"package-category\"\n value={category}\n onChange={(e) => {\n const newValue = e.target.value;\n setCategory(newValue);\n onCategoryChange?.(newValue);\n }}\n className=\"w-full rounded-md border border-border px-3 py-2 text-foreground placeholder:text-muted-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none disabled:disabled-effect\"\n >\n <option value=\"\">Not selected</option>\n <option value=\"Productivity\">Productivity</option>\n <option value=\"Governance\">Governance</option>\n <option value=\"Project Management\">Project Management</option>\n <option value=\"Finance\">Finance</option>\n <option value=\"Legal\">Legal</option>\n <option value=\"People & Culture\">People & Culture</option>\n <option value=\"Engineering\">Engineering</option>\n </select>\n </div>\n\n {/* Publisher Field */}\n <div>\n <label\n htmlFor=\"package-publisher\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Publisher\n </label>\n <input\n id=\"package-publisher\"\n type=\"text\"\n value={publisher}\n onChange={(e) => setPublisher(e.target.value)}\n className=\"w-full rounded-md border border-border px-3 py-2 text-foreground placeholder:text-muted-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none disabled:disabled-effect\"\n />\n </div>\n\n {/* Publisher URL Field */}\n <div>\n <label\n htmlFor=\"package-publisher-url\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Publisher URL\n </label>\n <input\n id=\"package-publisher-url\"\n type=\"text\"\n value={publisherUrl}\n onChange={(e) => setPublisherUrl(e.target.value)}\n className=\"w-full rounded-md border border-border px-3 py-2 text-foreground placeholder:text-muted-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none disabled:disabled-effect\"\n />\n </div>\n\n {/* Keywords Field */}\n <div>\n <label\n htmlFor=\"package-keywords\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Keywords\n </label>\n <div className=\"space-y-2\">\n <input\n id=\"package-keywords\"\n type=\"text\"\n value={keywordInput}\n onChange={(e) => setKeywordInput(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" && keywordInput.trim()) {\n e.preventDefault();\n const newKeyword = {\n id: Date.now().toString(), // Generate a unique ID\n label: keywordInput.trim(),\n };\n setKeywords([...keywords, newKeyword]);\n onAddKeyword?.(newKeyword);\n setKeywordInput(\"\");\n }\n }}\n placeholder=\"Type a keyword and press Enter\"\n className=\"w-full rounded-md border border-border px-3 py-2 text-foreground placeholder:text-muted-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none disabled:disabled-effect\"\n />\n <div className=\"flex min-h-[80px] flex-wrap gap-2 rounded-md border border-border p-3\">\n {keywords.map((keyword) => (\n <span\n key={keyword.id}\n className=\"inline-flex items-center rounded-sm border border-info bg-info/10 px-2 py-0.5 text-xs text-info\"\n >\n {keyword.label}\n <button\n onClick={() => {\n setKeywords(keywords.filter((k) => k.id !== keyword.id));\n onRemoveKeyword?.(keyword.id);\n }}\n className=\"ml-1 text-info hover:hover-effect focus:outline-none\"\n >\n ×\n </button>\n </span>\n ))}\n </div>\n </div>\n </div>\n </div>\n\n {/* Right Column */}\n <div className=\"space-y-6\">\n {/* Github Repository Field */}\n <div>\n <label\n htmlFor=\"package-github\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Github Repository\n </label>\n <input\n id=\"package-github\"\n type=\"text\"\n value={githubRepository}\n onChange={(e) => setGithubRepository(e.target.value)}\n className=\"w-full rounded-md border border-border px-3 py-2 text-foreground placeholder:text-muted-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none disabled:disabled-effect\"\n />\n </div>\n\n {/* NPM-package Field */}\n <div>\n <label\n htmlFor=\"package-npm\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n NPM-package\n </label>\n <input\n id=\"package-npm\"\n type=\"text\"\n value={npmPackage}\n onChange={(e) => setNpmPackage(e.target.value)}\n className=\"w-full rounded-md border border-border px-3 py-2 text-foreground placeholder:text-muted-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none disabled:disabled-effect\"\n />\n </div>\n\n {/* Version Field */}\n <div>\n <label\n htmlFor=\"package-version\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Version\n </label>\n <input\n id=\"package-version\"\n type=\"text\"\n placeholder=\"1.0.0-dev\"\n disabled\n className=\"w-full cursor-not-allowed rounded-md border border-border bg-background px-3 py-2 text-foreground placeholder:text-muted-foreground disabled:disabled-effect\"\n />\n </div>\n\n {/* License Field */}\n <div>\n <label\n htmlFor=\"package-license\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n License\n </label>\n <input\n id=\"package-license\"\n type=\"text\"\n placeholder=\"AGPL-3.0-only\"\n disabled\n className=\"w-full cursor-not-allowed rounded-md border border-border bg-background px-3 py-2 text-foreground placeholder:text-muted-foreground disabled:disabled-effect\"\n />\n </div>\n\n {/* Install with Field */}\n <div>\n <label\n htmlFor=\"package-install\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Install with:\n </label>\n <input\n id=\"package-install\"\n type=\"text\"\n placeholder=\"@powerhousedao/todo-demo-package\"\n disabled\n className=\"w-full cursor-not-allowed rounded-md border border-border bg-background px-3 py-2 text-foreground placeholder:text-muted-foreground disabled:disabled-effect\"\n />\n </div>\n </div>\n </div>\n );\n};\n","import type { PHDocumentEditorConfig } from \"@powerhousedao/reactor-browser\";\n\nexport const editorConfig: PHDocumentEditorConfig = {\n isExternalControlsEnabled: false,\n};\n","import { DocumentToolbar } from \"@powerhousedao/design-system/connect\";\nimport { useSetPHDocumentEditorConfig } from \"@powerhousedao/reactor-browser\";\nimport type { EditorProps as PHEditorProps } from \"@powerhousedao/shared/document-model\";\nimport { useCallback } from \"react\";\nimport {\n addPackageKeyword,\n removePackageKeyword,\n setPackageAuthorName,\n setPackageAuthorWebsite,\n setPackageCategory,\n setPackageDescription,\n setPackageGithubUrl,\n setPackageName,\n setPackageNpmUrl,\n} from \"../../document-models/vetra-package/index.js\";\nimport type {\n VetraPackageAction,\n VetraPackageDocument,\n} from \"../../document-models/vetra-package/index.js\";\nimport { MetaForm } from \"./components/MetaForm.js\";\nimport { editorConfig } from \"./config.js\";\n\nexport type EditorProps = PHEditorProps<\n VetraPackageDocument,\n VetraPackageAction\n> & {\n displayToolbar?: boolean;\n};\n\nexport default function Editor(props: EditorProps) {\n const { document, dispatch, displayToolbar = true } = props;\n useSetPHDocumentEditorConfig(editorConfig);\n\n const onNameChange = useCallback(\n (name: string) => {\n if (!document.state.global.name && !name) return;\n if (name === document.state.global.name) return;\n\n dispatch(setPackageName({ name }));\n },\n [document.state.global.name, dispatch],\n );\n\n const onDescriptionChange = useCallback(\n (description: string) => {\n if (!document.state.global.description && !description) return;\n if (description === document.state.global.description) return;\n\n dispatch(setPackageDescription({ description }));\n },\n [document.state.global.description, dispatch],\n );\n\n const onCategoryChange = useCallback(\n (category: string) => {\n if (!document.state.global.category && !category) return;\n if (category === document.state.global.category) return;\n\n dispatch(setPackageCategory({ category }));\n },\n [document.state.global.category, dispatch],\n );\n\n const onPublisherChange = useCallback(\n (name: string) => {\n if (!document.state.global.author.name && !name) return;\n if (name === document.state.global.author.name) return;\n\n dispatch(setPackageAuthorName({ name }));\n },\n [document.state.global.author.name, dispatch],\n );\n\n const onPublisherUrlChange = useCallback(\n (website: string) => {\n if (!document.state.global.author.website && !website) return;\n if (website === document.state.global.author.website) return;\n\n dispatch(setPackageAuthorWebsite({ website }));\n },\n [document.state.global.author.website, dispatch],\n );\n\n const onGithubRepositoryChange = useCallback(\n (url: string) => {\n if (!document.state.global.githubUrl && !url) return;\n if (url === document.state.global.githubUrl) return;\n\n dispatch(setPackageGithubUrl({ url }));\n },\n [document.state.global.githubUrl, dispatch],\n );\n\n const onNpmPackageChange = useCallback(\n (url: string) => {\n if (!document.state.global.npmUrl && !url) return;\n if (url === document.state.global.npmUrl) return;\n\n dispatch(setPackageNpmUrl({ url }));\n },\n [document.state.global.npmUrl, dispatch],\n );\n\n const onAddKeyword = useCallback(\n (keyword: { id: string; label: string }) => {\n dispatch(addPackageKeyword(keyword));\n },\n [dispatch],\n );\n\n const onRemoveKeyword = useCallback(\n (id: string) => {\n dispatch(removePackageKeyword({ id }));\n },\n [dispatch],\n );\n\n return (\n <div className=\"bg-background p-6\">\n {displayToolbar && <DocumentToolbar document={document} />}\n <MetaForm\n name={document.state.global.name ?? \"\"}\n description={document.state.global.description ?? \"\"}\n category={document.state.global.category ?? \"\"}\n publisher={document.state.global.author.name ?? \"\"}\n publisherUrl={document.state.global.author.website ?? \"\"}\n githubRepository={document.state.global.githubUrl ?? \"\"}\n npmPackage={document.state.global.npmUrl ?? \"\"}\n keywords={document.state.global.keywords}\n onNameChange={onNameChange}\n onDescriptionChange={onDescriptionChange}\n onCategoryChange={onCategoryChange}\n onPublisherChange={onPublisherChange}\n onPublisherUrlChange={onPublisherUrlChange}\n onGithubRepositoryChange={onGithubRepositoryChange}\n onNpmPackageChange={onNpmPackageChange}\n onAddKeyword={onAddKeyword}\n onRemoveKeyword={onRemoveKeyword}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;AAwBA,MAAa,YAAqC,UAAU;CAC1D,MAAM,EACJ,MAAM,aACN,aAAa,oBACb,UAAU,iBACV,WAAW,kBACX,cAAc,qBACd,kBAAkB,yBAClB,YAAY,mBACZ,UAAU,iBACV,cACA,qBACA,kBACA,mBACA,sBACA,0BACA,oBACA,cACA,oBACE;CAEJ,MAAM,CAAC,MAAM,WAAW,SAAS,WAAW;CAC5C,MAAM,CAAC,aAAa,kBAAkB,SAAS,kBAAkB;CACjE,MAAM,CAAC,UAAU,eAAe,SAAS,eAAe;CACxD,MAAM,CAAC,WAAW,gBAAgB,SAAS,gBAAgB;CAC3D,MAAM,CAAC,cAAc,mBAAmB,SAAS,mBAAmB;CACpE,MAAM,CAAC,kBAAkB,uBAAuB,SAC9C,uBACF;CACA,MAAM,CAAC,YAAY,iBAAiB,SAAS,iBAAiB;CAG9D,MAAM,CAAC,UAAU,eAAe,SAAoB,eAAe;CACnE,MAAM,CAAC,cAAc,mBAAmB,SAAS,EAAE;CAGnD,YAAY,MAAM,cAAc,GAAG;CACnC,YAAY,aAAa,qBAAqB,GAAG;CACjD,YA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WAAW,SAAS,MAAM,OAAO,OAAO,QAAQ;GAChD,cAAc,SAAS,MAAM,OAAO,OAAO,WAAW;GACtD,kBAAkB,SAAS,MAAM,OAAO,aAAa;GACrD,YAAY,SAAS,MAAM,OAAO,UAAU;GAC5C,UAAU,SAAS,MAAM,OAAO;GAClB;GACO;GACH;GACC;GACG;GACI;GACN;GACN;GACG;EAClB,CAAA,CACE;;AAET"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { addDocument,
|
|
1
|
+
import { EditorDocumentProvider, addDocument, resolveUrlPathname, showCreateDocumentModal, showDeleteNodeModal, useDocumentById, useDocumentModelModules, useEditorModuleFor, usePHToast, useSetPHAppConfig, useSetSelectedNode } from "@powerhousedao/reactor-browser";
|
|
2
2
|
import { Suspense, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
3
3
|
import { twMerge } from "tailwind-merge";
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
import { ConnectDropdownMenu, DefaultEditorLoader, fileNodeDropdownOptions } from "@powerhousedao/design-system/connect";
|
|
6
|
-
import { Icon } from "@powerhousedao/design-system";
|
|
5
|
+
import { ConnectDropdownMenu, DefaultEditorLoader, Icon, fileNodeDropdownOptions } from "@powerhousedao/design-system/connect";
|
|
7
6
|
//#region editors/vetra-drive-app/config.ts
|
|
8
7
|
const editorConfig = {
|
|
9
8
|
allowedDocumentTypes: [
|
|
@@ -292,6 +291,18 @@ const VetraIcon = ({ width = 23, height = 22, className = "" }) => {
|
|
|
292
291
|
};
|
|
293
292
|
//#endregion
|
|
294
293
|
//#region editors/vetra-drive-app/components/DriveHeader.tsx
|
|
294
|
+
/** A link that opens this host, under its base path, with `driveUrl` added. */
|
|
295
|
+
function makeDriveShareUrl(driveUrl) {
|
|
296
|
+
if (!driveUrl) return "";
|
|
297
|
+
try {
|
|
298
|
+
new URL(driveUrl);
|
|
299
|
+
} catch {
|
|
300
|
+
return "";
|
|
301
|
+
}
|
|
302
|
+
const appUrl = new URL(resolveUrlPathname("/"), window.location.origin);
|
|
303
|
+
appUrl.searchParams.set("driveUrl", driveUrl);
|
|
304
|
+
return appUrl.href;
|
|
305
|
+
}
|
|
295
306
|
const DriveHeader = ({ driveId, driveName, driveUrl }) => {
|
|
296
307
|
const [isInfoMenuOpen, setIsInfoMenuOpen] = useState(false);
|
|
297
308
|
const [isShareMenuOpen, setIsShareMenuOpen] = useState(false);
|
|
@@ -324,15 +335,7 @@ const DriveHeader = ({ driveId, driveName, driveUrl }) => {
|
|
|
324
335
|
document.removeEventListener("keydown", handleKeyDown);
|
|
325
336
|
};
|
|
326
337
|
}, [isInfoMenuOpen, isShareMenuOpen]);
|
|
327
|
-
const shareUrl = useMemo(() =>
|
|
328
|
-
if (!driveUrl) return "";
|
|
329
|
-
try {
|
|
330
|
-
new URL(driveUrl);
|
|
331
|
-
return `${window.location.origin}/?driveUrl=${encodeURIComponent(driveUrl)}`;
|
|
332
|
-
} catch {
|
|
333
|
-
return "";
|
|
334
|
-
}
|
|
335
|
-
}, [driveUrl]);
|
|
338
|
+
const shareUrl = useMemo(() => makeDriveShareUrl(driveUrl), [driveUrl]);
|
|
336
339
|
return /* @__PURE__ */ jsx("div", {
|
|
337
340
|
className: "bg-background px-6 py-4",
|
|
338
341
|
children: /* @__PURE__ */ jsxs("div", {
|
|
@@ -1517,29 +1520,30 @@ const DocumentModelsColumn = ({ documentModels, onAddDocumentModel, onOpenDocume
|
|
|
1517
1520
|
//#region editors/vetra-drive-app/components/SectionAccordion.tsx
|
|
1518
1521
|
const SectionAccordion = ({ title, children, defaultOpen = false, className = "", actionButton }) => {
|
|
1519
1522
|
const [isOpen, setIsOpen] = useState(defaultOpen);
|
|
1523
|
+
const header = /* @__PURE__ */ jsxs("div", {
|
|
1524
|
+
className: "flex items-center gap-2 rounded-md border border-border bg-background px-4 py-2 transition-colors hover:hover-effect",
|
|
1525
|
+
children: [
|
|
1526
|
+
/* @__PURE__ */ jsx(ChevronIcon, {
|
|
1527
|
+
width: 16,
|
|
1528
|
+
height: 16,
|
|
1529
|
+
className: twMerge("text-foreground transition-transform duration-300", isOpen ? "rotate-90" : "")
|
|
1530
|
+
}),
|
|
1531
|
+
/* @__PURE__ */ jsx("h2", {
|
|
1532
|
+
className: "text-base font-semibold text-foreground",
|
|
1533
|
+
children: title
|
|
1534
|
+
}),
|
|
1535
|
+
actionButton && /* @__PURE__ */ jsx("div", {
|
|
1536
|
+
className: "ml-auto",
|
|
1537
|
+
children: actionButton
|
|
1538
|
+
})
|
|
1539
|
+
]
|
|
1540
|
+
});
|
|
1520
1541
|
return /* @__PURE__ */ jsx("div", {
|
|
1521
1542
|
className,
|
|
1522
1543
|
children: /* @__PURE__ */ jsx(Accordion, {
|
|
1523
1544
|
isOpen,
|
|
1524
1545
|
onToggle: () => setIsOpen(!isOpen),
|
|
1525
|
-
header
|
|
1526
|
-
className: "flex items-center gap-2 rounded-md border border-border bg-background px-4 py-2 transition-colors hover:hover-effect",
|
|
1527
|
-
children: [
|
|
1528
|
-
/* @__PURE__ */ jsx(ChevronIcon, {
|
|
1529
|
-
width: 16,
|
|
1530
|
-
height: 16,
|
|
1531
|
-
className: twMerge("text-foreground transition-transform duration-300", isOpen ? "rotate-90" : "")
|
|
1532
|
-
}),
|
|
1533
|
-
/* @__PURE__ */ jsx("h2", {
|
|
1534
|
-
className: "text-base font-semibold text-foreground",
|
|
1535
|
-
children: title
|
|
1536
|
-
}),
|
|
1537
|
-
actionButton && /* @__PURE__ */ jsx("div", {
|
|
1538
|
-
className: "ml-auto",
|
|
1539
|
-
children: actionButton
|
|
1540
|
-
})
|
|
1541
|
-
]
|
|
1542
|
-
}),
|
|
1546
|
+
header,
|
|
1543
1547
|
children: /* @__PURE__ */ jsx("div", {
|
|
1544
1548
|
className: "px-4 pb-4",
|
|
1545
1549
|
children
|
|
@@ -1623,31 +1627,42 @@ const ModuleSpecificationsSection = (props) => {
|
|
|
1623
1627
|
};
|
|
1624
1628
|
//#endregion
|
|
1625
1629
|
//#region editors/vetra-drive-app/components/EditorContainer.tsx
|
|
1626
|
-
const
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
-
|
|
1630
|
+
const loadingContent = /* @__PURE__ */ jsx("div", {
|
|
1631
|
+
className: "flex h-full flex-1 items-center justify-center",
|
|
1632
|
+
children: /* @__PURE__ */ jsx(DefaultEditorLoader, {})
|
|
1633
|
+
});
|
|
1634
|
+
function HostedEditor({ documentId }) {
|
|
1635
|
+
const [document, dispatch] = useDocumentById(documentId);
|
|
1636
|
+
const editorModule = useEditorModuleFor(document);
|
|
1637
|
+
if (!document) return /* @__PURE__ */ jsxs("p", {
|
|
1638
|
+
role: "alert",
|
|
1639
|
+
className: "p-6 text-sm",
|
|
1640
|
+
children: [
|
|
1641
|
+
"The package document ",
|
|
1642
|
+
documentId,
|
|
1643
|
+
" was not found."
|
|
1644
|
+
]
|
|
1632
1645
|
});
|
|
1633
1646
|
if (!editorModule) return loadingContent;
|
|
1634
1647
|
const EditorComponent = editorModule.Component;
|
|
1635
|
-
return /* @__PURE__ */ jsx(
|
|
1636
|
-
|
|
1648
|
+
return /* @__PURE__ */ jsx(EditorDocumentProvider, {
|
|
1649
|
+
document,
|
|
1650
|
+
dispatch,
|
|
1637
1651
|
children: /* @__PURE__ */ jsx(EditorComponent, {
|
|
1638
1652
|
documentId,
|
|
1653
|
+
document,
|
|
1654
|
+
dispatch,
|
|
1639
1655
|
displayToolbar: false
|
|
1640
1656
|
})
|
|
1641
1657
|
});
|
|
1642
|
-
}
|
|
1658
|
+
}
|
|
1659
|
+
const EditorContainer = (props) => /* @__PURE__ */ jsx(Suspense, {
|
|
1660
|
+
fallback: loadingContent,
|
|
1661
|
+
children: /* @__PURE__ */ jsx(HostedEditor, { documentId: props.documentId })
|
|
1662
|
+
});
|
|
1643
1663
|
//#endregion
|
|
1644
1664
|
//#region editors/vetra-drive-app/components/PackageInformationSection.tsx
|
|
1645
1665
|
const PackageInformationSection = ({ className, packageDocumentId, onAddPackageDocument, onOpenPackageDocument }) => {
|
|
1646
|
-
const createpackageContent = /* @__PURE__ */ jsx("button", {
|
|
1647
|
-
className: "my-2 h-50 w-full rounded-md border border-dashed border-border bg-background",
|
|
1648
|
-
onClick: onAddPackageDocument,
|
|
1649
|
-
children: "Click to create package manifest"
|
|
1650
|
-
});
|
|
1651
1666
|
return /* @__PURE__ */ jsx(SectionAccordion, {
|
|
1652
1667
|
title: "Package Information",
|
|
1653
1668
|
defaultOpen: true,
|
|
@@ -1666,7 +1681,11 @@ const PackageInformationSection = ({ className, packageDocumentId, onAddPackageD
|
|
|
1666
1681
|
}) : void 0,
|
|
1667
1682
|
children: /* @__PURE__ */ jsx("div", {
|
|
1668
1683
|
className: "",
|
|
1669
|
-
children: packageDocumentId ? /* @__PURE__ */ jsx(EditorContainer, { documentId: packageDocumentId }) :
|
|
1684
|
+
children: packageDocumentId ? /* @__PURE__ */ jsx(EditorContainer, { documentId: packageDocumentId }) : /* @__PURE__ */ jsx("button", {
|
|
1685
|
+
className: "my-2 h-50 w-full rounded-md border border-dashed border-border bg-background",
|
|
1686
|
+
onClick: onAddPackageDocument,
|
|
1687
|
+
children: "Click to create package manifest"
|
|
1688
|
+
})
|
|
1670
1689
|
})
|
|
1671
1690
|
});
|
|
1672
1691
|
};
|
|
@@ -1708,8 +1727,8 @@ const DriveExplorer = ({ driveId, driveName, driveUrl, documentModels = [], edit
|
|
|
1708
1727
|
//#endregion
|
|
1709
1728
|
//#region editors/vetra-drive-app/editor.tsx
|
|
1710
1729
|
function BaseEditor(props) {
|
|
1711
|
-
const { children } = props;
|
|
1712
|
-
const
|
|
1730
|
+
const { children, document } = props;
|
|
1731
|
+
const setSelectedNode = useSetSelectedNode();
|
|
1713
1732
|
const driveId = document.header.id;
|
|
1714
1733
|
const driveName = document.state.global.name ?? "";
|
|
1715
1734
|
const driveUrl = document.state.local.triggers.find((t) => t.type === "PullResponder")?.data?.url ?? document.state.local.listeners.find((l) => l.callInfo?.data)?.callInfo?.data ?? "";
|
|
@@ -1722,10 +1741,10 @@ function BaseEditor(props) {
|
|
|
1722
1741
|
const docSubgraphsNodes = fileNodes.filter((node) => node.documentType === DOCUMENT_TYPES.documentSubgraph);
|
|
1723
1742
|
const docProcessorsNodes = fileNodes.filter((node) => node.documentType === DOCUMENT_TYPES.documentProcessor);
|
|
1724
1743
|
const docAppsNodes = fileNodes.filter((node) => node.documentType === DOCUMENT_TYPES.documentApp);
|
|
1725
|
-
const onCreateDocument =
|
|
1744
|
+
const onCreateDocument = (documentType) => {
|
|
1726
1745
|
const documentModel = documentModels?.find((model) => model.documentModel.global.id === documentType);
|
|
1727
1746
|
if (documentModel) showCreateDocumentModal(documentModel.documentModel.global.id);
|
|
1728
|
-
}
|
|
1747
|
+
};
|
|
1729
1748
|
const onCreatePackageFile = useCallback(() => {
|
|
1730
1749
|
addDocument(driveId, "vetra-package", DOCUMENT_TYPES.documentPackage).catch(console.error);
|
|
1731
1750
|
}, [driveId]);
|
|
@@ -1734,7 +1753,7 @@ function BaseEditor(props) {
|
|
|
1734
1753
|
}, []);
|
|
1735
1754
|
const onOpenPackageDocument = useCallback(() => {
|
|
1736
1755
|
if (packageNode) setSelectedNode(packageNode);
|
|
1737
|
-
}, [packageNode]);
|
|
1756
|
+
}, [packageNode, setSelectedNode]);
|
|
1738
1757
|
return !!children ? children : /* @__PURE__ */ jsx("div", {
|
|
1739
1758
|
style: { height: "100%" },
|
|
1740
1759
|
className: "bg-background p-6 after:pointer-events-none after:absolute after:inset-0 after:bg-info after:opacity-0 after:transition after:content-['']",
|
|
@@ -1769,4 +1788,4 @@ function Editor(props) {
|
|
|
1769
1788
|
//#endregion
|
|
1770
1789
|
export { BaseEditor, Editor as default };
|
|
1771
1790
|
|
|
1772
|
-
//# sourceMappingURL=editor-
|
|
1791
|
+
//# sourceMappingURL=editor-Cnk0M044.js.map
|