@powerhousedao/vetra 6.2.3-dev.69 → 6.2.3-dev.70
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/document-models/app-module/index.d.ts +2 -33
- package/dist/document-models/document-editor/index.d.ts +2 -31
- package/dist/document-models/processor-module/index.d.ts +2 -34
- package/dist/document-models/subgraph-module/index.d.ts +2 -29
- package/dist/document-models/vetra-package/index.d.ts +2 -37
- package/dist/{editor-CiX3Tq3g.js → editor-BDR7IYJG.js} +3 -5
- package/dist/{editor-CiX3Tq3g.js.map → editor-BDR7IYJG.js.map} +1 -1
- package/dist/{editor-DpZVlVN1.js → editor-CnfajXGg.js} +3 -5
- package/dist/{editor-DpZVlVN1.js.map → editor-CnfajXGg.js.map} +1 -1
- package/dist/{editor-Intw9NHl.js → editor-Cnk0M044.js} +29 -15
- package/dist/{editor-Intw9NHl.js.map → editor-Cnk0M044.js.map} +1 -1
- package/dist/{editor-BXOEFIDj.js → editor-D5SIbFn_.js} +3 -3
- package/dist/{editor-BXOEFIDj.js.map → editor-D5SIbFn_.js.map} +1 -1
- package/dist/{editor-C5a0rBQj.js → editor-DbE7t0TU.js} +3 -5
- package/dist/{editor-C5a0rBQj.js.map → editor-DbE7t0TU.js.map} +1 -1
- package/dist/{editor-DFEeM_dy.js → editor-SJk7cr6k.js} +3 -5
- package/dist/{editor-DFEeM_dy.js.map → editor-SJk7cr6k.js.map} +1 -1
- package/dist/editors/index.d.ts +17 -6
- package/dist/editors/index.d.ts.map +1 -1
- package/dist/editors/index.js +1 -1
- package/dist/index-6UbC6P89.d.ts +39 -0
- package/dist/index-6UbC6P89.d.ts.map +1 -0
- package/dist/index-6bE9h_7M.d.ts +35 -0
- package/dist/index-6bE9h_7M.d.ts.map +1 -0
- package/dist/index-7hPKQROx.d.ts +33 -0
- package/dist/index-7hPKQROx.d.ts.map +1 -0
- package/dist/index-D_rwE-2_.d.ts +31 -0
- package/dist/index-D_rwE-2_.d.ts.map +1 -0
- package/dist/index-cdL5k2sw.d.ts +36 -0
- package/dist/index-cdL5k2sw.d.ts.map +1 -0
- package/dist/index.js +1 -1
- package/dist/{module-CQ4BzxUF.js → module-CZLWjrD_.js} +7 -7
- package/dist/module-CZLWjrD_.js.map +1 -0
- package/package.json +9 -9
- 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/module-CQ4BzxUF.js.map +0 -1
- package/dist/useVetraDocument-B0k3gNtw.js +0 -30
- package/dist/useVetraDocument-B0k3gNtw.js.map +0 -1
|
@@ -188,14 +188,14 @@ const AppEditorForm = () => {
|
|
|
188
188
|
const editorConfig = { isExternalControlsEnabled: false };
|
|
189
189
|
//#endregion
|
|
190
190
|
//#region editors/app-editor/editor.tsx
|
|
191
|
-
function Editor() {
|
|
191
|
+
function Editor({ document }) {
|
|
192
192
|
useSetPHDocumentEditorConfig(editorConfig);
|
|
193
193
|
return /* @__PURE__ */ jsxs("div", {
|
|
194
194
|
className: "bg-background p-6",
|
|
195
|
-
children: [/* @__PURE__ */ jsx(DocumentToolbar, {}), /* @__PURE__ */ jsx(AppEditorForm, {})]
|
|
195
|
+
children: [/* @__PURE__ */ jsx(DocumentToolbar, { document }), /* @__PURE__ */ jsx(AppEditorForm, {})]
|
|
196
196
|
});
|
|
197
197
|
}
|
|
198
198
|
//#endregion
|
|
199
199
|
export { Editor as default };
|
|
200
200
|
|
|
201
|
-
//# sourceMappingURL=editor-
|
|
201
|
+
//# sourceMappingURL=editor-D5SIbFn_.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-BXOEFIDj.js","names":[],"sources":["../editors/app-editor/components/AppEditorForm.tsx","../editors/app-editor/config.ts","../editors/app-editor/editor.tsx"],"sourcesContent":["import {\n useDocumentTypesInSelectedDrive,\n useSupportedDocumentTypesInReactor,\n} from \"@powerhousedao/reactor-browser\";\nimport {\n addDocumentType,\n removeDocumentType,\n setAppName,\n setAppStatus,\n setDocumentTypes,\n setDragAndDropEnabled,\n} from \"@powerhousedao/vetra/document-models/app-module\";\nimport { useCallback, useEffect, useState } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\nimport { useSelectedAppModuleDocument } from \"../../../document-models/app-module/index.js\";\nimport { StatusPill } from \"../../components/index.js\";\nimport { useDebounce } from \"../../hooks/index.js\";\n\nconst ALL_IN_DRIVE = \"all-in-drive\";\nconst ALL_IN_REACTOR = \"all-in-reactor\";\nconst ALLOW_ANY = \"allow-any\";\n\nexport const AppEditorForm = () => {\n const [document, dispatch] = useSelectedAppModuleDocument();\n const documentName = document.state.global.name;\n const status = document.state.global.status;\n const isDragAndDropEnabled = document.state.global.isDragAndDropEnabled;\n const allowedDocumentTypes = document.state.global.allowedDocumentTypes;\n const [appName, handleSetAppName] = useState(documentName);\n const [isConfirmed, setIsConfirmed] = useState(status === \"CONFIRMED\");\n const documentTypesInSelectedDrive = useDocumentTypesInSelectedDrive();\n const supportedDocumentTypesInReactor = useSupportedDocumentTypesInReactor();\n const [selectedDocumentTypes, setSelectedDocumentTypes] = useState(\n allowedDocumentTypes ?? [],\n );\n\n // Use the debounce hook for name changes\n\n const onNameChange = useCallback(\n (name: string) => {\n if (name === documentName) return;\n console.log(\"onNameChange\", name);\n dispatch(setAppName({ name }));\n },\n [documentName, dispatch],\n );\n\n useDebounce(appName, onNameChange, 300);\n\n const onConfirm = () => {\n dispatch(setAppStatus({ status: \"CONFIRMED\" }));\n };\n\n const onDragAndDropToggle = (enabled: boolean) => {\n if (enabled === isDragAndDropEnabled) return;\n dispatch(setDragAndDropEnabled({ enabled }));\n };\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 (appName.trim()) {\n setIsConfirmed(true); // Immediate UI update\n onConfirm();\n }\n };\n\n const handleAddDocumentType = (documentType: string) => {\n if (!documentType || selectedDocumentTypes.includes(documentType)) return;\n setSelectedDocumentTypes([...selectedDocumentTypes, documentType]);\n dispatch(addDocumentType({ documentType }));\n };\n\n const handleRemoveDocumentType = (documentType: string) => {\n setSelectedDocumentTypes(\n selectedDocumentTypes.filter((dt) => dt !== documentType),\n );\n dispatch(removeDocumentType({ documentType }));\n };\n\n const handleAddAllDocumentTypesInDrive = () => {\n const newDocumentTypes = [\n ...new Set([\n ...selectedDocumentTypes,\n ...(documentTypesInSelectedDrive ?? []),\n ]),\n ];\n setSelectedDocumentTypes(newDocumentTypes);\n dispatch(setDocumentTypes({ documentTypes: newDocumentTypes }));\n };\n\n const handleAddAllDocumentTypesInReactor = () => {\n const newDocumentTypes = [\n ...new Set([\n ...selectedDocumentTypes,\n ...(supportedDocumentTypesInReactor ?? []),\n ]),\n ];\n setSelectedDocumentTypes(newDocumentTypes);\n dispatch(setDocumentTypes({ documentTypes: newDocumentTypes }));\n };\n\n const handleAllowAnyDocumentType = () => {\n setSelectedDocumentTypes([]);\n dispatch(setDocumentTypes({ documentTypes: [] }));\n };\n\n const handleDocumentTypeSelection = (selectedValue: string) => {\n if (selectedValue === ALL_IN_DRIVE) {\n handleAddAllDocumentTypesInDrive();\n } else if (selectedValue === ALL_IN_REACTOR) {\n handleAddAllDocumentTypesInReactor();\n } else if (selectedValue === ALLOW_ANY) {\n handleAllowAnyDocumentType();\n } else {\n handleAddDocumentType(selectedValue);\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 App Configuration\n </h2>\n <StatusPill\n status={status === \"CONFIRMED\" ? \"confirmed\" : \"draft\"}\n label={status === \"CONFIRMED\" ? \"Confirmed\" : \"Draft\"}\n />\n </div>\n\n {/* App Name Field */}\n <div>\n <label\n htmlFor=\"app-name\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n App Name\n </label>\n <input\n id=\"app-name\"\n type=\"text\"\n value={appName}\n onChange={(e) => handleSetAppName(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 app name\"\n />\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 && (\n <select\n onChange={(e) => handleDocumentTypeSelection(e.target.value)}\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>Select a document type to add</option>\n <option>--- Vetra drive document types ---</option>\n <option value={ALL_IN_DRIVE}>\n Add all document types in Vetra drive\n </option>\n {documentTypesInSelectedDrive\n ?.filter((dt) => !selectedDocumentTypes.includes(dt))\n .map((docType) => (\n <option key={docType} value={docType}>\n {docType}\n </option>\n ))}\n <option>--- Reactor document types ---</option>\n <option value={ALL_IN_REACTOR}>\n Add all document types in Reactor\n </option>\n {supportedDocumentTypesInReactor\n ?.filter((dt) => !selectedDocumentTypes.includes(dt))\n .map((docType) => (\n <option key={docType} value={docType}>\n {docType}\n </option>\n ))}\n <option>--- Allow any document type ---</option>\n <option value={ALLOW_ANY}>Allow any document type</option>\n </select>\n )}\n <div className=\"space-y-1\">\n {selectedDocumentTypes.length > 0 ? (\n selectedDocumentTypes.map((type) => (\n <div key={type} className=\"flex items-center py-1\">\n <span className=\"text-sm text-foreground\">{type}</span>\n {!isReadOnly && (\n <button\n onClick={() => handleRemoveDocumentType(type)}\n className=\"ml-2 text-muted-foreground hover:hover-effect focus:outline-none\"\n >\n ×\n </button>\n )}\n </div>\n ))\n ) : (\n <span className=\"text-sm text-foreground\">All documents (*)</span>\n )}\n </div>\n </div>\n </div>\n\n {/* Drag and Drop Settings */}\n <div>\n <h3 className=\"mb-4 text-base font-medium text-foreground\">\n Drag and Drop Settings\n </h3>\n\n {/* Enable/Disable Switch */}\n <div className=\"mb-4\">\n <label htmlFor=\"drag-and-drop-enabled\" className=\"flex items-center\">\n <input\n id=\"drag-and-drop-enabled\"\n type=\"checkbox\"\n checked={isDragAndDropEnabled}\n onChange={(e) => onDragAndDropToggle(e.target.checked)}\n disabled={isReadOnly}\n className={twMerge(\n \"mr-2 size-4 rounded-sm border-border text-info focus:ring-ring\",\n isReadOnly ? \"cursor-not-allowed\" : \"\",\n )}\n />\n <span className=\"text-sm font-medium text-foreground\">\n Enable drag and drop\n </span>\n </label>\n </div>\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={!appName.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 { useSetPHDocumentEditorConfig } from \"@powerhousedao/reactor-browser\";\nimport { AppEditorForm } from \"./components/AppEditorForm.js\";\nimport { editorConfig } from \"./config.js\";\n\nexport default function Editor() {\n useSetPHDocumentEditorConfig(editorConfig);\n\n return (\n <div className=\"bg-background p-6\">\n <DocumentToolbar />\n <AppEditorForm />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AAkBA,MAAM,eA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OACE,eAAe,yBAAyB,IAAI;OAC5C,WAAU;OACX,UAAA;MAEO,CAAA,CAEP;KAVK,GAAA,IAUL,CACN,IAED,oBAAC,QAAD;MAAM,WAAU;MAA0B,UAAA;KAAuB,CAAA;IAEhE,CAAA,CACF;GACF,CAAA,CAAA,EAAA,CAAA;GAGL,qBAAC,OAAD,EAAA,UAAA,CACE,oBAAC,MAAD;IAAI,WAAU;IAA6C,UAAA;GAEvD,CAAA,GAGJ,oBAAC,OAAD;IAAK,WAAU;IACb,UAAA,qBAAC,SAAD;KAAO,SAAQ;KAAwB,WAAU;KAAjD,UAAA,CACE,oBAAC,SAAD;MACE,IAAG;MACH,MAAK;MACL,SAAS;MACT,WAAW,MAAM,oBAAoB,EAAE,OAAO,OAAO;MACrD,UAAU;MACV,WAAW,QACT,kEACA,aAAa,uBAAuB,EACtC;KACD,CAAA,GACD,oBAAC,QAAD;MAAM,WAAU;MAAsC,UAAA;KAEhD,CAAA,CACD;;GACJ,CAAA,CACF,EAAA,CAAA;GAGJ,CAAC,cACA,oBAAC,OAAD,EAAA,UACE,oBAAC,UAAD;IACE,SAAS;IACT,UAAU,CAAC,QAAQ,KAAK;IACxB,WAAU;IACX,UAAA;GAEO,CAAA,EACL,CAAA;EAEJ;;AAET;;;ACxQA,MAAa,eAAuC,EAClD,2BAA2B,MAC7B;;;ACCA,SAAwB,SAAS;CAC/B,6BAA6B,YAAY;CAEzC,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,iBAAD,CAAkB,CAAA,GAClB,oBAAC,eAAD,CAAgB,CAAA,CACb;;AAET"}
|
|
1
|
+
{"version":3,"file":"editor-D5SIbFn_.js","names":[],"sources":["../editors/app-editor/components/AppEditorForm.tsx","../editors/app-editor/config.ts","../editors/app-editor/editor.tsx"],"sourcesContent":["import {\n useDocumentTypesInSelectedDrive,\n useSupportedDocumentTypesInReactor,\n} from \"@powerhousedao/reactor-browser\";\nimport {\n addDocumentType,\n removeDocumentType,\n setAppName,\n setAppStatus,\n setDocumentTypes,\n setDragAndDropEnabled,\n} from \"@powerhousedao/vetra/document-models/app-module\";\nimport { useCallback, useEffect, useState } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\nimport { useSelectedAppModuleDocument } from \"../../../document-models/app-module/index.js\";\nimport { StatusPill } from \"../../components/index.js\";\nimport { useDebounce } from \"../../hooks/index.js\";\n\nconst ALL_IN_DRIVE = \"all-in-drive\";\nconst ALL_IN_REACTOR = \"all-in-reactor\";\nconst ALLOW_ANY = \"allow-any\";\n\nexport const AppEditorForm = () => {\n const [document, dispatch] = useSelectedAppModuleDocument();\n const documentName = document.state.global.name;\n const status = document.state.global.status;\n const isDragAndDropEnabled = document.state.global.isDragAndDropEnabled;\n const allowedDocumentTypes = document.state.global.allowedDocumentTypes;\n const [appName, handleSetAppName] = useState(documentName);\n const [isConfirmed, setIsConfirmed] = useState(status === \"CONFIRMED\");\n const documentTypesInSelectedDrive = useDocumentTypesInSelectedDrive();\n const supportedDocumentTypesInReactor = useSupportedDocumentTypesInReactor();\n const [selectedDocumentTypes, setSelectedDocumentTypes] = useState(\n allowedDocumentTypes ?? [],\n );\n\n // Use the debounce hook for name changes\n\n const onNameChange = useCallback(\n (name: string) => {\n if (name === documentName) return;\n console.log(\"onNameChange\", name);\n dispatch(setAppName({ name }));\n },\n [documentName, dispatch],\n );\n\n useDebounce(appName, onNameChange, 300);\n\n const onConfirm = () => {\n dispatch(setAppStatus({ status: \"CONFIRMED\" }));\n };\n\n const onDragAndDropToggle = (enabled: boolean) => {\n if (enabled === isDragAndDropEnabled) return;\n dispatch(setDragAndDropEnabled({ enabled }));\n };\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 (appName.trim()) {\n setIsConfirmed(true); // Immediate UI update\n onConfirm();\n }\n };\n\n const handleAddDocumentType = (documentType: string) => {\n if (!documentType || selectedDocumentTypes.includes(documentType)) return;\n setSelectedDocumentTypes([...selectedDocumentTypes, documentType]);\n dispatch(addDocumentType({ documentType }));\n };\n\n const handleRemoveDocumentType = (documentType: string) => {\n setSelectedDocumentTypes(\n selectedDocumentTypes.filter((dt) => dt !== documentType),\n );\n dispatch(removeDocumentType({ documentType }));\n };\n\n const handleAddAllDocumentTypesInDrive = () => {\n const newDocumentTypes = [\n ...new Set([\n ...selectedDocumentTypes,\n ...(documentTypesInSelectedDrive ?? []),\n ]),\n ];\n setSelectedDocumentTypes(newDocumentTypes);\n dispatch(setDocumentTypes({ documentTypes: newDocumentTypes }));\n };\n\n const handleAddAllDocumentTypesInReactor = () => {\n const newDocumentTypes = [\n ...new Set([\n ...selectedDocumentTypes,\n ...(supportedDocumentTypesInReactor ?? []),\n ]),\n ];\n setSelectedDocumentTypes(newDocumentTypes);\n dispatch(setDocumentTypes({ documentTypes: newDocumentTypes }));\n };\n\n const handleAllowAnyDocumentType = () => {\n setSelectedDocumentTypes([]);\n dispatch(setDocumentTypes({ documentTypes: [] }));\n };\n\n const handleDocumentTypeSelection = (selectedValue: string) => {\n if (selectedValue === ALL_IN_DRIVE) {\n handleAddAllDocumentTypesInDrive();\n } else if (selectedValue === ALL_IN_REACTOR) {\n handleAddAllDocumentTypesInReactor();\n } else if (selectedValue === ALLOW_ANY) {\n handleAllowAnyDocumentType();\n } else {\n handleAddDocumentType(selectedValue);\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 App Configuration\n </h2>\n <StatusPill\n status={status === \"CONFIRMED\" ? \"confirmed\" : \"draft\"}\n label={status === \"CONFIRMED\" ? \"Confirmed\" : \"Draft\"}\n />\n </div>\n\n {/* App Name Field */}\n <div>\n <label\n htmlFor=\"app-name\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n App Name\n </label>\n <input\n id=\"app-name\"\n type=\"text\"\n value={appName}\n onChange={(e) => handleSetAppName(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 app name\"\n />\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 && (\n <select\n onChange={(e) => handleDocumentTypeSelection(e.target.value)}\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>Select a document type to add</option>\n <option>--- Vetra drive document types ---</option>\n <option value={ALL_IN_DRIVE}>\n Add all document types in Vetra drive\n </option>\n {documentTypesInSelectedDrive\n ?.filter((dt) => !selectedDocumentTypes.includes(dt))\n .map((docType) => (\n <option key={docType} value={docType}>\n {docType}\n </option>\n ))}\n <option>--- Reactor document types ---</option>\n <option value={ALL_IN_REACTOR}>\n Add all document types in Reactor\n </option>\n {supportedDocumentTypesInReactor\n ?.filter((dt) => !selectedDocumentTypes.includes(dt))\n .map((docType) => (\n <option key={docType} value={docType}>\n {docType}\n </option>\n ))}\n <option>--- Allow any document type ---</option>\n <option value={ALLOW_ANY}>Allow any document type</option>\n </select>\n )}\n <div className=\"space-y-1\">\n {selectedDocumentTypes.length > 0 ? (\n selectedDocumentTypes.map((type) => (\n <div key={type} className=\"flex items-center py-1\">\n <span className=\"text-sm text-foreground\">{type}</span>\n {!isReadOnly && (\n <button\n onClick={() => handleRemoveDocumentType(type)}\n className=\"ml-2 text-muted-foreground hover:hover-effect focus:outline-none\"\n >\n ×\n </button>\n )}\n </div>\n ))\n ) : (\n <span className=\"text-sm text-foreground\">All documents (*)</span>\n )}\n </div>\n </div>\n </div>\n\n {/* Drag and Drop Settings */}\n <div>\n <h3 className=\"mb-4 text-base font-medium text-foreground\">\n Drag and Drop Settings\n </h3>\n\n {/* Enable/Disable Switch */}\n <div className=\"mb-4\">\n <label htmlFor=\"drag-and-drop-enabled\" className=\"flex items-center\">\n <input\n id=\"drag-and-drop-enabled\"\n type=\"checkbox\"\n checked={isDragAndDropEnabled}\n onChange={(e) => onDragAndDropToggle(e.target.checked)}\n disabled={isReadOnly}\n className={twMerge(\n \"mr-2 size-4 rounded-sm border-border text-info focus:ring-ring\",\n isReadOnly ? \"cursor-not-allowed\" : \"\",\n )}\n />\n <span className=\"text-sm font-medium text-foreground\">\n Enable drag and drop\n </span>\n </label>\n </div>\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={!appName.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 AppModuleAction,\n AppModuleDocument,\n} from \"../../document-models/app-module/index.js\";\nimport { useSetPHDocumentEditorConfig } from \"@powerhousedao/reactor-browser\";\nimport { AppEditorForm } from \"./components/AppEditorForm.js\";\nimport { editorConfig } from \"./config.js\";\n\nexport default function Editor({\n document,\n}: EditorProps<AppModuleDocument, AppModuleAction>) {\n useSetPHDocumentEditorConfig(editorConfig);\n\n return (\n <div className=\"bg-background p-6\">\n <DocumentToolbar document={document} />\n <AppEditorForm />\n </div>\n );\n}\n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CAAA,GACrD,CAAC,cACA,oBAAC,UAAD;OACE,eAAe,yBAAyB,IAAI;OAC5C,WAAU;OACX,UAAA;MAEO,CAAA,CAEP;KAVK,GAAA,IAUL,CACN,IAED,oBAAC,QAAD;MAAM,WAAU;MAA0B,UAAA;KAAuB,CAAA;IAEhE,CAAA,CACF;GACF,CAAA,CAAA,EAAA,CAAA;GAGL,qBAAC,OAAD,EAAA,UAAA,CACE,oBAAC,MAAD;IAAI,WAAU;IAA6C,UAAA;GAEvD,CAAA,GAGJ,oBAAC,OAAD;IAAK,WAAU;IACb,UAAA,qBAAC,SAAD;KAAO,SAAQ;KAAwB,WAAU;KAAjD,UAAA,CACE,oBAAC,SAAD;MACE,IAAG;MACH,MAAK;MACL,SAAS;MACT,WAAW,MAAM,oBAAoB,EAAE,OAAO,OAAO;MACrD,UAAU;MACV,WAAW,QACT,kEACA,aAAa,uBAAuB,EACtC;KACD,CAAA,GACD,oBAAC,QAAD;MAAM,WAAU;MAAsC,UAAA;KAEhD,CAAA,CACD;;GACJ,CAAA,CACF,EAAA,CAAA;GAGJ,CAAC,cACA,oBAAC,OAAD,EAAA,UACE,oBAAC,UAAD;IACE,SAAS;IACT,UAAU,CAAC,QAAQ,KAAK;IACxB,WAAU;IACX,UAAA;GAEO,CAAA,EACL,CAAA;EAEJ;;AAET;;;ACxQA,MAAa,eAAuC,EAClD,2BAA2B,MAC7B;;;ACMA,SAAwB,OAAO,EAC7B,YACkD;CAClD,6BAA6B,YAAY;CAEzC,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,iBAAD,EAA2B,SAAW,CAAA,GACtC,oBAAC,eAAD,CAAgB,CAAA,CACb;;AAET"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { _ as removeDocumentType, b as setProcessorStatus, h as addProcessorApp, m as addDocumentType, v as removeProcessorApp, x as setProcessorType, y as setProcessorName } from "./utils-w_21RRK6.js";
|
|
2
2
|
import { StatusPill } from "./editors/components/index.js";
|
|
3
3
|
import { n as useAvailableDocumentTypes, t as useDebounce } from "./hooks-BbxvC-C3.js";
|
|
4
|
-
import { n as useSelectedProcessorModuleDocument } from "./useVetraDocument-B0k3gNtw.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";
|
|
@@ -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-DbE7t0TU.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-C5a0rBQj.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 { 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 { useSelectedProcessorModuleDocument } from \"../hooks/useVetraDocument.js\";\nimport { ProcessorEditorForm } from \"./components/ProcessorEditorForm.js\";\nimport { editorConfig } from \"./config.js\";\n\nexport default function Editor() {\n useSetPHDocumentEditorConfig(editorConfig);\n const [document, dispatch] = useSelectedProcessorModuleDocument();\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 />\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;CAC5C,YAAY,eAAe,cAAc,GAAG;CAG5C,gBAAgB;EAEd,iBAAiB,oBAAoB;CACvC,GAAG,CAAC,oBAAoB,CAAC;CAEzB,gBAAgB;EAEd,iBAAiB,oBAAoB;CACvC,GAAG,CAAC,oBAAoB,CAAC;CAEzB,gBAAgB;EAEd,iBAAiB,oBAAoB;CACvC,GAAG,CAAC,oBAAoB,CAAC;CAEzB,gBAAgB;EAEd,iBAAiB,oBAAoB;CACvC,GAAG,CAAC,oBAAoB,CAAC;CAGzB,gBAAgB;EACd,IAAI,WAAW,SAEb,eAAe,KAAK;CAExB,GAAG,CAAC,MAAM,CAAC;CAGX,MAAM,aAAa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../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;CAC5C,YAAY,eAAe,cAAc,GAAG;CAG5C,gBAAgB;EAEd,iBAAiB,oBAAoB;CACvC,GAAG,CAAC,oBAAoB,CAAC;CAEzB,gBAAgB;EAEd,iBAAiB,oBAAoB;CACvC,GAAG,CAAC,oBAAoB,CAAC;CAEzB,gBAAgB;EAEd,iBAAiB,oBAAoB;CACvC,GAAG,CAAC,oBAAoB,CAAC;CAEzB,gBAAgB;EAEd,iBAAiB,oBAAoB;CACvC,GAAG,CAAC,oBAAoB,CAAC;CAGzB,gBAAgB;EACd,IAAI,WAAW,SAEb,eAAe,KA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+1,4 @@
|
|
|
1
1
|
import { _ as setEditorName, g as removeDocumentType, m as addDocumentType, v as setEditorStatus } from "./utils-876N1Sph.js";
|
|
2
|
-
import { useSelectedDocumentEditorDocument } from "./document-models/document-editor/index.js";
|
|
3
2
|
import { StatusPill } from "./editors/components/index.js";
|
|
4
3
|
import { n as useAvailableDocumentTypes, t as useDebounce } from "./hooks-BbxvC-C3.js";
|
|
5
4
|
import { useSetPHDocumentEditorConfig } from "@powerhousedao/reactor-browser";
|
|
@@ -139,9 +138,8 @@ const DocumentEditorForm = ({ editorName: initialEditorName = "", documentTypes:
|
|
|
139
138
|
const editorConfig = { isExternalControlsEnabled: false };
|
|
140
139
|
//#endregion
|
|
141
140
|
//#region editors/document-editor/editor.tsx
|
|
142
|
-
function Editor() {
|
|
141
|
+
function Editor({ document, dispatch }) {
|
|
143
142
|
useSetPHDocumentEditorConfig(editorConfig);
|
|
144
|
-
const [document, dispatch] = useSelectedDocumentEditorDocument();
|
|
145
143
|
const onEditorNameChange = useCallback((name) => {
|
|
146
144
|
if (!document.state.global.name && !name) return;
|
|
147
145
|
if (name === document.state.global.name) return;
|
|
@@ -158,7 +156,7 @@ function Editor() {
|
|
|
158
156
|
}, [dispatch]);
|
|
159
157
|
return /* @__PURE__ */ jsxs("div", {
|
|
160
158
|
className: "bg-background p-6",
|
|
161
|
-
children: [/* @__PURE__ */ jsx(DocumentToolbar, {}), /* @__PURE__ */ jsx(DocumentEditorForm, {
|
|
159
|
+
children: [/* @__PURE__ */ jsx(DocumentToolbar, { document }), /* @__PURE__ */ jsx(DocumentEditorForm, {
|
|
162
160
|
status: document.state.global.status,
|
|
163
161
|
editorName: document.state.global.name ?? "",
|
|
164
162
|
documentTypes: document.state.global.documentTypes,
|
|
@@ -172,4 +170,4 @@ function Editor() {
|
|
|
172
170
|
//#endregion
|
|
173
171
|
export { Editor as default };
|
|
174
172
|
|
|
175
|
-
//# sourceMappingURL=editor-
|
|
173
|
+
//# sourceMappingURL=editor-SJk7cr6k.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-DFEeM_dy.js","names":[],"sources":["../editors/document-editor/components/DocumentEditorForm.tsx","../editors/document-editor/config.ts","../editors/document-editor/editor.tsx"],"sourcesContent":["import { Suspense, useEffect, useState } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\nimport type {\n AddDocumentTypeInput,\n DocumentTypeItem,\n RemoveDocumentTypeInput,\n} from \"../../../document-models/document-editor/index.js\";\nimport { StatusPill } from \"../../components/index.js\";\nimport { useAvailableDocumentTypes, useDebounce } from \"../../hooks/index.js\";\n\nexport interface DocumentEditorFormProps {\n editorName?: string;\n documentTypes?: DocumentTypeItem[];\n status?: string;\n onEditorNameChange?: (name: string) => void;\n onAddDocumentType?: (input: AddDocumentTypeInput) => void;\n onRemoveDocumentType?: (input: RemoveDocumentTypeInput) => void;\n onConfirm?: () => void;\n}\n\nfunction DocumentTypeSelectUI(\n props: React.SelectHTMLAttributes<HTMLSelectElement>,\n) {\n return (\n <select\n id=\"supported-document-types\"\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 {...props}\n >\n <option value=\"\">Select a document type</option>\n {props.children}\n </select>\n );\n}\n\nfunction DocumentTypeSelect({\n documentTypes,\n setDocumentTypes,\n onAddDocumentType,\n onRemoveDocumentType,\n}: {\n setDocumentTypes: (documentTypes: DocumentTypeItem[]) => void;\n} & Pick<\n DocumentEditorFormProps,\n \"documentTypes\" | \"onAddDocumentType\" | \"onRemoveDocumentType\"\n>) {\n // Get available document types from the hook (vetra drive only for document editor)\n const availableDocumentTypes = useAvailableDocumentTypes(true);\n const [selectedDocumentType, setSelectedDocumentType] = useState(\"\");\n\n return (\n <DocumentTypeSelectUI\n value={selectedDocumentType}\n onChange={(e) => {\n const selectedValue = e.target.value;\n if (selectedValue) {\n // Remove existing document type if any\n\n const existingType = documentTypes?.at(0);\n if (existingType) {\n onRemoveDocumentType?.({ id: existingType.id });\n }\n\n // Add the new document type\n const newTypeInput: AddDocumentTypeInput = {\n id: Date.now().toString(), // Generate a unique ID\n documentType: selectedValue,\n };\n const newType: DocumentTypeItem = {\n id: newTypeInput.id,\n documentType: newTypeInput.documentType,\n };\n setDocumentTypes([newType]); // Replace with single item array\n onAddDocumentType?.(newTypeInput);\n }\n setSelectedDocumentType(\"\");\n }}\n >\n {availableDocumentTypes.map((docType) => (\n <option key={docType} value={docType}>\n {docType}\n </option>\n ))}\n </DocumentTypeSelectUI>\n );\n}\n\nexport const DocumentEditorForm: React.FC<DocumentEditorFormProps> = ({\n editorName: initialEditorName = \"\",\n documentTypes: initialDocumentTypes = [],\n status = \"DRAFT\",\n onEditorNameChange,\n onAddDocumentType,\n onRemoveDocumentType,\n onConfirm,\n}) => {\n const [editorName, setEditorName] = useState(initialEditorName);\n const [documentTypes, setDocumentTypes] =\n useState<DocumentTypeItem[]>(initialDocumentTypes);\n const [isConfirmed, setIsConfirmed] = useState(false);\n\n // Use the debounce hook for name changes\n useDebounce(editorName, onEditorNameChange, 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 setEditorName(initialEditorName);\n }, [initialEditorName]);\n\n useEffect(() => {\n // eslint-disable-next-line react-hooks-extra/set-state-in-effect\n setDocumentTypes(initialDocumentTypes);\n }, [initialDocumentTypes]);\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 (editorName.trim() && documentTypes.length > 0) {\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 Editor Configuration\n </h2>\n <StatusPill\n status={status === \"CONFIRMED\" ? \"confirmed\" : \"draft\"}\n label={status === \"CONFIRMED\" ? \"Confirmed\" : \"Draft\"}\n />\n </div>\n\n {/* Editor Name Field */}\n <div>\n <label\n htmlFor=\"editor-name\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Editor Name\n </label>\n <input\n id=\"editor-name\"\n type=\"text\"\n value={editorName}\n onChange={(e) => setEditorName(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 />\n </div>\n\n {/* Supported Document Types Field */}\n <div>\n <label\n htmlFor=\"supported-document-types\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Supported Document Types\n </label>\n <div className=\"space-y-2\">\n {!isReadOnly && (\n <Suspense fallback={<DocumentTypeSelectUI />}>\n <DocumentTypeSelect\n documentTypes={documentTypes}\n setDocumentTypes={setDocumentTypes}\n onAddDocumentType={onAddDocumentType}\n onRemoveDocumentType={onRemoveDocumentType}\n />\n </Suspense>\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={() => {\n setDocumentTypes([]);\n onRemoveDocumentType?.({ id: type.id });\n }}\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\n {/* Confirm Button - only show if not in read-only mode */}\n {!isReadOnly && (\n <div>\n <button\n onClick={handleConfirm}\n disabled={!editorName.trim() || documentTypes.length === 0}\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 { useSetPHDocumentEditorConfig } from \"@powerhousedao/reactor-browser\";\nimport { useCallback } from \"react\";\nimport { useSelectedDocumentEditorDocument } from \"../../document-models/document-editor/index.js\";\nimport {\n addDocumentType,\n removeDocumentType,\n setEditorName,\n setEditorStatus,\n type AddDocumentTypeInput,\n type RemoveDocumentTypeInput,\n} from \"../../document-models/document-editor/index.js\";\nimport { DocumentEditorForm } from \"./components/DocumentEditorForm.js\";\nimport { editorConfig } from \"./config.js\";\n\nexport default function Editor() {\n useSetPHDocumentEditorConfig(editorConfig);\n const [document, dispatch] = useSelectedDocumentEditorDocument();\n\n const onEditorNameChange = useCallback(\n (name: string) => {\n if (!document.state.global.name && !name) return;\n if (name === document.state.global.name) return;\n\n dispatch(setEditorName({ name }));\n },\n [document.state.global.name, dispatch],\n );\n\n const onAddDocumentType = useCallback(\n (input: AddDocumentTypeInput) => {\n dispatch(addDocumentType(input));\n },\n [dispatch],\n );\n\n const onRemoveDocumentType = useCallback(\n (input: RemoveDocumentTypeInput) => {\n dispatch(removeDocumentType(input));\n },\n [dispatch],\n );\n\n const onConfirm = useCallback(() => {\n dispatch(setEditorStatus({ status: \"CONFIRMED\" }));\n }, [dispatch]);\n\n return (\n <div className=\"bg-background p-6\">\n <DocumentToolbar />\n <DocumentEditorForm\n status={document.state.global.status}\n editorName={document.state.global.name ?? \"\"}\n documentTypes={document.state.global.documentTypes}\n onEditorNameChange={onEditorNameChange}\n onAddDocumentType={onAddDocumentType}\n onRemoveDocumentType={onRemoveDocumentType}\n onConfirm={onConfirm}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AAoBA,SAAS,qBACP,OACA;CACA,OACE,qBAAC,UAAD;EACE,IAA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,"file":"editor-SJk7cr6k.js","names":[],"sources":["../editors/document-editor/components/DocumentEditorForm.tsx","../editors/document-editor/config.ts","../editors/document-editor/editor.tsx"],"sourcesContent":["import { Suspense, useEffect, useState } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\nimport type {\n AddDocumentTypeInput,\n DocumentTypeItem,\n RemoveDocumentTypeInput,\n} from \"../../../document-models/document-editor/index.js\";\nimport { StatusPill } from \"../../components/index.js\";\nimport { useAvailableDocumentTypes, useDebounce } from \"../../hooks/index.js\";\n\nexport interface DocumentEditorFormProps {\n editorName?: string;\n documentTypes?: DocumentTypeItem[];\n status?: string;\n onEditorNameChange?: (name: string) => void;\n onAddDocumentType?: (input: AddDocumentTypeInput) => void;\n onRemoveDocumentType?: (input: RemoveDocumentTypeInput) => void;\n onConfirm?: () => void;\n}\n\nfunction DocumentTypeSelectUI(\n props: React.SelectHTMLAttributes<HTMLSelectElement>,\n) {\n return (\n <select\n id=\"supported-document-types\"\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 {...props}\n >\n <option value=\"\">Select a document type</option>\n {props.children}\n </select>\n );\n}\n\nfunction DocumentTypeSelect({\n documentTypes,\n setDocumentTypes,\n onAddDocumentType,\n onRemoveDocumentType,\n}: {\n setDocumentTypes: (documentTypes: DocumentTypeItem[]) => void;\n} & Pick<\n DocumentEditorFormProps,\n \"documentTypes\" | \"onAddDocumentType\" | \"onRemoveDocumentType\"\n>) {\n // Get available document types from the hook (vetra drive only for document editor)\n const availableDocumentTypes = useAvailableDocumentTypes(true);\n const [selectedDocumentType, setSelectedDocumentType] = useState(\"\");\n\n return (\n <DocumentTypeSelectUI\n value={selectedDocumentType}\n onChange={(e) => {\n const selectedValue = e.target.value;\n if (selectedValue) {\n // Remove existing document type if any\n\n const existingType = documentTypes?.at(0);\n if (existingType) {\n onRemoveDocumentType?.({ id: existingType.id });\n }\n\n // Add the new document type\n const newTypeInput: AddDocumentTypeInput = {\n id: Date.now().toString(), // Generate a unique ID\n documentType: selectedValue,\n };\n const newType: DocumentTypeItem = {\n id: newTypeInput.id,\n documentType: newTypeInput.documentType,\n };\n setDocumentTypes([newType]); // Replace with single item array\n onAddDocumentType?.(newTypeInput);\n }\n setSelectedDocumentType(\"\");\n }}\n >\n {availableDocumentTypes.map((docType) => (\n <option key={docType} value={docType}>\n {docType}\n </option>\n ))}\n </DocumentTypeSelectUI>\n );\n}\n\nexport const DocumentEditorForm: React.FC<DocumentEditorFormProps> = ({\n editorName: initialEditorName = \"\",\n documentTypes: initialDocumentTypes = [],\n status = \"DRAFT\",\n onEditorNameChange,\n onAddDocumentType,\n onRemoveDocumentType,\n onConfirm,\n}) => {\n const [editorName, setEditorName] = useState(initialEditorName);\n const [documentTypes, setDocumentTypes] =\n useState<DocumentTypeItem[]>(initialDocumentTypes);\n const [isConfirmed, setIsConfirmed] = useState(false);\n\n // Use the debounce hook for name changes\n useDebounce(editorName, onEditorNameChange, 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 setEditorName(initialEditorName);\n }, [initialEditorName]);\n\n useEffect(() => {\n // eslint-disable-next-line react-hooks-extra/set-state-in-effect\n setDocumentTypes(initialDocumentTypes);\n }, [initialDocumentTypes]);\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 (editorName.trim() && documentTypes.length > 0) {\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 Editor Configuration\n </h2>\n <StatusPill\n status={status === \"CONFIRMED\" ? \"confirmed\" : \"draft\"}\n label={status === \"CONFIRMED\" ? \"Confirmed\" : \"Draft\"}\n />\n </div>\n\n {/* Editor Name Field */}\n <div>\n <label\n htmlFor=\"editor-name\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Editor Name\n </label>\n <input\n id=\"editor-name\"\n type=\"text\"\n value={editorName}\n onChange={(e) => setEditorName(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 />\n </div>\n\n {/* Supported Document Types Field */}\n <div>\n <label\n htmlFor=\"supported-document-types\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Supported Document Types\n </label>\n <div className=\"space-y-2\">\n {!isReadOnly && (\n <Suspense fallback={<DocumentTypeSelectUI />}>\n <DocumentTypeSelect\n documentTypes={documentTypes}\n setDocumentTypes={setDocumentTypes}\n onAddDocumentType={onAddDocumentType}\n onRemoveDocumentType={onRemoveDocumentType}\n />\n </Suspense>\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={() => {\n setDocumentTypes([]);\n onRemoveDocumentType?.({ id: type.id });\n }}\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\n {/* Confirm Button - only show if not in read-only mode */}\n {!isReadOnly && (\n <div>\n <button\n onClick={handleConfirm}\n disabled={!editorName.trim() || documentTypes.length === 0}\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 DocumentEditorAction,\n DocumentEditorDocument,\n} from \"../../document-models/document-editor/index.js\";\nimport { useSetPHDocumentEditorConfig } from \"@powerhousedao/reactor-browser\";\nimport { useCallback } from \"react\";\nimport {\n addDocumentType,\n removeDocumentType,\n setEditorName,\n setEditorStatus,\n type AddDocumentTypeInput,\n type RemoveDocumentTypeInput,\n} from \"../../document-models/document-editor/index.js\";\nimport { DocumentEditorForm } from \"./components/DocumentEditorForm.js\";\nimport { editorConfig } from \"./config.js\";\n\nexport default function Editor({\n document,\n dispatch,\n}: EditorProps<DocumentEditorDocument, DocumentEditorAction>) {\n useSetPHDocumentEditorConfig(editorConfig);\n\n const onEditorNameChange = useCallback(\n (name: string) => {\n if (!document.state.global.name && !name) return;\n if (name === document.state.global.name) return;\n\n dispatch(setEditorName({ name }));\n },\n [document.state.global.name, dispatch],\n );\n\n const onAddDocumentType = useCallback(\n (input: AddDocumentTypeInput) => {\n dispatch(addDocumentType(input));\n },\n [dispatch],\n );\n\n const onRemoveDocumentType = useCallback(\n (input: RemoveDocumentTypeInput) => {\n dispatch(removeDocumentType(input));\n },\n [dispatch],\n );\n\n const onConfirm = useCallback(() => {\n dispatch(setEditorStatus({ status: \"CONFIRMED\" }));\n }, [dispatch]);\n\n return (\n <div className=\"bg-background p-6\">\n <DocumentToolbar document={document} />\n <DocumentEditorForm\n status={document.state.global.status}\n editorName={document.state.global.name ?? \"\"}\n documentTypes={document.state.global.documentTypes}\n onEditorNameChange={onEditorNameChange}\n onAddDocumentType={onAddDocumentType}\n onRemoveDocumentType={onRemoveDocumentType}\n onConfirm={onConfirm}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;AAoBA,SAAS,qBACP,OACA;CACA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/dist/editors/index.d.ts
CHANGED
|
@@ -1,27 +1,38 @@
|
|
|
1
|
+
import { $ as AppModuleDocument, W as AppModuleAction } from "../index-DPG4u1Ym.js";
|
|
2
|
+
import "../index-6bE9h_7M.js";
|
|
3
|
+
import { G as DocumentEditorDocument, z as DocumentEditorAction } from "../index-D6Ai0OOc.js";
|
|
4
|
+
import "../index-7hPKQROx.js";
|
|
5
|
+
import { G as ProcessorModuleAction, et as ProcessorModuleDocument } from "../index-B52jv-LY.js";
|
|
6
|
+
import "../index-cdL5k2sw.js";
|
|
7
|
+
import { P as SubgraphModuleAction, R as SubgraphModuleDocument } from "../index-DplUuZMT.js";
|
|
8
|
+
import "../index-D_rwE-2_.js";
|
|
9
|
+
import { Z as VetraPackageDocument, xt as VetraPackageAction } from "../module-D4lqkHHK.js";
|
|
10
|
+
import "../index-6UbC6P89.js";
|
|
1
11
|
import { EditorModule } from "document-model";
|
|
2
12
|
import { EditorModule as EditorModule$1 } from "@powerhousedao/shared/document-model";
|
|
13
|
+
import { DocumentDriveAction, DocumentDriveDocument } from "@powerhousedao/shared/document-drive";
|
|
3
14
|
//#region editors/app-editor/module.d.ts
|
|
4
15
|
/** Document editor module for the "powerhouse/app" document type */
|
|
5
|
-
export declare const AppEditor: EditorModule
|
|
16
|
+
export declare const AppEditor: EditorModule<AppModuleDocument, AppModuleAction>;
|
|
6
17
|
//#endregion
|
|
7
18
|
//#region editors/document-editor/module.d.ts
|
|
8
19
|
/** Document editor module for the "powerhouse/document-editor" document type */
|
|
9
|
-
export declare const DocumentEditorEditor: EditorModule
|
|
20
|
+
export declare const DocumentEditorEditor: EditorModule<DocumentEditorDocument, DocumentEditorAction>;
|
|
10
21
|
//#endregion
|
|
11
22
|
//#region editors/processor-editor/module.d.ts
|
|
12
23
|
/** Document editor module for the "powerhouse/processor" document type */
|
|
13
|
-
export declare const ProcessorModuleEditor: EditorModule
|
|
24
|
+
export declare const ProcessorModuleEditor: EditorModule<ProcessorModuleDocument, ProcessorModuleAction>;
|
|
14
25
|
//#endregion
|
|
15
26
|
//#region editors/subgraph-editor/module.d.ts
|
|
16
27
|
/** Document editor module for the "powerhouse/subgraph" document type */
|
|
17
|
-
export declare const SubgraphModuleEditor: EditorModule
|
|
28
|
+
export declare const SubgraphModuleEditor: EditorModule<SubgraphModuleDocument, SubgraphModuleAction>;
|
|
18
29
|
//#endregion
|
|
19
30
|
//#region editors/vetra-drive-app/module.d.ts
|
|
20
|
-
export declare const VetraDriveApp: EditorModule$1
|
|
31
|
+
export declare const VetraDriveApp: EditorModule$1<DocumentDriveDocument, DocumentDriveAction>;
|
|
21
32
|
//#endregion
|
|
22
33
|
//#region editors/vetra-package/module.d.ts
|
|
23
34
|
/** Document editor module for the "powerhouse/package" document type */
|
|
24
|
-
export declare const VetraPackageEditor: EditorModule
|
|
35
|
+
export declare const VetraPackageEditor: EditorModule<VetraPackageDocument, VetraPackageAction>;
|
|
25
36
|
//#endregion
|
|
26
37
|
export {};
|
|
27
38
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","names":[],"sources":["../../editors/app-editor/module.ts","../../editors/document-editor/module.ts","../../editors/processor-editor/module.ts","../../editors/subgraph-editor/module.ts","../../editors/vetra-drive-app/module.ts","../../editors/vetra-package/module.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../editors/app-editor/module.ts","../../editors/document-editor/module.ts","../../editors/processor-editor/module.ts","../../editors/subgraph-editor/module.ts","../../editors/vetra-drive-app/module.ts","../../editors/vetra-package/module.ts"],"mappings":";;;;;;;;;;;;;;;qBAYa,WAAW,aAAa,mBAAmB;;;;qBCA3C,sBAAsB,aACjC,wBACA;;;;qBCFW,uBAAuB,aAClC,yBACA;;;;qBCFW,sBAAsB,aACjC,wBACA;;;qBCPW,eAAe,eAC1B,uBACA;;;;qBCGW,oBAAoB,aAC/B,sBACA"}
|
package/dist/editors/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as DocumentEditorEditor, i as ProcessorModuleEditor, n as VetraDriveApp, o as AppEditor, r as SubgraphModuleEditor, t as VetraPackageEditor } from "../module-
|
|
1
|
+
import { a as DocumentEditorEditor, i as ProcessorModuleEditor, n as VetraDriveApp, o as AppEditor, r as SubgraphModuleEditor, t as VetraPackageEditor } from "../module-CZLWjrD_.js";
|
|
2
2
|
export { AppEditor, DocumentEditorEditor, ProcessorModuleEditor, SubgraphModuleEditor, VetraDriveApp, VetraPackageEditor };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { At as SetPackageNameAction, Ct as RemovePackageKeywordAction, Dt as SetPackageCategoryAction, Et as SetPackageAuthorWebsiteAction, Ot as SetPackageDescriptionAction, St as AddPackageKeywordAction, Tt as SetPackageAuthorNameAction, _t as SetPackageGithubUrlInput, et as AddPackageKeywordInput, ft as SetPackageAuthorInput, gt as SetPackageDescriptionInput, ht as SetPackageCategoryInput, jt as SetPackageNpmUrlAction, kt as SetPackageGithubUrlAction, mt as SetPackageAuthorWebsiteInput, pt as SetPackageAuthorNameInput, ut as RemovePackageKeywordInput, vt as SetPackageNameInput, wt as SetPackageAuthorAction, yt as SetPackageNpmUrlInput } from "./module-D4lqkHHK.js";
|
|
2
|
+
import { UpgradeManifest } from "document-model";
|
|
3
|
+
//#region document-models/vetra-package/v1/actions.d.ts
|
|
4
|
+
/** Actions for the VetraPackage document model */
|
|
5
|
+
declare const actions: {
|
|
6
|
+
setName: typeof import("document-model").setName;
|
|
7
|
+
setPreferredEditor: typeof import("document-model").setPreferredEditor;
|
|
8
|
+
undo: typeof import("document-model").undo;
|
|
9
|
+
redo: typeof import("document-model").redo;
|
|
10
|
+
noop: typeof import("document-model").noop;
|
|
11
|
+
setPackageName: (input: SetPackageNameInput) => SetPackageNameAction;
|
|
12
|
+
setPackageDescription: (input: SetPackageDescriptionInput) => SetPackageDescriptionAction;
|
|
13
|
+
setPackageCategory: (input: SetPackageCategoryInput) => SetPackageCategoryAction;
|
|
14
|
+
setPackageAuthor: (input: SetPackageAuthorInput) => SetPackageAuthorAction;
|
|
15
|
+
setPackageAuthorName: (input: SetPackageAuthorNameInput) => SetPackageAuthorNameAction;
|
|
16
|
+
setPackageAuthorWebsite: (input: SetPackageAuthorWebsiteInput) => SetPackageAuthorWebsiteAction;
|
|
17
|
+
addPackageKeyword: (input: AddPackageKeywordInput) => AddPackageKeywordAction;
|
|
18
|
+
removePackageKeyword: (input: RemovePackageKeywordInput) => RemovePackageKeywordAction;
|
|
19
|
+
setPackageGithubUrl: (input: SetPackageGithubUrlInput) => SetPackageGithubUrlAction;
|
|
20
|
+
setPackageNpmUrl: (input: SetPackageNpmUrlInput) => SetPackageNpmUrlAction;
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region document-models/vetra-package/v1/gen/document-type.d.ts
|
|
24
|
+
/**
|
|
25
|
+
* WARNING: DO NOT EDIT
|
|
26
|
+
* This file is auto-generated and updated by codegen
|
|
27
|
+
*/
|
|
28
|
+
declare const vetraPackageDocumentType = "powerhouse/package";
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region document-models/vetra-package/upgrades/versions.d.ts
|
|
31
|
+
declare const supportedVersions: readonly [1];
|
|
32
|
+
declare const latestVersion: 1;
|
|
33
|
+
//#endregion
|
|
34
|
+
//#region document-models/vetra-package/upgrades/upgrade-manifest.d.ts
|
|
35
|
+
declare const vetraPackageUpgradeManifest: UpgradeManifest<typeof supportedVersions>;
|
|
36
|
+
//#endregion
|
|
37
|
+
export { actions as a, vetraPackageDocumentType as i, latestVersion as n, supportedVersions as r, vetraPackageUpgradeManifest as t };
|
|
38
|
+
export {};
|
|
39
|
+
//# sourceMappingURL=index-6UbC6P89.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-6UbC6P89.d.ts","names":[],"sources":["../document-models/vetra-package/v1/actions.ts","../document-models/vetra-package/v1/gen/document-type.ts","../document-models/vetra-package/upgrades/versions.ts","../document-models/vetra-package/upgrades/upgrade-manifest.ts"],"mappings":";;;;cASa;;;;;;0BAAA;;;;;;;;;;;;;;;;;cCLA;;;cCJA;cAEA;;;cCKA,6BAA6B,uBACjC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { K as SetDragAndDropEnabledAction, Q as SetDocumentTypesAction, X as SetAppNameAction, Y as RemoveDocumentTypeAction, Z as SetAppStatusAction, dt as RemoveDocumentTypeInput, gt as SetDragAndDropEnabledInput, ht as SetDocumentTypesInput, mt as SetAppStatusInput, nt as AddDocumentTypeInput, pt as SetAppNameInput, q as AddDocumentTypeAction } from "./index-DPG4u1Ym.js";
|
|
2
|
+
import { UpgradeManifest } from "document-model";
|
|
3
|
+
//#region document-models/app-module/v1/gen/document-type.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* WARNING: DO NOT EDIT
|
|
6
|
+
* This file is auto-generated and updated by codegen
|
|
7
|
+
*/
|
|
8
|
+
declare const appModuleDocumentType = "powerhouse/app";
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region document-models/app-module/v1/actions.d.ts
|
|
11
|
+
/** Actions for the AppModule document model */
|
|
12
|
+
declare const actions: {
|
|
13
|
+
setName: typeof import("document-model").setName;
|
|
14
|
+
setPreferredEditor: typeof import("document-model").setPreferredEditor;
|
|
15
|
+
undo: typeof import("document-model").undo;
|
|
16
|
+
redo: typeof import("document-model").redo;
|
|
17
|
+
noop: typeof import("document-model").noop;
|
|
18
|
+
setAppName: (input: SetAppNameInput) => SetAppNameAction;
|
|
19
|
+
setAppStatus: (input: SetAppStatusInput) => SetAppStatusAction;
|
|
20
|
+
addDocumentType: (input: AddDocumentTypeInput) => AddDocumentTypeAction;
|
|
21
|
+
removeDocumentType: (input: RemoveDocumentTypeInput) => RemoveDocumentTypeAction;
|
|
22
|
+
setDocumentTypes: (input: SetDocumentTypesInput) => SetDocumentTypesAction;
|
|
23
|
+
setDragAndDropEnabled: (input: SetDragAndDropEnabledInput) => SetDragAndDropEnabledAction;
|
|
24
|
+
};
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region document-models/app-module/upgrades/versions.d.ts
|
|
27
|
+
declare const supportedVersions: readonly [1];
|
|
28
|
+
declare const latestVersion: 1;
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region document-models/app-module/upgrades/upgrade-manifest.d.ts
|
|
31
|
+
declare const appModuleUpgradeManifest: UpgradeManifest<typeof supportedVersions>;
|
|
32
|
+
//#endregion
|
|
33
|
+
export { appModuleDocumentType as a, actions as i, latestVersion as n, supportedVersions as r, appModuleUpgradeManifest as t };
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=index-6bE9h_7M.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-6bE9h_7M.d.ts","names":[],"sources":["../document-models/app-module/v1/gen/document-type.ts","../document-models/app-module/v1/actions.ts","../document-models/app-module/upgrades/versions.ts","../document-models/app-module/upgrades/upgrade-manifest.ts"],"mappings":";;;;;;;cAIa;;;;cCQA;;;;;;sBAAA;;;;;;;;;cCZA;cAEA;;;cCKA,0BAA0B,uBAC9B"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { B as AddDocumentTypeAction, H as RemoveDocumentTypeAction, J as AddDocumentTypeInput, U as SetEditorNameAction, W as SetEditorStatusAction, it as RemoveDocumentTypeInput, ot as SetEditorNameInput, st as SetEditorStatusInput } from "./index-D6Ai0OOc.js";
|
|
2
|
+
import { UpgradeManifest } from "document-model";
|
|
3
|
+
//#region document-models/document-editor/v1/gen/document-type.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* WARNING: DO NOT EDIT
|
|
6
|
+
* This file is auto-generated and updated by codegen
|
|
7
|
+
*/
|
|
8
|
+
declare const documentEditorDocumentType = "powerhouse/document-editor";
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region document-models/document-editor/v1/actions.d.ts
|
|
11
|
+
/** Actions for the DocumentEditor document model */
|
|
12
|
+
declare const actions: {
|
|
13
|
+
setName: typeof import("document-model").setName;
|
|
14
|
+
setPreferredEditor: typeof import("document-model").setPreferredEditor;
|
|
15
|
+
undo: typeof import("document-model").undo;
|
|
16
|
+
redo: typeof import("document-model").redo;
|
|
17
|
+
noop: typeof import("document-model").noop;
|
|
18
|
+
setEditorName: (input: SetEditorNameInput) => SetEditorNameAction;
|
|
19
|
+
addDocumentType: (input: AddDocumentTypeInput) => AddDocumentTypeAction;
|
|
20
|
+
removeDocumentType: (input: RemoveDocumentTypeInput) => RemoveDocumentTypeAction;
|
|
21
|
+
setEditorStatus: (input: SetEditorStatusInput) => SetEditorStatusAction;
|
|
22
|
+
};
|
|
23
|
+
//#endregion
|
|
24
|
+
//#region document-models/document-editor/upgrades/versions.d.ts
|
|
25
|
+
declare const supportedVersions: readonly [1];
|
|
26
|
+
declare const latestVersion: 1;
|
|
27
|
+
//#endregion
|
|
28
|
+
//#region document-models/document-editor/upgrades/upgrade-manifest.d.ts
|
|
29
|
+
declare const documentEditorUpgradeManifest: UpgradeManifest<typeof supportedVersions>;
|
|
30
|
+
//#endregion
|
|
31
|
+
export { documentEditorDocumentType as a, actions as i, latestVersion as n, supportedVersions as r, documentEditorUpgradeManifest as t };
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=index-7hPKQROx.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-7hPKQROx.d.ts","names":[],"sources":["../document-models/document-editor/v1/gen/document-type.ts","../document-models/document-editor/v1/actions.ts","../document-models/document-editor/upgrades/versions.ts","../document-models/document-editor/upgrades/upgrade-manifest.ts"],"mappings":";;;;;;;cAIa;;;;cCKA;;;;;;yBAAA;;;;;;;cCTA;cAEA;;;cCKA,+BAA+B,uBACnC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { F as SetSubgraphNameAction, I as SetSubgraphStatusAction, X as SetSubgraphStatusInput, Y as SetSubgraphNameInput } from "./index-DplUuZMT.js";
|
|
2
|
+
import { UpgradeManifest } from "document-model";
|
|
3
|
+
//#region document-models/subgraph-module/v1/gen/document-type.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* WARNING: DO NOT EDIT
|
|
6
|
+
* This file is auto-generated and updated by codegen
|
|
7
|
+
*/
|
|
8
|
+
declare const subgraphModuleDocumentType = "powerhouse/subgraph";
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region document-models/subgraph-module/v1/actions.d.ts
|
|
11
|
+
/** Actions for the SubgraphModule document model */
|
|
12
|
+
declare const actions: {
|
|
13
|
+
setName: typeof import("document-model").setName;
|
|
14
|
+
setPreferredEditor: typeof import("document-model").setPreferredEditor;
|
|
15
|
+
undo: typeof import("document-model").undo;
|
|
16
|
+
redo: typeof import("document-model").redo;
|
|
17
|
+
noop: typeof import("document-model").noop;
|
|
18
|
+
setSubgraphName: (input: SetSubgraphNameInput) => SetSubgraphNameAction;
|
|
19
|
+
setSubgraphStatus: (input: SetSubgraphStatusInput) => SetSubgraphStatusAction;
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
//#region document-models/subgraph-module/upgrades/versions.d.ts
|
|
23
|
+
declare const supportedVersions: readonly [1];
|
|
24
|
+
declare const latestVersion: 1;
|
|
25
|
+
//#endregion
|
|
26
|
+
//#region document-models/subgraph-module/upgrades/upgrade-manifest.d.ts
|
|
27
|
+
declare const subgraphModuleUpgradeManifest: UpgradeManifest<typeof supportedVersions>;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { subgraphModuleDocumentType as a, actions as i, latestVersion as n, supportedVersions as r, subgraphModuleUpgradeManifest as t };
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=index-D_rwE-2_.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-D_rwE-2_.d.ts","names":[],"sources":["../document-models/subgraph-module/v1/gen/document-type.ts","../document-models/subgraph-module/v1/actions.ts","../document-models/subgraph-module/upgrades/versions.ts","../document-models/subgraph-module/upgrades/upgrade-manifest.ts"],"mappings":";;;;;;;cAIa;;;;cCKA;;;;;;2BAAA;;;;;cCTA;cAEA;;;cCKA,+BAA+B,uBACnC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { $ as SetProcessorTypeAction, K as AddDocumentTypeAction, Q as SetProcessorStatusAction, X as RemoveProcessorAppAction, Y as RemoveDocumentTypeAction, Z as SetProcessorNameAction, _t as SetProcessorNameInput, ht as RemoveProcessorAppInput, it as AddProcessorAppInput, mt as RemoveDocumentTypeInput, q as AddProcessorAppAction, rt as AddDocumentTypeInput, vt as SetProcessorStatusInput, yt as SetProcessorTypeInput } from "./index-B52jv-LY.js";
|
|
2
|
+
import { UpgradeManifest } from "document-model";
|
|
3
|
+
//#region document-models/processor-module/v1/gen/document-type.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* WARNING: DO NOT EDIT
|
|
6
|
+
* This file is auto-generated and updated by codegen
|
|
7
|
+
*/
|
|
8
|
+
declare const processorModuleDocumentType = "powerhouse/processor";
|
|
9
|
+
//#endregion
|
|
10
|
+
//#region document-models/processor-module/v1/actions.d.ts
|
|
11
|
+
/** Actions for the ProcessorModule document model */
|
|
12
|
+
declare const actions: {
|
|
13
|
+
setName: typeof import("document-model").setName;
|
|
14
|
+
setPreferredEditor: typeof import("document-model").setPreferredEditor;
|
|
15
|
+
undo: typeof import("document-model").undo;
|
|
16
|
+
redo: typeof import("document-model").redo;
|
|
17
|
+
noop: typeof import("document-model").noop;
|
|
18
|
+
setProcessorName: (input: SetProcessorNameInput) => SetProcessorNameAction;
|
|
19
|
+
setProcessorType: (input: SetProcessorTypeInput) => SetProcessorTypeAction;
|
|
20
|
+
addDocumentType: (input: AddDocumentTypeInput) => AddDocumentTypeAction;
|
|
21
|
+
removeDocumentType: (input: RemoveDocumentTypeInput) => RemoveDocumentTypeAction;
|
|
22
|
+
addProcessorApp: (input: AddProcessorAppInput) => AddProcessorAppAction;
|
|
23
|
+
removeProcessorApp: (input: RemoveProcessorAppInput) => RemoveProcessorAppAction;
|
|
24
|
+
setProcessorStatus: (input: SetProcessorStatusInput) => SetProcessorStatusAction;
|
|
25
|
+
};
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region document-models/processor-module/upgrades/versions.d.ts
|
|
28
|
+
declare const supportedVersions: readonly [1];
|
|
29
|
+
declare const latestVersion: 1;
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region document-models/processor-module/upgrades/upgrade-manifest.d.ts
|
|
32
|
+
declare const processorModuleUpgradeManifest: UpgradeManifest<typeof supportedVersions>;
|
|
33
|
+
//#endregion
|
|
34
|
+
export { processorModuleDocumentType as a, actions as i, latestVersion as n, supportedVersions as r, processorModuleUpgradeManifest as t };
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=index-cdL5k2sw.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-cdL5k2sw.d.ts","names":[],"sources":["../document-models/processor-module/v1/gen/document-type.ts","../document-models/processor-module/v1/actions.ts","../document-models/processor-module/upgrades/versions.ts","../document-models/processor-module/upgrades/upgrade-manifest.ts"],"mappings":";;;;;;;cAIa;;;;cCKA;;;;;;4BAAA;;;;;;;;;;cCTA;cAEA;;;cCKA,gCAAgC,uBACpC"}
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { t as documentEditorUpgradeManifest } from "./upgrade-manifest-D7xKGmZc.
|
|
|
8
8
|
import { t as processorModuleUpgradeManifest } from "./upgrade-manifest-d3LquK-H.js";
|
|
9
9
|
import { t as subgraphModuleUpgradeManifest } from "./upgrade-manifest-Dv62Cod7.js";
|
|
10
10
|
import { t as vetraPackageUpgradeManifest } from "./upgrade-manifest-BOZ5nmyK.js";
|
|
11
|
-
import { a as DocumentEditorEditor, i as ProcessorModuleEditor, n as VetraDriveApp, o as AppEditor, r as SubgraphModuleEditor, t as VetraPackageEditor } from "./module-
|
|
11
|
+
import { a as DocumentEditorEditor, i as ProcessorModuleEditor, n as VetraDriveApp, o as AppEditor, r as SubgraphModuleEditor, t as VetraPackageEditor } from "./module-CZLWjrD_.js";
|
|
12
12
|
//#region powerhouse.manifest.json
|
|
13
13
|
var powerhouse_manifest_default = {
|
|
14
14
|
name: "@powerhousedao/vetra",
|