@powerhousedao/vetra 6.2.0-dev.3 → 6.2.0-dev.31
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/codegen/index.d.ts +6 -91
- package/dist/codegen/index.d.ts.map +1 -1
- package/dist/codegen/index.js +2 -632
- package/dist/codegen/index.js.map +1 -1
- package/dist/codegen/spec.d.ts +2 -0
- package/dist/codegen/spec.js +2 -0
- package/dist/{connect-Bbz4cL8F.js → connect-CjGVphlq.js} +1 -1
- package/dist/{connect-Bbz4cL8F.js.map → connect-CjGVphlq.js.map} +1 -1
- package/dist/document-models/app-module/index.d.ts +1 -1
- package/dist/document-models/document-editor/index.d.ts +1 -1
- package/dist/document-models/index.d.ts +5 -5
- package/dist/document-models/processor-module/index.d.ts +1 -1
- package/dist/document-models/subgraph-module/index.d.ts +1 -1
- package/dist/document-models/vetra-package/index.d.ts +1 -1
- package/dist/{editor-Dz3cXtzn.js → editor-BmYxPe_4.js} +56 -56
- package/dist/editor-BmYxPe_4.js.map +1 -0
- package/dist/{editor-BamOOi9L.js → editor-CtN1Sy88.js} +11 -11
- package/dist/editor-CtN1Sy88.js.map +1 -0
- package/dist/{editor-je4HFt2f.js → editor-De5XaIXa.js} +32 -32
- package/dist/editor-De5XaIXa.js.map +1 -0
- package/dist/{editor-D-QqGEkw.js → editor-bA5TTxfU.js} +15 -15
- package/dist/editor-bA5TTxfU.js.map +1 -0
- package/dist/{editor-rYCWiter.js → editor-fNaLqnMc.js} +8 -8
- package/dist/editor-fNaLqnMc.js.map +1 -0
- package/dist/{editor-CM9tpwzR.js → editor-saGUzfCl.js} +17 -17
- package/dist/editor-saGUzfCl.js.map +1 -0
- package/dist/editors/components/index.js +1 -1
- package/dist/editors/components/index.js.map +1 -1
- package/dist/editors/hooks/index.js +1 -1
- package/dist/editors/index.js +1 -1
- package/dist/{factory-DcPyqWkY.js → factory-B6hBnFAf.js} +3 -3
- package/dist/{factory-DcPyqWkY.js.map → factory-B6hBnFAf.js.map} +1 -1
- package/dist/{factory-BkA-IvkR.js → factory-Cn0UwIFB.js} +2 -2
- package/dist/{factory-BkA-IvkR.js.map → factory-Cn0UwIFB.js.map} +1 -1
- package/dist/{hooks-Btogj1f0.js → hooks-D_8Uwk1s.js} +1 -1
- package/dist/{hooks-Btogj1f0.js.map → hooks-D_8Uwk1s.js.map} +1 -1
- package/dist/{index-BzDZOr5P.d.ts → index-BES2zg3c.d.ts} +4 -4
- package/dist/index-BES2zg3c.d.ts.map +1 -0
- package/dist/{index-DE_s19VI.d.ts → index-D2tNV62S.d.ts} +4 -4
- package/dist/index-D2tNV62S.d.ts.map +1 -0
- package/dist/{index-6u5B5ORH.d.ts → index-DMMMQaUe.d.ts} +4 -4
- package/dist/index-DMMMQaUe.d.ts.map +1 -0
- package/dist/{index-BL4jGAtJ.d.ts → index-HHjpYUNP.d.ts} +4 -4
- package/dist/index-HHjpYUNP.d.ts.map +1 -0
- package/dist/index.d.ts +5 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/{logger-CYkStoEb.js → logger-DLnGUZk9.js} +1 -1
- package/dist/{logger-CYkStoEb.js.map → logger-DLnGUZk9.js.map} +1 -1
- package/dist/module-1hr_ne9w.js.map +1 -1
- package/dist/{module-DvO77TZz.js → module-BhsG8kkn.js} +7 -7
- package/dist/{module-DvO77TZz.js.map → module-BhsG8kkn.js.map} +1 -1
- package/dist/{module-rS5YXFpM.d.ts → module-D3n9Z2mN.d.ts} +4 -4
- package/dist/module-D3n9Z2mN.d.ts.map +1 -0
- package/dist/{processor-BfQ_DU7u.js → processor-D2z8Eq93.js} +2 -2
- package/dist/{processor-BfQ_DU7u.js.map → processor-D2z8Eq93.js.map} +1 -1
- package/dist/processors/codegen/index.js +2 -2
- package/dist/processors/index.js +1 -1
- package/dist/processors/vetra-read-model/index.js +1 -1
- package/dist/spec-api-CT1DqmgF.js +640 -0
- package/dist/spec-api-CT1DqmgF.js.map +1 -0
- package/dist/specs-_7A7Tl_N.d.ts +90 -0
- package/dist/specs-_7A7Tl_N.d.ts.map +1 -0
- package/dist/switchboard-CvWiUgBP.js +8 -0
- package/dist/{switchboard-C_BapCdk.js.map → switchboard-CvWiUgBP.js.map} +1 -1
- package/dist/{useVetraDocument-tpjMF571.js → useVetraDocument-BpPD6DKR.js} +1 -1
- package/dist/{useVetraDocument-tpjMF571.js.map → useVetraDocument-BpPD6DKR.js.map} +1 -1
- package/dist/utils-B4KdjDnp.js.map +1 -1
- package/dist/utils-BiV3cs9Y.js.map +1 -1
- package/dist/utils-CkWB3DRk.js.map +1 -1
- package/dist/utils-D0ejTHeY.js.map +1 -1
- package/package.json +30 -11
- package/dist/editor-BamOOi9L.js.map +0 -1
- package/dist/editor-CM9tpwzR.js.map +0 -1
- package/dist/editor-D-QqGEkw.js.map +0 -1
- package/dist/editor-Dz3cXtzn.js.map +0 -1
- package/dist/editor-je4HFt2f.js.map +0 -1
- package/dist/editor-rYCWiter.js.map +0 -1
- package/dist/index-6u5B5ORH.d.ts.map +0 -1
- package/dist/index-BL4jGAtJ.d.ts.map +0 -1
- package/dist/index-BzDZOr5P.d.ts.map +0 -1
- package/dist/index-DE_s19VI.d.ts.map +0 -1
- package/dist/module-rS5YXFpM.d.ts.map +0 -1
- package/dist/switchboard-C_BapCdk.js +0 -8
|
@@ -1,6 +1,6 @@
|
|
|
1
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
|
-
import { t as useDebounce } from "./hooks-
|
|
3
|
-
import { t as useSelectedDriveVetraPackage } from "./useVetraDocument-
|
|
2
|
+
import { t as useDebounce } from "./hooks-D_8Uwk1s.js";
|
|
3
|
+
import { t as useSelectedDriveVetraPackage } from "./useVetraDocument-BpPD6DKR.js";
|
|
4
4
|
import { useSetPHDocumentEditorConfig } from "@powerhousedao/reactor-browser";
|
|
5
5
|
import { useCallback, useState } from "react";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -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-
|
|
33
|
+
className: "mb-2 block text-sm font-medium text-foreground",
|
|
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-
|
|
40
|
+
className: "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"
|
|
41
41
|
})] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
42
42
|
htmlFor: "package-description",
|
|
43
|
-
className: "mb-2 block text-sm font-medium text-
|
|
43
|
+
className: "mb-2 block text-sm font-medium text-foreground",
|
|
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-
|
|
50
|
+
className: "w-full resize-none 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"
|
|
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-
|
|
58
|
+
className: "mb-2 block text-sm font-medium text-foreground",
|
|
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-
|
|
68
|
+
className: "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",
|
|
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-
|
|
106
|
+
className: "mb-2 block text-sm font-medium text-foreground",
|
|
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-
|
|
113
|
+
className: "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"
|
|
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-
|
|
117
|
+
className: "mb-2 block text-sm font-medium text-foreground",
|
|
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-
|
|
124
|
+
className: "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"
|
|
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-
|
|
128
|
+
className: "mb-2 block text-sm font-medium text-foreground",
|
|
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-
|
|
150
|
+
className: "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"
|
|
151
151
|
}), /* @__PURE__ */ jsx("div", {
|
|
152
|
-
className: "flex min-h-[80px] flex-wrap gap-2 rounded-md border border-
|
|
152
|
+
className: "flex min-h-[80px] flex-wrap gap-2 rounded-md border border-border p-3",
|
|
153
153
|
children: keywords.map((keyword) => /* @__PURE__ */ jsxs("span", {
|
|
154
|
-
className: "inline-flex items-center rounded-sm border border-
|
|
154
|
+
className: "inline-flex items-center rounded-sm border border-info bg-info/10 px-2 py-0.5 text-xs text-info",
|
|
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-
|
|
160
|
+
className: "ml-1 text-info hover:hover-effect focus:outline-none",
|
|
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-
|
|
173
|
+
className: "mb-2 block text-sm font-medium text-foreground",
|
|
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-
|
|
180
|
+
className: "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"
|
|
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-
|
|
184
|
+
className: "mb-2 block text-sm font-medium text-foreground",
|
|
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-
|
|
191
|
+
className: "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"
|
|
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-
|
|
195
|
+
className: "mb-2 block text-sm font-medium text-foreground",
|
|
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
|
-
|
|
202
|
-
className: "w-full cursor-not-allowed rounded-md border border-
|
|
201
|
+
disabled: true,
|
|
202
|
+
className: "w-full cursor-not-allowed rounded-md border border-border bg-background px-3 py-2 text-foreground placeholder:text-muted-foreground disabled:disabled-effect"
|
|
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-
|
|
206
|
+
className: "mb-2 block text-sm font-medium text-foreground",
|
|
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
|
-
|
|
213
|
-
className: "w-full cursor-not-allowed rounded-md border border-
|
|
212
|
+
disabled: true,
|
|
213
|
+
className: "w-full cursor-not-allowed rounded-md border border-border bg-background px-3 py-2 text-foreground placeholder:text-muted-foreground disabled:disabled-effect"
|
|
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-
|
|
217
|
+
className: "mb-2 block text-sm font-medium text-foreground",
|
|
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
|
-
|
|
224
|
-
className: "w-full cursor-not-allowed rounded-md border border-
|
|
223
|
+
disabled: true,
|
|
224
|
+
className: "w-full cursor-not-allowed rounded-md border border-border bg-background px-3 py-2 text-foreground placeholder:text-muted-foreground disabled:disabled-effect"
|
|
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-
|
|
282
|
+
className: "bg-background p-6",
|
|
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-De5XaIXa.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-De5XaIXa.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-foreground\"\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-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 />\n </div>\n\n {/* Description Field */}\n <div>\n <label\n htmlFor=\"package-description\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\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-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 />\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-foreground\"\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-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 >\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-foreground\"\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-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 />\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-foreground\"\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-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 />\n </div>\n\n {/* Keywords Field */}\n <div>\n <label\n htmlFor=\"package-keywords\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\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-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 />\n <div className=\"flex min-h-[80px] flex-wrap gap-2 rounded-md border border-border p-3\">\n {keywords.map((keyword) => (\n <span\n key={keyword.id}\n className=\"inline-flex items-center rounded-sm border border-info bg-info/10 px-2 py-0.5 text-xs text-info\"\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-info hover:hover-effect focus:outline-none\"\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-foreground\"\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-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 />\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-foreground\"\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-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 />\n </div>\n\n {/* Version Field */}\n <div>\n <label\n htmlFor=\"package-version\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Version\n </label>\n <input\n id=\"package-version\"\n type=\"text\"\n placeholder=\"1.0.0-dev\"\n disabled\n className=\"w-full cursor-not-allowed rounded-md border border-border bg-background px-3 py-2 text-foreground placeholder:text-muted-foreground disabled:disabled-effect\"\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-foreground\"\n >\n License\n </label>\n <input\n id=\"package-license\"\n type=\"text\"\n placeholder=\"AGPL-3.0-only\"\n disabled\n className=\"w-full cursor-not-allowed rounded-md border border-border bg-background px-3 py-2 text-foreground placeholder:text-muted-foreground disabled:disabled-effect\"\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-foreground\"\n >\n Install with:\n </label>\n <input\n id=\"package-install\"\n type=\"text\"\n placeholder=\"@powerhousedao/todo-demo-package\"\n disabled\n className=\"w-full cursor-not-allowed rounded-md border border-border bg-background px-3 py-2 text-foreground placeholder:text-muted-foreground disabled:disabled-effect\"\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-background p-6\">\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;CAC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,qBAAC,OAAD;EAAK,WAAU;YAAf,CACG,kBAAkB,oBAAC,iBAAD,EAAmB,CAAA,EACtC,oBAAC,UAAD;GACE,MAAM,SAAS,MAAM,OAAO,QAAQ;GACpC,aAAa,SAAS,MAAM,OAAO,eAAe;GAClD,UAAU,SAAS,MAAM,OAAO,YAAY;GAC5C,WAAW,SAAS,MAAM,OAAO,OAAO,QAAQ;GAChD,cAAc,SAAS,MAAM,OAAO,OAAO,WAAW;GACtD,kBAAkB,SAAS,MAAM,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,7 +1,7 @@
|
|
|
1
1
|
import { b as setAppStatus, g as addDocumentType, h as setDragAndDropEnabled, v as removeDocumentType, x as setDocumentTypes, y as setAppName } from "./utils-B4KdjDnp.js";
|
|
2
2
|
import { s as useSelectedAppModuleDocument } from "./app-module-dG7ug7Cm.js";
|
|
3
3
|
import { StatusPill } from "./editors/components/index.js";
|
|
4
|
-
import { t as useDebounce } from "./hooks-
|
|
4
|
+
import { t as useDebounce } from "./hooks-D_8Uwk1s.js";
|
|
5
5
|
import { useDocumentTypesInSelectedDrive, useSetPHDocumentEditorConfig, useSupportedDocumentTypesInReactor } from "@powerhousedao/reactor-browser";
|
|
6
6
|
import { useCallback, useEffect, useState } from "react";
|
|
7
7
|
import { twMerge } from "tailwind-merge";
|
|
@@ -79,7 +79,7 @@ const AppEditorForm = () => {
|
|
|
79
79
|
/* @__PURE__ */ jsxs("div", {
|
|
80
80
|
className: "flex items-center justify-between",
|
|
81
81
|
children: [/* @__PURE__ */ jsx("h2", {
|
|
82
|
-
className: "text-lg font-medium text-
|
|
82
|
+
className: "text-lg font-medium text-foreground",
|
|
83
83
|
children: "App Configuration"
|
|
84
84
|
}), /* @__PURE__ */ jsx(StatusPill, {
|
|
85
85
|
status: status === "CONFIRMED" ? "confirmed" : "draft",
|
|
@@ -88,7 +88,7 @@ const AppEditorForm = () => {
|
|
|
88
88
|
}),
|
|
89
89
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
90
90
|
htmlFor: "app-name",
|
|
91
|
-
className: "mb-2 block text-sm font-medium text-
|
|
91
|
+
className: "mb-2 block text-sm font-medium text-foreground",
|
|
92
92
|
children: "App Name"
|
|
93
93
|
}), /* @__PURE__ */ jsx("input", {
|
|
94
94
|
id: "app-name",
|
|
@@ -96,18 +96,18 @@ const AppEditorForm = () => {
|
|
|
96
96
|
value: appName,
|
|
97
97
|
onChange: (e) => handleSetAppName(e.target.value),
|
|
98
98
|
disabled: isReadOnly,
|
|
99
|
-
className: twMerge("w-full rounded-md border border-
|
|
99
|
+
className: twMerge("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", isReadOnly ? "cursor-not-allowed bg-muted" : ""),
|
|
100
100
|
placeholder: "Enter app name"
|
|
101
101
|
})] }),
|
|
102
102
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
103
103
|
htmlFor: "document-types",
|
|
104
|
-
className: "mb-2 block text-sm font-medium text-
|
|
104
|
+
className: "mb-2 block text-sm font-medium text-foreground",
|
|
105
105
|
children: "Document Types"
|
|
106
106
|
}), /* @__PURE__ */ jsxs("div", {
|
|
107
107
|
className: "space-y-2",
|
|
108
108
|
children: [!isReadOnly && /* @__PURE__ */ jsxs("select", {
|
|
109
109
|
onChange: (e) => handleDocumentTypeSelection(e.target.value),
|
|
110
|
-
className: "w-full rounded-md border border-
|
|
110
|
+
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",
|
|
111
111
|
children: [
|
|
112
112
|
/* @__PURE__ */ jsx("option", { children: "Select a document type to add" }),
|
|
113
113
|
/* @__PURE__ */ jsx("option", { children: "--- Vetra drive document types ---" }),
|
|
@@ -139,21 +139,21 @@ const AppEditorForm = () => {
|
|
|
139
139
|
children: selectedDocumentTypes.length > 0 ? selectedDocumentTypes.map((type) => /* @__PURE__ */ jsxs("div", {
|
|
140
140
|
className: "flex items-center py-1",
|
|
141
141
|
children: [/* @__PURE__ */ jsx("span", {
|
|
142
|
-
className: "text-sm text-
|
|
142
|
+
className: "text-sm text-foreground",
|
|
143
143
|
children: type
|
|
144
144
|
}), !isReadOnly && /* @__PURE__ */ jsx("button", {
|
|
145
145
|
onClick: () => handleRemoveDocumentType(type),
|
|
146
|
-
className: "ml-2 text-
|
|
146
|
+
className: "ml-2 text-muted-foreground hover:hover-effect focus:outline-none",
|
|
147
147
|
children: "×"
|
|
148
148
|
})]
|
|
149
149
|
}, type)) : /* @__PURE__ */ jsx("span", {
|
|
150
|
-
className: "text-sm text-
|
|
150
|
+
className: "text-sm text-foreground",
|
|
151
151
|
children: "All documents (*)"
|
|
152
152
|
})
|
|
153
153
|
})]
|
|
154
154
|
})] }),
|
|
155
155
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h3", {
|
|
156
|
-
className: "mb-4 text-base font-medium text-
|
|
156
|
+
className: "mb-4 text-base font-medium text-foreground",
|
|
157
157
|
children: "Drag and Drop Settings"
|
|
158
158
|
}), /* @__PURE__ */ jsx("div", {
|
|
159
159
|
className: "mb-4",
|
|
@@ -166,9 +166,9 @@ const AppEditorForm = () => {
|
|
|
166
166
|
checked: isDragAndDropEnabled,
|
|
167
167
|
onChange: (e) => onDragAndDropToggle(e.target.checked),
|
|
168
168
|
disabled: isReadOnly,
|
|
169
|
-
className: twMerge("mr-2 size-4 rounded-sm border-
|
|
169
|
+
className: twMerge("mr-2 size-4 rounded-sm border-border text-info focus:ring-ring", isReadOnly ? "cursor-not-allowed" : "")
|
|
170
170
|
}), /* @__PURE__ */ jsx("span", {
|
|
171
|
-
className: "text-sm font-medium text-
|
|
171
|
+
className: "text-sm font-medium text-foreground",
|
|
172
172
|
children: "Enable drag and drop"
|
|
173
173
|
})]
|
|
174
174
|
})
|
|
@@ -176,7 +176,7 @@ const AppEditorForm = () => {
|
|
|
176
176
|
!isReadOnly && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("button", {
|
|
177
177
|
onClick: handleConfirm,
|
|
178
178
|
disabled: !appName.trim(),
|
|
179
|
-
className: "rounded-md bg-
|
|
179
|
+
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",
|
|
180
180
|
children: "Confirm"
|
|
181
181
|
}) })
|
|
182
182
|
]
|
|
@@ -190,11 +190,11 @@ const editorConfig = { isExternalControlsEnabled: false };
|
|
|
190
190
|
function Editor() {
|
|
191
191
|
useSetPHDocumentEditorConfig(editorConfig);
|
|
192
192
|
return /* @__PURE__ */ jsxs("div", {
|
|
193
|
-
className: "bg-
|
|
193
|
+
className: "bg-background p-6",
|
|
194
194
|
children: [/* @__PURE__ */ jsx(DocumentToolbar, {}), /* @__PURE__ */ jsx(AppEditorForm, {})]
|
|
195
195
|
});
|
|
196
196
|
}
|
|
197
197
|
//#endregion
|
|
198
198
|
export { Editor as default };
|
|
199
199
|
|
|
200
|
-
//# sourceMappingURL=editor-
|
|
200
|
+
//# sourceMappingURL=editor-bA5TTxfU.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-bA5TTxfU.js","names":[],"sources":["../editors/app-editor/components/AppEditorForm.tsx","../editors/app-editor/config.ts","../editors/app-editor/editor.tsx"],"sourcesContent":["import {\n useDocumentTypesInSelectedDrive,\n useSupportedDocumentTypesInReactor,\n} from \"@powerhousedao/reactor-browser\";\nimport {\n addDocumentType,\n removeDocumentType,\n setAppName,\n setAppStatus,\n setDocumentTypes,\n setDragAndDropEnabled,\n} from \"@powerhousedao/vetra/document-models/app-module\";\nimport { useCallback, useEffect, useState } from \"react\";\nimport { twMerge } from \"tailwind-merge\";\nimport { useSelectedAppModuleDocument } from \"../../../document-models/app-module/index.js\";\nimport { StatusPill } from \"../../components/index.js\";\nimport { useDebounce } from \"../../hooks/index.js\";\n\nconst ALL_IN_DRIVE = \"all-in-drive\";\nconst ALL_IN_REACTOR = \"all-in-reactor\";\nconst ALLOW_ANY = \"allow-any\";\n\nexport const AppEditorForm = () => {\n const [document, dispatch] = useSelectedAppModuleDocument();\n const documentName = document.state.global.name;\n const status = document.state.global.status;\n const isDragAndDropEnabled = document.state.global.isDragAndDropEnabled;\n const allowedDocumentTypes = document.state.global.allowedDocumentTypes;\n const [appName, handleSetAppName] = useState(documentName);\n const [isConfirmed, setIsConfirmed] = useState(status === \"CONFIRMED\");\n const documentTypesInSelectedDrive = useDocumentTypesInSelectedDrive();\n const supportedDocumentTypesInReactor = useSupportedDocumentTypesInReactor();\n const [selectedDocumentTypes, setSelectedDocumentTypes] = useState(\n allowedDocumentTypes ?? [],\n );\n\n // Use the debounce hook for name changes\n\n const onNameChange = useCallback(\n (name: string) => {\n if (name === documentName) return;\n console.log(\"onNameChange\", name);\n dispatch(setAppName({ name }));\n },\n [documentName, dispatch],\n );\n\n useDebounce(appName, onNameChange, 300);\n\n const onConfirm = () => {\n dispatch(setAppStatus({ status: \"CONFIRMED\" }));\n };\n\n const onDragAndDropToggle = (enabled: boolean) => {\n if (enabled === isDragAndDropEnabled) return;\n dispatch(setDragAndDropEnabled({ enabled }));\n };\n\n // Reset confirmation state if status changes back to DRAFT\n useEffect(() => {\n if (status === \"DRAFT\") {\n // 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 (appName.trim()) {\n setIsConfirmed(true); // Immediate UI update\n onConfirm();\n }\n };\n\n const handleAddDocumentType = (documentType: string) => {\n if (!documentType || selectedDocumentTypes.includes(documentType)) return;\n setSelectedDocumentTypes([...selectedDocumentTypes, documentType]);\n dispatch(addDocumentType({ documentType }));\n };\n\n const handleRemoveDocumentType = (documentType: string) => {\n setSelectedDocumentTypes(\n selectedDocumentTypes.filter((dt) => dt !== documentType),\n );\n dispatch(removeDocumentType({ documentType }));\n };\n\n const handleAddAllDocumentTypesInDrive = () => {\n const newDocumentTypes = [\n ...new Set([\n ...selectedDocumentTypes,\n ...(documentTypesInSelectedDrive ?? []),\n ]),\n ];\n setSelectedDocumentTypes(newDocumentTypes);\n dispatch(setDocumentTypes({ documentTypes: newDocumentTypes }));\n };\n\n const handleAddAllDocumentTypesInReactor = () => {\n const newDocumentTypes = [\n ...new Set([\n ...selectedDocumentTypes,\n ...(supportedDocumentTypesInReactor ?? []),\n ]),\n ];\n setSelectedDocumentTypes(newDocumentTypes);\n dispatch(setDocumentTypes({ documentTypes: newDocumentTypes }));\n };\n\n const handleAllowAnyDocumentType = () => {\n setSelectedDocumentTypes([]);\n dispatch(setDocumentTypes({ documentTypes: [] }));\n };\n\n const handleDocumentTypeSelection = (selectedValue: string) => {\n if (selectedValue === ALL_IN_DRIVE) {\n handleAddAllDocumentTypesInDrive();\n } else if (selectedValue === ALL_IN_REACTOR) {\n handleAddAllDocumentTypesInReactor();\n } else if (selectedValue === ALLOW_ANY) {\n handleAllowAnyDocumentType();\n } else {\n handleAddDocumentType(selectedValue);\n }\n };\n\n return (\n <div className=\"space-y-6 p-6\">\n <div className=\"flex items-center justify-between\">\n <h2 className=\"text-lg font-medium text-foreground\">\n App Configuration\n </h2>\n <StatusPill\n status={status === \"CONFIRMED\" ? \"confirmed\" : \"draft\"}\n label={status === \"CONFIRMED\" ? \"Confirmed\" : \"Draft\"}\n />\n </div>\n\n {/* App Name Field */}\n <div>\n <label\n htmlFor=\"app-name\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n App Name\n </label>\n <input\n id=\"app-name\"\n type=\"text\"\n value={appName}\n onChange={(e) => handleSetAppName(e.target.value)}\n disabled={isReadOnly}\n className={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 placeholder=\"Enter app name\"\n />\n </div>\n\n {/* Document Types Field */}\n <div>\n <label\n htmlFor=\"document-types\"\n className=\"mb-2 block text-sm font-medium text-foreground\"\n >\n Document Types\n </label>\n <div className=\"space-y-2\">\n {!isReadOnly && (\n <select\n onChange={(e) => handleDocumentTypeSelection(e.target.value)}\n className=\"w-full rounded-md border border-border px-3 py-2 text-foreground focus:border-transparent focus:ring-2 focus:ring-ring focus:outline-none\"\n >\n <option>Select a document type to add</option>\n <option>--- Vetra drive document types ---</option>\n <option value={ALL_IN_DRIVE}>\n Add all document types in Vetra drive\n </option>\n {documentTypesInSelectedDrive\n ?.filter((dt) => !selectedDocumentTypes.includes(dt))\n .map((docType) => (\n <option key={docType} value={docType}>\n {docType}\n </option>\n ))}\n <option>--- Reactor document types ---</option>\n <option value={ALL_IN_REACTOR}>\n Add all document types in Reactor\n </option>\n {supportedDocumentTypesInReactor\n ?.filter((dt) => !selectedDocumentTypes.includes(dt))\n .map((docType) => (\n <option key={docType} value={docType}>\n {docType}\n </option>\n ))}\n <option>--- Allow any document type ---</option>\n <option value={ALLOW_ANY}>Allow any document type</option>\n </select>\n )}\n <div className=\"space-y-1\">\n {selectedDocumentTypes.length > 0 ? (\n selectedDocumentTypes.map((type) => (\n <div key={type} className=\"flex items-center py-1\">\n <span className=\"text-sm text-foreground\">{type}</span>\n {!isReadOnly && (\n <button\n onClick={() => handleRemoveDocumentType(type)}\n className=\"ml-2 text-muted-foreground hover:hover-effect focus:outline-none\"\n >\n ×\n </button>\n )}\n </div>\n ))\n ) : (\n <span className=\"text-sm text-foreground\">All documents (*)</span>\n )}\n </div>\n </div>\n </div>\n\n {/* Drag and Drop Settings */}\n <div>\n <h3 className=\"mb-4 text-base font-medium text-foreground\">\n Drag and Drop Settings\n </h3>\n\n {/* Enable/Disable Switch */}\n <div className=\"mb-4\">\n <label htmlFor=\"drag-and-drop-enabled\" className=\"flex items-center\">\n <input\n id=\"drag-and-drop-enabled\"\n type=\"checkbox\"\n checked={isDragAndDropEnabled}\n onChange={(e) => onDragAndDropToggle(e.target.checked)}\n disabled={isReadOnly}\n className={twMerge(\n \"mr-2 size-4 rounded-sm border-border text-info focus:ring-ring\",\n isReadOnly ? \"cursor-not-allowed\" : \"\",\n )}\n />\n <span className=\"text-sm font-medium text-foreground\">\n Enable drag and drop\n </span>\n </label>\n </div>\n </div>\n\n {/* Confirm Button - only show if not in read-only mode */}\n {!isReadOnly && (\n <div>\n <button\n onClick={handleConfirm}\n disabled={!appName.trim()}\n className=\"rounded-md bg-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 { AppEditorForm } from \"./components/AppEditorForm.js\";\nimport { editorConfig } from \"./config.js\";\n\nexport default function Editor() {\n useSetPHDocumentEditorConfig(editorConfig);\n\n return (\n <div className=\"bg-background p-6\">\n <DocumentToolbar />\n <AppEditorForm />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;AAkBA,MAAM,eAAe;AACrB,MAAM,iBAAiB;AACvB,MAAM,YAAY;AAElB,MAAa,sBAAsB;CACjC,MAAM,CAAC,UAAU,YAAY,8BAA8B;CAC3D,MAAM,eAAe,SAAS,MAAM,OAAO;CAC3C,MAAM,SAAS,SAAS,MAAM,OAAO;CACrC,MAAM,uBAAuB,SAAS,MA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T,WAAW,MAAM,oBAAoB,EAAE,OAAO,QAAQ;MACtD,UAAU;MACV,WAAW,QACT,kEACA,aAAa,uBAAuB,GACrC;MACD,CAAA,EACF,oBAAC,QAAD;MAAM,WAAU;gBAAsC;MAE/C,CAAA,CACD;;IACJ,CAAA,CACF,EAAA,CAAA;GAGL,CAAC,cACA,oBAAC,OAAD,EAAA,UACE,oBAAC,UAAD;IACE,SAAS;IACT,UAAU,CAAC,QAAQ,MAAM;IACzB,WAAU;cACX;IAEQ,CAAA,EACL,CAAA;GAEJ;;;;;ACtQV,MAAa,eAAuC,EAClD,2BAA2B,OAC5B;;;ACCD,SAAwB,SAAS;AAC/B,8BAA6B,aAAa;AAE1C,QACE,qBAAC,OAAD;EAAK,WAAU;YAAf,CACE,oBAAC,iBAAD,EAAmB,CAAA,EACnB,oBAAC,eAAD,EAAiB,CAAA,CACb"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { g as setSubgraphStatus, h as setSubgraphName } from "./utils-BiV3cs9Y.js";
|
|
2
2
|
import { StatusPill } from "./editors/components/index.js";
|
|
3
|
-
import { t as useDebounce } from "./hooks-
|
|
4
|
-
import { r as useSelectedSubgraphModuleDocument } from "./useVetraDocument-
|
|
3
|
+
import { t as useDebounce } from "./hooks-D_8Uwk1s.js";
|
|
4
|
+
import { r as useSelectedSubgraphModuleDocument } from "./useVetraDocument-BpPD6DKR.js";
|
|
5
5
|
import { useSetPHDocumentEditorConfig } from "@powerhousedao/reactor-browser";
|
|
6
6
|
import { useCallback, useEffect, useState } from "react";
|
|
7
7
|
import { twMerge } from "tailwind-merge";
|
|
@@ -31,7 +31,7 @@ const SubgraphEditorForm = ({ subgraphName: initialSubgraphName = "", status = "
|
|
|
31
31
|
/* @__PURE__ */ jsxs("div", {
|
|
32
32
|
className: "flex items-center justify-between",
|
|
33
33
|
children: [/* @__PURE__ */ jsx("h2", {
|
|
34
|
-
className: "text-lg font-medium text-
|
|
34
|
+
className: "text-lg font-medium text-foreground",
|
|
35
35
|
children: "Subgraph Configuration"
|
|
36
36
|
}), /* @__PURE__ */ jsx(StatusPill, {
|
|
37
37
|
status: status === "CONFIRMED" ? "confirmed" : "draft",
|
|
@@ -40,7 +40,7 @@ const SubgraphEditorForm = ({ subgraphName: initialSubgraphName = "", status = "
|
|
|
40
40
|
}),
|
|
41
41
|
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("label", {
|
|
42
42
|
htmlFor: "subgraph-name",
|
|
43
|
-
className: "mb-2 block text-sm font-medium text-
|
|
43
|
+
className: "mb-2 block text-sm font-medium text-foreground",
|
|
44
44
|
children: "Subgraph Name"
|
|
45
45
|
}), /* @__PURE__ */ jsx("input", {
|
|
46
46
|
id: "subgraph-name",
|
|
@@ -48,13 +48,13 @@ const SubgraphEditorForm = ({ subgraphName: initialSubgraphName = "", status = "
|
|
|
48
48
|
value: subgraphName,
|
|
49
49
|
onChange: (e) => setSubgraphName(e.target.value),
|
|
50
50
|
disabled: isReadOnly,
|
|
51
|
-
className: twMerge("w-full rounded-md border border-
|
|
51
|
+
className: twMerge("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", isReadOnly ? "cursor-not-allowed bg-muted" : ""),
|
|
52
52
|
placeholder: "Enter subgraph name"
|
|
53
53
|
})] }),
|
|
54
54
|
!isReadOnly && /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx("button", {
|
|
55
55
|
onClick: handleConfirm,
|
|
56
56
|
disabled: !subgraphName.trim(),
|
|
57
|
-
className: "rounded-md bg-
|
|
57
|
+
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",
|
|
58
58
|
children: "Confirm"
|
|
59
59
|
}) })
|
|
60
60
|
]
|
|
@@ -76,7 +76,7 @@ function Editor() {
|
|
|
76
76
|
dispatch(setSubgraphStatus({ status: "CONFIRMED" }));
|
|
77
77
|
}, [dispatch]);
|
|
78
78
|
return /* @__PURE__ */ jsxs("div", {
|
|
79
|
-
className: "bg-
|
|
79
|
+
className: "bg-background p-6",
|
|
80
80
|
children: [/* @__PURE__ */ jsx(DocumentToolbar, {}), /* @__PURE__ */ jsx(SubgraphEditorForm, {
|
|
81
81
|
subgraphName: document.state.global.name ?? "",
|
|
82
82
|
status: document.state.global.status,
|
|
@@ -88,4 +88,4 @@ function Editor() {
|
|
|
88
88
|
//#endregion
|
|
89
89
|
export { Editor as default };
|
|
90
90
|
|
|
91
|
-
//# sourceMappingURL=editor-
|
|
91
|
+
//# sourceMappingURL=editor-fNaLqnMc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"editor-fNaLqnMc.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-foreground\">\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-foreground\"\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-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 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-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 {\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-background p-6\">\n <DocumentToolbar />\n <SubgraphEditorForm\n subgraphName={document.state.global.name ?? \"\"}\n status={document.state.global.status}\n onNameChange={onNameChange}\n onConfirm={onConfirm}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;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;eAAsC;KAE/C,CAAA,EACL,oBAAC,YAAD;KACE,QAAQ,WAAW,cAAc,cAAc;KAC/C,OAAO,WAAW,cAAc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