@powerhousedao/vetra 4.1.0-dev.86 → 4.1.0-dev.88

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.
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/app-editor/editor.tsx"],"names":[],"mappings":"AAIA,wBAAgB,MAAM,4CAIrB"}
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/app-editor/editor.tsx"],"names":[],"mappings":"AAKA,wBAAgB,MAAM,4CASrB"}
@@ -1,8 +1,9 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { DocumentToolbar } from "@powerhousedao/design-system";
2
3
  import { useSetPHDocumentEditorConfig } from "@powerhousedao/reactor-browser";
3
4
  import { AppEditorForm } from "./components/AppEditorForm.js";
4
5
  import { editorConfig } from "./config.js";
5
6
  export function Editor() {
6
7
  useSetPHDocumentEditorConfig(editorConfig);
7
- return _jsx(AppEditorForm, {});
8
+ return (_jsxs("div", { children: [_jsx(DocumentToolbar, {}), _jsx(AppEditorForm, {})] }));
8
9
  }
@@ -7,15 +7,28 @@ import { Editor } from "./editor.js";
7
7
  vi.mock("../hooks/useVetraDocument.js", () => ({
8
8
  useSelectedAppModuleDocument: vi.fn(),
9
9
  }));
10
- vi.mock("@powerhousedao/reactor-browser", () => ({
11
- useDocumentTypesInSelectedDrive: vi.fn(() => [
12
- "powerhouse/document-model",
13
- "powerhouse/budget-statement",
14
- "powerhouse/project-tracker",
15
- ]),
16
- useSupportedDocumentTypesInReactor: vi.fn(() => []),
17
- useSetPHDocumentEditorConfig: vi.fn(),
18
- }));
10
+ vi.mock("@powerhousedao/reactor-browser", async (importOriginal) => {
11
+ const actual = await importOriginal();
12
+ return {
13
+ ...actual,
14
+ useDocumentTypesInSelectedDrive: vi.fn(() => [
15
+ "powerhouse/document-model",
16
+ "powerhouse/budget-statement",
17
+ "powerhouse/project-tracker",
18
+ ]),
19
+ useSupportedDocumentTypesInReactor: vi.fn(() => []),
20
+ useSetPHDocumentEditorConfig: vi.fn(),
21
+ // These are needed by DocumentToolbar but mocked in setupTests
22
+ useSelectedDocument: vi.fn(() => [null, vi.fn()]),
23
+ useDocumentById: vi.fn(() => [null, vi.fn()]),
24
+ useDocumentTimeline: vi.fn(() => []),
25
+ useNodeParentFolderById: vi.fn(() => null),
26
+ setSelectedNode: vi.fn(),
27
+ setSelectedTimelineItem: vi.fn(),
28
+ showRevisionHistory: vi.fn(),
29
+ exportDocument: vi.fn(),
30
+ };
31
+ });
19
32
  describe("AppModule Editor", () => {
20
33
  let mockDispatch;
21
34
  beforeEach(() => {
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/document-editor/editor.tsx"],"names":[],"mappings":"AAWA,wBAAgB,MAAM,4CA6CrB"}
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/document-editor/editor.tsx"],"names":[],"mappings":"AAYA,wBAAgB,MAAM,4CA8CrB"}
@@ -1,4 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { DocumentToolbar } from "@powerhousedao/design-system";
2
3
  import { useSetPHDocumentEditorConfig } from "@powerhousedao/reactor-browser";
3
4
  import { useCallback } from "react";
4
5
  import { actions } from "../../document-models/document-editor/index.js";
@@ -24,5 +25,5 @@ export function Editor() {
24
25
  const onConfirm = useCallback(() => {
25
26
  dispatch(actions.setEditorStatus({ status: "CONFIRMED" }));
26
27
  }, [dispatch]);
27
- return (_jsx("div", { children: _jsx(DocumentEditorForm, { status: document.state.global.status, editorName: document.state.global.name ?? "", documentTypes: document.state.global.documentTypes, onEditorNameChange: onEditorNameChange, onAddDocumentType: onAddDocumentType, onRemoveDocumentType: onRemoveDocumentType, onConfirm: onConfirm }) }));
28
+ return (_jsxs("div", { children: [_jsx(DocumentToolbar, {}), _jsx(DocumentEditorForm, { status: document.state.global.status, editorName: document.state.global.name ?? "", documentTypes: document.state.global.documentTypes, onEditorNameChange: onEditorNameChange, onAddDocumentType: onAddDocumentType, onRemoveDocumentType: onRemoveDocumentType, onConfirm: onConfirm })] }));
28
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/processor-editor/editor.tsx"],"names":[],"mappings":"AAOA,wBAAgB,MAAM,4CAsDrB"}
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/processor-editor/editor.tsx"],"names":[],"mappings":"AAQA,wBAAgB,MAAM,4CAuDrB"}
@@ -1,4 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { DocumentToolbar } from "@powerhousedao/design-system";
2
3
  import { useSetPHDocumentEditorConfig } from "@powerhousedao/reactor-browser";
3
4
  import { useCallback } from "react";
4
5
  import { actions } from "../../document-models/processor-module/index.js";
@@ -28,5 +29,5 @@ export function Editor() {
28
29
  const onRemoveDocumentType = useCallback((id) => {
29
30
  dispatch(actions.removeDocumentType({ id }));
30
31
  }, [dispatch]);
31
- return (_jsx("div", { children: _jsx(ProcessorEditorForm, { onNameChange: onNameChange, onTypeChange: onTypeChange, onAddDocumentType: onAddDocumentType, onRemoveDocumentType: onRemoveDocumentType, status: document.state.global.status, processorName: document.state.global.name ?? "", processorType: document.state.global.type ?? "", documentTypes: document.state.global.documentTypes ?? [], onConfirm: onConfirm }) }));
32
+ return (_jsxs("div", { children: [_jsx(DocumentToolbar, {}), _jsx(ProcessorEditorForm, { onNameChange: onNameChange, onTypeChange: onTypeChange, onAddDocumentType: onAddDocumentType, onRemoveDocumentType: onRemoveDocumentType, status: document.state.global.status, processorName: document.state.global.name ?? "", processorType: document.state.global.type ?? "", documentTypes: document.state.global.documentTypes ?? [], onConfirm: onConfirm })] }));
32
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/subgraph-editor/editor.tsx"],"names":[],"mappings":"AAOA,wBAAgB,MAAM,4CA0BrB"}
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/subgraph-editor/editor.tsx"],"names":[],"mappings":"AAQA,wBAAgB,MAAM,4CA2BrB"}
@@ -1,4 +1,5 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { DocumentToolbar } from "@powerhousedao/design-system";
2
3
  import { useSetPHDocumentEditorConfig } from "@powerhousedao/reactor-browser";
3
4
  import { useCallback } from "react";
4
5
  import { actions } from "../../document-models/subgraph-module/index.js";
@@ -16,5 +17,5 @@ export function Editor() {
16
17
  const onConfirm = useCallback(() => {
17
18
  dispatch(actions.setSubgraphStatus({ status: "CONFIRMED" }));
18
19
  }, [dispatch]);
19
- return (_jsx("div", { children: _jsx(SubgraphEditorForm, { subgraphName: document.state.global.name ?? "", status: document.state.global.status, onNameChange: onNameChange, onConfirm: onConfirm }) }));
20
+ return (_jsxs("div", { children: [_jsx(DocumentToolbar, {}), _jsx(SubgraphEditorForm, { subgraphName: document.state.global.name ?? "", status: document.state.global.status, onNameChange: onNameChange, onConfirm: onConfirm })] }));
20
21
  }
@@ -9,5 +9,5 @@ export const EditorContainer = (props) => {
9
9
  if (!editorModule)
10
10
  return loadingContent;
11
11
  const EditorComponent = editorModule.Component;
12
- return (_jsx(Suspense, { fallback: loadingContent, children: _jsx(EditorComponent, { documentId: documentId }) }));
12
+ return (_jsx(Suspense, { fallback: loadingContent, children: _jsx(EditorComponent, { documentId: documentId, displayToolbar: false }) }));
13
13
  };
@@ -1,2 +1,5 @@
1
- export declare function Editor(): import("react/jsx-runtime").JSX.Element;
1
+ export type EditorProps = {
2
+ displayToolbar?: boolean;
3
+ };
4
+ export declare function Editor(props: EditorProps): import("react/jsx-runtime").JSX.Element;
2
5
  //# sourceMappingURL=editor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/vetra-package/editor.tsx"],"names":[],"mappings":"AAOA,wBAAgB,MAAM,4CAyGrB"}
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/vetra-package/editor.tsx"],"names":[],"mappings":"AAQA,MAAM,MAAM,WAAW,GAAG;IACxB,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,wBAAgB,MAAM,CAAC,KAAK,EAAE,WAAW,2CA2GxC"}
@@ -1,11 +1,13 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { DocumentToolbar } from "@powerhousedao/design-system";
2
3
  import { useSetPHDocumentEditorConfig } from "@powerhousedao/reactor-browser";
3
4
  import { useCallback } from "react";
4
5
  import { actions } from "../../document-models/vetra-package/index.js";
5
6
  import { useSelectedDriveVetraPackage } from "../hooks/useVetraDocument.js";
6
7
  import { MetaForm } from "./components/MetaForm.js";
7
8
  import { editorConfig } from "./config.js";
8
- export function Editor() {
9
+ export function Editor(props) {
10
+ const { displayToolbar = true } = props;
9
11
  useSetPHDocumentEditorConfig(editorConfig);
10
12
  const [document, dispatch] = useSelectedDriveVetraPackage();
11
13
  const onNameChange = useCallback((name) => {
@@ -63,5 +65,5 @@ export function Editor() {
63
65
  const onRemoveKeyword = useCallback((id) => {
64
66
  dispatch(actions.removePackageKeyword({ id }));
65
67
  }, []);
66
- return (_jsx("div", { children: _jsx(MetaForm, { name: document.state.global.name ?? "", description: document.state.global.description ?? "", category: document.state.global.category ?? "", publisher: document.state.global.author.name ?? "", publisherUrl: document.state.global.author.website ?? "", githubRepository: document.state.global.githubUrl ?? "", npmPackage: document.state.global.npmUrl ?? "", keywords: document.state.global.keywords, onNameChange: onNameChange, onDescriptionChange: onDescriptionChange, onCategoryChange: onCategoryChange, onPublisherChange: onPublisherChange, onPublisherUrlChange: onPublisherUrlChange, onGithubRepositoryChange: onGithubRepositoryChange, onNpmPackageChange: onNpmPackageChange, onAddKeyword: onAddKeyword, onRemoveKeyword: onRemoveKeyword }) }));
68
+ return (_jsxs("div", { children: [displayToolbar && _jsx(DocumentToolbar, {}), _jsx(MetaForm, { name: document.state.global.name ?? "", description: document.state.global.description ?? "", category: document.state.global.category ?? "", publisher: document.state.global.author.name ?? "", publisherUrl: document.state.global.author.website ?? "", githubRepository: document.state.global.githubUrl ?? "", npmPackage: document.state.global.npmUrl ?? "", keywords: document.state.global.keywords, onNameChange: onNameChange, onDescriptionChange: onDescriptionChange, onCategoryChange: onCategoryChange, onPublisherChange: onPublisherChange, onPublisherUrlChange: onPublisherUrlChange, onGithubRepositoryChange: onGithubRepositoryChange, onNpmPackageChange: onNpmPackageChange, onAddKeyword: onAddKeyword, onRemoveKeyword: onRemoveKeyword })] }));
67
69
  }
@@ -1,4 +1,5 @@
1
1
  import type { EditorModule } from "document-model";
2
- export declare const module: EditorModule;
2
+ import { type EditorProps } from "./editor.js";
3
+ export declare const module: EditorModule<EditorProps>;
3
4
  export default module;
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../editors/vetra-package/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,eAAO,MAAM,MAAM,EAAE,YAOpB,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../editors/vetra-package/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAU,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAEvD,eAAO,MAAM,MAAM,EAAE,YAAY,CAAC,WAAW,CAO5C,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -1 +1,45 @@
1
1
  import "@testing-library/jest-dom";
2
+ import { vi } from "vitest";
3
+ vi.mock("@powerhousedao/reactor-browser", () => ({
4
+ // Mock hooks
5
+ useSelectedDocument: vi.fn(() => [null, vi.fn()]),
6
+ useSetPHDocumentEditorConfig: vi.fn(),
7
+ useSetPHDriveEditorConfig: vi.fn(),
8
+ useDocumentById: vi.fn(() => [null, vi.fn()]),
9
+ useDocumentTimeline: vi.fn(() => []),
10
+ useNodeParentFolderById: vi.fn(() => null),
11
+ useSelectedNode: vi.fn(() => null),
12
+ useSelectedDrive: vi.fn(() => null),
13
+ useSelectedDocumentId: vi.fn(() => null),
14
+ useAllDocuments: vi.fn(() => []),
15
+ useDrives: vi.fn(() => []),
16
+ useFolderById: vi.fn(() => null),
17
+ useNodeById: vi.fn(() => null),
18
+ usePHModal: vi.fn(() => null),
19
+ useReactor: vi.fn(() => null),
20
+ useNodeActions: vi.fn(() => ({
21
+ addDocument: vi.fn(),
22
+ addFolder: vi.fn(),
23
+ deleteNode: vi.fn(),
24
+ renameNode: vi.fn(),
25
+ })),
26
+ // Mock action functions
27
+ setSelectedNode: vi.fn(),
28
+ setSelectedTimelineItem: vi.fn(),
29
+ showRevisionHistory: vi.fn(),
30
+ exportDocument: vi.fn(),
31
+ setSelectedDrive: vi.fn(),
32
+ showPHModal: vi.fn(),
33
+ closePHModal: vi.fn(),
34
+ addFolder: vi.fn(() => Promise.resolve()),
35
+ addDocument: vi.fn(() => Promise.resolve()),
36
+ deleteNode: vi.fn(() => Promise.resolve()),
37
+ exportFile: vi.fn(() => Promise.resolve()),
38
+ setAllDocuments: vi.fn(),
39
+ setDrives: vi.fn(),
40
+ setVetraPackages: vi.fn(),
41
+ // Mock config setters
42
+ setPHDocumentEditorConfig: vi.fn(),
43
+ setPHDriveEditorConfig: vi.fn(),
44
+ setPHGlobalConfig: vi.fn(),
45
+ }));