@powerhousedao/vetra 6.2.3-dev.42 → 6.2.3-dev.44
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/{editor-B9UHEqSb.js → editor-DFEeM_dy.js} +2 -2
- package/dist/{editor-B9UHEqSb.js.map → editor-DFEeM_dy.js.map} +1 -1
- package/dist/editors/index.js +1 -1
- package/dist/index.js +1 -1
- package/dist/{module-DUCwkDVx.js → module-CdpGkPNN.js} +2 -2
- package/dist/{module-DUCwkDVx.js.map → module-CdpGkPNN.js.map} +1 -1
- package/package.json +8 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as setEditorName, g as removeDocumentType, m as addDocumentType, v as setEditorStatus } from "./utils-876N1Sph.js";
|
|
2
|
-
import { StatusPill } from "./editors/components/index.js";
|
|
3
2
|
import { useSelectedDocumentEditorDocument } from "./document-models/document-editor/index.js";
|
|
3
|
+
import { StatusPill } from "./editors/components/index.js";
|
|
4
4
|
import { n as useAvailableDocumentTypes, t as useDebounce } from "./hooks-BbxvC-C3.js";
|
|
5
5
|
import { useSetPHDocumentEditorConfig } from "@powerhousedao/reactor-browser";
|
|
6
6
|
import { Suspense, useCallback, useEffect, useState } from "react";
|
|
@@ -172,4 +172,4 @@ function Editor() {
|
|
|
172
172
|
//#endregion
|
|
173
173
|
export { Editor as default };
|
|
174
174
|
|
|
175
|
-
//# sourceMappingURL=editor-
|
|
175
|
+
//# sourceMappingURL=editor-DFEeM_dy.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-B9UHEqSb.js","names":[],"sources":["../editors/document-editor/components/DocumentEditorForm.tsx","../editors/document-editor/config.ts","../editors/document-editor/editor.tsx"],"sourcesContent":["import { Suspense, useEffect, useState } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\nimport type {\n AddDocumentTypeInput,\n DocumentTypeItem,\n RemoveDocumentTypeInput,\n} from \"../../../document-models/document-editor/index.js\";\nimport { StatusPill } from \"../../components/index.js\";\nimport { useAvailableDocumentTypes, useDebounce } from \"../../hooks/index.js\";\n\nexport interface DocumentEditorFormProps {\n editorName?: string;\n documentTypes?: DocumentTypeItem[];\n status?: string;\n onEditorNameChange?: (name: string) => void;\n onAddDocumentType?: (input: AddDocumentTypeInput) => void;\n onRemoveDocumentType?: (input: RemoveDocumentTypeInput) => void;\n onConfirm?: () => void;\n}\n\nfunction DocumentTypeSelectUI(\n props: React.SelectHTMLAttributes<HTMLSelectElement>,\n) {\n return (\n <select\n id=\"supported-document-types\"\n className=\"w-full rounded-md border border-border px-3 py-2 text-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none\"\n {...props}\n >\n <option value=\"\">Select a document type</option>\n {props.children}\n </select>\n );\n}\n\nfunction DocumentTypeSelect({\n documentTypes,\n setDocumentTypes,\n onAddDocumentType,\n onRemoveDocumentType,\n}: {\n setDocumentTypes: (documentTypes: DocumentTypeItem[]) => void;\n} & Pick<\n DocumentEditorFormProps,\n \"documentTypes\" | \"onAddDocumentType\" | \"onRemoveDocumentType\"\n>) {\n // Get available document types from the hook (vetra drive only for document editor)\n const availableDocumentTypes = useAvailableDocumentTypes(true);\n const [selectedDocumentType, setSelectedDocumentType] = useState(\"\");\n\n return (\n <DocumentTypeSelectUI\n value={selectedDocumentType}\n onChange={(e) => {\n const selectedValue = e.target.value;\n if (selectedValue) {\n // Remove existing document type if any\n\n const existingType = documentTypes?.at(0);\n if (existingType) {\n onRemoveDocumentType?.({ id: existingType.id });\n }\n\n // Add the new document type\n const newTypeInput: AddDocumentTypeInput = {\n id: Date.now().toString(), // Generate a unique ID\n documentType: selectedValue,\n };\n const newType: DocumentTypeItem = {\n id: newTypeInput.id,\n documentType: newTypeInput.documentType,\n };\n setDocumentTypes([newType]); // Replace with single item array\n onAddDocumentType?.(newTypeInput);\n }\n setSelectedDocumentType(\"\");\n }}\n >\n {availableDocumentTypes.map((docType) => (\n <option key={docType} value={docType}>\n {docType}\n </option>\n ))}\n </DocumentTypeSelectUI>\n );\n}\n\nexport const DocumentEditorForm: React.FC<DocumentEditorFormProps> = ({\n editorName: initialEditorName = \"\",\n documentTypes: initialDocumentTypes = [],\n status = \"DRAFT\",\n onEditorNameChange,\n onAddDocumentType,\n onRemoveDocumentType,\n onConfirm,\n}) => {\n const [editorName, setEditorName] = useState(initialEditorName);\n const [documentTypes, setDocumentTypes] =\n useState<DocumentTypeItem[]>(initialDocumentTypes);\n const [isConfirmed, setIsConfirmed] = useState(false);\n\n // Use the debounce hook for name changes\n useDebounce(editorName, onEditorNameChange, 300);\n\n // Update local state when initial values change\n useEffect(() => {\n // eslint-disable-next-line react-hooks-extra/set-state-in-effect\n setEditorName(initialEditorName);\n }, [initialEditorName]);\n\n useEffect(() => {\n // eslint-disable-next-line react-hooks-extra/set-state-in-effect\n setDocumentTypes(initialDocumentTypes);\n }, [initialDocumentTypes]);\n\n // Reset confirmation state if status changes back to DRAFT\n useEffect(() => {\n if (status === \"DRAFT\") {\n // eslint-disable-next-line react-hooks-extra/set-state-in-effect\n setIsConfirmed(false);\n }\n }, [status]);\n\n // Check if form should be read-only\n const isReadOnly = isConfirmed || status === \"CONFIRMED\";\n\n const handleConfirm = () => {\n if (editorName.trim() && documentTypes.length > 0) {\n setIsConfirmed(true); // Immediate UI update\n onConfirm?.();\n }\n };\n\n return (\n <div className=\"space-y-6 p-6\">\n <div className=\"flex items-center justify-between\">\n <h2 className=\"text-lg font-medium text-foreground\">\n Editor Configuration\n </h2>\n <StatusPill\n status={status === \"CONFIRMED\" ? \"confirmed\" : \"draft\"}\n label={status === \"CONFIRMED\" ? \"Confirmed\" : \"Draft\"}\n />\n </div>\n\n {/* Editor Name Field */}\n <div>\n <label\n htmlFor=\"editor-name\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Editor Name\n </label>\n <input\n id=\"editor-name\"\n type=\"text\"\n value={editorName}\n onChange={(e) => setEditorName(e.target.value)}\n disabled={isReadOnly}\n className={twMerge(\n \"w-full rounded-md border border-border px-3 py-2 text-foreground placeholder:text-muted-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none disabled:disabled-effect\",\n isReadOnly ? \"cursor-not-allowed bg-muted\" : \"\",\n )}\n />\n </div>\n\n {/* Supported Document Types Field */}\n <div>\n <label\n htmlFor=\"supported-document-types\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Supported Document Types\n </label>\n <div className=\"space-y-2\">\n {!isReadOnly && (\n <Suspense fallback={<DocumentTypeSelectUI />}>\n <DocumentTypeSelect\n documentTypes={documentTypes}\n setDocumentTypes={setDocumentTypes}\n onAddDocumentType={onAddDocumentType}\n onRemoveDocumentType={onRemoveDocumentType}\n />\n </Suspense>\n )}\n <div className=\"space-y-1\">\n {documentTypes.map((type) => (\n <div key={type.id} className=\"flex items-center py-1\">\n <span className=\"text-sm text-foreground\">\n {type.documentType}\n </span>\n {!isReadOnly && (\n <button\n onClick={() => {\n setDocumentTypes([]);\n onRemoveDocumentType?.({ id: type.id });\n }}\n className=\"ml-2 text-muted-foreground hover:hover-effect focus:outline-none\"\n >\n ×\n </button>\n )}\n </div>\n ))}\n </div>\n </div>\n </div>\n\n {/* Confirm Button - only show if not in read-only mode */}\n {!isReadOnly && (\n <div>\n <button\n onClick={handleConfirm}\n disabled={!editorName.trim() || documentTypes.length === 0}\n className=\"rounded-md bg-primary px-4 py-2 text-primary-foreground hover:hover-effect focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-none disabled:disabled-effect\"\n >\n Confirm\n </button>\n </div>\n )}\n </div>\n );\n};\n","import type { PHDocumentEditorConfig } from \"@powerhousedao/reactor-browser\";\n\nexport const editorConfig: PHDocumentEditorConfig = {\n isExternalControlsEnabled: false,\n};\n","import { DocumentToolbar } from \"@powerhousedao/design-system/connect\";\nimport { useSetPHDocumentEditorConfig } from \"@powerhousedao/reactor-browser\";\nimport { useCallback } from \"react\";\nimport { useSelectedDocumentEditorDocument } from \"../../document-models/document-editor/index.js\";\nimport {\n addDocumentType,\n removeDocumentType,\n setEditorName,\n setEditorStatus,\n type AddDocumentTypeInput,\n type RemoveDocumentTypeInput,\n} from \"../../document-models/document-editor/index.js\";\nimport { DocumentEditorForm } from \"./components/DocumentEditorForm.js\";\nimport { editorConfig } from \"./config.js\";\n\nexport default function Editor() {\n useSetPHDocumentEditorConfig(editorConfig);\n const [document, dispatch] = useSelectedDocumentEditorDocument();\n\n const onEditorNameChange = useCallback(\n (name: string) => {\n if (!document.state.global.name && !name) return;\n if (name === document.state.global.name) return;\n\n dispatch(setEditorName({ name }));\n },\n [document.state.global.name, dispatch],\n );\n\n const onAddDocumentType = useCallback(\n (input: AddDocumentTypeInput) => {\n dispatch(addDocumentType(input));\n },\n [dispatch],\n );\n\n const onRemoveDocumentType = useCallback(\n (input: RemoveDocumentTypeInput) => {\n dispatch(removeDocumentType(input));\n },\n [dispatch],\n );\n\n const onConfirm = useCallback(() => {\n dispatch(setEditorStatus({ status: \"CONFIRMED\" }));\n }, [dispatch]);\n\n return (\n <div className=\"bg-background p-6\">\n <DocumentToolbar />\n <DocumentEditorForm\n status={document.state.global.status}\n editorName={document.state.global.name ?? \"\"}\n documentTypes={document.state.global.documentTypes}\n onEditorNameChange={onEditorNameChange}\n onAddDocumentType={onAddDocumentType}\n onRemoveDocumentType={onRemoveDocumentType}\n onConfirm={onConfirm}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AAoBA,SAAS,qBACP,OACA;CACA,OACE,qBAAC,UAAD;EACE,IAAG;EACH,WAAU;EACV,GAAI;EAHN,UAAA,CAKE,oBAAC,UAAD;GAAQ,OAAM;GAAG,UAAA;EAA8B,CAAA,GAC9C,MAAM,QACD;;AAEZ;AAEA,SAAS,mBAAmB,EAC1B,eACA,kBACA,mBACA,wBAMC;CAED,MAAM,yBAAyB,0BAA0B,IAAI;CAC7D,MAAM,CAAC,sBAAsB,2BAA2B,SAAS,EAAE;CAEnE,OACE,oBAAC,sBAAD;EACE,OAAO;EACP,WA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J;;AAET;;;AC5NA,MAAa,eAAuC,EAClD,2BAA2B,MAC7B;;;ACWA,SAAwB,SAAS;CAC/B,6BAA6B,YAAY;CACzC,MAAM,CAAC,UAAU,YAAY,kCAAkC;CAE/D,MAAM,qBAAqB,aACxB,SAAiB;EAChB,IAAI,CAAC,SAAS,MAAM,OAAO,QAAQ,CAAC,MAAM;EAC1C,IAAI,SAAS,SAAS,MAAM,OAAO,MAAM;EAEzC,SAAS,cAAc,EAAE,KAAK,CAAC,CAAC;CAClC,GACA,CAAC,SAAS,MAAM,OAAO,MAAM,QAAQ,CACvC;CAEA,MAAM,oBAAoB,aACvB,UAAgC;EAC/B,SAAS,gBAAgB,KAAK,CAAC;CACjC,GACA,CAAC,QAAQ,CACX;CAEA,MAAM,uBAAuB,aAC1B,UAAmC;EAClC,SAAS,mBAAmB,KAAK,CAAC;CACpC,GACA,CAAC,QAAQ,CACX;CAEA,MAAM,YAAY,kBAAkB;EAClC,SAAS,gBAAgB,EAAE,QAAQ,YAAY,CAAC,CAAC;CACnD,GAAG,CAAC,QAAQ,CAAC;CAEb,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,iBAAD,CAAkB,CAAA,GAClB,oBAAC,oBAAD;GACE,QAAQ,SAAS,MAAM,OAAO;GAC9B,YAAY,SAAS,MAAM,OAAO,QAAQ;GAC1C,eAAe,SAAS,MAAM,OAAO;GACjB;GACD;GACG;GACX;EACZ,CAAA,CACE;;AAET"}
|
|
1
|
+
{"version":3,"file":"editor-DFEeM_dy.js","names":[],"sources":["../editors/document-editor/components/DocumentEditorForm.tsx","../editors/document-editor/config.ts","../editors/document-editor/editor.tsx"],"sourcesContent":["import { Suspense, useEffect, useState } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\nimport type {\n AddDocumentTypeInput,\n DocumentTypeItem,\n RemoveDocumentTypeInput,\n} from \"../../../document-models/document-editor/index.js\";\nimport { StatusPill } from \"../../components/index.js\";\nimport { useAvailableDocumentTypes, useDebounce } from \"../../hooks/index.js\";\n\nexport interface DocumentEditorFormProps {\n editorName?: string;\n documentTypes?: DocumentTypeItem[];\n status?: string;\n onEditorNameChange?: (name: string) => void;\n onAddDocumentType?: (input: AddDocumentTypeInput) => void;\n onRemoveDocumentType?: (input: RemoveDocumentTypeInput) => void;\n onConfirm?: () => void;\n}\n\nfunction DocumentTypeSelectUI(\n props: React.SelectHTMLAttributes<HTMLSelectElement>,\n) {\n return (\n <select\n id=\"supported-document-types\"\n className=\"w-full rounded-md border border-border px-3 py-2 text-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none\"\n {...props}\n >\n <option value=\"\">Select a document type</option>\n {props.children}\n </select>\n );\n}\n\nfunction DocumentTypeSelect({\n documentTypes,\n setDocumentTypes,\n onAddDocumentType,\n onRemoveDocumentType,\n}: {\n setDocumentTypes: (documentTypes: DocumentTypeItem[]) => void;\n} & Pick<\n DocumentEditorFormProps,\n \"documentTypes\" | \"onAddDocumentType\" | \"onRemoveDocumentType\"\n>) {\n // Get available document types from the hook (vetra drive only for document editor)\n const availableDocumentTypes = useAvailableDocumentTypes(true);\n const [selectedDocumentType, setSelectedDocumentType] = useState(\"\");\n\n return (\n <DocumentTypeSelectUI\n value={selectedDocumentType}\n onChange={(e) => {\n const selectedValue = e.target.value;\n if (selectedValue) {\n // Remove existing document type if any\n\n const existingType = documentTypes?.at(0);\n if (existingType) {\n onRemoveDocumentType?.({ id: existingType.id });\n }\n\n // Add the new document type\n const newTypeInput: AddDocumentTypeInput = {\n id: Date.now().toString(), // Generate a unique ID\n documentType: selectedValue,\n };\n const newType: DocumentTypeItem = {\n id: newTypeInput.id,\n documentType: newTypeInput.documentType,\n };\n setDocumentTypes([newType]); // Replace with single item array\n onAddDocumentType?.(newTypeInput);\n }\n setSelectedDocumentType(\"\");\n }}\n >\n {availableDocumentTypes.map((docType) => (\n <option key={docType} value={docType}>\n {docType}\n </option>\n ))}\n </DocumentTypeSelectUI>\n );\n}\n\nexport const DocumentEditorForm: React.FC<DocumentEditorFormProps> = ({\n editorName: initialEditorName = \"\",\n documentTypes: initialDocumentTypes = [],\n status = \"DRAFT\",\n onEditorNameChange,\n onAddDocumentType,\n onRemoveDocumentType,\n onConfirm,\n}) => {\n const [editorName, setEditorName] = useState(initialEditorName);\n const [documentTypes, setDocumentTypes] =\n useState<DocumentTypeItem[]>(initialDocumentTypes);\n const [isConfirmed, setIsConfirmed] = useState(false);\n\n // Use the debounce hook for name changes\n useDebounce(editorName, onEditorNameChange, 300);\n\n // Update local state when initial values change\n useEffect(() => {\n // eslint-disable-next-line react-hooks-extra/set-state-in-effect\n setEditorName(initialEditorName);\n }, [initialEditorName]);\n\n useEffect(() => {\n // eslint-disable-next-line react-hooks-extra/set-state-in-effect\n setDocumentTypes(initialDocumentTypes);\n }, [initialDocumentTypes]);\n\n // Reset confirmation state if status changes back to DRAFT\n useEffect(() => {\n if (status === \"DRAFT\") {\n // eslint-disable-next-line react-hooks-extra/set-state-in-effect\n setIsConfirmed(false);\n }\n }, [status]);\n\n // Check if form should be read-only\n const isReadOnly = isConfirmed || status === \"CONFIRMED\";\n\n const handleConfirm = () => {\n if (editorName.trim() && documentTypes.length > 0) {\n setIsConfirmed(true); // Immediate UI update\n onConfirm?.();\n }\n };\n\n return (\n <div className=\"space-y-6 p-6\">\n <div className=\"flex items-center justify-between\">\n <h2 className=\"text-lg font-medium text-foreground\">\n Editor Configuration\n </h2>\n <StatusPill\n status={status === \"CONFIRMED\" ? \"confirmed\" : \"draft\"}\n label={status === \"CONFIRMED\" ? \"Confirmed\" : \"Draft\"}\n />\n </div>\n\n {/* Editor Name Field */}\n <div>\n <label\n htmlFor=\"editor-name\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Editor Name\n </label>\n <input\n id=\"editor-name\"\n type=\"text\"\n value={editorName}\n onChange={(e) => setEditorName(e.target.value)}\n disabled={isReadOnly}\n className={twMerge(\n \"w-full rounded-md border border-border px-3 py-2 text-foreground placeholder:text-muted-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none disabled:disabled-effect\",\n isReadOnly ? \"cursor-not-allowed bg-muted\" : \"\",\n )}\n />\n </div>\n\n {/* Supported Document Types Field */}\n <div>\n <label\n htmlFor=\"supported-document-types\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Supported Document Types\n </label>\n <div className=\"space-y-2\">\n {!isReadOnly && (\n <Suspense fallback={<DocumentTypeSelectUI />}>\n <DocumentTypeSelect\n documentTypes={documentTypes}\n setDocumentTypes={setDocumentTypes}\n onAddDocumentType={onAddDocumentType}\n onRemoveDocumentType={onRemoveDocumentType}\n />\n </Suspense>\n )}\n <div className=\"space-y-1\">\n {documentTypes.map((type) => (\n <div key={type.id} className=\"flex items-center py-1\">\n <span className=\"text-sm text-foreground\">\n {type.documentType}\n </span>\n {!isReadOnly && (\n <button\n onClick={() => {\n setDocumentTypes([]);\n onRemoveDocumentType?.({ id: type.id });\n }}\n className=\"ml-2 text-muted-foreground hover:hover-effect focus:outline-none\"\n >\n ×\n </button>\n )}\n </div>\n ))}\n </div>\n </div>\n </div>\n\n {/* Confirm Button - only show if not in read-only mode */}\n {!isReadOnly && (\n <div>\n <button\n onClick={handleConfirm}\n disabled={!editorName.trim() || documentTypes.length === 0}\n className=\"rounded-md bg-primary px-4 py-2 text-primary-foreground hover:hover-effect focus:ring-2 focus:ring-ring focus:ring-offset-2 focus:outline-none disabled:disabled-effect\"\n >\n Confirm\n </button>\n </div>\n )}\n </div>\n );\n};\n","import type { PHDocumentEditorConfig } from \"@powerhousedao/reactor-browser\";\n\nexport const editorConfig: PHDocumentEditorConfig = {\n isExternalControlsEnabled: false,\n};\n","import { DocumentToolbar } from \"@powerhousedao/design-system/connect\";\nimport { useSetPHDocumentEditorConfig } from \"@powerhousedao/reactor-browser\";\nimport { useCallback } from \"react\";\nimport { useSelectedDocumentEditorDocument } from \"../../document-models/document-editor/index.js\";\nimport {\n addDocumentType,\n removeDocumentType,\n setEditorName,\n setEditorStatus,\n type AddDocumentTypeInput,\n type RemoveDocumentTypeInput,\n} from \"../../document-models/document-editor/index.js\";\nimport { DocumentEditorForm } from \"./components/DocumentEditorForm.js\";\nimport { editorConfig } from \"./config.js\";\n\nexport default function Editor() {\n useSetPHDocumentEditorConfig(editorConfig);\n const [document, dispatch] = useSelectedDocumentEditorDocument();\n\n const onEditorNameChange = useCallback(\n (name: string) => {\n if (!document.state.global.name && !name) return;\n if (name === document.state.global.name) return;\n\n dispatch(setEditorName({ name }));\n },\n [document.state.global.name, dispatch],\n );\n\n const onAddDocumentType = useCallback(\n (input: AddDocumentTypeInput) => {\n dispatch(addDocumentType(input));\n },\n [dispatch],\n );\n\n const onRemoveDocumentType = useCallback(\n (input: RemoveDocumentTypeInput) => {\n dispatch(removeDocumentType(input));\n },\n [dispatch],\n );\n\n const onConfirm = useCallback(() => {\n dispatch(setEditorStatus({ status: \"CONFIRMED\" }));\n }, [dispatch]);\n\n return (\n <div className=\"bg-background p-6\">\n <DocumentToolbar />\n <DocumentEditorForm\n status={document.state.global.status}\n editorName={document.state.global.name ?? \"\"}\n documentTypes={document.state.global.documentTypes}\n onEditorNameChange={onEditorNameChange}\n onAddDocumentType={onAddDocumentType}\n onRemoveDocumentType={onRemoveDocumentType}\n onConfirm={onConfirm}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AAoBA,SAAS,qBACP,OACA;CACA,OACE,qBAAC,UAAD;EACE,IAAG;EACH,WAAU;EACV,GAAI;EAHN,UAAA,CAKE,oBAAC,UAAD;GAAQ,OAAM;GAAG,UAAA;EAA8B,CAAA,GAC9C,MAAM,QACD;;AAEZ;AAEA,SAAS,mBAAmB,EAC1B,eACA,kBACA,mBACA,wBAMC;CAED,MAAM,yBAAyB,0BAA0B,IAAI;CAC7D,MAAM,CAAC,sBAAsB,2BAA2B,SAAS,EAAE;CAEnE,OACE,oBAAC,sBAAD;EACE,OAAO;EACP,WAAW,MAAM;GACf,MAAM,gBAAgB,EAAE,OAAO;GAC/B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MAC7B;;;ACWA,SAAwB,SAAS;CAC/B,6BAA6B,YAAY;CACzC,MAAM,CAAC,UAAU,YAAY,kCAAkC;CAE/D,MAAM,qBAAqB,aACxB,SAAiB;EAChB,IAAI,CAAC,SAAS,MAAM,OAAO,QAAQ,CAAC,MAAM;EAC1C,IAAI,SAAS,SAAS,MAAM,OAAO,MAAM;EAEzC,SAAS,cAAc,EAAE,KAAK,CAAC,CAAC;CAClC,GACA,CAAC,SAAS,MAAM,OAAO,MAAM,QAAQ,CACvC;CAEA,MAAM,oBAAoB,aACvB,UAAgC;EAC/B,SAAS,gBAAgB,KAAK,CAAC;CACjC,GACA,CAAC,QAAQ,CACX;CAEA,MAAM,uBAAuB,aAC1B,UAAmC;EAClC,SAAS,mBAAmB,KAAK,CAAC;CACpC,GACA,CAAC,QAAQ,CACX;CAEA,MAAM,YAAY,kBAAkB;EAClC,SAAS,gBAAgB,EAAE,QAAQ,YAAY,CAAC,CAAC;CACnD,GAAG,CAAC,QAAQ,CAAC;CAEb,OACE,qBAAC,OAAD;EAAK,WAAU;EAAf,UAAA,CACE,oBAAC,iBAAD,CAAkB,CAAA,GAClB,oBAAC,oBAAD;GACE,QAAQ,SAAS,MAAM,OAAO;GAC9B,YAAY,SAAS,MAAM,OAAO,QAAQ;GAC1C,eAAe,SAAS,MAAM,OAAO;GACjB;GACD;GACG;GACX;EACZ,CAAA,CACE;;AAET"}
|
package/dist/editors/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as DocumentEditorEditor, i as ProcessorModuleEditor, n as VetraDriveApp, o as AppEditor, r as SubgraphModuleEditor, t as VetraPackageEditor } from "../module-
|
|
1
|
+
import { a as DocumentEditorEditor, i as ProcessorModuleEditor, n as VetraDriveApp, o as AppEditor, r as SubgraphModuleEditor, t as VetraPackageEditor } from "../module-CdpGkPNN.js";
|
|
2
2
|
export { AppEditor, DocumentEditorEditor, ProcessorModuleEditor, SubgraphModuleEditor, VetraDriveApp, VetraPackageEditor };
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { t as documentEditorUpgradeManifest } from "./upgrade-manifest-D7xKGmZc.
|
|
|
8
8
|
import { t as processorModuleUpgradeManifest } from "./upgrade-manifest-d3LquK-H.js";
|
|
9
9
|
import { t as subgraphModuleUpgradeManifest } from "./upgrade-manifest-Dv62Cod7.js";
|
|
10
10
|
import { t as vetraPackageUpgradeManifest } from "./upgrade-manifest-BOZ5nmyK.js";
|
|
11
|
-
import { a as DocumentEditorEditor, i as ProcessorModuleEditor, n as VetraDriveApp, o as AppEditor, r as SubgraphModuleEditor, t as VetraPackageEditor } from "./module-
|
|
11
|
+
import { a as DocumentEditorEditor, i as ProcessorModuleEditor, n as VetraDriveApp, o as AppEditor, r as SubgraphModuleEditor, t as VetraPackageEditor } from "./module-CdpGkPNN.js";
|
|
12
12
|
//#region powerhouse.manifest.json
|
|
13
13
|
var powerhouse_manifest_default = {
|
|
14
14
|
name: "@powerhousedao/vetra",
|
|
@@ -13,7 +13,7 @@ const AppEditor = {
|
|
|
13
13
|
//#region editors/document-editor/module.ts
|
|
14
14
|
/** Document editor module for the "powerhouse/document-editor" document type */
|
|
15
15
|
const DocumentEditorEditor = {
|
|
16
|
-
Component: lazy(() => import("./editor-
|
|
16
|
+
Component: lazy(() => import("./editor-DFEeM_dy.js")),
|
|
17
17
|
documentTypes: ["powerhouse/document-editor"],
|
|
18
18
|
config: {
|
|
19
19
|
id: "document-editor-editor",
|
|
@@ -66,4 +66,4 @@ const VetraPackageEditor = {
|
|
|
66
66
|
//#endregion
|
|
67
67
|
export { DocumentEditorEditor as a, ProcessorModuleEditor as i, VetraDriveApp as n, AppEditor as o, SubgraphModuleEditor as r, VetraPackageEditor as t };
|
|
68
68
|
|
|
69
|
-
//# sourceMappingURL=module-
|
|
69
|
+
//# sourceMappingURL=module-CdpGkPNN.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-
|
|
1
|
+
{"version":3,"file":"module-CdpGkPNN.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":["/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { EditorModule } from \"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","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { EditorModule } from \"document-model\";\nimport { lazy } from \"react\";\n\n/** Document editor module for the \"powerhouse/document-editor\" document type */\nexport const DocumentEditorEditor: 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","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { EditorModule } from \"document-model\";\nimport { lazy } from \"react\";\n\n/** Document editor module for the \"powerhouse/processor\" document type */\nexport const ProcessorModuleEditor: 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","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { EditorModule } from \"document-model\";\nimport { lazy } from \"react\";\n\n/** Document editor module for the \"powerhouse/subgraph\" document type */\nexport const SubgraphModuleEditor: 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","/**\n * WARNING: DO NOT EDIT\n * This file is auto-generated and updated by codegen\n */\nimport type { EditorModule } from \"document-model\";\nimport { lazy } from \"react\";\n\n/** Document editor module for the \"powerhouse/package\" document type */\nexport const VetraPackageEditor: EditorModule = {\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":";;;AAQA,MAAa,YAA0B;CACrC,WAAW,WAAW,OAAO,uBAAc;CAC3C,eAAe,CAAC,gBAAgB;CAChC,QAAQ;EACN,IAAI;EACJ,MAAM;CACR;AACF;;;;ACPA,MAAa,uBAAqC;CAChD,WAAW,WAAW,OAAO,uBAAc;CAC3C,eAAe,CAAC,4BAA4B;CAC5C,QAAQ;EACN,IAAI;EACJ,MAAM;CACR;AACF;;;;ACPA,MAAa,wBAAsC;CACjD,WAAW,WAAW,OAAO,uBAAc;CAC3C,eAAe,CAAC,sBAAsB;CACtC,QAAQ;EACN,IAAI;EACJ,MAAM;CACR;AACF;;;;ACPA,MAAa,uBAAqC;CAChD,WAAW,WAAW,OAAO,uBAAc;CAC3C,eAAe,CAAC,qBAAqB;CACrC,QAAQ;EACN,IAAI;EACJ,MAAM;CACR;AACF;;;ACZA,MAAa,gBAA8B;CACzC,WAAW,WAAW,OAAO,uBAAc;CAC3C,eAAe,CAAC,2BAA2B;CAC3C,QAAQ;EACN,IAAI;EACJ,MAAM;CACR;AACF;;;;ACFA,MAAa,qBAAmC;CAC9C,WAAW,WAAW,OAAO,uBAAc;CAC3C,eAAe,CAAC,oBAAoB;CACpC,QAAQ;EACN,IAAI;EACJ,MAAM;CACR;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@powerhousedao/vetra",
|
|
3
|
-
"version": "6.2.3-dev.
|
|
3
|
+
"version": "6.2.3-dev.44",
|
|
4
4
|
"license": "AGPL-3.0-only",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -61,19 +61,19 @@
|
|
|
61
61
|
"./package.json": "./package.json"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@powerhousedao/codegen": "6.2.3-dev.
|
|
65
|
-
"@powerhousedao/config": "6.2.3-dev.
|
|
66
|
-
"@powerhousedao/design-system": "6.2.3-dev.
|
|
67
|
-
"@powerhousedao/reactor-browser": "6.2.3-dev.
|
|
68
|
-
"@powerhousedao/shared": "6.2.3-dev.
|
|
64
|
+
"@powerhousedao/codegen": "6.2.3-dev.44",
|
|
65
|
+
"@powerhousedao/config": "6.2.3-dev.44",
|
|
66
|
+
"@powerhousedao/design-system": "6.2.3-dev.44",
|
|
67
|
+
"@powerhousedao/reactor-browser": "6.2.3-dev.44",
|
|
68
|
+
"@powerhousedao/shared": "6.2.3-dev.44",
|
|
69
69
|
"change-case": "5.4.4",
|
|
70
|
-
"document-model": "6.2.3-dev.
|
|
70
|
+
"document-model": "6.2.3-dev.44",
|
|
71
71
|
"react": "19.2.6",
|
|
72
72
|
"zod": "4.3.6",
|
|
73
73
|
"tailwind-merge": "3.4.0"
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
|
-
"@powerhousedao/builder-tools": "6.2.3-dev.
|
|
76
|
+
"@powerhousedao/builder-tools": "6.2.3-dev.44",
|
|
77
77
|
"@tailwindcss/cli": "4.2.2",
|
|
78
78
|
"@testing-library/jest-dom": "^6.9.1",
|
|
79
79
|
"@testing-library/react": "^16.3.0",
|