@powerhousedao/vetra 5.2.0-staging.9 → 6.0.0-dev.1
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/gen/schema/zod.d.ts +1 -1
- package/dist/document-models/app-module/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/app-module/hooks.d.ts +5 -2
- package/dist/document-models/app-module/hooks.d.ts.map +1 -1
- package/dist/document-models/app-module/hooks.js +3 -4
- package/dist/document-models/document-editor/gen/schema/zod.d.ts +1 -1
- package/dist/document-models/document-editor/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/document-editor/hooks.d.ts +5 -2
- package/dist/document-models/document-editor/hooks.d.ts.map +1 -1
- package/dist/document-models/document-editor/hooks.js +3 -4
- package/dist/document-models/processor-module/gen/schema/zod.d.ts +1 -1
- package/dist/document-models/processor-module/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/processor-module/hooks.d.ts +5 -2
- package/dist/document-models/processor-module/hooks.d.ts.map +1 -1
- package/dist/document-models/processor-module/hooks.js +3 -4
- package/dist/document-models/subgraph-module/gen/schema/zod.d.ts +1 -1
- package/dist/document-models/subgraph-module/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/subgraph-module/hooks.d.ts +5 -2
- package/dist/document-models/subgraph-module/hooks.d.ts.map +1 -1
- package/dist/document-models/subgraph-module/hooks.js +3 -4
- package/dist/document-models/vetra-package/gen/schema/zod.d.ts +1 -1
- package/dist/document-models/vetra-package/gen/schema/zod.d.ts.map +1 -1
- package/dist/document-models/vetra-package/hooks.d.ts +5 -2
- package/dist/document-models/vetra-package/hooks.d.ts.map +1 -1
- package/dist/document-models/vetra-package/hooks.js +3 -4
- package/dist/editors/app-editor/components/AppEditorForm.js +1 -1
- package/dist/editors/app-editor/editor.test.js +3 -2
- package/dist/editors/document-editor/components/DocumentEditorForm.d.ts.map +1 -1
- package/dist/editors/document-editor/components/DocumentEditorForm.js +32 -26
- package/dist/editors/document-editor/editor.js +1 -1
- package/dist/editors/document-editor/editor.test.js +2 -2
- package/dist/editors/vetra-drive-app/DriveExplorer.d.ts +3 -1
- package/dist/editors/vetra-drive-app/DriveExplorer.d.ts.map +1 -1
- package/dist/editors/vetra-drive-app/DriveExplorer.js +2 -2
- package/dist/editors/vetra-drive-app/components/DriveHeader.d.ts +3 -1
- package/dist/editors/vetra-drive-app/components/DriveHeader.d.ts.map +1 -1
- package/dist/editors/vetra-drive-app/components/DriveHeader.js +55 -3
- package/dist/editors/vetra-drive-app/components/DriveInfoItem.d.ts +8 -0
- package/dist/editors/vetra-drive-app/components/DriveInfoItem.d.ts.map +1 -0
- package/dist/editors/vetra-drive-app/components/DriveInfoItem.js +22 -0
- package/dist/editors/vetra-drive-app/components/ShareMenuItem.d.ts +8 -0
- package/dist/editors/vetra-drive-app/components/ShareMenuItem.d.ts.map +1 -0
- package/dist/editors/vetra-drive-app/components/ShareMenuItem.js +23 -0
- package/dist/editors/vetra-drive-app/editor.d.ts.map +1 -1
- package/dist/editors/vetra-drive-app/editor.js +7 -1
- package/dist/editors/vetra-drive-app/icons/CopyIcon.d.ts +10 -0
- package/dist/editors/vetra-drive-app/icons/CopyIcon.d.ts.map +1 -0
- package/dist/editors/vetra-drive-app/icons/CopyIcon.js +5 -0
- package/dist/editors/vetra-drive-app/icons/ExternalLinkIcon.d.ts +10 -0
- package/dist/editors/vetra-drive-app/icons/ExternalLinkIcon.d.ts.map +1 -0
- package/dist/editors/vetra-drive-app/icons/ExternalLinkIcon.js +5 -0
- package/dist/editors/vetra-drive-app/icons/LinkIcon.d.ts +10 -0
- package/dist/editors/vetra-drive-app/icons/LinkIcon.d.ts.map +1 -0
- package/dist/editors/vetra-drive-app/icons/LinkIcon.js +5 -0
- package/dist/editors/vetra-drive-app/icons/ShareIcon.d.ts +1 -1
- package/dist/editors/vetra-drive-app/icons/ShareIcon.d.ts.map +1 -1
- package/dist/editors/vetra-drive-app/icons/ShareIcon.js +3 -3
- package/dist/processors/codegen/__tests__/codegen-processor-e2e.test.js +2 -3
- package/dist/processors/codegen/document-handlers/generators/document-model-generator.d.ts.map +1 -1
- package/dist/processors/codegen/document-handlers/generators/document-model-generator.js +1 -2
- package/dist/setupTests.js +1 -0
- package/dist/style.css +159 -62
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +19 -19
|
@@ -5,7 +5,7 @@ type Properties<T> = Required<{
|
|
|
5
5
|
}>;
|
|
6
6
|
type definedNonNullAny = {};
|
|
7
7
|
export declare const isDefinedNonNullAny: (v: any) => v is definedNonNullAny;
|
|
8
|
-
export declare const definedNonNullAnySchema: z.ZodAny
|
|
8
|
+
export declare const definedNonNullAnySchema: z.ZodAny & z.ZodType<definedNonNullAny, any, z.core.$ZodTypeInternals<definedNonNullAny, any>>;
|
|
9
9
|
export declare const StatusTypeSchema: z.ZodEnum<{
|
|
10
10
|
CONFIRMED: "CONFIRMED";
|
|
11
11
|
DRAFT: "DRAFT";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../../../../document-models/app-module/gen/schema/zod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,KAAK,EACV,oBAAoB,EACpB,cAAc,EACd,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,0BAA0B,EAE3B,MAAM,YAAY,CAAC;AAEpB,KAAK,UAAU,CAAC,CAAC,IAAI,QAAQ,CAAC;KAC3B,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAChC,CAAC,CAAC;AAEH,KAAK,iBAAiB,GAAG,EAAE,CAAC;AAE5B,eAAO,MAAM,mBAAmB,GAAI,GAAG,GAAG,KAAG,CAAC,IAAI,iBACnB,CAAC;AAEhC,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../../../../document-models/app-module/gen/schema/zod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,KAAK,EACV,oBAAoB,EACpB,cAAc,EACd,uBAAuB,EACvB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,0BAA0B,EAE3B,MAAM,YAAY,CAAC;AAEpB,KAAK,UAAU,CAAC,CAAC,IAAI,QAAQ,CAAC;KAC3B,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAChC,CAAC,CAAC;AAEH,KAAK,iBAAiB,GAAG,EAAE,CAAC;AAE5B,eAAO,MAAM,mBAAmB,GAAI,GAAG,GAAG,KAAG,CAAC,IAAI,iBACnB,CAAC;AAEhC,eAAO,MAAM,uBAAuB,gGAEI,CAAC;AAEzC,eAAO,MAAM,gBAAgB;;;EAAiC,CAAC;AAE/D,wBAAgB,0BAA0B,IAAI,CAAC,CAAC,SAAS,CACvD,UAAU,CAAC,oBAAoB,CAAC,CACjC,CAIA;AAED,wBAAgB,oBAAoB,IAAI,CAAC,CAAC,SAAS,CACjD,UAAU,CAAC,cAAc,CAAC,CAC3B,CAQA;AAED,wBAAgB,6BAA6B,IAAI,CAAC,CAAC,SAAS,CAC1D,UAAU,CAAC,uBAAuB,CAAC,CACpC,CAIA;AAED,wBAAgB,qBAAqB,IAAI,CAAC,CAAC,SAAS,CAClD,UAAU,CAAC,eAAe,CAAC,CAC5B,CAIA;AAED,wBAAgB,uBAAuB,IAAI,CAAC,CAAC,SAAS,CACpD,UAAU,CAAC,iBAAiB,CAAC,CAC9B,CAIA;AAED,wBAAgB,2BAA2B,IAAI,CAAC,CAAC,SAAS,CACxD,UAAU,CAAC,qBAAqB,CAAC,CAClC,CAIA;AAED,wBAAgB,gCAAgC,IAAI,CAAC,CAAC,SAAS,CAC7D,UAAU,CAAC,0BAA0B,CAAC,CACvC,CAIA"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { DocumentDispatch } from "@powerhousedao/reactor-browser";
|
|
2
|
-
import type {
|
|
2
|
+
import type { AppModuleAction, AppModuleDocument } from "@powerhousedao/vetra/document-models/app-module";
|
|
3
3
|
/** Hook to get a AppModule document by its id */
|
|
4
4
|
export declare function useAppModuleDocumentById(documentId: string | null | undefined): [AppModuleDocument, DocumentDispatch<AppModuleAction>] | [undefined, undefined];
|
|
5
5
|
/** Hook to get the selected AppModule document */
|
|
6
|
-
export declare function useSelectedAppModuleDocument(): [
|
|
6
|
+
export declare function useSelectedAppModuleDocument(): [
|
|
7
|
+
AppModuleDocument,
|
|
8
|
+
DocumentDispatch<AppModuleAction>
|
|
9
|
+
];
|
|
7
10
|
/** Hook to get all AppModule documents in the selected drive */
|
|
8
11
|
export declare function useAppModuleDocumentsInSelectedDrive(): AppModuleDocument[] | undefined;
|
|
9
12
|
/** Hook to get all AppModule documents in the selected folder */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../document-models/app-module/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAOvE,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../document-models/app-module/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAOvE,OAAO,KAAK,EACV,eAAe,EACf,iBAAiB,EAClB,MAAM,iDAAiD,CAAC;AAMzD,iDAAiD;AACjD,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAEnC,CAAC,iBAAiB,EAAE,gBAAgB,CAAC,eAAe,CAAC,CAAC,GACtD,CAAC,SAAS,EAAE,SAAS,CAAC,CAIzB;AAED,kDAAkD;AAClD,wBAAgB,4BAA4B,IAAI;IAC9C,iBAAiB;IACjB,gBAAgB,CAAC,eAAe,CAAC;CAClC,CAIA;AAED,gEAAgE;AAChE,wBAAgB,oCAAoC,oCAGnD;AAED,iEAAiE;AACjE,wBAAgB,qCAAqC,oCAGpD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useDocumentsInSelectedDrive, useDocumentsInSelectedFolder,
|
|
2
|
-
import { isAppModuleDocument } from "./gen/document-schema.js";
|
|
1
|
+
import { useDocumentById, useDocumentsInSelectedDrive, useDocumentsInSelectedFolder, useSelectedDocument, } from "@powerhousedao/reactor-browser";
|
|
2
|
+
import { assertIsAppModuleDocument, isAppModuleDocument, } from "./gen/document-schema.js";
|
|
3
3
|
/** Hook to get a AppModule document by its id */
|
|
4
4
|
export function useAppModuleDocumentById(documentId) {
|
|
5
5
|
const [document, dispatch] = useDocumentById(documentId);
|
|
@@ -10,8 +10,7 @@ export function useAppModuleDocumentById(documentId) {
|
|
|
10
10
|
/** Hook to get the selected AppModule document */
|
|
11
11
|
export function useSelectedAppModuleDocument() {
|
|
12
12
|
const [document, dispatch] = useSelectedDocument();
|
|
13
|
-
|
|
14
|
-
return [undefined, undefined];
|
|
13
|
+
assertIsAppModuleDocument(document);
|
|
15
14
|
return [document, dispatch];
|
|
16
15
|
}
|
|
17
16
|
/** Hook to get all AppModule documents in the selected drive */
|
|
@@ -5,7 +5,7 @@ type Properties<T> = Required<{
|
|
|
5
5
|
}>;
|
|
6
6
|
type definedNonNullAny = {};
|
|
7
7
|
export declare const isDefinedNonNullAny: (v: any) => v is definedNonNullAny;
|
|
8
|
-
export declare const definedNonNullAnySchema: z.ZodAny
|
|
8
|
+
export declare const definedNonNullAnySchema: z.ZodAny & z.ZodType<definedNonNullAny, any, z.core.$ZodTypeInternals<definedNonNullAny, any>>;
|
|
9
9
|
export declare const StatusTypeSchema: z.ZodEnum<{
|
|
10
10
|
CONFIRMED: "CONFIRMED";
|
|
11
11
|
DRAFT: "DRAFT";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../../../../document-models/document-editor/gen/schema/zod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EAErB,MAAM,YAAY,CAAC;AAEpB,KAAK,UAAU,CAAC,CAAC,IAAI,QAAQ,CAAC;KAC3B,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAChC,CAAC,CAAC;AAEH,KAAK,iBAAiB,GAAG,EAAE,CAAC;AAE5B,eAAO,MAAM,mBAAmB,GAAI,GAAG,GAAG,KAAG,CAAC,IAAI,iBACnB,CAAC;AAEhC,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../../../../document-models/document-editor/gen/schema/zod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACnB,gBAAgB,EAChB,uBAAuB,EACvB,kBAAkB,EAClB,oBAAoB,EAErB,MAAM,YAAY,CAAC;AAEpB,KAAK,UAAU,CAAC,CAAC,IAAI,QAAQ,CAAC;KAC3B,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAChC,CAAC,CAAC;AAEH,KAAK,iBAAiB,GAAG,EAAE,CAAC;AAE5B,eAAO,MAAM,mBAAmB,GAAI,GAAG,GAAG,KAAG,CAAC,IAAI,iBACnB,CAAC;AAEhC,eAAO,MAAM,uBAAuB,gGAEI,CAAC;AAEzC,eAAO,MAAM,gBAAgB;;;EAAiC,CAAC;AAE/D,wBAAgB,0BAA0B,IAAI,CAAC,CAAC,SAAS,CACvD,UAAU,CAAC,oBAAoB,CAAC,CACjC,CAKA;AAED,wBAAgB,yBAAyB,IAAI,CAAC,CAAC,SAAS,CACtD,UAAU,CAAC,mBAAmB,CAAC,CAChC,CAOA;AAED,wBAAgB,sBAAsB,IAAI,CAAC,CAAC,SAAS,CACnD,UAAU,CAAC,gBAAgB,CAAC,CAC7B,CAMA;AAED,wBAAgB,6BAA6B,IAAI,CAAC,CAAC,SAAS,CAC1D,UAAU,CAAC,uBAAuB,CAAC,CACpC,CAIA;AAED,wBAAgB,wBAAwB,IAAI,CAAC,CAAC,SAAS,CACrD,UAAU,CAAC,kBAAkB,CAAC,CAC/B,CAIA;AAED,wBAAgB,0BAA0B,IAAI,CAAC,CAAC,SAAS,CACvD,UAAU,CAAC,oBAAoB,CAAC,CACjC,CAIA"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { DocumentDispatch } from "@powerhousedao/reactor-browser";
|
|
2
|
-
import type {
|
|
2
|
+
import type { DocumentEditorAction, DocumentEditorDocument } from "@powerhousedao/vetra/document-models/document-editor";
|
|
3
3
|
/** Hook to get a DocumentEditor document by its id */
|
|
4
4
|
export declare function useDocumentEditorDocumentById(documentId: string | null | undefined): [DocumentEditorDocument, DocumentDispatch<DocumentEditorAction>] | [undefined, undefined];
|
|
5
5
|
/** Hook to get the selected DocumentEditor document */
|
|
6
|
-
export declare function useSelectedDocumentEditorDocument(): [
|
|
6
|
+
export declare function useSelectedDocumentEditorDocument(): [
|
|
7
|
+
DocumentEditorDocument,
|
|
8
|
+
DocumentDispatch<DocumentEditorAction>
|
|
9
|
+
];
|
|
7
10
|
/** Hook to get all DocumentEditor documents in the selected drive */
|
|
8
11
|
export declare function useDocumentEditorDocumentsInSelectedDrive(): DocumentEditorDocument[] | undefined;
|
|
9
12
|
/** Hook to get all DocumentEditor documents in the selected folder */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../document-models/document-editor/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAOvE,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../document-models/document-editor/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAOvE,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,sDAAsD,CAAC;AAM9D,sDAAsD;AACtD,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAEnC,CAAC,sBAAsB,EAAE,gBAAgB,CAAC,oBAAoB,CAAC,CAAC,GAChE,CAAC,SAAS,EAAE,SAAS,CAAC,CAIzB;AAED,uDAAuD;AACvD,wBAAgB,iCAAiC,IAAI;IACnD,sBAAsB;IACtB,gBAAgB,CAAC,oBAAoB,CAAC;CACvC,CAIA;AAED,qEAAqE;AACrE,wBAAgB,yCAAyC,yCAGxD;AAED,sEAAsE;AACtE,wBAAgB,0CAA0C,yCAGzD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useDocumentsInSelectedDrive, useDocumentsInSelectedFolder,
|
|
2
|
-
import { isDocumentEditorDocument } from "./gen/document-schema.js";
|
|
1
|
+
import { useDocumentById, useDocumentsInSelectedDrive, useDocumentsInSelectedFolder, useSelectedDocument, } from "@powerhousedao/reactor-browser";
|
|
2
|
+
import { assertIsDocumentEditorDocument, isDocumentEditorDocument, } from "./gen/document-schema.js";
|
|
3
3
|
/** Hook to get a DocumentEditor document by its id */
|
|
4
4
|
export function useDocumentEditorDocumentById(documentId) {
|
|
5
5
|
const [document, dispatch] = useDocumentById(documentId);
|
|
@@ -10,8 +10,7 @@ export function useDocumentEditorDocumentById(documentId) {
|
|
|
10
10
|
/** Hook to get the selected DocumentEditor document */
|
|
11
11
|
export function useSelectedDocumentEditorDocument() {
|
|
12
12
|
const [document, dispatch] = useSelectedDocument();
|
|
13
|
-
|
|
14
|
-
return [undefined, undefined];
|
|
13
|
+
assertIsDocumentEditorDocument(document);
|
|
15
14
|
return [document, dispatch];
|
|
16
15
|
}
|
|
17
16
|
/** Hook to get all DocumentEditor documents in the selected drive */
|
|
@@ -5,7 +5,7 @@ type Properties<T> = Required<{
|
|
|
5
5
|
}>;
|
|
6
6
|
type definedNonNullAny = {};
|
|
7
7
|
export declare const isDefinedNonNullAny: (v: any) => v is definedNonNullAny;
|
|
8
|
-
export declare const definedNonNullAnySchema: z.ZodAny
|
|
8
|
+
export declare const definedNonNullAnySchema: z.ZodAny & z.ZodType<definedNonNullAny, any, z.core.$ZodTypeInternals<definedNonNullAny, any>>;
|
|
9
9
|
export declare const StatusTypeSchema: z.ZodEnum<{
|
|
10
10
|
CONFIRMED: "CONFIRMED";
|
|
11
11
|
DRAFT: "DRAFT";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../../../../document-models/processor-module/gen/schema/zod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EAEtB,MAAM,YAAY,CAAC;AAEpB,KAAK,UAAU,CAAC,CAAC,IAAI,QAAQ,CAAC;KAC3B,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAChC,CAAC,CAAC;AAEH,KAAK,iBAAiB,GAAG,EAAE,CAAC;AAE5B,eAAO,MAAM,mBAAmB,GAAI,GAAG,GAAG,KAAG,CAAC,IAAI,iBACnB,CAAC;AAEhC,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../../../../document-models/processor-module/gen/schema/zod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EAChB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EAEtB,MAAM,YAAY,CAAC;AAEpB,KAAK,UAAU,CAAC,CAAC,IAAI,QAAQ,CAAC;KAC3B,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAChC,CAAC,CAAC;AAEH,KAAK,iBAAiB,GAAG,EAAE,CAAC;AAE5B,eAAO,MAAM,mBAAmB,GAAI,GAAG,GAAG,KAAG,CAAC,IAAI,iBACnB,CAAC;AAEhC,eAAO,MAAM,uBAAuB,gGAEI,CAAC;AAEzC,eAAO,MAAM,gBAAgB;;;EAAiC,CAAC;AAE/D,wBAAgB,0BAA0B,IAAI,CAAC,CAAC,SAAS,CACvD,UAAU,CAAC,oBAAoB,CAAC,CACjC,CAKA;AAED,wBAAgB,sBAAsB,IAAI,CAAC,CAAC,SAAS,CACnD,UAAU,CAAC,gBAAgB,CAAC,CAC7B,CAMA;AAED,wBAAgB,0BAA0B,IAAI,CAAC,CAAC,SAAS,CACvD,UAAU,CAAC,oBAAoB,CAAC,CACjC,CAQA;AAED,wBAAgB,6BAA6B,IAAI,CAAC,CAAC,SAAS,CAC1D,UAAU,CAAC,uBAAuB,CAAC,CACpC,CAIA;AAED,wBAAgB,2BAA2B,IAAI,CAAC,CAAC,SAAS,CACxD,UAAU,CAAC,qBAAqB,CAAC,CAClC,CAIA;AAED,wBAAgB,6BAA6B,IAAI,CAAC,CAAC,SAAS,CAC1D,UAAU,CAAC,uBAAuB,CAAC,CACpC,CAIA;AAED,wBAAgB,2BAA2B,IAAI,CAAC,CAAC,SAAS,CACxD,UAAU,CAAC,qBAAqB,CAAC,CAClC,CAIA"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { DocumentDispatch } from "@powerhousedao/reactor-browser";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ProcessorModuleAction, ProcessorModuleDocument } from "@powerhousedao/vetra/document-models/processor-module";
|
|
3
3
|
/** Hook to get a ProcessorModule document by its id */
|
|
4
4
|
export declare function useProcessorModuleDocumentById(documentId: string | null | undefined): [ProcessorModuleDocument, DocumentDispatch<ProcessorModuleAction>] | [undefined, undefined];
|
|
5
5
|
/** Hook to get the selected ProcessorModule document */
|
|
6
|
-
export declare function useSelectedProcessorModuleDocument(): [
|
|
6
|
+
export declare function useSelectedProcessorModuleDocument(): [
|
|
7
|
+
ProcessorModuleDocument,
|
|
8
|
+
DocumentDispatch<ProcessorModuleAction>
|
|
9
|
+
];
|
|
7
10
|
/** Hook to get all ProcessorModule documents in the selected drive */
|
|
8
11
|
export declare function useProcessorModuleDocumentsInSelectedDrive(): ProcessorModuleDocument[] | undefined;
|
|
9
12
|
/** Hook to get all ProcessorModule documents in the selected folder */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../document-models/processor-module/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAOvE,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../document-models/processor-module/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAOvE,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,uDAAuD,CAAC;AAM/D,uDAAuD;AACvD,wBAAgB,8BAA8B,CAC5C,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAEnC,CAAC,uBAAuB,EAAE,gBAAgB,CAAC,qBAAqB,CAAC,CAAC,GAClE,CAAC,SAAS,EAAE,SAAS,CAAC,CAIzB;AAED,wDAAwD;AACxD,wBAAgB,kCAAkC,IAAI;IACpD,uBAAuB;IACvB,gBAAgB,CAAC,qBAAqB,CAAC;CACxC,CAIA;AAED,sEAAsE;AACtE,wBAAgB,0CAA0C,0CAGzD;AAED,uEAAuE;AACvE,wBAAgB,2CAA2C,0CAG1D"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useDocumentsInSelectedDrive, useDocumentsInSelectedFolder,
|
|
2
|
-
import { isProcessorModuleDocument } from "./gen/document-schema.js";
|
|
1
|
+
import { useDocumentById, useDocumentsInSelectedDrive, useDocumentsInSelectedFolder, useSelectedDocument, } from "@powerhousedao/reactor-browser";
|
|
2
|
+
import { assertIsProcessorModuleDocument, isProcessorModuleDocument, } from "./gen/document-schema.js";
|
|
3
3
|
/** Hook to get a ProcessorModule document by its id */
|
|
4
4
|
export function useProcessorModuleDocumentById(documentId) {
|
|
5
5
|
const [document, dispatch] = useDocumentById(documentId);
|
|
@@ -10,8 +10,7 @@ export function useProcessorModuleDocumentById(documentId) {
|
|
|
10
10
|
/** Hook to get the selected ProcessorModule document */
|
|
11
11
|
export function useSelectedProcessorModuleDocument() {
|
|
12
12
|
const [document, dispatch] = useSelectedDocument();
|
|
13
|
-
|
|
14
|
-
return [undefined, undefined];
|
|
13
|
+
assertIsProcessorModuleDocument(document);
|
|
15
14
|
return [document, dispatch];
|
|
16
15
|
}
|
|
17
16
|
/** Hook to get all ProcessorModule documents in the selected drive */
|
|
@@ -5,7 +5,7 @@ type Properties<T> = Required<{
|
|
|
5
5
|
}>;
|
|
6
6
|
type definedNonNullAny = {};
|
|
7
7
|
export declare const isDefinedNonNullAny: (v: any) => v is definedNonNullAny;
|
|
8
|
-
export declare const definedNonNullAnySchema: z.ZodAny
|
|
8
|
+
export declare const definedNonNullAnySchema: z.ZodAny & z.ZodType<definedNonNullAny, any, z.core.$ZodTypeInternals<definedNonNullAny, any>>;
|
|
9
9
|
export declare const StatusTypeSchema: z.ZodEnum<{
|
|
10
10
|
CONFIRMED: "CONFIRMED";
|
|
11
11
|
DRAFT: "DRAFT";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../../../../document-models/subgraph-module/gen/schema/zod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EAEtB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAEpB,KAAK,UAAU,CAAC,CAAC,IAAI,QAAQ,CAAC;KAC3B,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAChC,CAAC,CAAC;AAEH,KAAK,iBAAiB,GAAG,EAAE,CAAC;AAE5B,eAAO,MAAM,mBAAmB,GAAI,GAAG,GAAG,KAAG,CAAC,IAAI,iBACnB,CAAC;AAEhC,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../../../../document-models/subgraph-module/gen/schema/zod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EAEtB,mBAAmB,EACpB,MAAM,YAAY,CAAC;AAEpB,KAAK,UAAU,CAAC,CAAC,IAAI,QAAQ,CAAC;KAC3B,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAChC,CAAC,CAAC;AAEH,KAAK,iBAAiB,GAAG,EAAE,CAAC;AAE5B,eAAO,MAAM,mBAAmB,GAAI,GAAG,GAAG,KAAG,CAAC,IAAI,iBACnB,CAAC;AAEhC,eAAO,MAAM,uBAAuB,gGAEI,CAAC;AAEzC,eAAO,MAAM,gBAAgB;;;EAAiC,CAAC;AAE/D,wBAAgB,0BAA0B,IAAI,CAAC,CAAC,SAAS,CACvD,UAAU,CAAC,oBAAoB,CAAC,CACjC,CAIA;AAED,wBAAgB,4BAA4B,IAAI,CAAC,CAAC,SAAS,CACzD,UAAU,CAAC,sBAAsB,CAAC,CACnC,CAIA;AAED,wBAAgB,yBAAyB,IAAI,CAAC,CAAC,SAAS,CACtD,UAAU,CAAC,mBAAmB,CAAC,CAChC,CAMA"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { DocumentDispatch } from "@powerhousedao/reactor-browser";
|
|
2
|
-
import type {
|
|
2
|
+
import type { SubgraphModuleAction, SubgraphModuleDocument } from "@powerhousedao/vetra/document-models/subgraph-module";
|
|
3
3
|
/** Hook to get a SubgraphModule document by its id */
|
|
4
4
|
export declare function useSubgraphModuleDocumentById(documentId: string | null | undefined): [SubgraphModuleDocument, DocumentDispatch<SubgraphModuleAction>] | [undefined, undefined];
|
|
5
5
|
/** Hook to get the selected SubgraphModule document */
|
|
6
|
-
export declare function useSelectedSubgraphModuleDocument(): [
|
|
6
|
+
export declare function useSelectedSubgraphModuleDocument(): [
|
|
7
|
+
SubgraphModuleDocument,
|
|
8
|
+
DocumentDispatch<SubgraphModuleAction>
|
|
9
|
+
];
|
|
7
10
|
/** Hook to get all SubgraphModule documents in the selected drive */
|
|
8
11
|
export declare function useSubgraphModuleDocumentsInSelectedDrive(): SubgraphModuleDocument[] | undefined;
|
|
9
12
|
/** Hook to get all SubgraphModule documents in the selected folder */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../document-models/subgraph-module/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAOvE,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../document-models/subgraph-module/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAOvE,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,sDAAsD,CAAC;AAM9D,sDAAsD;AACtD,wBAAgB,6BAA6B,CAC3C,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAEnC,CAAC,sBAAsB,EAAE,gBAAgB,CAAC,oBAAoB,CAAC,CAAC,GAChE,CAAC,SAAS,EAAE,SAAS,CAAC,CAIzB;AAED,uDAAuD;AACvD,wBAAgB,iCAAiC,IAAI;IACnD,sBAAsB;IACtB,gBAAgB,CAAC,oBAAoB,CAAC;CACvC,CAIA;AAED,qEAAqE;AACrE,wBAAgB,yCAAyC,yCAGxD;AAED,sEAAsE;AACtE,wBAAgB,0CAA0C,yCAGzD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useDocumentsInSelectedDrive, useDocumentsInSelectedFolder,
|
|
2
|
-
import { isSubgraphModuleDocument } from "./gen/document-schema.js";
|
|
1
|
+
import { useDocumentById, useDocumentsInSelectedDrive, useDocumentsInSelectedFolder, useSelectedDocument, } from "@powerhousedao/reactor-browser";
|
|
2
|
+
import { assertIsSubgraphModuleDocument, isSubgraphModuleDocument, } from "./gen/document-schema.js";
|
|
3
3
|
/** Hook to get a SubgraphModule document by its id */
|
|
4
4
|
export function useSubgraphModuleDocumentById(documentId) {
|
|
5
5
|
const [document, dispatch] = useDocumentById(documentId);
|
|
@@ -10,8 +10,7 @@ export function useSubgraphModuleDocumentById(documentId) {
|
|
|
10
10
|
/** Hook to get the selected SubgraphModule document */
|
|
11
11
|
export function useSelectedSubgraphModuleDocument() {
|
|
12
12
|
const [document, dispatch] = useSelectedDocument();
|
|
13
|
-
|
|
14
|
-
return [undefined, undefined];
|
|
13
|
+
assertIsSubgraphModuleDocument(document);
|
|
15
14
|
return [document, dispatch];
|
|
16
15
|
}
|
|
17
16
|
/** Hook to get all SubgraphModule documents in the selected drive */
|
|
@@ -5,7 +5,7 @@ type Properties<T> = Required<{
|
|
|
5
5
|
}>;
|
|
6
6
|
type definedNonNullAny = {};
|
|
7
7
|
export declare const isDefinedNonNullAny: (v: any) => v is definedNonNullAny;
|
|
8
|
-
export declare const definedNonNullAnySchema: z.ZodAny
|
|
8
|
+
export declare const definedNonNullAnySchema: z.ZodAny & z.ZodType<definedNonNullAny, any, z.core.$ZodTypeInternals<definedNonNullAny, any>>;
|
|
9
9
|
export declare function AddPackageKeywordInputSchema(): z.ZodObject<Properties<AddPackageKeywordInput>>;
|
|
10
10
|
export declare function AuthorSchema(): z.ZodObject<Properties<Author>>;
|
|
11
11
|
export declare function KeywordSchema(): z.ZodObject<Properties<Keyword>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../../../../document-models/vetra-package/gen/schema/zod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,KAAK,EACV,sBAAsB,EACtB,MAAM,EACN,OAAO,EACP,yBAAyB,EACzB,qBAAqB,EACrB,yBAAyB,EACzB,4BAA4B,EAC5B,uBAAuB,EACvB,0BAA0B,EAC1B,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAEpB,KAAK,UAAU,CAAC,CAAC,IAAI,QAAQ,CAAC;KAC3B,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAChC,CAAC,CAAC;AAEH,KAAK,iBAAiB,GAAG,EAAE,CAAC;AAE5B,eAAO,MAAM,mBAAmB,GAAI,GAAG,GAAG,KAAG,CAAC,IAAI,iBACnB,CAAC;AAEhC,eAAO,MAAM,uBAAuB,
|
|
1
|
+
{"version":3,"file":"zod.d.ts","sourceRoot":"","sources":["../../../../../document-models/vetra-package/gen/schema/zod.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,KAAK,EACV,sBAAsB,EACtB,MAAM,EACN,OAAO,EACP,yBAAyB,EACzB,qBAAqB,EACrB,yBAAyB,EACzB,4BAA4B,EAC5B,uBAAuB,EACvB,0BAA0B,EAC1B,wBAAwB,EACxB,mBAAmB,EACnB,qBAAqB,EACrB,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAEpB,KAAK,UAAU,CAAC,CAAC,IAAI,QAAQ,CAAC;KAC3B,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAChC,CAAC,CAAC;AAEH,KAAK,iBAAiB,GAAG,EAAE,CAAC;AAE5B,eAAO,MAAM,mBAAmB,GAAI,GAAG,GAAG,KAAG,CAAC,IAAI,iBACnB,CAAC;AAEhC,eAAO,MAAM,uBAAuB,gGAEI,CAAC;AAEzC,wBAAgB,4BAA4B,IAAI,CAAC,CAAC,SAAS,CACzD,UAAU,CAAC,sBAAsB,CAAC,CACnC,CAKA;AAED,wBAAgB,YAAY,IAAI,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAM9D;AAED,wBAAgB,aAAa,IAAI,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAMhE;AAED,wBAAgB,+BAA+B,IAAI,CAAC,CAAC,SAAS,CAC5D,UAAU,CAAC,yBAAyB,CAAC,CACtC,CAIA;AAED,wBAAgB,2BAA2B,IAAI,CAAC,CAAC,SAAS,CACxD,UAAU,CAAC,qBAAqB,CAAC,CAClC,CAKA;AAED,wBAAgB,+BAA+B,IAAI,CAAC,CAAC,SAAS,CAC5D,UAAU,CAAC,yBAAyB,CAAC,CACtC,CAIA;AAED,wBAAgB,kCAAkC,IAAI,CAAC,CAAC,SAAS,CAC/D,UAAU,CAAC,4BAA4B,CAAC,CACzC,CAIA;AAED,wBAAgB,6BAA6B,IAAI,CAAC,CAAC,SAAS,CAC1D,UAAU,CAAC,uBAAuB,CAAC,CACpC,CAIA;AAED,wBAAgB,gCAAgC,IAAI,CAAC,CAAC,SAAS,CAC7D,UAAU,CAAC,0BAA0B,CAAC,CACvC,CAIA;AAED,wBAAgB,8BAA8B,IAAI,CAAC,CAAC,SAAS,CAC3D,UAAU,CAAC,wBAAwB,CAAC,CACrC,CAIA;AAED,wBAAgB,yBAAyB,IAAI,CAAC,CAAC,SAAS,CACtD,UAAU,CAAC,mBAAmB,CAAC,CAChC,CAIA;AAED,wBAAgB,2BAA2B,IAAI,CAAC,CAAC,SAAS,CACxD,UAAU,CAAC,qBAAqB,CAAC,CAClC,CAIA;AAED,wBAAgB,uBAAuB,IAAI,CAAC,CAAC,SAAS,CACpD,UAAU,CAAC,iBAAiB,CAAC,CAC9B,CAWA"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import type { DocumentDispatch } from "@powerhousedao/reactor-browser";
|
|
2
|
-
import type {
|
|
2
|
+
import type { VetraPackageAction, VetraPackageDocument } from "@powerhousedao/vetra/document-models/vetra-package";
|
|
3
3
|
/** Hook to get a VetraPackage document by its id */
|
|
4
4
|
export declare function useVetraPackageDocumentById(documentId: string | null | undefined): [VetraPackageDocument, DocumentDispatch<VetraPackageAction>] | [undefined, undefined];
|
|
5
5
|
/** Hook to get the selected VetraPackage document */
|
|
6
|
-
export declare function useSelectedVetraPackageDocument(): [
|
|
6
|
+
export declare function useSelectedVetraPackageDocument(): [
|
|
7
|
+
VetraPackageDocument,
|
|
8
|
+
DocumentDispatch<VetraPackageAction>
|
|
9
|
+
];
|
|
7
10
|
/** Hook to get all VetraPackage documents in the selected drive */
|
|
8
11
|
export declare function useVetraPackageDocumentsInSelectedDrive(): VetraPackageDocument[] | undefined;
|
|
9
12
|
/** Hook to get all VetraPackage documents in the selected folder */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../document-models/vetra-package/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAOvE,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../document-models/vetra-package/hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAOvE,OAAO,KAAK,EACV,kBAAkB,EAClB,oBAAoB,EACrB,MAAM,oDAAoD,CAAC;AAM5D,oDAAoD;AACpD,wBAAgB,2BAA2B,CACzC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAEnC,CAAC,oBAAoB,EAAE,gBAAgB,CAAC,kBAAkB,CAAC,CAAC,GAC5D,CAAC,SAAS,EAAE,SAAS,CAAC,CAIzB;AAED,qDAAqD;AACrD,wBAAgB,+BAA+B,IAAI;IACjD,oBAAoB;IACpB,gBAAgB,CAAC,kBAAkB,CAAC;CACrC,CAIA;AAED,mEAAmE;AACnE,wBAAgB,uCAAuC,uCAGtD;AAED,oEAAoE;AACpE,wBAAgB,wCAAwC,uCAGvD"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { useDocumentsInSelectedDrive, useDocumentsInSelectedFolder,
|
|
2
|
-
import { isVetraPackageDocument } from "./gen/document-schema.js";
|
|
1
|
+
import { useDocumentById, useDocumentsInSelectedDrive, useDocumentsInSelectedFolder, useSelectedDocument, } from "@powerhousedao/reactor-browser";
|
|
2
|
+
import { assertIsVetraPackageDocument, isVetraPackageDocument, } from "./gen/document-schema.js";
|
|
3
3
|
/** Hook to get a VetraPackage document by its id */
|
|
4
4
|
export function useVetraPackageDocumentById(documentId) {
|
|
5
5
|
const [document, dispatch] = useDocumentById(documentId);
|
|
@@ -10,8 +10,7 @@ export function useVetraPackageDocumentById(documentId) {
|
|
|
10
10
|
/** Hook to get the selected VetraPackage document */
|
|
11
11
|
export function useSelectedVetraPackageDocument() {
|
|
12
12
|
const [document, dispatch] = useSelectedDocument();
|
|
13
|
-
|
|
14
|
-
return [undefined, undefined];
|
|
13
|
+
assertIsVetraPackageDocument(document);
|
|
15
14
|
return [document, dispatch];
|
|
16
15
|
}
|
|
17
16
|
/** Hook to get all VetraPackage documents in the selected drive */
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useDocumentTypesInSelectedDrive, useSupportedDocumentTypesInReactor, } from "@powerhousedao/reactor-browser";
|
|
3
3
|
import { useCallback, useEffect, useState } from "react";
|
|
4
|
+
import { useSelectedAppModuleDocument } from "../../../document-models/app-module/hooks.js";
|
|
4
5
|
import { actions } from "../../../document-models/app-module/index.js";
|
|
5
6
|
import { StatusPill } from "../../components/index.js";
|
|
6
7
|
import { useDebounce } from "../../hooks/index.js";
|
|
7
|
-
import { useSelectedAppModuleDocument } from "../../hooks/useVetraDocument.js";
|
|
8
8
|
const ALL_IN_DRIVE = "all-in-drive";
|
|
9
9
|
const ALL_IN_REACTOR = "all-in-reactor";
|
|
10
10
|
const ALLOW_ANY = "allow-any";
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { render, screen, waitFor } from "@testing-library/react";
|
|
3
3
|
import { userEvent } from "@testing-library/user-event";
|
|
4
4
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
5
|
-
import { useSelectedAppModuleDocument } from "
|
|
5
|
+
import { useSelectedAppModuleDocument } from "../../document-models/app-module/hooks.js";
|
|
6
6
|
import Editor from "./editor.js";
|
|
7
|
-
vi.mock("
|
|
7
|
+
vi.mock("../../document-models/app-module/hooks.js", () => ({
|
|
8
8
|
useSelectedAppModuleDocument: vi.fn(),
|
|
9
9
|
}));
|
|
10
10
|
vi.mock("@powerhousedao/reactor-browser", async (importOriginal) => {
|
|
@@ -20,6 +20,7 @@ vi.mock("@powerhousedao/reactor-browser", async (importOriginal) => {
|
|
|
20
20
|
useSetPHDocumentEditorConfig: vi.fn(),
|
|
21
21
|
// These are needed by DocumentToolbar but mocked in setupTests
|
|
22
22
|
useSelectedDocument: vi.fn(() => [null, vi.fn()]),
|
|
23
|
+
useSelectedDocumentSafe: vi.fn(() => [null, vi.fn()]),
|
|
23
24
|
useDocumentById: vi.fn(() => [null, vi.fn()]),
|
|
24
25
|
useDocumentTimeline: vi.fn(() => []),
|
|
25
26
|
useNodeParentFolderById: vi.fn(() => null),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DocumentEditorForm.d.ts","sourceRoot":"","sources":["../../../../editors/document-editor/components/DocumentEditorForm.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,mDAAmD,CAAC;AAI3D,MAAM,WAAW,uBAAuB;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC1D,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,IAAI,CAAC;IAChE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;
|
|
1
|
+
{"version":3,"file":"DocumentEditorForm.d.ts","sourceRoot":"","sources":["../../../../editors/document-editor/components/DocumentEditorForm.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,oBAAoB,EACpB,gBAAgB,EAChB,uBAAuB,EACxB,MAAM,mDAAmD,CAAC;AAI3D,MAAM,WAAW,uBAAuB;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,gBAAgB,EAAE,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kBAAkB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5C,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC1D,oBAAoB,CAAC,EAAE,CAAC,KAAK,EAAE,uBAAuB,KAAK,IAAI,CAAC;IAChE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAqED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAmIhE,CAAC"}
|
|
@@ -1,14 +1,41 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useState } from "react";
|
|
2
|
+
import { Suspense, useEffect, useState } from "react";
|
|
3
3
|
import { StatusPill } from "../../components/index.js";
|
|
4
4
|
import { useAvailableDocumentTypes, useDebounce } from "../../hooks/index.js";
|
|
5
|
+
function DocumentTypeSelectUI(props) {
|
|
6
|
+
return (_jsxs("select", { id: "supported-document-types", 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", ...props, children: [_jsx("option", { value: "", children: "Select a document type" }), props.children] }));
|
|
7
|
+
}
|
|
8
|
+
function DocumentTypeSelect({ documentTypes, setDocumentTypes, onAddDocumentType, onRemoveDocumentType, }) {
|
|
9
|
+
// Get available document types from the hook (vetra drive only for document editor)
|
|
10
|
+
const availableDocumentTypes = useAvailableDocumentTypes(true);
|
|
11
|
+
const [selectedDocumentType, setSelectedDocumentType] = useState("");
|
|
12
|
+
return (_jsx(DocumentTypeSelectUI, { value: selectedDocumentType, onChange: (e) => {
|
|
13
|
+
const selectedValue = e.target.value;
|
|
14
|
+
if (selectedValue) {
|
|
15
|
+
// Remove existing document type if any
|
|
16
|
+
const existingType = documentTypes?.at(0);
|
|
17
|
+
if (existingType) {
|
|
18
|
+
onRemoveDocumentType?.({ id: existingType.id });
|
|
19
|
+
}
|
|
20
|
+
// Add the new document type
|
|
21
|
+
const newTypeInput = {
|
|
22
|
+
id: Date.now().toString(), // Generate a unique ID
|
|
23
|
+
documentType: selectedValue,
|
|
24
|
+
};
|
|
25
|
+
const newType = {
|
|
26
|
+
id: newTypeInput.id,
|
|
27
|
+
documentType: newTypeInput.documentType,
|
|
28
|
+
};
|
|
29
|
+
setDocumentTypes([newType]); // Replace with single item array
|
|
30
|
+
onAddDocumentType?.(newTypeInput);
|
|
31
|
+
}
|
|
32
|
+
setSelectedDocumentType("");
|
|
33
|
+
}, children: availableDocumentTypes.map((docType) => (_jsx("option", { value: docType, children: docType }, docType))) }));
|
|
34
|
+
}
|
|
5
35
|
export const DocumentEditorForm = ({ editorName: initialEditorName = "", documentTypes: initialDocumentTypes = [], status = "DRAFT", onEditorNameChange, onAddDocumentType, onRemoveDocumentType, onConfirm, }) => {
|
|
6
36
|
const [editorName, setEditorName] = useState(initialEditorName);
|
|
7
37
|
const [documentTypes, setDocumentTypes] = useState(initialDocumentTypes);
|
|
8
|
-
const [selectedDocumentType, setSelectedDocumentType] = useState("");
|
|
9
38
|
const [isConfirmed, setIsConfirmed] = useState(false);
|
|
10
|
-
// Get available document types from the hook (vetra drive only for document editor)
|
|
11
|
-
const availableDocumentTypes = useAvailableDocumentTypes(true);
|
|
12
39
|
// Use the debounce hook for name changes
|
|
13
40
|
useDebounce(editorName, onEditorNameChange, 300);
|
|
14
41
|
// Update local state when initial values change
|
|
@@ -32,28 +59,7 @@ export const DocumentEditorForm = ({ editorName: initialEditorName = "", documen
|
|
|
32
59
|
onConfirm?.();
|
|
33
60
|
}
|
|
34
61
|
};
|
|
35
|
-
return (_jsxs("div", { className: "space-y-6 bg-white p-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h2", { className: "text-lg font-medium text-gray-900", children: "Editor Configuration" }), _jsx(StatusPill, { status: status === "CONFIRMED" ? "confirmed" : "draft", label: status === "CONFIRMED" ? "Confirmed" : "Draft" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "editor-name", className: "mb-2 block text-sm font-medium text-gray-700", children: "Editor Name" }), _jsx("input", { id: "editor-name", type: "text", value: editorName, onChange: (e) => setEditorName(e.target.value), disabled: isReadOnly, 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 ${isReadOnly ? "cursor-not-allowed bg-gray-100" : ""}` })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "supported-document-types", className: "mb-2 block text-sm font-medium text-gray-700", children: "Supported Document Types" }), _jsxs("div", { className: "space-y-2", children: [!isReadOnly &&
|
|
36
|
-
const selectedValue = e.target.value;
|
|
37
|
-
if (selectedValue) {
|
|
38
|
-
// Remove existing document type if any
|
|
39
|
-
const existingType = documentTypes.at(0);
|
|
40
|
-
if (existingType) {
|
|
41
|
-
onRemoveDocumentType?.({ id: existingType.id });
|
|
42
|
-
}
|
|
43
|
-
// Add the new document type
|
|
44
|
-
const newTypeInput = {
|
|
45
|
-
id: Date.now().toString(), // Generate a unique ID
|
|
46
|
-
documentType: selectedValue,
|
|
47
|
-
};
|
|
48
|
-
const newType = {
|
|
49
|
-
id: newTypeInput.id,
|
|
50
|
-
documentType: newTypeInput.documentType,
|
|
51
|
-
};
|
|
52
|
-
setDocumentTypes([newType]); // Replace with single item array
|
|
53
|
-
onAddDocumentType?.(newTypeInput);
|
|
54
|
-
}
|
|
55
|
-
setSelectedDocumentType("");
|
|
56
|
-
}, 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", children: [_jsx("option", { value: "", children: "Select a document type" }), availableDocumentTypes.map((docType) => (_jsx("option", { value: docType, children: docType }, docType)))] })), _jsx("div", { className: "space-y-1", children: documentTypes.map((type) => (_jsxs("div", { className: "flex items-center py-1", children: [_jsx("span", { className: "text-sm text-gray-700", children: type.documentType }), !isReadOnly && (_jsx("button", { onClick: () => {
|
|
62
|
+
return (_jsxs("div", { className: "space-y-6 bg-white p-6", children: [_jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h2", { className: "text-lg font-medium text-gray-900", children: "Editor Configuration" }), _jsx(StatusPill, { status: status === "CONFIRMED" ? "confirmed" : "draft", label: status === "CONFIRMED" ? "Confirmed" : "Draft" })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "editor-name", className: "mb-2 block text-sm font-medium text-gray-700", children: "Editor Name" }), _jsx("input", { id: "editor-name", type: "text", value: editorName, onChange: (e) => setEditorName(e.target.value), disabled: isReadOnly, 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 ${isReadOnly ? "cursor-not-allowed bg-gray-100" : ""}` })] }), _jsxs("div", { children: [_jsx("label", { htmlFor: "supported-document-types", className: "mb-2 block text-sm font-medium text-gray-700", children: "Supported Document Types" }), _jsxs("div", { className: "space-y-2", children: [!isReadOnly && (_jsx(Suspense, { fallback: _jsx(DocumentTypeSelectUI, {}), children: _jsx(DocumentTypeSelect, { documentTypes: documentTypes, setDocumentTypes: setDocumentTypes, onAddDocumentType: onAddDocumentType, onRemoveDocumentType: onRemoveDocumentType }) })), _jsx("div", { className: "space-y-1", children: documentTypes.map((type) => (_jsxs("div", { className: "flex items-center py-1", children: [_jsx("span", { className: "text-sm text-gray-700", children: type.documentType }), !isReadOnly && (_jsx("button", { onClick: () => {
|
|
57
63
|
setDocumentTypes([]);
|
|
58
64
|
onRemoveDocumentType?.({ id: type.id });
|
|
59
65
|
}, className: "ml-2 text-gray-400 hover:text-gray-600 focus:outline-none", children: "\u00D7" }))] }, type.id))) })] })] }), !isReadOnly && (_jsx("div", { children: _jsx("button", { onClick: handleConfirm, disabled: !editorName.trim() || documentTypes.length === 0, 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", children: "Confirm" }) }))] }));
|
|
@@ -2,8 +2,8 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { DocumentToolbar } from "@powerhousedao/design-system/connect";
|
|
3
3
|
import { useSetPHDocumentEditorConfig } from "@powerhousedao/reactor-browser";
|
|
4
4
|
import { useCallback } from "react";
|
|
5
|
+
import { useSelectedDocumentEditorDocument } from "../../document-models/document-editor/hooks.js";
|
|
5
6
|
import { actions } from "../../document-models/document-editor/index.js";
|
|
6
|
-
import { useSelectedDocumentEditorDocument } from "../hooks/useVetraDocument.js";
|
|
7
7
|
import { DocumentEditorForm } from "./components/DocumentEditorForm.js";
|
|
8
8
|
import { editorConfig } from "./config.js";
|
|
9
9
|
export default function Editor() {
|
|
@@ -2,9 +2,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { render, screen, waitFor } from "@testing-library/react";
|
|
3
3
|
import { userEvent } from "@testing-library/user-event";
|
|
4
4
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
5
|
-
import { useSelectedDocumentEditorDocument } from "
|
|
5
|
+
import { useSelectedDocumentEditorDocument } from "../../document-models/document-editor/hooks.js";
|
|
6
6
|
import Editor from "./editor.js";
|
|
7
|
-
vi.mock("
|
|
7
|
+
vi.mock("../../document-models/document-editor/hooks.js", () => ({
|
|
8
8
|
useSelectedDocumentEditorDocument: vi.fn(),
|
|
9
9
|
}));
|
|
10
10
|
vi.mock("../hooks/useAvailableDocumentTypes.js", () => ({
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
import type { FileNode } from "document-drive";
|
|
2
2
|
import type React from "react";
|
|
3
3
|
interface DriveExplorerProps {
|
|
4
|
+
driveId: string;
|
|
5
|
+
driveName: string;
|
|
6
|
+
driveUrl: string;
|
|
4
7
|
documentModels?: FileNode[];
|
|
5
8
|
editors?: FileNode[];
|
|
6
9
|
apps?: FileNode[];
|
|
7
10
|
subgraphs?: FileNode[];
|
|
8
11
|
processors?: FileNode[];
|
|
9
12
|
codegenProcessors?: FileNode[];
|
|
10
|
-
onShareDrive?: () => void;
|
|
11
13
|
onAddDocumentModel?: () => void;
|
|
12
14
|
onAddEditor?: () => void;
|
|
13
15
|
onAddApp?: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DriveExplorer.d.ts","sourceRoot":"","sources":["../../../editors/vetra-drive-app/DriveExplorer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,UAAU,kBAAkB;IAC1B,cAAc,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;IACrB,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC;IAClB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC;IACxB,iBAAiB,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC/B,
|
|
1
|
+
{"version":3,"file":"DriveExplorer.d.ts","sourceRoot":"","sources":["../../../editors/vetra-drive-app/DriveExplorer.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B,UAAU,kBAAkB;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;IACrB,IAAI,CAAC,EAAE,QAAQ,EAAE,CAAC;IAClB,SAAS,CAAC,EAAE,QAAQ,EAAE,CAAC;IACvB,UAAU,CAAC,EAAE,QAAQ,EAAE,CAAC;IACxB,iBAAiB,CAAC,EAAE,QAAQ,EAAE,CAAC;IAC/B,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;IAChC,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;IAC5B,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,oBAAoB,CAAC,EAAE,MAAM,IAAI,CAAC;IAClC,qBAAqB,CAAC,EAAE,MAAM,IAAI,CAAC;IACnC,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;IAC1C,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;CACrC;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAwDtD,CAAC"}
|
|
@@ -2,6 +2,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { DriveHeader } from "./components/DriveHeader.js";
|
|
3
3
|
import { ModuleSpecificationsSection } from "./components/ModuleSpecificationsSection.js";
|
|
4
4
|
import { PackageInformationSection } from "./components/PackageInformationSection.js";
|
|
5
|
-
export const DriveExplorer = ({ documentModels = [], editors = [], apps = [], subgraphs = [], processors = [], codegenProcessors = [],
|
|
6
|
-
return (_jsxs("div", { className: "min-h-screen bg-white", children: [_jsx(DriveHeader, {
|
|
5
|
+
export const DriveExplorer = ({ driveId, driveName, driveUrl, documentModels = [], editors = [], apps = [], subgraphs = [], processors = [], codegenProcessors = [], onAddDocumentModel, onAddEditor, onAddApp, onAddSubgraph, onAddProcessor, onAddCodegenProcessor, packageDocumentId, onAddPackageDocument, onOpenPackageDocument, onOpenDocument, onDelete, }) => {
|
|
6
|
+
return (_jsxs("div", { className: "min-h-screen bg-white", children: [_jsx(DriveHeader, { driveId: driveId, driveName: driveName, driveUrl: driveUrl }), _jsxs("div", { className: "mx-6 mt-6 bg-white", children: [_jsx(PackageInformationSection, { className: "mb-6", packageDocumentId: packageDocumentId, onAddPackageDocument: onAddPackageDocument, onOpenPackageDocument: onOpenPackageDocument }), _jsx(ModuleSpecificationsSection, { documentModels: documentModels, editors: editors, apps: apps, subgraphs: subgraphs, processors: processors, codegenProcessors: codegenProcessors, onAddDocumentModel: onAddDocumentModel, onAddEditor: onAddEditor, onAddApp: onAddApp, onAddSubgraph: onAddSubgraph, onAddProcessor: onAddProcessor, onAddCodegenProcessor: onAddCodegenProcessor, onOpenDocument: onOpenDocument, onDelete: onDelete })] })] }));
|
|
7
7
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DriveHeader.d.ts","sourceRoot":"","sources":["../../../../editors/vetra-drive-app/components/DriveHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"DriveHeader.d.ts","sourceRoot":"","sources":["../../../../editors/vetra-drive-app/components/DriveHeader.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAQpE,UAAU,gBAAgB;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAgIlD,CAAC"}
|
|
@@ -1,8 +1,60 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import React from "react";
|
|
2
|
+
import React, { useEffect, useMemo, useRef, useState } from "react";
|
|
3
|
+
import { DriveInfoItem } from "./DriveInfoItem.js";
|
|
4
|
+
import { ShareMenuItem } from "./ShareMenuItem.js";
|
|
3
5
|
import { InfoIcon } from "../icons/InfoIcon.js";
|
|
6
|
+
import { ExternalLinkIcon } from "../icons/ExternalLinkIcon.js";
|
|
4
7
|
import { ShareIcon } from "../icons/ShareIcon.js";
|
|
5
8
|
import { VetraIcon } from "../icons/VetraIcon.js";
|
|
6
|
-
export const DriveHeader = ({
|
|
7
|
-
|
|
9
|
+
export const DriveHeader = ({ driveId, driveName, driveUrl, }) => {
|
|
10
|
+
const [isInfoMenuOpen, setIsInfoMenuOpen] = useState(false);
|
|
11
|
+
const [isShareMenuOpen, setIsShareMenuOpen] = useState(false);
|
|
12
|
+
const infoMenuRef = useRef(null);
|
|
13
|
+
const shareMenuRef = useRef(null);
|
|
14
|
+
const toggleInfoMenu = () => {
|
|
15
|
+
setIsInfoMenuOpen((prev) => !prev);
|
|
16
|
+
setIsShareMenuOpen(false);
|
|
17
|
+
};
|
|
18
|
+
const toggleShareMenu = () => {
|
|
19
|
+
setIsShareMenuOpen((prev) => !prev);
|
|
20
|
+
setIsInfoMenuOpen(false);
|
|
21
|
+
};
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
if (!isInfoMenuOpen && !isShareMenuOpen)
|
|
24
|
+
return;
|
|
25
|
+
const handleClickOutside = (event) => {
|
|
26
|
+
if (infoMenuRef.current &&
|
|
27
|
+
!infoMenuRef.current.contains(event.target)) {
|
|
28
|
+
setIsInfoMenuOpen(false);
|
|
29
|
+
}
|
|
30
|
+
if (shareMenuRef.current &&
|
|
31
|
+
!shareMenuRef.current.contains(event.target)) {
|
|
32
|
+
setIsShareMenuOpen(false);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
const handleKeyDown = (event) => {
|
|
36
|
+
if (event.key === "Escape") {
|
|
37
|
+
setIsInfoMenuOpen(false);
|
|
38
|
+
setIsShareMenuOpen(false);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
42
|
+
document.addEventListener("keydown", handleKeyDown);
|
|
43
|
+
return () => {
|
|
44
|
+
document.removeEventListener("mousedown", handleClickOutside);
|
|
45
|
+
document.removeEventListener("keydown", handleKeyDown);
|
|
46
|
+
};
|
|
47
|
+
}, [isInfoMenuOpen, isShareMenuOpen]);
|
|
48
|
+
const shareUrl = useMemo(() => {
|
|
49
|
+
if (!driveUrl)
|
|
50
|
+
return "";
|
|
51
|
+
try {
|
|
52
|
+
new URL(driveUrl);
|
|
53
|
+
return `${window.location.origin}/?driveUrl=${encodeURIComponent(driveUrl)}`;
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return "";
|
|
57
|
+
}
|
|
58
|
+
}, [driveUrl]);
|
|
59
|
+
return (_jsx("div", { className: "bg-white px-6 py-4", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsxs("div", { className: "flex items-center gap-2", children: [_jsx(VetraIcon, { width: 20, height: 20 }), _jsx("h1", { className: "text-lg font-semibold text-gray-900", children: "Vetra Studio Drive" }), _jsxs("div", { className: "relative", ref: infoMenuRef, children: [_jsx("button", { "aria-label": "Drive information", "aria-expanded": isInfoMenuOpen, className: "rounded-full p-1 transition-colors hover:bg-gray-100", onClick: toggleInfoMenu, children: _jsx(InfoIcon, { className: "text-gray-500" }) }), isInfoMenuOpen && (_jsxs("div", { role: "menu", className: "absolute left-0 top-full z-10 mt-2 flex flex-col items-start gap-2 rounded-lg bg-white p-3 shadow-lg", children: [_jsx(DriveInfoItem, { label: "Name", value: driveName }), _jsx(DriveInfoItem, { label: "Drive ID", value: driveId })] }))] }), driveUrl && (_jsxs("div", { className: "relative", ref: shareMenuRef, children: [_jsx("button", { "aria-label": "Share drive", "aria-expanded": isShareMenuOpen, className: "rounded-full p-1 transition-colors hover:bg-gray-100", onClick: toggleShareMenu, children: _jsx(ShareIcon, { width: 16, height: 16, stroke: "#343839" }) }), isShareMenuOpen && (_jsxs("div", { role: "menu", className: "absolute left-0 top-full z-10 mt-2 flex w-max flex-col gap-4 rounded-lg bg-white p-4 shadow-lg", children: [_jsx(ShareMenuItem, { label: "Copy the Drive URL", url: driveUrl }), _jsx(ShareMenuItem, { label: "Share this Drive directly in Connect", url: shareUrl })] }))] }))] }), _jsxs("a", { href: "https://academy.vetra.io/", target: "_blank", rel: "noopener noreferrer", className: "flex items-center gap-2 text-sm text-gray-900 underline transition-colors hover:text-gray-700", children: [_jsx(ExternalLinkIcon, { fill: "#111827" }), "Vetra Academy"] })] }) }));
|
|
8
60
|
};
|