@powerhousedao/vetra 6.0.0-dev.247 → 6.0.0-dev.249

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. package/dist/editor-Bsu4yikl.js +2 -0
  2. package/dist/{editor-BwBHWEmR.js → editor-CGNcK2z0.js} +5 -5
  3. package/dist/editor-CGNcK2z0.js.map +1 -0
  4. package/dist/{editor-Bm0GwtcN.js → editor-CdzYJozI.js} +3 -3
  5. package/dist/editor-CdzYJozI.js.map +1 -0
  6. package/dist/{editor-ouUpfWQx.js → editor-CgkzQJ4g.js} +10 -10
  7. package/dist/editor-CgkzQJ4g.js.map +1 -0
  8. package/dist/{editor-CwC9mpEu.js → editor-D4FHn5u4.js} +10 -10
  9. package/dist/editor-D4FHn5u4.js.map +1 -0
  10. package/dist/{editor-CQwD5q6a.js → editor-DqkJ0B4G.js} +4 -4
  11. package/dist/editor-DqkJ0B4G.js.map +1 -0
  12. package/dist/{editor-9B-mf9yE.js → editor-ddcGG42r.js} +6 -6
  13. package/dist/editor-ddcGG42r.js.map +1 -0
  14. package/dist/editors/index.js +1 -1
  15. package/dist/index-CxWUNzph.d.ts +21319 -0
  16. package/dist/index-CxWUNzph.d.ts.map +1 -0
  17. package/dist/index-Ofk3NYAC.d.ts +18596 -0
  18. package/dist/index-Ofk3NYAC.d.ts.map +1 -0
  19. package/dist/index.js +1 -1
  20. package/dist/{module-DWvO3WCv.js → module-BW12i5H3.js} +7 -7
  21. package/dist/{module-DWvO3WCv.js.map → module-BW12i5H3.js.map} +1 -1
  22. package/dist/processors/codegen/index.d.ts +2 -17
  23. package/dist/processors/index.d.ts +2 -2
  24. package/dist/processors/vetra-read-model/index.d.ts +1 -1
  25. package/dist/style.css +7 -8
  26. package/package.json +10 -14
  27. package/dist/editor-9B-mf9yE.js.map +0 -1
  28. package/dist/editor-Bm0GwtcN.js.map +0 -1
  29. package/dist/editor-BwBHWEmR.js.map +0 -1
  30. package/dist/editor-CD3KcVf6.js +0 -2
  31. package/dist/editor-CQwD5q6a.js.map +0 -1
  32. package/dist/editor-CwC9mpEu.js.map +0 -1
  33. package/dist/editor-ouUpfWQx.js.map +0 -1
  34. package/dist/index-COsHJRmm.d.ts +0 -37
  35. package/dist/index-COsHJRmm.d.ts.map +0 -1
  36. package/dist/processors/codegen/index.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import powerhouse_manifest_default from "./powerhouse.manifest.js";
2
2
  import { a as AppModule, i as DocumentEditor, n as SubgraphModule, r as ProcessorModule, t as VetraPackage } from "./module-XCoMwFat.js";
3
- import { a as DocumentEditor$1, i as ProcessorEditor, n as VetraDriveApp, o as AppEditor, r as SubgraphEditor, t as VetraPackageEditor } from "./module-DWvO3WCv.js";
3
+ import { a as DocumentEditor$1, i as ProcessorEditor, n as VetraDriveApp, o as AppEditor, r as SubgraphEditor, t as VetraPackageEditor } from "./module-BW12i5H3.js";
4
4
  //#region document-models/document-models.ts
