@powerhousedao/vetra 6.1.0-dev.12 → 6.1.0-dev.14
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/{app-module-CHTbm_9a.js → app-module-dG7ug7Cm.js} +3 -3
- package/dist/{app-module-CHTbm_9a.js.map → app-module-dG7ug7Cm.js.map} +1 -1
- package/dist/codegen/index.js +11 -11
- package/dist/codegen/index.js.map +1 -1
- package/dist/{document-editor--pHInvi3.js → document-editor-5gSBaTUM.js} +3 -3
- package/dist/{document-editor--pHInvi3.js.map → document-editor-5gSBaTUM.js.map} +1 -1
- package/dist/document-models/app-module/index.js +4 -4
- package/dist/document-models/document-editor/index.js +4 -4
- package/dist/document-models/index.js +5 -5
- package/dist/document-models/processor-module/index.js +4 -4
- package/dist/document-models/subgraph-module/index.js +4 -4
- package/dist/document-models/vetra-package/index.js +2 -2
- package/dist/{editor-Bba0kIIP.js → editor-BQxk6LrL.js} +17 -16
- package/dist/editor-BQxk6LrL.js.map +1 -0
- package/dist/{editor-BsM-iHdN.js → editor-ClvvgHg3.js} +8 -7
- package/dist/editor-ClvvgHg3.js.map +1 -0
- package/dist/{editor-CsLmxkXj.js → editor-DLluDQKM.js} +28 -28
- package/dist/editor-DLluDQKM.js.map +1 -0
- package/dist/{editor-D-IzvjvS.js → editor-Dw-NohMb.js} +17 -15
- package/dist/editor-Dw-NohMb.js.map +1 -0
- package/dist/{editor-BuV8eJum.js → editor-UWE1ab9Y.js} +13 -12
- package/dist/editor-UWE1ab9Y.js.map +1 -0
- package/dist/{editor-CLERZjRS.js → editor-fvDig5Bd.js} +83 -83
- package/dist/editor-fvDig5Bd.js.map +1 -0
- package/dist/editors/components/index.d.ts.map +1 -1
- package/dist/editors/components/index.js +2 -1
- package/dist/editors/components/index.js.map +1 -1
- package/dist/editors/index.js +1 -1
- package/dist/index-BPoF8P3O.d.ts.map +1 -1
- package/dist/index-BoGed4Fa.d.ts.map +1 -1
- package/dist/index-C4s0aLv3.d.ts.map +1 -1
- package/dist/index-ClaOdn_F.d.ts.map +1 -1
- package/dist/index.js +6 -6
- package/dist/{module-BV5uKc_X.js → module-1hr_ne9w.js} +3 -6
- package/dist/module-1hr_ne9w.js.map +1 -0
- package/dist/{module-CC1BnDod.js → module-BTlKlxoV.js} +7 -7
- package/dist/{module-CC1BnDod.js.map → module-BTlKlxoV.js.map} +1 -1
- package/dist/{module-D8H1Oetz.js → module-C0jUPu9F.js} +2 -2
- package/dist/{module-D8H1Oetz.js.map → module-C0jUPu9F.js.map} +1 -1
- package/dist/{module-BAE-Cdy6.js → module-CRq_lUkG.js} +2 -2
- package/dist/{module-BAE-Cdy6.js.map → module-CRq_lUkG.js.map} +1 -1
- package/dist/{module-BSpVJEfF.js → module-DP3bVbak.js} +2 -2
- package/dist/{module-BSpVJEfF.js.map → module-DP3bVbak.js.map} +1 -1
- package/dist/module-Drla4Vmn.d.ts.map +1 -1
- package/dist/{module-wcMEGEcg.js → module-mtR8W4L4.js} +2 -2
- package/dist/{module-wcMEGEcg.js.map → module-mtR8W4L4.js.map} +1 -1
- package/dist/{ph-factories-BIe1kTJb.js → ph-factories-BKH_LPa8.js} +2 -2
- package/dist/{ph-factories-BIe1kTJb.js.map → ph-factories-BKH_LPa8.js.map} +1 -1
- package/dist/{ph-factories-D6cQKmns.js → ph-factories-BL1-hdeG.js} +2 -2
- package/dist/{ph-factories-D6cQKmns.js.map → ph-factories-BL1-hdeG.js.map} +1 -1
- package/dist/{ph-factories-4ifueM1H.js → ph-factories-Dvy-HW6C.js} +2 -2
- package/dist/{ph-factories-4ifueM1H.js.map → ph-factories-Dvy-HW6C.js.map} +1 -1
- package/dist/{ph-factories-Bep45EPP.js → ph-factories-qCTFKODg.js} +2 -2
- package/dist/{ph-factories-Bep45EPP.js.map → ph-factories-qCTFKODg.js.map} +1 -1
- package/dist/{processor-module-D7kxj_HT.js → processor-module-NP3ktbdr.js} +3 -3
- package/dist/{processor-module-D7kxj_HT.js.map → processor-module-NP3ktbdr.js.map} +1 -1
- package/dist/{subgraph-module-DqsecQjc.js → subgraph-module-B_5B8e3I.js} +3 -3
- package/dist/{subgraph-module-DqsecQjc.js.map → subgraph-module-B_5B8e3I.js.map} +1 -1
- package/dist/{utils-A2M9gfq4.js → utils-B4KdjDnp.js} +3 -6
- package/dist/{utils-A2M9gfq4.js.map → utils-B4KdjDnp.js.map} +1 -1
- package/dist/{utils-DL6w0tV1.js → utils-BiV3cs9Y.js} +3 -6
- package/dist/{utils-DL6w0tV1.js.map → utils-BiV3cs9Y.js.map} +1 -1
- package/dist/{utils-CSA5LPj9.js → utils-CkWB3DRk.js} +3 -6
- package/dist/{utils-CSA5LPj9.js.map → utils-CkWB3DRk.js.map} +1 -1
- package/dist/{utils-D3lwZ3L6.js → utils-D0ejTHeY.js} +3 -6
- package/dist/{utils-D3lwZ3L6.js.map → utils-D0ejTHeY.js.map} +1 -1
- package/dist/{vetra-package-C0hmmUZX.js → vetra-package-Ds8CruJz.js} +2 -2
- package/dist/{vetra-package-C0hmmUZX.js.map → vetra-package-Ds8CruJz.js.map} +1 -1
- package/package.json +13 -12
- package/style.css +12 -0
- package/dist/editor-Bba0kIIP.js.map +0 -1
- package/dist/editor-BsM-iHdN.js.map +0 -1
- package/dist/editor-BuV8eJum.js.map +0 -1
- package/dist/editor-CLERZjRS.js.map +0 -1
- package/dist/editor-CsLmxkXj.js.map +0 -1
- package/dist/editor-D-IzvjvS.js.map +0 -1
- package/dist/module-BV5uKc_X.js.map +0 -1
- package/dist/style.css +0 -1038
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { g as setSubgraphStatus, h as setSubgraphName } from "./utils-
|
|
1
|
+
import { g as setSubgraphStatus, h as setSubgraphName } from "./utils-BiV3cs9Y.js";
|
|
2
2
|
import { StatusPill } from "./editors/components/index.js";
|
|
3
3
|
import { t as useDebounce } from "./hooks-Btogj1f0.js";
|
|
4
4
|
import { r as useSelectedSubgraphModuleDocument } from "./useVetraDocument-BQKyels4.js";
|
|
5
5
|
import { useSetPHDocumentEditorConfig } from "@powerhousedao/reactor-browser";
|
|
6
6
|
import { useCallback, useEffect, useState } from "react";
|
|
7
|
+
import { twMerge } from "tailwind-merge";
|
|
7
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
9
|
import { DocumentToolbar } from "@powerhousedao/design-system/connect";
|
|
9
10
|
//#region editors/subgraph-editor/components/SubgraphEditorForm.tsx
|
|
@@ -30,7 +31,7 @@ const SubgraphEditorForm = ({ subgraphName: initialSubgraphName = "", status = "
|
|
|
30
31
|
/* @__PURE__ */ jsxs("div", {
|
|
31
32
|
className: "flex items-center justify-between",
|
|
32
33
|
children: [/* @__PURE__ */ jsx("h2", {
|
|
33
|
-
className: "text-lg font-medium text-gray-900",
|
|
34
|
+
className: "text-lg font-medium text-gray-900 dark:text-slate-50",
|
|
34
35
|
children: "Subgraph Configuration"
|
|
35
36
|
}), /* @__PURE__ */ jsx(StatusPill, {
|
|
36
37
|
status: status === "CONFIRMED" ? "confirmed" : "draft",
|
|
@@ -39,7 +40,7 @@ const SubgraphEditorForm = ({ subgraphName: initialSubgraphName = "", status = "
|
|
|
39
40
|
}),
|
|
40
41
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
41
42
|
htmlFor: "subgraph-name",
|
|
42
|
-
className: "mb-2 block text-sm font-medium text-gray-700",
|
|
43
|
+
className: "mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200",
|
|
43
44
|
children: "Subgraph Name"
|
|
44
45
|
}), /* @__PURE__ */ jsx("input", {
|
|
45
46
|
id: "subgraph-name",
|
|
@@ -47,13 +48,13 @@ const SubgraphEditorForm = ({ subgraphName: initialSubgraphName = "", status = "
|
|
|
47
48
|
value: subgraphName,
|
|
48
49
|
onChange: (e) => setSubgraphName(e.target.value),
|
|
49
50
|
disabled: isReadOnly,
|
|
50
|
-
className:
|
|
51
|
+
className: twMerge("w-full rounded-md border border-gray-300 px-3 py-2 placeholder:text-gray-700 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100 dark:placeholder:text-slate-200", isReadOnly ? "cursor-not-allowed bg-gray-100 dark:bg-slate-700" : ""),
|
|
51
52
|
placeholder: "Enter subgraph name"
|
|
52
53
|
})] }),
|
|
53
54
|
!isReadOnly && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("button", {
|
|
54
55
|
onClick: handleConfirm,
|
|
55
56
|
disabled: !subgraphName.trim(),
|
|
56
|
-
className: "rounded-md bg-blue-600 px-4 py-2 text-white hover:bg-blue-700 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:outline-none disabled:cursor-not-allowed disabled:bg-gray-300",
|
|
57
|
+
className: "rounded-md bg-blue-600 px-4 py-2 text-white hover:bg-blue-700 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:outline-none disabled:cursor-not-allowed disabled:bg-gray-300 dark:bg-blue-300 dark:text-slate-900 dark:hover:bg-blue-200 dark:disabled:bg-slate-600 dark:disabled:text-slate-100",
|
|
57
58
|
children: "Confirm"
|
|
58
59
|
}) })
|
|
59
60
|
]
|
|
@@ -75,7 +76,7 @@ function Editor() {
|
|
|
75
76
|
dispatch(setSubgraphStatus({ status: "CONFIRMED" }));
|
|
76
77
|
}, [dispatch]);
|
|
77
78
|
return /* @__PURE__ */ jsxs("div", {
|
|
78
|
-
className: "bg-gray-50 p-6",
|
|
79
|
+
className: "bg-gray-50 p-6 dark:bg-slate-800",
|
|
79
80
|
children: [/* @__PURE__ */ jsx(DocumentToolbar, {}), /* @__PURE__ */ jsx(SubgraphEditorForm, {
|
|
80
81
|
subgraphName: document.state.global.name ?? "",
|
|
81
82
|
status: document.state.global.status,
|
|
@@ -87,4 +88,4 @@ function Editor() {
|
|
|
87
88
|
//#endregion
|
|
88
89
|
export { Editor as default };
|
|
89
90
|
|
|
90
|
-
//# sourceMappingURL=editor-
|
|
91
|
+
//# sourceMappingURL=editor-ClvvgHg3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-ClvvgHg3.js","names":[],"sources":["../editors/subgraph-editor/components/SubgraphEditorForm.tsx","../editors/subgraph-editor/config.ts","../editors/subgraph-editor/editor.tsx"],"sourcesContent":["import { useEffect, useState } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\nimport { StatusPill } from \"../../components/index.js\";\nimport { useDebounce } from \"../../hooks/index.js\";\n\nexport interface SubgraphEditorFormProps {\n subgraphName?: string;\n status?: string;\n onNameChange?: (name: string) => void;\n onConfirm?: () => void;\n}\n\nexport const SubgraphEditorForm: React.FC<SubgraphEditorFormProps> = ({\n subgraphName: initialSubgraphName = \"\",\n status = \"DRAFT\",\n onNameChange,\n onConfirm,\n}) => {\n const [subgraphName, setSubgraphName] = useState(initialSubgraphName);\n const [isConfirmed, setIsConfirmed] = useState(false);\n\n // Use the debounce hook for name changes\n useDebounce(subgraphName, onNameChange, 300);\n\n // Update local state when initialSubgraphName changes\n useEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setSubgraphName(initialSubgraphName);\n }, [initialSubgraphName]);\n\n // Reset confirmation state if status changes back to DRAFT\n useEffect(() => {\n if (status === \"DRAFT\") {\n // eslint-disable-next-line react-hooks/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 (subgraphName.trim()) {\n setIsConfirmed(true); // Immediate UI update\n onConfirm?.();\n }\n };\n\n return (\n <div className=\"space-y-6 p-6\">\n <div className=\"flex items-center justify-between\">\n <h2 className=\"text-lg font-medium text-gray-900 dark:text-slate-50\">\n Subgraph Configuration\n </h2>\n <StatusPill\n status={status === \"CONFIRMED\" ? \"confirmed\" : \"draft\"}\n label={status === \"CONFIRMED\" ? \"Confirmed\" : \"Draft\"}\n />\n </div>\n\n {/* Subgraph Name Field */}\n <div>\n <label\n htmlFor=\"subgraph-name\"\n className=\"mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200\"\n >\n Subgraph Name\n </label>\n <input\n id=\"subgraph-name\"\n type=\"text\"\n value={subgraphName}\n onChange={(e) => setSubgraphName(e.target.value)}\n disabled={isReadOnly}\n className={twMerge(\n \"w-full rounded-md border border-gray-300 px-3 py-2 placeholder:text-gray-700 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100 dark:placeholder:text-slate-200\",\n isReadOnly\n ? \"cursor-not-allowed bg-gray-100 dark:bg-slate-700\"\n : \"\",\n )}\n placeholder=\"Enter subgraph name\"\n />\n </div>\n\n {/* Confirm Button - only show if not in read-only mode */}\n {!isReadOnly && (\n <div>\n <button\n onClick={handleConfirm}\n disabled={!subgraphName.trim()}\n className=\"rounded-md bg-blue-600 px-4 py-2 text-white hover:bg-blue-700 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:outline-none disabled:cursor-not-allowed disabled:bg-gray-300 dark:bg-blue-300 dark:text-slate-900 dark:hover:bg-blue-200 dark:disabled:bg-slate-600 dark:disabled:text-slate-100\"\n >\n Confirm\n </button>\n </div>\n )}\n </div>\n );\n};\n","import type { PHDocumentEditorConfig } from \"@powerhousedao/reactor-browser\";\n\nexport const editorConfig: PHDocumentEditorConfig = {\n isExternalControlsEnabled: false,\n};\n","import { DocumentToolbar } from \"@powerhousedao/design-system/connect\";\nimport { useSetPHDocumentEditorConfig } from \"@powerhousedao/reactor-browser\";\nimport {\n setSubgraphName,\n setSubgraphStatus,\n} from \"@powerhousedao/vetra/document-models/subgraph-module\";\nimport { useCallback } from \"react\";\nimport { useSelectedSubgraphModuleDocument } from \"../hooks/useVetraDocument.js\";\nimport { SubgraphEditorForm } from \"./components/SubgraphEditorForm.js\";\nimport { editorConfig } from \"./config.js\";\n\nexport default function Editor() {\n useSetPHDocumentEditorConfig(editorConfig);\n const [document, dispatch] = useSelectedSubgraphModuleDocument();\n\n const onNameChange = useCallback(\n (name: string) => {\n if (name === document.state.global.name) return;\n dispatch(setSubgraphName({ name }));\n },\n [document.state.global.name, dispatch],\n );\n\n const onConfirm = useCallback(() => {\n dispatch(setSubgraphStatus({ status: \"CONFIRMED\" }));\n }, [dispatch]);\n\n return (\n <div className=\"bg-gray-50 p-6 dark:bg-slate-800\">\n <DocumentToolbar />\n <SubgraphEditorForm\n subgraphName={document.state.global.name ?? \"\"}\n status={document.state.global.status}\n onNameChange={onNameChange}\n onConfirm={onConfirm}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AAYA,MAAa,sBAAyD,EACpE,cAAc,sBAAsB,IACpC,SAAS,SACT,cACA,gBACI;CACJ,MAAM,CAAC,cAAc,mBAAmB,SAAS,oBAAoB;CACrE,MAAM,CAAC,aAAa,kBAAkB,SAAS,MAAM;AAGrD,aAAY,cAAc,cAAc,IAAI;AAG5C,iBAAgB;AAEd,kBAAgB,oBAAoB;IACnC,CAAC,oBAAoB,CAAC;AAGzB,iBAAgB;AACd,MAAI,WAAW,QAEb,gBAAe,MAAM;IAEtB,CAAC,OAAO,CAAC;CAGZ,MAAM,aAAa,eAAe,WAAW;CAE7C,MAAM,sBAAsB;AAC1B,MAAI,aAAa,MAAM,EAAE;AACvB,kBAAe,KAAK;AACpB,gBAAa;;;AAIjB,QACE,qBAAC,OAAD;EAAK,WAAU;YAAf;GACE,qBAAC,OAAD;IAAK,WAAU;cAAf,CACE,oBAAC,MAAD;KAAI,WAAU;eAAuD;KAEhE,CAAA,EACL,oBAAC,YAAD;KACE,QAAQ,WAAW,cAAc,cAAc;KAC/C,OAAO,WAAW,cAAc,cAAc;KAC9C,CAAA,CACE;;GAGN,qBAAC,OAAD,EAAA,UAAA,CACE,oBAAC,SAAD;IACE,SAAQ;IACR,WAAU;cACX;IAEO,CAAA,EACR,oBAAC,SAAD;IACE,IAAG;IACH,MAAK;IACL,OAAO;IACP,WAAW,MAAM,gBAAgB,EAAE,OAAO,MAAM;IAChD,UAAU;IACV,WAAW,QACT,yPACA,aACI,qDACA,GACL;IACD,aAAY;IACZ,CAAA,CACE,EAAA,CAAA;GAGL,CAAC,cACA,oBAAC,OAAD,EAAA,UACE,oBAAC,UAAD;IACE,SAAS;IACT,UAAU,CAAC,aAAa,MAAM;IAC9B,WAAU;cACX;IAEQ,CAAA,EACL,CAAA;GAEJ;;;;;AC9FV,MAAa,eAAuC,EAClD,2BAA2B,OAC5B;;;ACOD,SAAwB,SAAS;AAC/B,8BAA6B,aAAa;CAC1C,MAAM,CAAC,UAAU,YAAY,mCAAmC;CAEhE,MAAM,eAAe,aAClB,SAAiB;AAChB,MAAI,SAAS,SAAS,MAAM,OAAO,KAAM;AACzC,WAAS,gBAAgB,EAAE,MAAM,CAAC,CAAC;IAErC,CAAC,SAAS,MAAM,OAAO,MAAM,SAAS,CACvC;CAED,MAAM,YAAY,kBAAkB;AAClC,WAAS,kBAAkB,EAAE,QAAQ,aAAa,CAAC,CAAC;IACnD,CAAC,SAAS,CAAC;AAEd,QACE,qBAAC,OAAD;EAAK,WAAU;YAAf,CACE,oBAAC,iBAAD,EAAmB,CAAA,EACnB,oBAAC,oBAAD;GACE,cAAc,SAAS,MAAM,OAAO,QAAQ;GAC5C,QAAQ,SAAS,MAAM,OAAO;GAChB;GACH;GACX,CAAA,CACE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as setPackageCategory, D as setPackageNpmUrl, E as setPackageName, S as setPackageAuthorWebsite, T as setPackageGithubUrl, _ as addPackageKeyword, w as setPackageDescription, x as setPackageAuthorName, y as removePackageKeyword } from "./module-
|
|
1
|
+
import { C as setPackageCategory, D as setPackageNpmUrl, E as setPackageName, S as setPackageAuthorWebsite, T as setPackageGithubUrl, _ as addPackageKeyword, w as setPackageDescription, x as setPackageAuthorName, y as removePackageKeyword } from "./module-1hr_ne9w.js";
|
|
2
2
|
import { t as useDebounce } from "./hooks-Btogj1f0.js";
|
|
3
3
|
import { t as useSelectedDriveVetraPackage } from "./useVetraDocument-BQKyels4.js";
|
|
4
4
|
import { useSetPHDocumentEditorConfig } from "@powerhousedao/reactor-browser";
|
|
@@ -30,24 +30,24 @@ const MetaForm = (props) => {
|
|
|
30
30
|
className: "space-y-6",
|
|
31
31
|
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
32
32
|
htmlFor: "package-name",
|
|
33
|
-
className: "mb-2 block text-sm font-medium text-gray-700",
|
|
33
|
+
className: "mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200",
|
|
34
34
|
children: "Name"
|
|
35
35
|
}), /* @__PURE__ */ jsx("input", {
|
|
36
36
|
id: "package-name",
|
|
37
37
|
type: "text",
|
|
38
38
|
value: name,
|
|
39
39
|
onChange: (e) => setName(e.target.value),
|
|
40
|
-
className: "w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none"
|
|
40
|
+
className: "w-full rounded-md border border-gray-300 px-3 py-2 placeholder:text-gray-700 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100 dark:placeholder:text-slate-200"
|
|
41
41
|
})] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
42
42
|
htmlFor: "package-description",
|
|
43
|
-
className: "mb-2 block text-sm font-medium text-gray-700",
|
|
43
|
+
className: "mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200",
|
|
44
44
|
children: "Description"
|
|
45
45
|
}), /* @__PURE__ */ jsx("textarea", {
|
|
46
46
|
id: "package-description",
|
|
47
47
|
rows: 6,
|
|
48
48
|
value: description,
|
|
49
49
|
onChange: (e) => setDescription(e.target.value),
|
|
50
|
-
className: "w-full resize-none rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none"
|
|
50
|
+
className: "w-full resize-none rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100"
|
|
51
51
|
})] })]
|
|
52
52
|
}),
|
|
53
53
|
/* @__PURE__ */ jsxs("div", {
|
|
@@ -55,7 +55,7 @@ const MetaForm = (props) => {
|
|
|
55
55
|
children: [
|
|
56
56
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
57
57
|
htmlFor: "package-category",
|
|
58
|
-
className: "mb-2 block text-sm font-medium text-gray-700",
|
|
58
|
+
className: "mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200",
|
|
59
59
|
children: "Category"
|
|
60
60
|
}), /* @__PURE__ */ jsxs("select", {
|
|
61
61
|
id: "package-category",
|
|
@@ -65,7 +65,7 @@ const MetaForm = (props) => {
|
|
|
65
65
|
setCategory(newValue);
|
|
66
66
|
onCategoryChange?.(newValue);
|
|
67
67
|
},
|
|
68
|
-
className: "w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none",
|
|
68
|
+
className: "w-full rounded-md border border-gray-300 px-3 py-2 text-gray-900 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100",
|
|
69
69
|
children: [
|
|
70
70
|
/* @__PURE__ */ jsx("option", {
|
|
71
71
|
value: "",
|
|
@@ -103,29 +103,29 @@ const MetaForm = (props) => {
|
|
|
103
103
|
})] }),
|
|
104
104
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
105
105
|
htmlFor: "package-publisher",
|
|
106
|
-
className: "mb-2 block text-sm font-medium text-gray-700",
|
|
106
|
+
className: "mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200",
|
|
107
107
|
children: "Publisher"
|
|
108
108
|
}), /* @__PURE__ */ jsx("input", {
|
|
109
109
|
id: "package-publisher",
|
|
110
110
|
type: "text",
|
|
111
111
|
value: publisher,
|
|
112
112
|
onChange: (e) => setPublisher(e.target.value),
|
|
113
|
-
className: "w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none"
|
|
113
|
+
className: "w-full rounded-md border border-gray-300 px-3 py-2 placeholder:text-gray-700 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100 dark:placeholder:text-slate-200"
|
|
114
114
|
})] }),
|
|
115
115
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
116
116
|
htmlFor: "package-publisher-url",
|
|
117
|
-
className: "mb-2 block text-sm font-medium text-gray-700",
|
|
117
|
+
className: "mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200",
|
|
118
118
|
children: "Publisher URL"
|
|
119
119
|
}), /* @__PURE__ */ jsx("input", {
|
|
120
120
|
id: "package-publisher-url",
|
|
121
121
|
type: "text",
|
|
122
122
|
value: publisherUrl,
|
|
123
123
|
onChange: (e) => setPublisherUrl(e.target.value),
|
|
124
|
-
className: "w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none"
|
|
124
|
+
className: "w-full rounded-md border border-gray-300 px-3 py-2 placeholder:text-gray-700 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100 dark:placeholder:text-slate-200"
|
|
125
125
|
})] }),
|
|
126
126
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
127
127
|
htmlFor: "package-keywords",
|
|
128
|
-
className: "mb-2 block text-sm font-medium text-gray-700",
|
|
128
|
+
className: "mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200",
|
|
129
129
|
children: "Keywords"
|
|
130
130
|
}), /* @__PURE__ */ jsxs("div", {
|
|
131
131
|
className: "space-y-2",
|
|
@@ -147,17 +147,17 @@ const MetaForm = (props) => {
|
|
|
147
147
|
}
|
|
148
148
|
},
|
|
149
149
|
placeholder: "Type a keyword and press Enter",
|
|
150
|
-
className: "w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none"
|
|
150
|
+
className: "w-full rounded-md border border-gray-300 px-3 py-2 placeholder:text-gray-700 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100 dark:placeholder:text-slate-200"
|
|
151
151
|
}), /* @__PURE__ */ jsx("div", {
|
|
152
|
-
className: "flex min-h-[80px] flex-wrap gap-2 rounded-md border border-gray-300 p-3",
|
|
152
|
+
className: "flex min-h-[80px] flex-wrap gap-2 rounded-md border border-gray-300 p-3 dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100",
|
|
153
153
|
children: keywords.map((keyword) => /* @__PURE__ */ jsxs("span", {
|
|
154
|
-
className: "inline-flex items-center rounded-sm border border-blue-300 bg-blue-100 px-2 py-0.5 text-xs text-blue-800",
|
|
154
|
+
className: "inline-flex items-center rounded-sm border border-blue-300 bg-blue-100 px-2 py-0.5 text-xs text-blue-800 dark:border-blue-600 dark:bg-blue-800 dark:text-blue-100",
|
|
155
155
|
children: [keyword.label, /* @__PURE__ */ jsx("button", {
|
|
156
156
|
onClick: () => {
|
|
157
157
|
setKeywords(keywords.filter((k) => k.id !== keyword.id));
|
|
158
158
|
onRemoveKeyword?.(keyword.id);
|
|
159
159
|
},
|
|
160
|
-
className: "ml-1 text-blue-600 hover:text-blue-800 focus:outline-none",
|
|
160
|
+
className: "ml-1 text-blue-600 hover:text-blue-800 focus:outline-none dark:text-blue-100 dark:hover:text-blue-100",
|
|
161
161
|
children: "×"
|
|
162
162
|
})]
|
|
163
163
|
}, keyword.id))
|
|
@@ -170,58 +170,58 @@ const MetaForm = (props) => {
|
|
|
170
170
|
children: [
|
|
171
171
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
172
172
|
htmlFor: "package-github",
|
|
173
|
-
className: "mb-2 block text-sm font-medium text-gray-700",
|
|
173
|
+
className: "mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200",
|
|
174
174
|
children: "Github Repository"
|
|
175
175
|
}), /* @__PURE__ */ jsx("input", {
|
|
176
176
|
id: "package-github",
|
|
177
177
|
type: "text",
|
|
178
178
|
value: githubRepository,
|
|
179
179
|
onChange: (e) => setGithubRepository(e.target.value),
|
|
180
|
-
className: "w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none"
|
|
180
|
+
className: "w-full rounded-md border border-gray-300 px-3 py-2 placeholder:text-gray-700 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100 dark:placeholder:text-slate-200"
|
|
181
181
|
})] }),
|
|
182
182
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
183
183
|
htmlFor: "package-npm",
|
|
184
|
-
className: "mb-2 block text-sm font-medium text-gray-700",
|
|
184
|
+
className: "mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200",
|
|
185
185
|
children: "NPM-package"
|
|
186
186
|
}), /* @__PURE__ */ jsx("input", {
|
|
187
187
|
id: "package-npm",
|
|
188
188
|
type: "text",
|
|
189
189
|
value: npmPackage,
|
|
190
190
|
onChange: (e) => setNpmPackage(e.target.value),
|
|
191
|
-
className: "w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none"
|
|
191
|
+
className: "w-full rounded-md border border-gray-300 px-3 py-2 placeholder:text-gray-700 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100 dark:placeholder:text-slate-200"
|
|
192
192
|
})] }),
|
|
193
193
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
194
194
|
htmlFor: "package-version",
|
|
195
|
-
className: "mb-2 block text-sm font-medium text-gray-700",
|
|
195
|
+
className: "mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200",
|
|
196
196
|
children: "Version"
|
|
197
197
|
}), /* @__PURE__ */ jsx("input", {
|
|
198
198
|
id: "package-version",
|
|
199
199
|
type: "text",
|
|
200
200
|
placeholder: "1.0.0-dev",
|
|
201
201
|
readOnly: true,
|
|
202
|
-
className: "w-full cursor-not-allowed rounded-md border border-gray-300 bg-gray-50 px-3 py-2 text-gray-500"
|
|
202
|
+
className: "w-full cursor-not-allowed rounded-md border border-gray-300 bg-gray-50 px-3 py-2 text-gray-500 placeholder:text-gray-700 dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100 dark:placeholder:text-slate-200"
|
|
203
203
|
})] }),
|
|
204
204
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
205
205
|
htmlFor: "package-license",
|
|
206
|
-
className: "mb-2 block text-sm font-medium text-gray-700",
|
|
206
|
+
className: "mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200",
|
|
207
207
|
children: "License"
|
|
208
208
|
}), /* @__PURE__ */ jsx("input", {
|
|
209
209
|
id: "package-license",
|
|
210
210
|
type: "text",
|
|
211
211
|
placeholder: "AGPL-3.0-only",
|
|
212
212
|
readOnly: true,
|
|
213
|
-
className: "w-full cursor-not-allowed rounded-md border border-gray-300 bg-gray-50 px-3 py-2 text-gray-500"
|
|
213
|
+
className: "w-full cursor-not-allowed rounded-md border border-gray-300 bg-gray-50 px-3 py-2 text-gray-500 placeholder:text-gray-700 dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100 dark:placeholder:text-slate-200"
|
|
214
214
|
})] }),
|
|
215
215
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
216
216
|
htmlFor: "package-install",
|
|
217
|
-
className: "mb-2 block text-sm font-medium text-gray-700",
|
|
217
|
+
className: "mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200",
|
|
218
218
|
children: "Install with:"
|
|
219
219
|
}), /* @__PURE__ */ jsx("input", {
|
|
220
220
|
id: "package-install",
|
|
221
221
|
type: "text",
|
|
222
222
|
placeholder: "@powerhousedao/todo-demo-package",
|
|
223
223
|
readOnly: true,
|
|
224
|
-
className: "w-full cursor-not-allowed rounded-md border border-gray-300 bg-gray-50 px-3 py-2 text-gray-500"
|
|
224
|
+
className: "w-full cursor-not-allowed rounded-md border border-gray-300 bg-gray-50 px-3 py-2 text-gray-500 placeholder:text-gray-700 dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100 dark:placeholder:text-slate-200"
|
|
225
225
|
})] })
|
|
226
226
|
]
|
|
227
227
|
})
|
|
@@ -279,7 +279,7 @@ function Editor(props) {
|
|
|
279
279
|
dispatch(removePackageKeyword({ id }));
|
|
280
280
|
}, [dispatch]);
|
|
281
281
|
return /* @__PURE__ */ jsxs("div", {
|
|
282
|
-
className: "bg-gray-50 p-6",
|
|
282
|
+
className: "bg-gray-50 p-6 dark:bg-slate-800",
|
|
283
283
|
children: [displayToolbar && /* @__PURE__ */ jsx(DocumentToolbar, {}), /* @__PURE__ */ jsx(MetaForm, {
|
|
284
284
|
name: document.state.global.name ?? "",
|
|
285
285
|
description: document.state.global.description ?? "",
|
|
@@ -304,4 +304,4 @@ function Editor(props) {
|
|
|
304
304
|
//#endregion
|
|
305
305
|
export { Editor as default };
|
|
306
306
|
|
|
307
|
-
//# sourceMappingURL=editor-
|
|
307
|
+
//# sourceMappingURL=editor-DLluDQKM.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-DLluDQKM.js","names":[],"sources":["../editors/vetra-package/components/MetaForm.tsx","../editors/vetra-package/config.ts","../editors/vetra-package/editor.tsx"],"sourcesContent":["import { useState } from \"react\";\nimport type { Keyword } from \"../../../document-models/vetra-package/index.js\";\nimport { useDebounce } from \"../../hooks/index.js\";\n\nexport interface MetaFormProps {\n name: string;\n description: string;\n category: string;\n publisher: string;\n publisherUrl: string;\n githubRepository: string;\n npmPackage: string;\n keywords: Keyword[];\n onNameChange?: (name: string) => void;\n onDescriptionChange?: (description: string) => void;\n onCategoryChange?: (category: string) => void;\n onPublisherChange?: (publisher: string) => void;\n onPublisherUrlChange?: (publisherUrl: string) => void;\n onGithubRepositoryChange?: (githubRepository: string) => void;\n onNpmPackageChange?: (npmPackage: string) => void;\n onAddKeyword?: (keyword: { id: string; label: string }) => void;\n onRemoveKeyword?: (id: string) => void;\n}\n\nexport const MetaForm: React.FC<MetaFormProps> = (props) => {\n const {\n name: initialName,\n description: initialDescription,\n category: initialCategory,\n publisher: initialPublisher,\n publisherUrl: initialPublisherUrl,\n githubRepository: initialGithubRepository,\n npmPackage: initialNpmPackage,\n keywords: initialKeywords,\n onNameChange,\n onDescriptionChange,\n onCategoryChange,\n onPublisherChange,\n onPublisherUrlChange,\n onGithubRepositoryChange,\n onNpmPackageChange,\n onAddKeyword,\n onRemoveKeyword,\n } = props;\n\n const [name, setName] = useState(initialName);\n const [description, setDescription] = useState(initialDescription);\n const [category, setCategory] = useState(initialCategory);\n const [publisher, setPublisher] = useState(initialPublisher);\n const [publisherUrl, setPublisherUrl] = useState(initialPublisherUrl);\n const [githubRepository, setGithubRepository] = useState(\n initialGithubRepository,\n );\n const [npmPackage, setNpmPackage] = useState(initialNpmPackage);\n\n // Keywords state\n const [keywords, setKeywords] = useState<Keyword[]>(initialKeywords);\n const [keywordInput, setKeywordInput] = useState(\"\");\n\n // Use the debounce hook with callbacks\n useDebounce(name, onNameChange, 300);\n useDebounce(description, onDescriptionChange, 300);\n useDebounce(publisher, onPublisherChange, 300);\n useDebounce(publisherUrl, onPublisherUrlChange, 300);\n useDebounce(githubRepository, onGithubRepositoryChange, 300);\n useDebounce(npmPackage, onNpmPackageChange, 300);\n\n return (\n <div className=\"grid grid-cols-1 gap-6 p-6 lg:grid-cols-3\">\n {/* Left Column */}\n <div className=\"space-y-6\">\n {/* Name Field */}\n <div>\n <label\n htmlFor=\"package-name\"\n className=\"mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200\"\n >\n Name\n </label>\n <input\n id=\"package-name\"\n type=\"text\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n className=\"w-full rounded-md border border-gray-300 px-3 py-2 placeholder:text-gray-700 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100 dark:placeholder:text-slate-200\"\n />\n </div>\n\n {/* Description Field */}\n <div>\n <label\n htmlFor=\"package-description\"\n className=\"mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200\"\n >\n Description\n </label>\n <textarea\n id=\"package-description\"\n rows={6}\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n className=\"w-full resize-none rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100\"\n />\n </div>\n </div>\n\n {/* Middle Column */}\n <div className=\"space-y-6\">\n {/* Category Field */}\n <div>\n <label\n htmlFor=\"package-category\"\n className=\"mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200\"\n >\n Category\n </label>\n <select\n id=\"package-category\"\n value={category}\n onChange={(e) => {\n const newValue = e.target.value;\n setCategory(newValue);\n onCategoryChange?.(newValue);\n }}\n className=\"w-full rounded-md border border-gray-300 px-3 py-2 text-gray-900 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100\"\n >\n <option value=\"\">Not selected</option>\n <option value=\"Productivity\">Productivity</option>\n <option value=\"Governance\">Governance</option>\n <option value=\"Project Management\">Project Management</option>\n <option value=\"Finance\">Finance</option>\n <option value=\"Legal\">Legal</option>\n <option value=\"People & Culture\">People & Culture</option>\n <option value=\"Engineering\">Engineering</option>\n </select>\n </div>\n\n {/* Publisher Field */}\n <div>\n <label\n htmlFor=\"package-publisher\"\n className=\"mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200\"\n >\n Publisher\n </label>\n <input\n id=\"package-publisher\"\n type=\"text\"\n value={publisher}\n onChange={(e) => setPublisher(e.target.value)}\n className=\"w-full rounded-md border border-gray-300 px-3 py-2 placeholder:text-gray-700 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100 dark:placeholder:text-slate-200\"\n />\n </div>\n\n {/* Publisher URL Field */}\n <div>\n <label\n htmlFor=\"package-publisher-url\"\n className=\"mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200\"\n >\n Publisher URL\n </label>\n <input\n id=\"package-publisher-url\"\n type=\"text\"\n value={publisherUrl}\n onChange={(e) => setPublisherUrl(e.target.value)}\n className=\"w-full rounded-md border border-gray-300 px-3 py-2 placeholder:text-gray-700 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100 dark:placeholder:text-slate-200\"\n />\n </div>\n\n {/* Keywords Field */}\n <div>\n <label\n htmlFor=\"package-keywords\"\n className=\"mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200\"\n >\n Keywords\n </label>\n <div className=\"space-y-2\">\n <input\n id=\"package-keywords\"\n type=\"text\"\n value={keywordInput}\n onChange={(e) => setKeywordInput(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" && keywordInput.trim()) {\n e.preventDefault();\n const newKeyword = {\n id: Date.now().toString(), // Generate a unique ID\n label: keywordInput.trim(),\n };\n setKeywords([...keywords, newKeyword]);\n onAddKeyword?.(newKeyword);\n setKeywordInput(\"\");\n }\n }}\n placeholder=\"Type a keyword and press Enter\"\n className=\"w-full rounded-md border border-gray-300 px-3 py-2 placeholder:text-gray-700 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100 dark:placeholder:text-slate-200\"\n />\n <div className=\"flex min-h-[80px] flex-wrap gap-2 rounded-md border border-gray-300 p-3 dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100\">\n {keywords.map((keyword) => (\n <span\n key={keyword.id}\n className=\"inline-flex items-center rounded-sm border border-blue-300 bg-blue-100 px-2 py-0.5 text-xs text-blue-800 dark:border-blue-600 dark:bg-blue-800 dark:text-blue-100\"\n >\n {keyword.label}\n <button\n onClick={() => {\n setKeywords(keywords.filter((k) => k.id !== keyword.id));\n onRemoveKeyword?.(keyword.id);\n }}\n className=\"ml-1 text-blue-600 hover:text-blue-800 focus:outline-none dark:text-blue-100 dark:hover:text-blue-100\"\n >\n ×\n </button>\n </span>\n ))}\n </div>\n </div>\n </div>\n </div>\n\n {/* Right Column */}\n <div className=\"space-y-6\">\n {/* Github Repository Field */}\n <div>\n <label\n htmlFor=\"package-github\"\n className=\"mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200\"\n >\n Github Repository\n </label>\n <input\n id=\"package-github\"\n type=\"text\"\n value={githubRepository}\n onChange={(e) => setGithubRepository(e.target.value)}\n className=\"w-full rounded-md border border-gray-300 px-3 py-2 placeholder:text-gray-700 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100 dark:placeholder:text-slate-200\"\n />\n </div>\n\n {/* NPM-package Field */}\n <div>\n <label\n htmlFor=\"package-npm\"\n className=\"mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200\"\n >\n NPM-package\n </label>\n <input\n id=\"package-npm\"\n type=\"text\"\n value={npmPackage}\n onChange={(e) => setNpmPackage(e.target.value)}\n className=\"w-full rounded-md border border-gray-300 px-3 py-2 placeholder:text-gray-700 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100 dark:placeholder:text-slate-200\"\n />\n </div>\n\n {/* Version Field */}\n <div>\n <label\n htmlFor=\"package-version\"\n className=\"mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200\"\n >\n Version\n </label>\n <input\n id=\"package-version\"\n type=\"text\"\n placeholder=\"1.0.0-dev\"\n readOnly\n className=\"w-full cursor-not-allowed rounded-md border border-gray-300 bg-gray-50 px-3 py-2 text-gray-500 placeholder:text-gray-700 dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100 dark:placeholder:text-slate-200\"\n />\n </div>\n\n {/* License Field */}\n <div>\n <label\n htmlFor=\"package-license\"\n className=\"mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200\"\n >\n License\n </label>\n <input\n id=\"package-license\"\n type=\"text\"\n placeholder=\"AGPL-3.0-only\"\n readOnly\n className=\"w-full cursor-not-allowed rounded-md border border-gray-300 bg-gray-50 px-3 py-2 text-gray-500 placeholder:text-gray-700 dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100 dark:placeholder:text-slate-200\"\n />\n </div>\n\n {/* Install with Field */}\n <div>\n <label\n htmlFor=\"package-install\"\n className=\"mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200\"\n >\n Install with:\n </label>\n <input\n id=\"package-install\"\n type=\"text\"\n placeholder=\"@powerhousedao/todo-demo-package\"\n readOnly\n className=\"w-full cursor-not-allowed rounded-md border border-gray-300 bg-gray-50 px-3 py-2 text-gray-500 placeholder:text-gray-700 dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100 dark:placeholder:text-slate-200\"\n />\n </div>\n </div>\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 {\n addPackageKeyword,\n removePackageKeyword,\n setPackageAuthorName,\n setPackageAuthorWebsite,\n setPackageCategory,\n setPackageDescription,\n setPackageGithubUrl,\n setPackageName,\n setPackageNpmUrl,\n} from \"../../document-models/vetra-package/index.js\";\nimport { useSelectedDriveVetraPackage } from \"../hooks/useVetraDocument.js\";\nimport { MetaForm } from \"./components/MetaForm.js\";\nimport { editorConfig } from \"./config.js\";\n\nexport type EditorProps = {\n displayToolbar?: boolean;\n};\n\nexport default function Editor(props: EditorProps) {\n const { displayToolbar = true } = props;\n useSetPHDocumentEditorConfig(editorConfig);\n const [document, dispatch] = useSelectedDriveVetraPackage();\n\n const onNameChange = useCallback(\n (name: string) => {\n if (!document.state.global.name && !name) return;\n if (name === document.state.global.name) return;\n\n dispatch(setPackageName({ name }));\n },\n [document.state.global.name, dispatch],\n );\n\n const onDescriptionChange = useCallback(\n (description: string) => {\n if (!document.state.global.description && !description) return;\n if (description === document.state.global.description) return;\n\n dispatch(setPackageDescription({ description }));\n },\n [document.state.global.description, dispatch],\n );\n\n const onCategoryChange = useCallback(\n (category: string) => {\n if (!document.state.global.category && !category) return;\n if (category === document.state.global.category) return;\n\n dispatch(setPackageCategory({ category }));\n },\n [document.state.global.category, dispatch],\n );\n\n const onPublisherChange = useCallback(\n (name: string) => {\n if (!document.state.global.author.name && !name) return;\n if (name === document.state.global.author.name) return;\n\n dispatch(setPackageAuthorName({ name }));\n },\n [document.state.global.author.name, dispatch],\n );\n\n const onPublisherUrlChange = useCallback(\n (website: string) => {\n if (!document.state.global.author.website && !website) return;\n if (website === document.state.global.author.website) return;\n\n dispatch(setPackageAuthorWebsite({ website }));\n },\n [document.state.global.author.website, dispatch],\n );\n\n const onGithubRepositoryChange = useCallback(\n (url: string) => {\n if (!document.state.global.githubUrl && !url) return;\n if (url === document.state.global.githubUrl) return;\n\n dispatch(setPackageGithubUrl({ url }));\n },\n [document.state.global.githubUrl, dispatch],\n );\n\n const onNpmPackageChange = useCallback(\n (url: string) => {\n if (!document.state.global.npmUrl && !url) return;\n if (url === document.state.global.npmUrl) return;\n\n dispatch(setPackageNpmUrl({ url }));\n },\n [document.state.global.npmUrl, dispatch],\n );\n\n const onAddKeyword = useCallback(\n (keyword: { id: string; label: string }) => {\n dispatch(addPackageKeyword(keyword));\n },\n [dispatch],\n );\n\n const onRemoveKeyword = useCallback(\n (id: string) => {\n dispatch(removePackageKeyword({ id }));\n },\n [dispatch],\n );\n\n return (\n <div className=\"bg-gray-50 p-6 dark:bg-slate-800\">\n {displayToolbar && <DocumentToolbar />}\n <MetaForm\n name={document.state.global.name ?? \"\"}\n description={document.state.global.description ?? \"\"}\n category={document.state.global.category ?? \"\"}\n publisher={document.state.global.author.name ?? \"\"}\n publisherUrl={document.state.global.author.website ?? \"\"}\n githubRepository={document.state.global.githubUrl ?? \"\"}\n npmPackage={document.state.global.npmUrl ?? \"\"}\n keywords={document.state.global.keywords}\n onNameChange={onNameChange}\n onDescriptionChange={onDescriptionChange}\n onCategoryChange={onCategoryChange}\n onPublisherChange={onPublisherChange}\n onPublisherUrlChange={onPublisherUrlChange}\n onGithubRepositoryChange={onGithubRepositoryChange}\n onNpmPackageChange={onNpmPackageChange}\n onAddKeyword={onAddKeyword}\n onRemoveKeyword={onRemoveKeyword}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;AAwBA,MAAa,YAAqC,UAAU;CAC1D,MAAM,EACJ,MAAM,aACN,aAAa,oBACb,UAAU,iBACV,WAAW,kBACX,cAAc,qBACd,kBAAkB,yBAClB,YAAY,mBACZ,UAAU,iBACV,cACA,qBACA,kBACA,mBACA,sBACA,0BACA,oBACA,cACA,oBACE;CAEJ,MAAM,CAAC,MAAM,WAAW,SAAS,YAAY;CAC7C,MAAM,CAAC,aAAa,kBAAkB,SAAS,mBAAmB;CAClE,MAAM,CAAC,UAAU,eAAe,SAAS,gBAAgB;CACzD,MAAM,CAAC,WAAW,gBAAgB,SAAS,iBAAiB;CAC5D,MAAM,CAAC,cAAc,mBAAmB,SAAS,oBAAoB;CACrE,MAAM,CAAC,kBAAkB,uBAAuB,SAC9C,wBACD;CACD,MAAM,CAAC,YAAY,iBAAiB,SAAS,kBAAkB;CAG/D,MAAM,CAAC,UAAU,eAAe,S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AM,OAAO,aAAa;GACrD,YAAY,SAAS,MAAM,OAAO,UAAU;GAC5C,UAAU,SAAS,MAAM,OAAO;GAClB;GACO;GACH;GACC;GACG;GACI;GACN;GACN;GACG;GACjB,CAAA,CACE"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { _ as removeDocumentType, b as setProcessorStatus, h as addProcessorApp, m as addDocumentType, v as removeProcessorApp, x as setProcessorType, y as setProcessorName } from "./utils-
|
|
1
|
+
import { _ as removeDocumentType, b as setProcessorStatus, h as addProcessorApp, m as addDocumentType, v as removeProcessorApp, x as setProcessorType, y as setProcessorName } from "./utils-CkWB3DRk.js";
|
|
2
2
|
import { StatusPill } from "./editors/components/index.js";
|
|
3
3
|
import { n as useAvailableDocumentTypes, t as useDebounce } from "./hooks-Btogj1f0.js";
|
|
4
4
|
import { n as useSelectedProcessorModuleDocument } from "./useVetraDocument-BQKyels4.js";
|
|
5
5
|
import { useSetPHDocumentEditorConfig } from "@powerhousedao/reactor-browser";
|
|
6
6
|
import { PROCESSOR_APPS } from "@powerhousedao/shared/processors";
|
|
7
7
|
import { useCallback, useEffect, useState } from "react";
|
|
8
|
+
import { twMerge } from "tailwind-merge";
|
|
8
9
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
9
10
|
import { DocumentToolbar } from "@powerhousedao/design-system/connect";
|
|
10
11
|
//#region editors/processor-editor/components/ProcessorEditorForm.tsx
|
|
@@ -51,7 +52,7 @@ const ProcessorEditorForm = ({ processorName: initialProcessorName = "", process
|
|
|
51
52
|
/* @__PURE__ */ jsxs("div", {
|
|
52
53
|
className: "flex items-center justify-between",
|
|
53
54
|
children: [/* @__PURE__ */ jsx("h2", {
|
|
54
|
-
className: "text-lg font-medium text-gray-900",
|
|
55
|
+
className: "text-lg font-medium text-gray-900 dark:text-slate-50",
|
|
55
56
|
children: "Processor Configuration"
|
|
56
57
|
}), /* @__PURE__ */ jsx(StatusPill, {
|
|
57
58
|
status: status === "CONFIRMED" ? "confirmed" : "draft",
|
|
@@ -60,7 +61,7 @@ const ProcessorEditorForm = ({ processorName: initialProcessorName = "", process
|
|
|
60
61
|
}),
|
|
61
62
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
62
63
|
htmlFor: "processor-name",
|
|
63
|
-
className: "mb-2 block text-sm font-medium text-gray-700",
|
|
64
|
+
className: "mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200",
|
|
64
65
|
children: "Processor Name"
|
|
65
66
|
}), /* @__PURE__ */ jsx("input", {
|
|
66
67
|
id: "processor-name",
|
|
@@ -68,19 +69,19 @@ const ProcessorEditorForm = ({ processorName: initialProcessorName = "", process
|
|
|
68
69
|
value: processorName,
|
|
69
70
|
onChange: (e) => setProcessorName(e.target.value),
|
|
70
71
|
disabled: isReadOnly,
|
|
71
|
-
className:
|
|
72
|
+
className: twMerge("w-full rounded-md border border-gray-300 px-3 py-2 placeholder:text-gray-700 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100 dark:placeholder:text-slate-200", isReadOnly ? "cursor-not-allowed bg-gray-100 dark:bg-slate-700" : ""),
|
|
72
73
|
placeholder: "Enter processor name"
|
|
73
74
|
})] }),
|
|
74
75
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
75
76
|
htmlFor: "processor-type",
|
|
76
|
-
className: "mb-2 block text-sm font-medium text-gray-700",
|
|
77
|
+
className: "mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200",
|
|
77
78
|
children: "Type"
|
|
78
79
|
}), /* @__PURE__ */ jsxs("select", {
|
|
79
80
|
id: "processor-type",
|
|
80
81
|
value: processorType,
|
|
81
82
|
onChange: (e) => setProcessorType(e.target.value),
|
|
82
83
|
disabled: isReadOnly,
|
|
83
|
-
className:
|
|
84
|
+
className: twMerge("w-full rounded-md border border-gray-300 px-3 py-2 text-gray-900 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100", isReadOnly ? "cursor-not-allowed bg-gray-100 dark:bg-slate-700" : ""),
|
|
84
85
|
children: [
|
|
85
86
|
/* @__PURE__ */ jsx("option", {
|
|
86
87
|
value: "",
|
|
@@ -98,7 +99,7 @@ const ProcessorEditorForm = ({ processorName: initialProcessorName = "", process
|
|
|
98
99
|
})] }),
|
|
99
100
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
100
101
|
htmlFor: "document-types",
|
|
101
|
-
className: "mb-2 block text-sm font-medium text-gray-700",
|
|
102
|
+
className: "mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200",
|
|
102
103
|
children: "Document Types"
|
|
103
104
|
}), /* @__PURE__ */ jsxs("div", {
|
|
104
105
|
className: "space-y-2",
|
|
@@ -118,7 +119,7 @@ const ProcessorEditorForm = ({ processorName: initialProcessorName = "", process
|
|
|
118
119
|
}
|
|
119
120
|
setSelectedDocumentType("");
|
|
120
121
|
},
|
|
121
|
-
className: "w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none",
|
|
122
|
+
className: "w-full rounded-md border border-gray-300 px-3 py-2 text-gray-900 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100",
|
|
122
123
|
children: [/* @__PURE__ */ jsx("option", {
|
|
123
124
|
value: "",
|
|
124
125
|
children: "Select a document type to add"
|
|
@@ -131,11 +132,11 @@ const ProcessorEditorForm = ({ processorName: initialProcessorName = "", process
|
|
|
131
132
|
children: documentTypes.map((type) => /* @__PURE__ */ jsxs("div", {
|
|
132
133
|
className: "flex items-center py-1",
|
|
133
134
|
children: [/* @__PURE__ */ jsx("span", {
|
|
134
|
-
className: "text-sm text-gray-700",
|
|
135
|
+
className: "text-sm text-gray-700 dark:text-slate-200",
|
|
135
136
|
children: type.documentType
|
|
136
137
|
}), !isReadOnly && /* @__PURE__ */ jsx("button", {
|
|
137
138
|
onClick: () => handleRemoveDocumentType(type.id),
|
|
138
|
-
className: "ml-2 text-gray-400 hover:text-gray-600 focus:outline-none",
|
|
139
|
+
className: "ml-2 text-gray-400 hover:text-gray-600 focus:outline-none dark:text-slate-500 dark:hover:text-slate-300",
|
|
139
140
|
children: "×"
|
|
140
141
|
})]
|
|
141
142
|
}, type.id))
|
|
@@ -143,7 +144,7 @@ const ProcessorEditorForm = ({ processorName: initialProcessorName = "", process
|
|
|
143
144
|
})] }),
|
|
144
145
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
145
146
|
htmlFor: "processor-apps",
|
|
146
|
-
className: "mb-2 block text-sm font-medium text-gray-700",
|
|
147
|
+
className: "mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200",
|
|
147
148
|
children: "Processor Apps"
|
|
148
149
|
}), /* @__PURE__ */ jsxs("div", {
|
|
149
150
|
className: "space-y-2",
|
|
@@ -165,12 +166,13 @@ const ProcessorEditorForm = ({ processorName: initialProcessorName = "", process
|
|
|
165
166
|
}
|
|
166
167
|
}), /* @__PURE__ */ jsx("label", {
|
|
167
168
|
htmlFor: processorApp,
|
|
169
|
+
className: "text-gray-700 dark:text-slate-200",
|
|
168
170
|
children: processorApp
|
|
169
171
|
})]
|
|
170
172
|
}, processorApp)) }), /* @__PURE__ */ jsx("div", {
|
|
171
173
|
className: "space-y-1",
|
|
172
174
|
children: isReadOnly && processorApps.map((processorApp) => /* @__PURE__ */ jsx("span", {
|
|
173
|
-
className: "text-sm text-gray-700",
|
|
175
|
+
className: "text-sm text-gray-700 dark:text-slate-200",
|
|
174
176
|
children: processorApp
|
|
175
177
|
}, processorApp))
|
|
176
178
|
})]
|
|
@@ -178,7 +180,7 @@ const ProcessorEditorForm = ({ processorName: initialProcessorName = "", process
|
|
|
178
180
|
!isReadOnly && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("button", {
|
|
179
181
|
onClick: handleConfirm,
|
|
180
182
|
disabled: !canConfirm,
|
|
181
|
-
className: "rounded-md bg-blue-600 px-4 py-2 text-white hover:bg-blue-700 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:outline-none disabled:cursor-not-allowed disabled:bg-gray-300",
|
|
183
|
+
className: "rounded-md bg-blue-600 px-4 py-2 text-white hover:bg-blue-700 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:outline-none disabled:cursor-not-allowed disabled:bg-gray-300 dark:bg-blue-300 dark:text-slate-900 dark:hover:bg-blue-200 dark:disabled:bg-slate-600 dark:disabled:text-slate-100",
|
|
182
184
|
children: "Confirm"
|
|
183
185
|
}) })
|
|
184
186
|
]
|
|
@@ -219,7 +221,7 @@ function Editor() {
|
|
|
219
221
|
dispatch(removeProcessorApp({ processorApp }));
|
|
220
222
|
}, [dispatch]);
|
|
221
223
|
return /* @__PURE__ */ jsxs("div", {
|
|
222
|
-
className: "bg-gray-50 p-6",
|
|
224
|
+
className: "bg-gray-50 p-6 dark:bg-slate-800",
|
|
223
225
|
children: [/* @__PURE__ */ jsx(DocumentToolbar, {}), /* @__PURE__ */ jsx(ProcessorEditorForm, {
|
|
224
226
|
onNameChange,
|
|
225
227
|
onTypeChange,
|
|
@@ -239,4 +241,4 @@ function Editor() {
|
|
|
239
241
|
//#endregion
|
|
240
242
|
export { Editor as default };
|
|
241
243
|
|
|
242
|
-
//# sourceMappingURL=editor-
|
|
244
|
+
//# sourceMappingURL=editor-Dw-NohMb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-Dw-NohMb.js","names":[],"sources":["../editors/processor-editor/components/ProcessorEditorForm.tsx","../editors/processor-editor/config.ts","../editors/processor-editor/editor.tsx"],"sourcesContent":["import {\n PROCESSOR_APPS,\n type ProcessorApp,\n type ProcessorApps,\n} from \"@powerhousedao/shared/processors\";\nimport { useEffect, useState } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\nimport type { DocumentTypeItem } from \"../../../document-models/processor-module/index.js\";\nimport { StatusPill } from \"../../components/index.js\";\nimport { useAvailableDocumentTypes, useDebounce } from \"../../hooks/index.js\";\n\nexport interface ProcessorEditorFormProps {\n processorName?: string;\n processorType?: string;\n documentTypes?: DocumentTypeItem[];\n processorApps?: ProcessorApps;\n status?: string;\n onNameChange?: (name: string) => void;\n onTypeChange?: (type: string) => void;\n onAddDocumentType?: (id: string, documentType: string) => void;\n onRemoveDocumentType?: (id: string) => void;\n onAddProcessorApp?: (processorApp: ProcessorApp) => void;\n onRemoveProcessorApp?: (processorApp: ProcessorApp) => void;\n onConfirm?: () => void;\n}\n\nexport const ProcessorEditorForm: React.FC<ProcessorEditorFormProps> = ({\n processorName: initialProcessorName = \"\",\n processorType: initialProcessorType = \"\",\n documentTypes: initialDocumentTypes = [],\n processorApps: initialProcessorApps = [],\n status = \"DRAFT\",\n onNameChange,\n onTypeChange,\n onAddDocumentType,\n onRemoveDocumentType,\n onAddProcessorApp,\n onRemoveProcessorApp,\n onConfirm,\n}) => {\n const [processorName, setProcessorName] = useState(initialProcessorName);\n const [processorType, setProcessorType] = useState(initialProcessorType);\n const [documentTypes, setDocumentTypes] =\n useState<DocumentTypeItem[]>(initialDocumentTypes);\n const [selectedDocumentType, setSelectedDocumentType] = useState(\"\");\n const [processorApps, setProcessorApps] = useState(initialProcessorApps);\n const [isConfirmed, setIsConfirmed] = useState(false);\n\n // Get available document types from the hook (combines reactor and vetra drive)\n const availableDocumentTypes = useAvailableDocumentTypes();\n\n // Use the debounce hook for name and type changes\n useDebounce(processorName, onNameChange, 300);\n useDebounce(processorType, onTypeChange, 300);\n\n // Update local state when initial values change\n useEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setProcessorName(initialProcessorName);\n }, [initialProcessorName]);\n\n useEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setProcessorType(initialProcessorType);\n }, [initialProcessorType]);\n\n useEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setDocumentTypes(initialDocumentTypes);\n }, [initialDocumentTypes]);\n\n useEffect(() => {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setProcessorApps(initialProcessorApps);\n }, [initialProcessorApps]);\n\n // Reset confirmation state if status changes back to DRAFT\n useEffect(() => {\n if (status === \"DRAFT\") {\n // eslint-disable-next-line react-hooks/set-state-in-effect\n setIsConfirmed(false);\n }\n }, [status]);\n\n // Check if form should be read-only\n const isReadOnly = isConfirmed || status === \"CONFIRMED\";\n\n const handleConfirm = () => {\n if (\n processorName.trim() &&\n processorType &&\n documentTypes.length > 0 &&\n processorApps.length > 0\n ) {\n setIsConfirmed(true); // Immediate UI update\n onConfirm?.();\n }\n };\n\n const handleRemoveDocumentType = (id: string) => {\n setDocumentTypes(documentTypes.filter((dt) => dt.id !== id));\n onRemoveDocumentType?.(id);\n };\n\n const canConfirm =\n !!processorName.trim() &&\n !!processorType &&\n documentTypes.length > 0 &&\n processorApps.length > 0;\n\n return (\n <div className=\"space-y-6 p-6\">\n <div className=\"flex items-center justify-between\">\n <h2 className=\"text-lg font-medium text-gray-900 dark:text-slate-50\">\n Processor Configuration\n </h2>\n <StatusPill\n status={status === \"CONFIRMED\" ? \"confirmed\" : \"draft\"}\n label={status === \"CONFIRMED\" ? \"Confirmed\" : \"Draft\"}\n />\n </div>\n\n {/* Processor Name Field */}\n <div>\n <label\n htmlFor=\"processor-name\"\n className=\"mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200\"\n >\n Processor Name\n </label>\n <input\n id=\"processor-name\"\n type=\"text\"\n value={processorName}\n onChange={(e) => setProcessorName(e.target.value)}\n disabled={isReadOnly}\n className={twMerge(\n \"w-full rounded-md border border-gray-300 px-3 py-2 placeholder:text-gray-700 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100 dark:placeholder:text-slate-200\",\n isReadOnly\n ? \"cursor-not-allowed bg-gray-100 dark:bg-slate-700\"\n : \"\",\n )}\n placeholder=\"Enter processor name\"\n />\n </div>\n\n {/* Processor Type Dropdown */}\n <div>\n <label\n htmlFor=\"processor-type\"\n className=\"mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200\"\n >\n Type\n </label>\n <select\n id=\"processor-type\"\n value={processorType}\n onChange={(e) => setProcessorType(e.target.value)}\n disabled={isReadOnly}\n className={twMerge(\n \"w-full rounded-md border border-gray-300 px-3 py-2 text-gray-900 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100\",\n isReadOnly\n ? \"cursor-not-allowed bg-gray-100 dark:bg-slate-700\"\n : \"\",\n )}\n >\n <option value=\"\">Select type...</option>\n <option value=\"analytics\">Analytics</option>\n <option value=\"relational\">Relational Database</option>\n </select>\n </div>\n\n {/* Document Types Field */}\n <div>\n <label\n htmlFor=\"document-types\"\n className=\"mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200\"\n >\n Document Types\n </label>\n <div className=\"space-y-2\">\n {!isReadOnly && availableDocumentTypes.length > 0 && (\n <select\n id=\"document-types\"\n value={selectedDocumentType}\n onChange={(e) => {\n const selectedValue = e.target.value;\n if (\n selectedValue &&\n !documentTypes.some((dt) => dt.documentType === selectedValue)\n ) {\n const id = Date.now().toString();\n const newType: DocumentTypeItem = {\n id,\n documentType: selectedValue,\n };\n setDocumentTypes([...documentTypes, newType]);\n onAddDocumentType?.(id, selectedValue);\n }\n setSelectedDocumentType(\"\");\n }}\n className=\"w-full rounded-md border border-gray-300 px-3 py-2 text-gray-900 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100\"\n >\n <option value=\"\">Select a document type to add</option>\n {availableDocumentTypes\n .filter(\n (docType) =>\n !documentTypes.some((dt) => dt.documentType === docType),\n )\n .map((docType) => (\n <option key={docType} value={docType}>\n {docType}\n </option>\n ))}\n </select>\n )}\n <div className=\"space-y-1\">\n {documentTypes.map((type) => (\n <div key={type.id} className=\"flex items-center py-1\">\n <span className=\"text-sm text-gray-700 dark:text-slate-200\">\n {type.documentType}\n </span>\n {!isReadOnly && (\n <button\n onClick={() => handleRemoveDocumentType(type.id)}\n className=\"ml-2 text-gray-400 hover:text-gray-600 focus:outline-none dark:text-slate-500 dark:hover:text-slate-300\"\n >\n ×\n </button>\n )}\n </div>\n ))}\n </div>\n </div>\n </div>\n {/* Processor Apps Field */}\n <div>\n <label\n htmlFor=\"processor-apps\"\n className=\"mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200\"\n >\n Processor Apps\n </label>\n <div className=\"space-y-2\">\n {!isReadOnly && (\n <>\n {PROCESSOR_APPS.map((processorApp) => (\n <div key={processorApp} className=\"flex gap-1\">\n <input\n type=\"checkbox\"\n name={processorApp}\n id={processorApp}\n checked={processorApps.includes(processorApp)}\n onChange={(event) => {\n const isChecked = event.target.checked;\n if (isChecked) {\n setProcessorApps((processorApps) => [\n ...new Set([...processorApps, processorApp]),\n ]);\n onAddProcessorApp?.(processorApp);\n } else {\n if (processorApps.length > 1) {\n setProcessorApps((processorApps) =>\n processorApps.filter((p) => p !== processorApp),\n );\n onRemoveProcessorApp?.(processorApp);\n }\n }\n }}\n />\n <label\n htmlFor={processorApp}\n className=\"text-gray-700 dark:text-slate-200\"\n >\n {processorApp}\n </label>\n </div>\n ))}\n </>\n )}\n <div className=\"space-y-1\">\n {isReadOnly &&\n processorApps.map((processorApp) => (\n <span\n key={processorApp}\n className=\"text-sm text-gray-700 dark:text-slate-200\"\n >\n {processorApp}\n </span>\n ))}\n </div>\n </div>\n </div>\n {/* Confirm Button - only show if not in read-only mode */}\n {!isReadOnly && (\n <div>\n <button\n onClick={handleConfirm}\n disabled={!canConfirm}\n className=\"rounded-md bg-blue-600 px-4 py-2 text-white hover:bg-blue-700 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:outline-none disabled:cursor-not-allowed disabled:bg-gray-300 dark:bg-blue-300 dark:text-slate-900 dark:hover:bg-blue-200 dark:disabled:bg-slate-600 dark:disabled:text-slate-100\"\n >\n Confirm\n </button>\n </div>\n )}\n </div>\n );\n};\n","import type { PHDocumentEditorConfig } from \"@powerhousedao/reactor-browser\";\n\nexport const editorConfig: PHDocumentEditorConfig = {\n isExternalControlsEnabled: false,\n};\n","import { DocumentToolbar } from \"@powerhousedao/design-system/connect\";\nimport { useSetPHDocumentEditorConfig } from \"@powerhousedao/reactor-browser\";\nimport type {\n ProcessorApp,\n ProcessorApps,\n} from \"@powerhousedao/shared/processors\";\nimport { useCallback } from \"react\";\nimport {\n addDocumentType,\n addProcessorApp,\n removeDocumentType,\n removeProcessorApp,\n setProcessorName,\n setProcessorStatus,\n setProcessorType,\n} from \"../../document-models/processor-module/index.js\";\nimport { useSelectedProcessorModuleDocument } from \"../hooks/useVetraDocument.js\";\nimport { ProcessorEditorForm } from \"./components/ProcessorEditorForm.js\";\nimport { editorConfig } from \"./config.js\";\n\nexport default function Editor() {\n useSetPHDocumentEditorConfig(editorConfig);\n const [document, dispatch] = useSelectedProcessorModuleDocument();\n\n const onConfirm = useCallback(() => {\n // Dispatch all actions at once\n dispatch([setProcessorStatus({ status: \"CONFIRMED\" })]);\n }, [dispatch]);\n\n const onNameChange = useCallback(\n (name: string) => {\n if (name === document.state.global.name) return;\n dispatch(setProcessorName({ name }));\n },\n [document.state.global.name, dispatch],\n );\n\n const onTypeChange = useCallback(\n (type: string) => {\n if (type === document.state.global.type) return;\n dispatch(setProcessorType({ type }));\n },\n [document.state.global.type, dispatch],\n );\n\n const onAddDocumentType = useCallback(\n (id: string, documentType: string) => {\n dispatch(addDocumentType({ id, documentType }));\n },\n [dispatch],\n );\n\n const onRemoveDocumentType = useCallback(\n (id: string) => {\n dispatch(removeDocumentType({ id }));\n },\n [dispatch],\n );\n\n const onAddProcessorApp = useCallback(\n (processorApp: ProcessorApp) => {\n dispatch(addProcessorApp({ processorApp }));\n },\n [dispatch],\n );\n\n const onRemoveProcessorApp = useCallback(\n (processorApp: ProcessorApp) => {\n dispatch(removeProcessorApp({ processorApp }));\n },\n [dispatch],\n );\n\n return (\n <div className=\"bg-gray-50 p-6 dark:bg-slate-800\">\n <DocumentToolbar />\n <ProcessorEditorForm\n onNameChange={onNameChange}\n onTypeChange={onTypeChange}\n onAddDocumentType={onAddDocumentType}\n onRemoveDocumentType={onRemoveDocumentType}\n onAddProcessorApp={onAddProcessorApp}\n onRemoveProcessorApp={onRemoveProcessorApp}\n status={document.state.global.status}\n processorName={document.state.global.name ?? \"\"}\n processorType={document.state.global.type ?? \"\"}\n documentTypes={document.state.global.documentTypes ?? []}\n processorApps={document.state.global.processorApps as ProcessorApps}\n onConfirm={onConfirm}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;AA0BA,MAAa,uBAA2D,EACtE,eAAe,uBAAuB,IACtC,eAAe,uBAAuB,IACtC,eAAe,uBAAuB,EAAE,EACxC,eAAe,uBAAuB,EAAE,EACxC,SAAS,SACT,cACA,cACA,mBACA,sBACA,mBACA,sBACA,gBACI;CACJ,MAAM,CAAC,eAAe,oBAAoB,SAAS,qBAAqB;CACxE,MAAM,CAAC,eAAe,oBAAoB,SAAS,qBAAqB;CACxE,MAAM,CAAC,eAAe,oBACpB,SAA6B,qBAAqB;CACpD,MAAM,CAAC,sBAAsB,2BAA2B,SAAS,GAAG;CACpE,MAAM,CAAC,eAAe,oBAAoB,SAAS,qBAAqB;CACxE,MAAM,CAAC,aAAa,kBAAkB,SAAS,MAAM;CAGrD,MAAM,yBAAyB,2BAA2B;AAG1D,aAAY,eAAe,cAAc,IAAI;AAC7C,aAAY,eAAe,cAAc,IAAI;AAG7C,iBAAgB;AAEd,mBAAiB,qBAAqB;IACrC,CAAC,qBAAqB,CAAC;AAE1B,iBAAgB;AAEd,mBAAiB,qBAAqB;IACrC,CAAC,qBAAqB,CAAC;AAE1B,iBAAgB;AAEd,mBAAiB,qBAAqB;IACrC,CAAC,qBAAqB,CAAC;AAE1B,iB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AACzC,WAAS,iBAAiB,EAAE,MAAM,CAAC,CAAC;IAEtC,CAAC,SAAS,MAAM,OAAO,MAAM,SAAS,CACvC;CAED,MAAM,eAAe,aAClB,SAAiB;AAChB,MAAI,SAAS,SAAS,MAAM,OAAO,KAAM;AACzC,WAAS,iBAAiB,EAAE,MAAM,CAAC,CAAC;IAEtC,CAAC,SAAS,MAAM,OAAO,MAAM,SAAS,CACvC;CAED,MAAM,oBAAoB,aACvB,IAAY,iBAAyB;AACpC,WAAS,gBAAgB;GAAE;GAAI;GAAc,CAAC,CAAC;IAEjD,CAAC,SAAS,CACX;CAED,MAAM,uBAAuB,aAC1B,OAAe;AACd,WAAS,mBAAmB,EAAE,IAAI,CAAC,CAAC;IAEtC,CAAC,SAAS,CACX;CAED,MAAM,oBAAoB,aACvB,iBAA+B;AAC9B,WAAS,gBAAgB,EAAE,cAAc,CAAC,CAAC;IAE7C,CAAC,SAAS,CACX;CAED,MAAM,uBAAuB,aAC1B,iBAA+B;AAC9B,WAAS,mBAAmB,EAAE,cAAc,CAAC,CAAC;IAEhD,CAAC,SAAS,CACX;AAED,QACE,qBAAC,OAAD;EAAK,WAAU;YAAf,CACE,oBAAC,iBAAD,EAAmB,CAAA,EACnB,oBAAC,qBAAD;GACgB;GACA;GACK;GACG;GACH;GACG;GACtB,QAAQ,SAAS,MAAM,OAAO;GAC9B,eAAe,SAAS,MAAM,OAAO,QAAQ;GAC7C,eAAe,SAAS,MAAM,OAAO,QAAQ;GAC7C,eAAe,SAAS,MAAM,OAAO,iBAAiB,EAAE;GACxD,eAAe,SAAS,MAAM,OAAO;GAC1B;GACX,CAAA,CACE"}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { _ as setEditorName, g as removeDocumentType, m as addDocumentType, v as setEditorStatus } from "./utils-
|
|
2
|
-
import { s as useSelectedDocumentEditorDocument } from "./document-editor
|
|
1
|
+
import { _ as setEditorName, g as removeDocumentType, m as addDocumentType, v as setEditorStatus } from "./utils-D0ejTHeY.js";
|
|
2
|
+
import { s as useSelectedDocumentEditorDocument } from "./document-editor-5gSBaTUM.js";
|
|
3
3
|
import { StatusPill } from "./editors/components/index.js";
|
|
4
4
|
import { n as useAvailableDocumentTypes, t as useDebounce } from "./hooks-Btogj1f0.js";
|
|
5
5
|
import { useSetPHDocumentEditorConfig } from "@powerhousedao/reactor-browser";
|
|
6
6
|
import { Suspense, useCallback, useEffect, useState } from "react";
|
|
7
|
+
import { twMerge } from "tailwind-merge";
|
|
7
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
9
|
import { DocumentToolbar } from "@powerhousedao/design-system/connect";
|
|
9
10
|
//#region editors/document-editor/components/DocumentEditorForm.tsx
|
|
10
11
|
function DocumentTypeSelectUI(props) {
|
|
11
12
|
return /* @__PURE__ */ jsxs("select", {
|
|
12
13
|
id: "supported-document-types",
|
|
13
|
-
className: "w-full rounded-md border border-gray-300 px-3 py-2 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none",
|
|
14
|
+
className: "w-full rounded-md border border-gray-300 px-3 py-2 text-gray-900 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100",
|
|
14
15
|
...props,
|
|
15
16
|
children: [/* @__PURE__ */ jsx("option", {
|
|
16
17
|
value: "",
|
|
@@ -73,7 +74,7 @@ const DocumentEditorForm = ({ editorName: initialEditorName = "", documentTypes:
|
|
|
73
74
|
/* @__PURE__ */ jsxs("div", {
|
|
74
75
|
className: "flex items-center justify-between",
|
|
75
76
|
children: [/* @__PURE__ */ jsx("h2", {
|
|
76
|
-
className: "text-lg font-medium text-gray-900",
|
|
77
|
+
className: "text-lg font-medium text-gray-900 dark:text-slate-50",
|
|
77
78
|
children: "Editor Configuration"
|
|
78
79
|
}), /* @__PURE__ */ jsx(StatusPill, {
|
|
79
80
|
status: status === "CONFIRMED" ? "confirmed" : "draft",
|
|
@@ -82,7 +83,7 @@ const DocumentEditorForm = ({ editorName: initialEditorName = "", documentTypes:
|
|
|
82
83
|
}),
|
|
83
84
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
84
85
|
htmlFor: "editor-name",
|
|
85
|
-
className: "mb-2 block text-sm font-medium text-gray-700",
|
|
86
|
+
className: "mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200",
|
|
86
87
|
children: "Editor Name"
|
|
87
88
|
}), /* @__PURE__ */ jsx("input", {
|
|
88
89
|
id: "editor-name",
|
|
@@ -90,11 +91,11 @@ const DocumentEditorForm = ({ editorName: initialEditorName = "", documentTypes:
|
|
|
90
91
|
value: editorName,
|
|
91
92
|
onChange: (e) => setEditorName(e.target.value),
|
|
92
93
|
disabled: isReadOnly,
|
|
93
|
-
className:
|
|
94
|
+
className: twMerge("w-full rounded-md border border-gray-300 px-3 py-2 placeholder:text-gray-700 focus:border-transparent focus:ring-2 focus:ring-blue-500 focus:outline-none dark:border-slate-500 dark:bg-slate-600 dark:text-slate-100 dark:placeholder:text-slate-200", isReadOnly ? "cursor-not-allowed bg-gray-100 dark:bg-slate-700" : "")
|
|
94
95
|
})] }),
|
|
95
96
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
96
97
|
htmlFor: "supported-document-types",
|
|
97
|
-
className: "mb-2 block text-sm font-medium text-gray-700",
|
|
98
|
+
className: "mb-2 block text-sm font-medium text-gray-700 dark:text-slate-200",
|
|
98
99
|
children: "Supported Document Types"
|
|
99
100
|
}), /* @__PURE__ */ jsxs("div", {
|
|
100
101
|
className: "space-y-2",
|
|
@@ -111,14 +112,14 @@ const DocumentEditorForm = ({ editorName: initialEditorName = "", documentTypes:
|
|
|
111
112
|
children: documentTypes.map((type) => /* @__PURE__ */ jsxs("div", {
|
|
112
113
|
className: "flex items-center py-1",
|
|
113
114
|
children: [/* @__PURE__ */ jsx("span", {
|
|
114
|
-
className: "text-sm text-gray-700",
|
|
115
|
+
className: "text-sm text-gray-700 dark:text-slate-200",
|
|
115
116
|
children: type.documentType
|
|
116
117
|
}), !isReadOnly && /* @__PURE__ */ jsx("button", {
|
|
117
118
|
onClick: () => {
|
|
118
119
|
setDocumentTypes([]);
|
|
119
120
|
onRemoveDocumentType?.({ id: type.id });
|
|
120
121
|
},
|
|
121
|
-
className: "ml-2 text-gray-400 hover:text-gray-600 focus:outline-none",
|
|
122
|
+
className: "ml-2 text-gray-400 hover:text-gray-600 focus:outline-none dark:text-slate-500 dark:hover:text-slate-300",
|
|
122
123
|
children: "×"
|
|
123
124
|
})]
|
|
124
125
|
}, type.id))
|
|
@@ -127,7 +128,7 @@ const DocumentEditorForm = ({ editorName: initialEditorName = "", documentTypes:
|
|
|
127
128
|
!isReadOnly && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("button", {
|
|
128
129
|
onClick: handleConfirm,
|
|
129
130
|
disabled: !editorName.trim() || documentTypes.length === 0,
|
|
130
|
-
className: "rounded-md bg-blue-600 px-4 py-2 text-white hover:bg-blue-700 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:outline-none disabled:cursor-not-allowed disabled:bg-gray-300",
|
|
131
|
+
className: "rounded-md bg-blue-600 px-4 py-2 text-white hover:bg-blue-700 focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 focus:outline-none disabled:cursor-not-allowed disabled:bg-gray-300 dark:bg-blue-300 dark:text-slate-900 dark:hover:bg-blue-200 dark:disabled:bg-slate-600 dark:disabled:text-slate-100",
|
|
131
132
|
children: "Confirm"
|
|
132
133
|
}) })
|
|
133
134
|
]
|
|
@@ -156,7 +157,7 @@ function Editor() {
|
|
|
156
157
|
dispatch(setEditorStatus({ status: "CONFIRMED" }));
|
|
157
158
|
}, [dispatch]);
|
|
158
159
|
return /* @__PURE__ */ jsxs("div", {
|
|
159
|
-
className: "bg-gray-50 p-6",
|
|
160
|
+
className: "bg-gray-50 p-6 dark:bg-slate-800",
|
|
160
161
|
children: [/* @__PURE__ */ jsx(DocumentToolbar, {}), /* @__PURE__ */ jsx(DocumentEditorForm, {
|
|
161
162
|
status: document.state.global.status,
|
|
162
163
|
editorName: document.state.global.name ?? "",
|
|
@@ -171,4 +172,4 @@ function Editor() {
|
|
|
171
172
|
//#endregion
|
|
172
173
|
export { Editor as default };
|
|
173
174
|
|
|
174
|
-
//# sourceMappingURL=editor-
|
|
175
|
+
//# sourceMappingURL=editor-UWE1ab9Y.js.map
|