5
5
  const documentModels = [
6
6
  AppModule,
@@ -2,7 +2,7 @@ import { lazy } from "react";
2
2
  //#region editors/app-editor/module.ts
3
3
  /** Document editor module for the "powerhouse/app" document type */
4
4
  const AppEditor = {
5
- Component: lazy(() => import("./editor-9B-mf9yE.js")),
5
+ Component: lazy(() => import("./editor-ddcGG42r.js")),
6
6
  documentTypes: ["powerhouse/app"],
7
7
  config: {
8
8
  id: "app-editor",
@@ -12,7 +12,7 @@ const AppEditor = {
12
12
  //#endregion
13
13
  //#region editors/document-editor/module.ts
14
14
  const DocumentEditor = {
15
- Component: lazy(() => import("./editor-CQwD5q6a.js")),
15
+ Component: lazy(() => import("./editor-DqkJ0B4G.js")),
16
16
  documentTypes: ["powerhouse/document-editor"],
17
17
  config: {
18
18
  id: "document-editor-editor",
@@ -22,7 +22,7 @@ const DocumentEditor = {
22
22
  //#endregion
23
23
  //#region editors/processor-editor/module.ts
24
24
  const ProcessorEditor = {
25
- Component: lazy(() => import("./editor-BwBHWEmR.js")),
25
+ Component: lazy(() => import("./editor-CGNcK2z0.js")),
26
26
  documentTypes: ["powerhouse/processor"],
27
27
  config: {
28
28
  id: "processor-module-editor",
@@ -32,7 +32,7 @@ const ProcessorEditor = {
32
32
  //#endregion
33
33
  //#region editors/subgraph-editor/module.ts
34
34
  const SubgraphEditor = {
35
- Component: lazy(() => import("./editor-Bm0GwtcN.js")),
35
+ Component: lazy(() => import("./editor-CdzYJozI.js")),
36
36
  documentTypes: ["powerhouse/subgraph"],
37
37
  config: {
38
38
  id: "subgraph-module-editor",
@@ -42,7 +42,7 @@ const SubgraphEditor = {
42
42
  //#endregion
43
43
  //#region editors/vetra-drive-app/module.ts
44
44
  const VetraDriveApp = {
45
- Component: lazy(() => import("./editor-CwC9mpEu.js")),
45
+ Component: lazy(() => import("./editor-D4FHn5u4.js")),
46
46
  documentTypes: ["powerhouse/document-drive"],
47
47
  config: {
48
48
  id: "vetra-drive-app",
@@ -52,7 +52,7 @@ const VetraDriveApp = {
52
52
  //#endregion
53
53
  //#region editors/vetra-package/module.ts
54
54
  const VetraPackageEditor = {
55
- Component: lazy(() => import("./editor-CD3KcVf6.js")),
55
+ Component: lazy(() => import("./editor-Bsu4yikl.js")),
56
56
  documentTypes: ["powerhouse/package"],
57
57
  config: {
58
58
  id: "vetra-package-editor",
@@ -62,4 +62,4 @@ const VetraPackageEditor = {
62
62
  //#endregion
63
63
  export { DocumentEditor as a, ProcessorEditor as i, VetraDriveApp as n, AppEditor as o, SubgraphEditor as r, VetraPackageEditor as t };
64
64
 
65
- //# sourceMappingURL=module-DWvO3WCv.js.map
65
+ //# sourceMappingURL=module-BW12i5H3.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"module-DWvO3WCv.js","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"],"sourcesContent":["import type { EditorModule } from \"@powerhousedao/shared/document-model\";\nimport { lazy } from \"react\";\n\n/** Document editor module for the \"powerhouse/app\" document type */\nexport const AppEditor: EditorModule = {\n Component: lazy(() => import(\"./editor.js\")),\n documentTypes: [\"powerhouse/app\"],\n config: {\n id: \"app-editor\",\n name: \"AppEditor\",\n },\n};\n","import type { EditorModule } from \"@powerhousedao/shared/document-model\";\nimport { lazy } from \"react\";\n\nexport const DocumentEditor: EditorModule = {\n Component: lazy(() => import(\"./editor.js\")),\n documentTypes: [\"powerhouse/document-editor\"],\n config: {\n id: \"document-editor-editor\",\n name: \"Document Editor Editor\",\n },\n};\n","import type { EditorModule } from \"@powerhousedao/shared/document-model\";\nimport { lazy } from \"react\";\n\nexport const ProcessorEditor: EditorModule = {\n Component: lazy(() => import(\"./editor.js\")),\n documentTypes: [\"powerhouse/processor\"],\n config: {\n id: \"processor-module-editor\",\n name: \"Processor Module Editor\",\n },\n};\n","import type { EditorModule } from \"@powerhousedao/shared/document-model\";\nimport { lazy } from \"react\";\n\nexport const SubgraphEditor: EditorModule = {\n Component: lazy(() => import(\"./editor.js\")),\n documentTypes: [\"powerhouse/subgraph\"],\n config: {\n id: \"subgraph-module-editor\",\n name: \"Subgraph Module Editor\",\n },\n};\n","import type { EditorModule } from \"@powerhousedao/shared/document-model\";\nimport { lazy } from \"react\";\n\nexport const VetraDriveApp: EditorModule = {\n Component: lazy(() => import(\"./editor.js\")),\n documentTypes: [\"powerhouse/document-drive\"],\n config: {\n id: \"vetra-drive-app\",\n name: \"Vetra Drive App\",\n },\n};\n","import type { EditorModule } from \"@powerhousedao/shared/document-model\";\nimport { lazy } from \"react\";\nimport { type EditorProps } from \"./editor.js\";\n\nexport const VetraPackageEditor: EditorModule<EditorProps> = {\n Component: lazy(() => import(\"./editor.js\")),\n documentTypes: [\"powerhouse/package\"],\n config: {\n id: \"vetra-package-editor\",\n name: \"Vetra Package Editor\",\n },\n};\n"],"mappings":";;;AAIA,MAAa,YAA0B;CACrC,WAAW,WAAW,OAAO,wBAAe;CAC5C,eAAe,CAAC,iBAAiB;CACjC,QAAQ;EACN,IAAI;EACJ,MAAM;EACP;CACF;;;ACRD,MAAa,iBAA+B;CAC1C,WAAW,WAAW,OAAO,wBAAe;CAC5C,eAAe,CAAC,6BAA6B;CAC7C,QAAQ;EACN,IAAI;EACJ,MAAM;EACP;CACF;;;ACPD,MAAa,kBAAgC;CAC3C,WAAW,WAAW,OAAO,wBAAe;CAC5C,eAAe,CAAC,uBAAuB;CACvC,QAAQ;EACN,IAAI;EACJ,MAAM;EACP;CACF;;;ACPD,MAAa,iBAA+B;CAC1C,WAAW,WAAW,OAAO,wBAAe;CAC5C,eAAe,CAAC,sBAAsB;CACtC,QAAQ;EACN,IAAI;EACJ,MAAM;EACP;CACF;;;ACPD,MAAa,gBAA8B;CACzC,WAAW,WAAW,OAAO,wBAAe;CAC5C,eAAe,CAAC,4BAA4B;CAC5C,QAAQ;EACN,IAAI;EACJ,MAAM;EACP;CACF;;;ACND,MAAa,qBAAgD;CAC3D,WAAW,WAAW,OAAO,wBAAe;CAC5C,eAAe,CAAC,qBAAqB;CACrC,QAAQ;EACN,IAAI;EACJ,MAAM;EACP;CACF"}
1
+ {"version":3,"file":"module-BW12i5H3.js","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"],"sourcesContent":["import type { EditorModule } from \"@powerhousedao/shared/document-model\";\nimport { lazy } from \"react\";\n\n/** Document editor module for the \"powerhouse/app\" document type */\nexport const AppEditor: EditorModule = {\n Component: lazy(() => import(\"./editor.js\")),\n documentTypes: [\"powerhouse/app\"],\n config: {\n id: \"app-editor\",\n name: \"AppEditor\",\n },\n};\n","import type { EditorModule } from \"@powerhousedao/shared/document-model\";\nimport { lazy } from \"react\";\n\nexport const DocumentEditor: EditorModule = {\n Component: lazy(() => import(\"./editor.js\")),\n documentTypes: [\"powerhouse/document-editor\"],\n config: {\n id: \"document-editor-editor\",\n name: \"Document Editor Editor\",\n },\n};\n","import type { EditorModule } from \"@powerhousedao/shared/document-model\";\nimport { lazy } from \"react\";\n\nexport const ProcessorEditor: EditorModule = {\n Component: lazy(() => import(\"./editor.js\")),\n documentTypes: [\"powerhouse/processor\"],\n config: {\n id: \"processor-module-editor\",\n name: \"Processor Module Editor\",\n },\n};\n","import type { EditorModule } from \"@powerhousedao/shared/document-model\";\nimport { lazy } from \"react\";\n\nexport const SubgraphEditor: EditorModule = {\n Component: lazy(() => import(\"./editor.js\")),\n documentTypes: [\"powerhouse/subgraph\"],\n config: {\n id: \"subgraph-module-editor\",\n name: \"Subgraph Module Editor\",\n },\n};\n","import type { EditorModule } from \"@powerhousedao/shared/document-model\";\nimport { lazy } from \"react\";\n\nexport const VetraDriveApp: EditorModule = {\n Component: lazy(() => import(\"./editor.js\")),\n documentTypes: [\"powerhouse/document-drive\"],\n config: {\n id: \"vetra-drive-app\",\n name: \"Vetra Drive App\",\n },\n};\n","import type { EditorModule } from \"@powerhousedao/shared/document-model\";\nimport { lazy } from \"react\";\nimport { type EditorProps } from \"./editor.js\";\n\nexport const VetraPackageEditor: EditorModule<EditorProps> = {\n Component: lazy(() => import(\"./editor.js\")),\n documentTypes: [\"powerhouse/package\"],\n config: {\n id: \"vetra-package-editor\",\n name: \"Vetra Package Editor\",\n },\n};\n"],"mappings":";;;AAIA,MAAa,YAA0B;CACrC,WAAW,WAAW,OAAO,wBAAe;CAC5C,eAAe,CAAC,iBAAiB;CACjC,QAAQ;EACN,IAAI;EACJ,MAAM;EACP;CACF;;;ACRD,MAAa,iBAA+B;CAC1C,WAAW,WAAW,OAAO,wBAAe;CAC5C,eAAe,CAAC,6BAA6B;CAC7C,QAAQ;EACN,IAAI;EACJ,MAAM;EACP;CACF;;;ACPD,MAAa,kBAAgC;CAC3C,WAAW,WAAW,OAAO,wBAAe;CAC5C,eAAe,CAAC,uBAAuB;CACvC,QAAQ;EACN,IAAI;EACJ,MAAM;EACP;CACF;;;ACPD,MAAa,iBAA+B;CAC1C,WAAW,WAAW,OAAO,wBAAe;CAC5C,eAAe,CAAC,sBAAsB;CACtC,QAAQ;EACN,IAAI;EACJ,MAAM;EACP;CACF;;;ACPD,MAAa,gBAA8B;CACzC,WAAW,WAAW,OAAO,wBAAe;CAC5C,eAAe,CAAC,4BAA4B;CAC5C,QAAQ;EACN,IAAI;EACJ,MAAM;EACP;CACF;;;ACND,MAAa,qBAAgD;CAC3D,WAAW,WAAW,OAAO,wBAAe;CAC5C,eAAe,CAAC,qBAAqB;CACrC,QAAQ;EACN,IAAI;EACJ,MAAM;EACP;CACF"}
@@ -1,17 +1,2 @@
1
- import { IProcessor, OperationWithContext } from "@powerhousedao/reactor-browser";
2
- import { PowerhouseConfig } from "@powerhousedao/shared";
3
- import { Project } from "ts-morph";
4
-
5
- //#region processors/codegen/index.d.ts
6
- declare class CodegenProcessor implements IProcessor {
7
- private manager;
8
- constructor(project: Project, config: PowerhouseConfig, cwd: string, interactiveMode?: boolean);
9
- onOperations(operations: OperationWithContext[]): Promise<void>;
10
- onDisconnect(): Promise<void>;
11
- setInteractiveMode(enabled: boolean): void;
12
- isInteractive(): boolean;
13
- isProcessingInteractive(): boolean;
14
- }
15
- //#endregion
16
- export { CodegenProcessor };
17
- //# sourceMappingURL=index.d.ts.map
1
+ import { t as CodegenProcessor } from "../../index-CxWUNzph.js";
2
+ export { CodegenProcessor };
@@ -1,5 +1,5 @@
1
- import { CodegenProcessor } from "./codegen/index.js";
2
- import { t as VetraReadModelProcessor } from "../index-COsHJRmm.js";
1
+ import { t as CodegenProcessor } from "../index-CxWUNzph.js";
2
+ import { t as VetraReadModelProcessor } from "../index-Ofk3NYAC.js";
3
3
  import { PHDocumentHeader } from "@powerhousedao/shared/document-model";
4
4
  import { IProcessorHostModule, ProcessorRecord as ProcessorRecord$1 } from "@powerhousedao/reactor-browser";
5
5
 
@@ -1,2 +1,2 @@
1
- import { t as VetraReadModelProcessor } from "../../index-COsHJRmm.js";
1
+ import { t as VetraReadModelProcessor } from "../../index-Ofk3NYAC.js";
2
2
  export { VetraReadModelProcessor };
package/dist/style.css CHANGED
@@ -46,6 +46,7 @@
46
46
  --font-weight-normal: 400;
47
47
  --font-weight-medium: 500;
48
48
  --font-weight-semibold: 600;
49
+ --radius-sm: 0.25rem;
49
50
  --radius-md: 0.375rem;
50
51
  --radius-lg: 0.5rem;
51
52
  --ease-in-out: cubic-bezier(0.4, 0, 0.2, 1);
@@ -300,7 +301,8 @@
300
301
  .table {
301
302
  display: table;
302
303
  }
303
- .h-4 {
304
+ .size-4 {
305
+ width: calc(var(--spacing) * 4);
304
306
  height: calc(var(--spacing) * 4);
305
307
  }
306
308
  .h-8 {
@@ -318,9 +320,6 @@
318
320
  .min-h-screen {
319
321
  min-height: 100vh;
320
322
  }
321
- .w-4 {
322
- width: calc(var(--spacing) * 4);
323
- }
324
323
  .w-\[300px\] {
325
324
  width: 300px;
326
325
  }
@@ -339,7 +338,7 @@
339
338
  .flex-1 {
340
339
  flex: 1;
341
340
  }
342
- .flex-shrink-0 {
341
+ .shrink-0 {
343
342
  flex-shrink: 0;
344
343
  }
345
344
  .rotate-90 {
@@ -428,9 +427,6 @@
428
427
  .overflow-hidden {
429
428
  overflow: hidden;
430
429
  }
431
- .rounded {
432
- border-radius: 0.25rem;
433
- }
434
430
  .rounded-full {
435
431
  border-radius: calc(infinity * 1px);
436
432
  }
@@ -440,6 +436,9 @@
440
436
  .rounded-md {
441
437
  border-radius: var(--radius-md);
442
438
  }
439
+ .rounded-sm {
440
+ border-radius: var(--radius-sm);
441
+ }
443
442
  .border {
444
443
  border-style: var(--tw-border-style);
445
444
  border-width: 1px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerhousedao/vetra",
3
- "version": "6.0.0-dev.247",
3
+ "version": "6.0.0-dev.249",
4
4
  "license": "AGPL-3.0-only",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -45,16 +45,14 @@
45
45
  },
46
46
  "dependencies": {
47
47
  "change-case": "5.4.4",
48
- "kysely": "0.28.16",
49
48
  "react": "19.2.6",
50
- "ts-morph": "27.0.2",
51
49
  "zod": "4.3.6",
52
- "@powerhousedao/codegen": "6.0.0-dev.247",
53
- "@powerhousedao/config": "6.0.0-dev.247",
54
- "@powerhousedao/design-system": "6.0.0-dev.247",
55
- "@powerhousedao/reactor-browser": "6.0.0-dev.247",
56
- "@powerhousedao/shared": "6.0.0-dev.247",
57
- "document-model": "6.0.0-dev.247"
50
+ "@powerhousedao/codegen": "6.0.0-dev.249",
51
+ "@powerhousedao/config": "6.0.0-dev.249",
52
+ "@powerhousedao/design-system": "6.0.0-dev.249",
53
+ "@powerhousedao/reactor-browser": "6.0.0-dev.249",
54
+ "@powerhousedao/shared": "6.0.0-dev.249",
55
+ "document-model": "6.0.0-dev.249"
58
56
  },
59
57
  "devDependencies": {
60
58
  "@tailwindcss/cli": "4.2.2",
@@ -65,16 +63,14 @@
65
63
  "@types/react": "19.2.14",
66
64
  "@types/react-dom": "19.2.3",
67
65
  "@vitejs/plugin-react": "6.0.1",
66
+ "kysely": "0.28.16",
68
67
  "react-dom": "19.2.6",
69
68
  "tailwindcss": "4.2.2",
69
+ "ts-morph": "27.0.2",
70
70
  "tsdown": "0.21.1",
71
71
  "vite": "8.0.8",
72
72
  "vitest": "4.1.1",
73
- "@powerhousedao/builder-tools": "6.0.0-dev.247"
74
- },
75
- "optionalDependencies": {
76
- "@powerhousedao/connect": "6.0.0-dev.247",
77
- "@powerhousedao/ph-cli": "6.0.0-dev.247"
73
+ "@powerhousedao/builder-tools": "6.0.0-dev.249"
78
74
  },
79
75
  "description": "",
80
76
  "scripts": {
@@ -1 +0,0 @@
1
- {"version":3,"file":"editor-9B-mf9yE.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 { useSelectedAppModuleDocument } from \"../../../document-models/app-module/hooks.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],\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 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-gray-900\">App Configuration</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-gray-700\"\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={`w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500 ${\n isReadOnly ? \"cursor-not-allowed bg-gray-100\" : \"\"\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-gray-700\"\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-gray-300 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500\"\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-gray-700\">{type}</span>\n {!isReadOnly && (\n <button\n onClick={() => handleRemoveDocumentType(type)}\n className=\"ml-2 text-gray-400 hover:text-gray-600 focus:outline-none\"\n >\n ×\n </button>\n )}\n </div>\n ))\n ) : (\n <span className=\"text-sm text-gray-700\">All documents (*)</span>\n )}\n </div>\n </div>\n </div>\n\n {/* Drag and Drop Settings */}\n <div>\n <h3 className=\"text-md mb-4 font-medium text-gray-900\">\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={`mr-2 h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500 ${\n isReadOnly ? \"cursor-not-allowed\" : \"\"\n }`}\n />\n <span className=\"text-sm font-medium text-gray-700\">\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-blue-600 px-4 py-2 text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:bg-gray-300\"\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-gray-50 p-6\">\n <DocumentToolbar />\n <AppEditorForm />\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAiBA,MAAM,eAAe;AACrB,MAAM,iBAAiB;AACvB,MAAM,YAAY;AAElB,MAAa,sBAAsB;CACjC,MAAM,CAAC,UAAU,YAAY,8BAA8B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AAO,SAAQ;KAAwB,WAAU;eAAjD,CACE,oBAAC,SAAD;MACE,IAAG;MACH,MAAK;MACL,SAAS;MACT,WAAW,MAAM,oBAAoB,EAAE,OAAO,QAAQ;MACtD,UAAU;MACV,WAAW,0EACT,aAAa,uBAAuB;MAEtC,CAAA,EACF,oBAAC,QAAD;MAAM,WAAU;gBAAoC;MAE7C,CAAA,CACD;;IACJ,CAAA,CACF,EAAA,CAAA;GAGL,CAAC,cACA,oBAAC,OAAD,EAAA,UACE,oBAAC,UAAD;IACE,SAAS;IACT,UAAU,CAAC,QAAQ,MAAM;IACzB,WAAU;cACX;IAEQ,CAAA,EACL,CAAA;GAEJ;;;;;AChQV,MAAa,eAAuC,EAClD,2BAA2B,OAC5B;;;ACCD,SAAwB,SAAS;AAC/B,8BAA6B,aAAa;AAE1C,QACE,qBAAC,OAAD;EAAK,WAAU;YAAf,CACE,oBAAC,iBAAD,EAAmB,CAAA,EACnB,oBAAC,eAAD,EAAiB,CAAA,CACb"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"editor-Bm0GwtcN.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 { 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 setSubgraphName(initialSubgraphName);\n }, [initialSubgraphName]);\n\n // Reset confirmation state if status changes back to DRAFT\n useEffect(() => {\n if (status === \"DRAFT\") {\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-gray-900\">\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-gray-700\"\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={`w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500 ${\n isReadOnly ? \"cursor-not-allowed bg-gray-100\" : \"\"\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-blue-600 px-4 py-2 text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:bg-gray-300\"\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 {\n setSubgraphName,\n setSubgraphStatus,\n} from \"@powerhousedao/vetra/document-models/subgraph-module\";\nimport { useCallback } from \"react\";\nimport { useSelectedSubgraphModuleDocument } from \"../hooks/useVetraDocument.js\";\nimport { SubgraphEditorForm } from \"./components/SubgraphEditorForm.js\";\nimport { editorConfig } from \"./config.js\";\n\nexport default function Editor() {\n useSetPHDocumentEditorConfig(editorConfig);\n const [document, dispatch] = useSelectedSubgraphModuleDocument();\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-gray-50 p-6\">\n <DocumentToolbar />\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":";;;;;;;;;AAWA,MAAa,sBAAyD,EACpE,cAAc,sBAAsB,IACpC,SAAS,SACT,cACA,gBACI;CACJ,MAAM,CAAC,cAAc,mBAAmB,SAAS,oBAAoB;CACrE,MAAM,CAAC,aAAa,kBAAkB,SAAS,MAAM;AAGrD,aAAY,cAAc,cAAc,IAAI;AAG5C,iBAAgB;AACd,kBAAgB,oBAAoB;IACnC,CAAC,oBAAoB,CAAC;AAGzB,iBAAgB;AACd,MAAI,WAAW,QACb,gBAAe,MAAM;IAEtB,CAAC,OAAO,CAAC;CAGZ,MAAM,aAAa,eAAe,WAAW;CAE7C,MAAM,sBAAsB;AAC1B,MAAI,aAAa,MAAM,EAAE;AACvB,kBAAe,KAAK;AACpB,gBAAa;;;AAIjB,QACE,qBAAC,OAAD;EAAK,WAAU;YAAf;GACE,qBAAC,OAAD;IAAK,WAAU;cAAf,CACE,oBAAC,MAAD;KAAI,WAAU;eAAoC;KAE7C,CAAA,EACL,oBAAC,YAAD;KACE,QAAQ,WAAW,cAAc,cAAc;KAC/C,OAAO,WAAW,cAAc,cAAc;KAC9C,CAAA,CACE;;GAGN,qBAAC,OAAD,EAAA,UAAA,CACE,oBAAC,SAAD;IACE,SAAQ;IACR,WAAU;cACX;IAEO,CAAA,EACR,oBAAC,SAAD;IACE,IAAG;IACH,MAAK;IACL,OAAO;IACP,WAAW,MAAM,gBAAgB,EAAE,OAAO,MAAM;IAChD,UAAU;IACV,WAAW,mIACT,aAAa,mCAAmC;IAElD,aAAY;IACZ,CAAA,CACE,EAAA,CAAA;GAGL,CAAC,cACA,oBAAC,OAAD,EAAA,UACE,oBAAC,UAAD;IACE,SAAS;IACT,UAAU,CAAC,aAAa,MAAM;IAC9B,WAAU;cACX;IAEQ,CAAA,EACL,CAAA;GAEJ;;;;;ACxFV,MAAa,eAAuC,EAClD,2BAA2B,OAC5B;;;ACOD,SAAwB,SAAS;AAC/B,8BAA6B,aAAa;CAC1C,MAAM,CAAC,UAAU,YAAY,mCAAmC;CAEhE,MAAM,eAAe,aAClB,SAAiB;AAChB,MAAI,SAAS,SAAS,MAAM,OAAO,KAAM;AACzC,WAAS,gBAAgB,EAAE,MAAM,CAAC,CAAC;IAErC,CAAC,SAAS,MAAM,OAAO,MAAM,SAAS,CACvC;CAED,MAAM,YAAY,kBAAkB;AAClC,WAAS,kBAAkB,EAAE,QAAQ,aAAa,CAAC,CAAC;IACnD,CAAC,SAAS,CAAC;AAEd,QACE,qBAAC,OAAD;EAAK,WAAU;YAAf,CACE,oBAAC,iBAAD,EAAmB,CAAA,EACnB,oBAAC,oBAAD;GACE,cAAc,SAAS,MAAM,OAAO,QAAQ;GAC5C,QAAQ,SAAS,MAAM,OAAO;GAChB;GACH;GACX,CAAA,CACE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"editor-BwBHWEmR.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 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 setProcessorName(initialProcessorName);\n }, [initialProcessorName]);\n\n useEffect(() => {\n setProcessorType(initialProcessorType);\n }, [initialProcessorType]);\n\n useEffect(() => {\n setDocumentTypes(initialDocumentTypes);\n }, [initialDocumentTypes]);\n\n useEffect(() => {\n setProcessorApps(initialProcessorApps);\n }, [initialProcessorApps]);\n\n // Reset confirmation state if status changes back to DRAFT\n useEffect(() => {\n if (status === \"DRAFT\") {\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-gray-900\">\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-gray-700\"\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={`w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500 ${\n isReadOnly ? \"cursor-not-allowed bg-gray-100\" : \"\"\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-gray-700\"\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={`w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500 ${\n isReadOnly ? \"cursor-not-allowed bg-gray-100\" : \"\"\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-gray-700\"\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-gray-300 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500\"\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-gray-700\">\n {type.documentType}\n </span>\n {!isReadOnly && (\n <button\n onClick={() => handleRemoveDocumentType(type.id)}\n className=\"ml-2 text-gray-400 hover:text-gray-600 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-gray-700\"\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}>{processorApp}</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-gray-700\">\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-blue-600 px-4 py-2 text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:bg-gray-300\"\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-gray-50 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":";;;;;;;;;;AAyBA,MAAa,uBAA2D,EACtE,eAAe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AAc,CAAC,CAAC;IAE7C,CAAC,SAAS,CACX;CAED,MAAM,uBAAuB,aAC1B,iBAA+B;AAC9B,WAAS,mBAAmB,EAAE,cAAc,CAAC,CAAC;IAEhD,CAAC,SAAS,CACX;AAED,QACE,qBAAC,OAAD;EAAK,WAAU;YAAf,CACE,oBAAC,iBAAD,EAAmB,CAAA,EACnB,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,EAAE;GACxD,eAAe,SAAS,MAAM,OAAO;GAC1B;GACX,CAAA,CACE"}
@@ -1,2 +0,0 @@
1
- import { t as Editor } from "./editor-ouUpfWQx.js";
2
- export { Editor as default };
@@ -1 +0,0 @@
1
- {"version":3,"file":"editor-CQwD5q6a.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 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-gray-300 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500\"\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 setEditorName(initialEditorName);\n }, [initialEditorName]);\n\n useEffect(() => {\n setDocumentTypes(initialDocumentTypes);\n }, [initialDocumentTypes]);\n\n // Reset confirmation state if status changes back to DRAFT\n useEffect(() => {\n if (status === \"DRAFT\") {\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-gray-900\">\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-gray-700\"\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={`w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:outline-none focus:ring-2 focus:ring-blue-500 ${\n isReadOnly ? \"cursor-not-allowed bg-gray-100\" : \"\"\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-gray-700\"\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-gray-700\">\n {type.documentType}\n </span>\n {!isReadOnly && (\n <button\n onClick={() => {\n setDocumentTypes([]);\n onRemoveDocumentType?.({ id: type.id });\n }}\n className=\"ml-2 text-gray-400 hover:text-gray-600 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-blue-600 px-4 py-2 text-white hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:cursor-not-allowed disabled:bg-gray-300\"\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/hooks.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-gray-50 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":";;;;;;;;AAmBA,SAAS,qBACP,OACA;AACA,QACE,qBAAC,UAAD;EACE,IAAG;EACH,WAAU;EACV,GAAI;YAHN,CAKE,oBAAC,UAAD;GAAQ,OAAM;aAAG;GAA+B,CAAA,EAC/C,MAAM,SACA;;;AAIb,SAAS,mBAAmB,EAC1B,eACA,kBACA,mBACA,wBAMC;CAED,MAAM,yBAAyB,0BAA0B,KAAK;CAC9D,MAAM,CAAC,sBAAsB,2BAA2B,SAAS,GAAG;AAEpE,QACE,oBAAC,sBAAD;EACE,OAAO;EACP,WAAW,MAAM;GACf,MAAM,gBAAgB,EAAE,OAAO;AAC/B,OAAI,eAAe;IAGjB,MAAM,eAAe,eAAe,GAAG,EAAE;AACzC,QAAI,aACF,wBAAuB,EAAE,IAAI,aAAa,IAAI,CAAC;IAIjD,MAAM,eAAqC;KACzC,IAAI,KAAK,KAAK,CAAC,UAAU;KACzB,cAAc;KACf;AAKD,qBAAiB,CAJiB;KAChC,IAAI,aAAa;KACjB,cAAc,aAAa;KAC5B,CACyB,CAAC;AAC3B,wBAAoB,aAAa;;AAEnC,2BAAwB,GAAG;;YAG5B,uBAAuB,KAAK,YAC3B,oBAAC,UAAD;GAAsB,OAAO;aAC1B;GACM,EAFI,QAEJ,CACT;EACmB,CAAA;;AAI3B,MAAa,sBAAyD,EACpE,YAAY,oBAAoB,IAChC,eAAe,uBAAuB,EAAE,EACxC,SAAS,SACT,oBACA,mBACA,sBACA,gBACI;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