@powerhousedao/builder-tools 6.0.0-dev.6 → 6.0.0-dev.60
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/connect-utils/helpers.d.ts +1 -1
- package/dist/connect-utils/helpers.d.ts.map +1 -1
- package/dist/connect-utils/helpers.js +2 -2
- package/dist/connect-utils/helpers.js.map +1 -1
- package/dist/connect-utils/index.d.ts +0 -1
- package/dist/connect-utils/index.d.ts.map +1 -1
- package/dist/connect-utils/index.js +0 -1
- package/dist/connect-utils/index.js.map +1 -1
- package/dist/connect-utils/types.d.ts +0 -1
- package/dist/connect-utils/types.d.ts.map +1 -1
- package/dist/connect-utils/vite-config.d.ts.map +1 -1
- package/dist/connect-utils/vite-config.js +19 -4
- package/dist/connect-utils/vite-config.js.map +1 -1
- package/dist/editor-utils/index.d.ts +0 -2
- package/dist/editor-utils/index.d.ts.map +1 -1
- package/dist/editor-utils/index.js +0 -2
- package/dist/editor-utils/index.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +21 -108
- package/dist/browser.d.ts +0 -2
- package/dist/browser.d.ts.map +0 -1
- package/dist/browser.js +0 -2
- package/dist/browser.js.map +0 -1
- package/dist/connect-utils/env-config.d.ts +0 -844
- package/dist/connect-utils/env-config.d.ts.map +0 -1
- package/dist/connect-utils/env-config.js +0 -518
- package/dist/connect-utils/env-config.js.map +0 -1
- package/dist/document-model-editor/components/button.d.ts +0 -2
- package/dist/document-model-editor/components/button.d.ts.map +0 -1
- package/dist/document-model-editor/components/button.js +0 -8
- package/dist/document-model-editor/components/button.js.map +0 -1
- package/dist/document-model-editor/components/code-editors/constants.d.ts +0 -3
- package/dist/document-model-editor/components/code-editors/constants.d.ts.map +0 -1
- package/dist/document-model-editor/components/code-editors/constants.js +0 -38
- package/dist/document-model-editor/components/code-editors/constants.js.map +0 -1
- package/dist/document-model-editor/components/code-editors/factories.d.ts +0 -4
- package/dist/document-model-editor/components/code-editors/factories.d.ts.map +0 -1
- package/dist/document-model-editor/components/code-editors/factories.js +0 -47
- package/dist/document-model-editor/components/code-editors/factories.js.map +0 -1
- package/dist/document-model-editor/components/code-editors/graphql-editor.d.ts +0 -10
- package/dist/document-model-editor/components/code-editors/graphql-editor.d.ts.map +0 -1
- package/dist/document-model-editor/components/code-editors/graphql-editor.js +0 -73
- package/dist/document-model-editor/components/code-editors/graphql-editor.js.map +0 -1
- package/dist/document-model-editor/components/code-editors/hooks.d.ts +0 -23
- package/dist/document-model-editor/components/code-editors/hooks.d.ts.map +0 -1
- package/dist/document-model-editor/components/code-editors/hooks.js +0 -59
- package/dist/document-model-editor/components/code-editors/hooks.js.map +0 -1
- package/dist/document-model-editor/components/code-editors/json-editor.d.ts +0 -8
- package/dist/document-model-editor/components/code-editors/json-editor.d.ts.map +0 -1
- package/dist/document-model-editor/components/code-editors/json-editor.js +0 -47
- package/dist/document-model-editor/components/code-editors/json-editor.js.map +0 -1
- package/dist/document-model-editor/components/code-editors/linting.d.ts +0 -6
- package/dist/document-model-editor/components/code-editors/linting.d.ts.map +0 -1
- package/dist/document-model-editor/components/code-editors/linting.js +0 -59
- package/dist/document-model-editor/components/code-editors/linting.js.map +0 -1
- package/dist/document-model-editor/components/divider.d.ts +0 -8
- package/dist/document-model-editor/components/divider.d.ts.map +0 -1
- package/dist/document-model-editor/components/divider.js +0 -22
- package/dist/document-model-editor/components/divider.js.map +0 -1
- package/dist/document-model-editor/components/errors.d.ts +0 -6
- package/dist/document-model-editor/components/errors.d.ts.map +0 -1
- package/dist/document-model-editor/components/errors.js +0 -5
- package/dist/document-model-editor/components/errors.js.map +0 -1
- package/dist/document-model-editor/components/form.d.ts +0 -12
- package/dist/document-model-editor/components/form.d.ts.map +0 -1
- package/dist/document-model-editor/components/form.js +0 -43
- package/dist/document-model-editor/components/form.js.map +0 -1
- package/dist/document-model-editor/components/input.d.ts +0 -6
- package/dist/document-model-editor/components/input.d.ts.map +0 -1
- package/dist/document-model-editor/components/input.js +0 -9
- package/dist/document-model-editor/components/input.js.map +0 -1
- package/dist/document-model-editor/components/label.d.ts +0 -6
- package/dist/document-model-editor/components/label.d.ts.map +0 -1
- package/dist/document-model-editor/components/label.js +0 -10
- package/dist/document-model-editor/components/label.js.map +0 -1
- package/dist/document-model-editor/components/model-metadata-form.d.ts +0 -31
- package/dist/document-model-editor/components/model-metadata-form.d.ts.map +0 -1
- package/dist/document-model-editor/components/model-metadata-form.js +0 -70
- package/dist/document-model-editor/components/model-metadata-form.js.map +0 -1
- package/dist/document-model-editor/components/module-form.d.ts +0 -10
- package/dist/document-model-editor/components/module-form.d.ts.map +0 -1
- package/dist/document-model-editor/components/module-form.js +0 -22
- package/dist/document-model-editor/components/module-form.js.map +0 -1
- package/dist/document-model-editor/components/module.d.ts +0 -22
- package/dist/document-model-editor/components/module.d.ts.map +0 -1
- package/dist/document-model-editor/components/module.js +0 -10
- package/dist/document-model-editor/components/module.js.map +0 -1
- package/dist/document-model-editor/components/modules.d.ts +0 -20
- package/dist/document-model-editor/components/modules.d.ts.map +0 -1
- package/dist/document-model-editor/components/modules.js +0 -17
- package/dist/document-model-editor/components/modules.js.map +0 -1
- package/dist/document-model-editor/components/operation-description-form.d.ts +0 -9
- package/dist/document-model-editor/components/operation-description-form.d.ts.map +0 -1
- package/dist/document-model-editor/components/operation-description-form.js +0 -13
- package/dist/document-model-editor/components/operation-description-form.js.map +0 -1
- package/dist/document-model-editor/components/operation-error-form.d.ts +0 -13
- package/dist/document-model-editor/components/operation-error-form.d.ts.map +0 -1
- package/dist/document-model-editor/components/operation-error-form.js +0 -40
- package/dist/document-model-editor/components/operation-error-form.js.map +0 -1
- package/dist/document-model-editor/components/operation-errors.d.ts +0 -10
- package/dist/document-model-editor/components/operation-errors.d.ts.map +0 -1
- package/dist/document-model-editor/components/operation-errors.js +0 -17
- package/dist/document-model-editor/components/operation-errors.js.map +0 -1
- package/dist/document-model-editor/components/operation-form.d.ts +0 -13
- package/dist/document-model-editor/components/operation-form.d.ts.map +0 -1
- package/dist/document-model-editor/components/operation-form.js +0 -37
- package/dist/document-model-editor/components/operation-form.js.map +0 -1
- package/dist/document-model-editor/components/operation.d.ts +0 -23
- package/dist/document-model-editor/components/operation.d.ts.map +0 -1
- package/dist/document-model-editor/components/operation.js +0 -25
- package/dist/document-model-editor/components/operation.js.map +0 -1
- package/dist/document-model-editor/components/operations.d.ts +0 -18
- package/dist/document-model-editor/components/operations.d.ts.map +0 -1
- package/dist/document-model-editor/components/operations.js +0 -20
- package/dist/document-model-editor/components/operations.js.map +0 -1
- package/dist/document-model-editor/components/state-error.d.ts +0 -5
- package/dist/document-model-editor/components/state-error.d.ts.map +0 -1
- package/dist/document-model-editor/components/state-error.js +0 -21
- package/dist/document-model-editor/components/state-error.js.map +0 -1
- package/dist/document-model-editor/components/state-schemas.d.ts +0 -15
- package/dist/document-model-editor/components/state-schemas.d.ts.map +0 -1
- package/dist/document-model-editor/components/state-schemas.js +0 -81
- package/dist/document-model-editor/components/state-schemas.js.map +0 -1
- package/dist/document-model-editor/components/tabs.d.ts +0 -8
- package/dist/document-model-editor/components/tabs.d.ts.map +0 -1
- package/dist/document-model-editor/components/tabs.js +0 -13
- package/dist/document-model-editor/components/tabs.js.map +0 -1
- package/dist/document-model-editor/components/text-area.d.ts +0 -9
- package/dist/document-model-editor/components/text-area.d.ts.map +0 -1
- package/dist/document-model-editor/components/text-area.js +0 -27
- package/dist/document-model-editor/components/text-area.js.map +0 -1
- package/dist/document-model-editor/components/text-field.d.ts +0 -21
- package/dist/document-model-editor/components/text-field.d.ts.map +0 -1
- package/dist/document-model-editor/components/text-field.js +0 -80
- package/dist/document-model-editor/components/text-field.js.map +0 -1
- package/dist/document-model-editor/config.d.ts +0 -3
- package/dist/document-model-editor/config.d.ts.map +0 -1
- package/dist/document-model-editor/config.js +0 -4
- package/dist/document-model-editor/config.js.map +0 -1
- package/dist/document-model-editor/constants/documents.d.ts +0 -13
- package/dist/document-model-editor/constants/documents.d.ts.map +0 -1
- package/dist/document-model-editor/constants/documents.js +0 -18
- package/dist/document-model-editor/constants/documents.js.map +0 -1
- package/dist/document-model-editor/constants/graphql-kinds.d.ts +0 -9
- package/dist/document-model-editor/constants/graphql-kinds.d.ts.map +0 -1
- package/dist/document-model-editor/constants/graphql-kinds.js +0 -13
- package/dist/document-model-editor/constants/graphql-kinds.js.map +0 -1
- package/dist/document-model-editor/context/form-context.d.ts +0 -11
- package/dist/document-model-editor/context/form-context.d.ts.map +0 -1
- package/dist/document-model-editor/context/form-context.js +0 -4
- package/dist/document-model-editor/context/form-context.js.map +0 -1
- package/dist/document-model-editor/context/schema-context.d.ts +0 -18
- package/dist/document-model-editor/context/schema-context.d.ts.map +0 -1
- package/dist/document-model-editor/context/schema-context.js +0 -129
- package/dist/document-model-editor/context/schema-context.js.map +0 -1
- package/dist/document-model-editor/document-model-editor.stories.d.ts +0 -8
- package/dist/document-model-editor/document-model-editor.stories.d.ts.map +0 -1
- package/dist/document-model-editor/document-model-editor.stories.js +0 -267
- package/dist/document-model-editor/document-model-editor.stories.js.map +0 -1
- package/dist/document-model-editor/editor.d.ts +0 -2
- package/dist/document-model-editor/editor.d.ts.map +0 -1
- package/dist/document-model-editor/editor.js +0 -217
- package/dist/document-model-editor/editor.js.map +0 -1
- package/dist/document-model-editor/hooks/index.d.ts +0 -3
- package/dist/document-model-editor/hooks/index.d.ts.map +0 -1
- package/dist/document-model-editor/hooks/index.js +0 -3
- package/dist/document-model-editor/hooks/index.js.map +0 -1
- package/dist/document-model-editor/hooks/useDocumentModelDocument.d.ts +0 -5
- package/dist/document-model-editor/hooks/useDocumentModelDocument.d.ts.map +0 -1
- package/dist/document-model-editor/hooks/useDocumentModelDocument.js +0 -8
- package/dist/document-model-editor/hooks/useDocumentModelDocument.js.map +0 -1
- package/dist/document-model-editor/hooks/useFormField.d.ts +0 -13
- package/dist/document-model-editor/hooks/useFormField.d.ts.map +0 -1
- package/dist/document-model-editor/hooks/useFormField.js +0 -22
- package/dist/document-model-editor/hooks/useFormField.js.map +0 -1
- package/dist/document-model-editor/index.d.ts +0 -2
- package/dist/document-model-editor/index.d.ts.map +0 -1
- package/dist/document-model-editor/index.js +0 -2
- package/dist/document-model-editor/index.js.map +0 -1
- package/dist/document-model-editor/module.d.ts +0 -3
- package/dist/document-model-editor/module.d.ts.map +0 -1
- package/dist/document-model-editor/module.js +0 -10
- package/dist/document-model-editor/module.js.map +0 -1
- package/dist/document-model-editor/schemas/inputs.d.ts +0 -25
- package/dist/document-model-editor/schemas/inputs.d.ts.map +0 -1
- package/dist/document-model-editor/schemas/inputs.js +0 -71
- package/dist/document-model-editor/schemas/inputs.js.map +0 -1
- package/dist/document-model-editor/schemas/utils.d.ts +0 -3
- package/dist/document-model-editor/schemas/utils.d.ts.map +0 -1
- package/dist/document-model-editor/schemas/utils.js +0 -3
- package/dist/document-model-editor/schemas/utils.js.map +0 -1
- package/dist/document-model-editor/types/documents.d.ts +0 -26
- package/dist/document-model-editor/types/documents.d.ts.map +0 -1
- package/dist/document-model-editor/types/documents.js +0 -2
- package/dist/document-model-editor/types/documents.js.map +0 -1
- package/dist/document-model-editor/types.d.ts +0 -2
- package/dist/document-model-editor/types.d.ts.map +0 -1
- package/dist/document-model-editor/types.js +0 -2
- package/dist/document-model-editor/types.js.map +0 -1
- package/dist/document-model-editor/utils/helpers.d.ts +0 -112
- package/dist/document-model-editor/utils/helpers.d.ts.map +0 -1
- package/dist/document-model-editor/utils/helpers.js +0 -920
- package/dist/document-model-editor/utils/helpers.js.map +0 -1
- package/dist/document-model-editor/utils/linting.d.ts +0 -7
- package/dist/document-model-editor/utils/linting.d.ts.map +0 -1
- package/dist/document-model-editor/utils/linting.js +0 -49
- package/dist/document-model-editor/utils/linting.js.map +0 -1
- package/dist/document-model-editor/utils/style.d.ts +0 -3
- package/dist/document-model-editor/utils/style.d.ts.map +0 -1
- package/dist/document-model-editor/utils/style.js +0 -6
- package/dist/document-model-editor/utils/style.js.map +0 -1
- package/dist/editor-utils/hooks/index.d.ts +0 -2
- package/dist/editor-utils/hooks/index.d.ts.map +0 -1
- package/dist/editor-utils/hooks/index.js +0 -2
- package/dist/editor-utils/hooks/index.js.map +0 -1
- package/dist/editor-utils/hooks/useEnsInfo.d.ts +0 -15
- package/dist/editor-utils/hooks/useEnsInfo.d.ts.map +0 -1
- package/dist/editor-utils/hooks/useEnsInfo.js +0 -64
- package/dist/editor-utils/hooks/useEnsInfo.js.map +0 -1
- package/dist/editor-utils/storybook.d.ts +0 -32
- package/dist/editor-utils/storybook.d.ts.map +0 -1
- package/dist/editor-utils/storybook.js +0 -104
- package/dist/editor-utils/storybook.js.map +0 -1
- package/dist/style.css +0 -890
- package/dist/test/helpers.test.d.ts +0 -2
- package/dist/test/helpers.test.d.ts.map +0 -1
- package/dist/test/helpers.test.js +0 -805
- package/dist/test/helpers.test.js.map +0 -1
- package/dist/test/index.d.ts +0 -2
- package/dist/test/index.d.ts.map +0 -1
- package/dist/test/index.js +0 -2
- package/dist/test/index.js.map +0 -1
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback } from "react";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
import { handleModelNameChange, makeInitialSchemaDoc, renameSchemaType, } from "../utils/helpers.js";
|
|
5
|
-
import { TextField } from "./text-field.js";
|
|
6
|
-
export const MetadataFormSchema = z.object({
|
|
7
|
-
name: z.string(),
|
|
8
|
-
documentType: z.string(),
|
|
9
|
-
extension: z.string().optional().default(""),
|
|
10
|
-
description: z.string(),
|
|
11
|
-
authorName: z.string(),
|
|
12
|
-
authorWebsite: z.string(),
|
|
13
|
-
});
|
|
14
|
-
export default function ModelMetadata(props) {
|
|
15
|
-
return (_jsxs("div", { children: [_jsx(ModelNameForm, { ...props }), _jsx("div", { className: "flex h-full flex-col gap-4", children: _jsxs("div", { className: "grid flex-1 grid-cols-3 items-start gap-4", children: [_jsxs("div", { className: "col-span-2 flex h-full flex-col gap-4", children: [_jsx("div", { className: "shrink-0", children: _jsx(DocumentTypeForm, { ...props }) }), _jsx("div", { className: "min-h-0 flex-1", children: _jsx(DescriptionForm, { ...props }) })] }), _jsxs("div", { className: "col-span-1 flex flex-col gap-4", children: [_jsx(AuthorNameForm, { ...props }), _jsx(AuthorWebsiteForm, { ...props }), _jsx(ModelExtensionForm, { ...props })] })] }) })] }));
|
|
16
|
-
}
|
|
17
|
-
export function ModelNameForm(props) {
|
|
18
|
-
const { name, globalStateSchema, localStateSchema, setModelName, setStateSchema, } = props;
|
|
19
|
-
const onSubmit = useCallback((newName) => {
|
|
20
|
-
if (name === newName) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
setModelName(newName);
|
|
24
|
-
const hasExistingSchema = !!globalStateSchema;
|
|
25
|
-
if (!hasExistingSchema) {
|
|
26
|
-
const initialSchemaDoc = makeInitialSchemaDoc(newName, "global");
|
|
27
|
-
setStateSchema(initialSchemaDoc, "global");
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
const newSchema = renameSchemaType(globalStateSchema, name, newName, "global");
|
|
31
|
-
setStateSchema(newSchema, "global");
|
|
32
|
-
if (localStateSchema) {
|
|
33
|
-
const newLocalStateSchema = renameSchemaType(localStateSchema, name, newName, "local");
|
|
34
|
-
setStateSchema(newLocalStateSchema, "local");
|
|
35
|
-
}
|
|
36
|
-
handleModelNameChange({
|
|
37
|
-
oldName: name,
|
|
38
|
-
newName,
|
|
39
|
-
globalStateSchema,
|
|
40
|
-
localStateSchema,
|
|
41
|
-
setStateSchema,
|
|
42
|
-
});
|
|
43
|
-
}, [name, globalStateSchema, localStateSchema, setStateSchema]);
|
|
44
|
-
return (_jsx(TextField, { name: "name", value: name, onSubmit: onSubmit, placeholder: "Model name", className: "border-none pl-0 text-xl font-bold text-gray-900", required: true, focusOnMount: true }));
|
|
45
|
-
}
|
|
46
|
-
export function DocumentTypeForm(props) {
|
|
47
|
-
const { documentType, setModelId } = props;
|
|
48
|
-
return (_jsx(TextField, { label: "Document Type *", name: "powerhouse/document-model", value: documentType, onSubmit: setModelId, placeholder: "Document Type", required: true }));
|
|
49
|
-
}
|
|
50
|
-
export function ModelExtensionForm(props) {
|
|
51
|
-
const { extension, setModelExtension } = props;
|
|
52
|
-
return (_jsx(TextField, { name: "extension", value: extension, onSubmit: setModelExtension, label: "Model Extension", placeholder: "Example .phdm", allowEmpty: true }));
|
|
53
|
-
}
|
|
54
|
-
export function DescriptionForm(props) {
|
|
55
|
-
const { description, setModelDescription } = props;
|
|
56
|
-
return (_jsx(TextField, { name: "description", label: "Model Description", value: description, onSubmit: setModelDescription, placeholder: "Describe your document to others", allowEmpty: true, className: "h-full" }));
|
|
57
|
-
}
|
|
58
|
-
export function AuthorNameForm(props) {
|
|
59
|
-
const { authorName, setAuthorName } = props;
|
|
60
|
-
return (_jsx(TextField, { name: "authorName", value: authorName, onSubmit: setAuthorName, label: "Author Name", placeholder: "Username or organisation", allowEmpty: true }));
|
|
61
|
-
}
|
|
62
|
-
export function AuthorWebsiteForm(props) {
|
|
63
|
-
const { authorWebsite, setAuthorWebsite } = props;
|
|
64
|
-
return (_jsx(TextField, { name: "authorWebsite", value: authorWebsite, label: "Website URL", onSubmit: (newAuthorWebsite) => {
|
|
65
|
-
if (!!authorWebsite && !newAuthorWebsite)
|
|
66
|
-
return;
|
|
67
|
-
setAuthorWebsite(newAuthorWebsite);
|
|
68
|
-
}, placeholder: "https://www.powerhouse.inc/", allowEmpty: true }));
|
|
69
|
-
}
|
|
70
|
-
//# sourceMappingURL=model-metadata-form.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"model-metadata-form.js","sourceRoot":"","sources":["../../../document-model-editor/components/model-metadata-form.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,qBAAqB,EACrB,oBA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KAAK,EAAC,aAAa,EACnB,QAAQ,EAAE,CAAC,gBAAgB,EAAE,EAAE;YAC7B,IAAI,CAAC,CAAC,aAAa,IAAI,CAAC,gBAAgB;gBAAE,OAAO;YACjD,gBAAgB,CAAC,gBAAgB,CAAC,CAAC;QACrC,CAAC,EACD,WAAW,EAAC,6BAA6B,EACzC,UAAU,SACV,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ModuleSpecification } from "document-model";
|
|
2
|
-
type Props = {
|
|
3
|
-
modules?: ModuleSpecification[];
|
|
4
|
-
module?: ModuleSpecification;
|
|
5
|
-
onAddModule: (name: string) => Promise<string | undefined>;
|
|
6
|
-
updateModuleName: (id: string, name: string) => void;
|
|
7
|
-
};
|
|
8
|
-
export declare function ModuleForm({ module, onAddModule, updateModuleName, modules, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=module-form.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module-form.d.ts","sourceRoot":"","sources":["../../../document-model-editor/components/module-form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAI1D,KAAK,KAAK,GAAG;IACX,OAAO,CAAC,EAAE,mBAAmB,EAAE,CAAC;IAChC,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC3D,gBAAgB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACtD,CAAC;AAEF,wBAAgB,UAAU,CAAC,EACzB,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,OAAY,GACb,EAAE,KAAK,2CA8BP"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { toLowercaseSnakeCase } from "../schemas/inputs.js";
|
|
3
|
-
import { TextField } from "./text-field.js";
|
|
4
|
-
export function ModuleForm({ module, onAddModule, updateModuleName, modules = [], }) {
|
|
5
|
-
const isEdit = !!module;
|
|
6
|
-
const moduleNames = modules.map((m) => m.name);
|
|
7
|
-
const handleSubmit = async (name) => {
|
|
8
|
-
const formattedName = toLowercaseSnakeCase(name);
|
|
9
|
-
if (!formattedName.length)
|
|
10
|
-
return;
|
|
11
|
-
if (isEdit) {
|
|
12
|
-
if (formattedName !== module.name) {
|
|
13
|
-
updateModuleName(module.id, formattedName);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
await onAddModule(formattedName);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
return (_jsx(TextField, { name: "name", label: isEdit ? "Module name *" : "Add module *", value: module?.name, onSubmit: handleSubmit, placeholder: "Add module", unique: moduleNames, shouldReset: !isEdit, required: true }, module?.id ?? "new"));
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=module-form.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module-form.js","sourceRoot":"","sources":["../../../document-model-editor/components/module-form.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAS5C,MAAM,UAAU,UAAU,CAAC,EACzB,MAAM,EACN,WAAW,EACX,gBAAgB,EAChB,OAAO,GAAG,EAAE,GACN;IACN,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IACxB,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IAE/C,MAAM,YAAY,GAAG,KAAK,EAAE,IAAY,EAAE,EAAE;QAC1C,MAAM,aAAa,GAAG,oBAAoB,CAAC,IAAI,CAAC,CAAC;QACjD,IAAI,CAAC,aAAa,CAAC,MAAM;YAAE,OAAO;QAElC,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,aAAa,KAAK,MAAM,CAAC,IAAI,EAAE,CAAC;gBAClC,gBAAgB,CAAC,MAAM,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;YAC7C,CAAC;QACH,CAAC;aAAM,CAAC;YACN,MAAM,WAAW,CAAC,aAAa,CAAC,CAAC;QACnC,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,SAAS,IAER,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,cAAc,EAChD,KAAK,EAAE,MAAM,EAAE,IAAI,EACnB,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAC,YAAY,EACxB,MAAM,EAAE,WAAW,EACnB,WAAW,EAAE,CAAC,MAAM,EACpB,QAAQ,UARH,MAAM,EAAE,EAAE,IAAI,KAAK,CASxB,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { ModuleSpecification as TModule } from "document-model";
|
|
2
|
-
type Props = {
|
|
3
|
-
module?: TModule;
|
|
4
|
-
modules?: TModule[];
|
|
5
|
-
allOperations: TModule["operations"];
|
|
6
|
-
lastCreatedModuleId: string | null;
|
|
7
|
-
onAddModule: (name: string) => Promise<string | undefined>;
|
|
8
|
-
updateModuleName: (id: string, name: string) => void;
|
|
9
|
-
deleteModule: (id: string) => void;
|
|
10
|
-
updateOperationName: (id: string, name: string) => void;
|
|
11
|
-
deleteOperation: (id: string) => void;
|
|
12
|
-
addOperationAndInitialSchema: (moduleId: string, name: string) => Promise<string | undefined>;
|
|
13
|
-
updateOperationSchema: (id: string, newDoc: string) => void;
|
|
14
|
-
setOperationDescription: (id: string, description: string) => void;
|
|
15
|
-
addOperationError: (operationId: string, errorName: string) => Promise<string | undefined>;
|
|
16
|
-
deleteOperationError: (id: string) => void;
|
|
17
|
-
setOperationErrorName: (operationId: string, errorId: string, name: string) => void;
|
|
18
|
-
toggleNoInputRequired: (id: string, noInputRequired: boolean) => void;
|
|
19
|
-
};
|
|
20
|
-
export declare function Module(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
21
|
-
export {};
|
|
22
|
-
//# sourceMappingURL=module.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module.d.ts","sourceRoot":"","sources":["../../../document-model-editor/components/module.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,IAAI,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAGrE,KAAK,KAAK,GAAG;IACX,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,EAAE,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IACrC,mBAAmB,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,WAAW,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC3D,gBAAgB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,4BAA4B,EAAE,CAC5B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,KACT,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACjC,qBAAqB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,uBAAuB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACnE,iBAAiB,EAAE,CACjB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,KACd,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACjC,oBAAoB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,qBAAqB,EAAE,CACrB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,KACT,IAAI,CAAC;IACV,qBAAqB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,KAAK,IAAI,CAAC;CACvE,CAAC;AACF,wBAAgB,MAAM,CAAC,KAAK,EAAE,KAAK,2CAiElC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { ModuleForm } from "./module-form.js";
|
|
3
|
-
import { Operations } from "./operations.js";
|
|
4
|
-
export function Module(props) {
|
|
5
|
-
const { module, modules, allOperations, lastCreatedModuleId, onAddModule, updateModuleName, deleteModule, updateOperationName, deleteOperation, addOperationAndInitialSchema, updateOperationSchema, setOperationDescription, addOperationError, deleteOperationError, setOperationErrorName, toggleNoInputRequired, } = props;
|
|
6
|
-
return (_jsxs("div", { className: "relative rounded-3xl bg-gray-100 p-6", children: [_jsxs("div", { className: "mb-2 w-1/2 pr-6", children: [_jsx(ModuleForm, { modules: modules, module: module, onAddModule: onAddModule, updateModuleName: updateModuleName }), !!module && (_jsx("button", { "aria-label": "Delete module", tabIndex: -1, className: "absolute right-1 top-1 p-2 text-gray-800 transition-colors hover:text-gray-500", onClick: () => {
|
|
7
|
-
deleteModule(module.id);
|
|
8
|
-
}, children: _jsx("svg", { className: "size-6", viewBox: "0 0 24 24", fill: "currentcolor", children: _jsx("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M16.9993 8.51506L15.4844 7L11.9994 10.4852L8.51497 7.00057L7 8.51562L10.4844 12.0003L7.00056 15.4843L8.51552 16.9994L11.9994 13.5153L15.4838 17L16.9988 15.4849L13.5144 12.0003L16.9993 8.51506Z" }) }) }))] }), !!module && (_jsx(Operations, { module: module, allOperations: allOperations, shouldFocusNewOperation: module.id === lastCreatedModuleId, updateOperationName: updateOperationName, deleteOperation: deleteOperation, addOperationAndInitialSchema: addOperationAndInitialSchema, updateOperationSchema: updateOperationSchema, setOperationDescription: setOperationDescription, addOperationError: addOperationError, deleteOperationError: deleteOperationError, setOperationErrorName: setOperationErrorName, toggleNoInputRequired: toggleNoInputRequired }))] }));
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"module.js","sourceRoot":"","sources":["../../../document-model-editor/components/module.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AA6B7C,MAAM,UAAU,MAAM,CAAC,KAAY;IACjC,MAAM,EACJ,MAAM,EACN,OAAO,EACP,aAAa,EACb,mBAAmB,EACnB,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,4BAA4B,EAC5B,qBAAqB,EACrB,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACtB,GAAG,KAAK,CAAC;IACV,OAAO,CACL,eAAK,SAAS,EAAC,sCAAsC,aACnD,eAAK,SAAS,EAAC,iBAAiB,aAC9B,KAAC,UAAU,IACT,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,GAClC,EACD,CAAC,CAAC,MAAM,IAAI,CACX,+BACa,eAAe,EAC1B,QAAQ,EAAE,CAAC,CAAC,EACZ,SAAS,EAAC,gFAAgF,EAC1F,OAAO,EAAE,GAAG,EAAE;4BACZ,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;wBAC1B,CAAC,YAED,cAAK,SAAS,EAAC,QAAQ,EAAC,OAAO,EAAC,WAAW,EAAC,IAAI,EAAC,cAAc,YAC7D,eACE,QAAQ,EAAC,SAAS,EAClB,QAAQ,EAAC,SAAS,EAClB,CAAC,EAAC,kMAAkM,GACpM,GACE,GACC,CACV,IACG,EACL,CAAC,CAAC,MAAM,IAAI,CACX,KAAC,UAAU,IACT,MAAM,EAAE,MAAM,EACd,aAAa,EAAE,aAAa,EAC5B,uBAAuB,EAAE,MAAM,CAAC,EAAE,KAAK,mBAAmB,EAC1D,mBAAmB,EAAE,mBAAmB,EACxC,eAAe,EAAE,eAAe,EAChC,4BAA4B,EAAE,4BAA4B,EAC1D,qBAAqB,EAAE,qBAAqB,EAC5C,uBAAuB,EAAE,uBAAuB,EAChD,iBAAiB,EAAE,iBAAiB,EACpC,oBAAoB,EAAE,oBAAoB,EAC1C,qBAAqB,EAAE,qBAAqB,EAC5C,qBAAqB,EAAE,qBAAqB,GAC5C,CACH,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ModuleSpecification as TModule } from "document-model";
|
|
2
|
-
type Props = {
|
|
3
|
-
modules: TModule[];
|
|
4
|
-
allOperations: TModule["operations"];
|
|
5
|
-
addModule: (name: string) => Promise<string | undefined>;
|
|
6
|
-
updateModuleName: (id: string, name: string) => void;
|
|
7
|
-
deleteModule: (id: string) => void;
|
|
8
|
-
updateOperationName: (id: string, name: string) => void;
|
|
9
|
-
deleteOperation: (id: string) => void;
|
|
10
|
-
addOperationAndInitialSchema: (moduleId: string, name: string) => Promise<string | undefined>;
|
|
11
|
-
updateOperationSchema: (id: string, newDoc: string) => void;
|
|
12
|
-
setOperationDescription: (id: string, description: string) => void;
|
|
13
|
-
addOperationError: (operationId: string, errorName: string) => Promise<string | undefined>;
|
|
14
|
-
deleteOperationError: (id: string) => void;
|
|
15
|
-
setOperationErrorName: (operationId: string, errorId: string, name: string) => void;
|
|
16
|
-
toggleNoInputRequired: (id: string, noInputRequired: boolean) => void;
|
|
17
|
-
};
|
|
18
|
-
export default function Modules({ modules, allOperations, addModule, updateModuleName, deleteModule, updateOperationName, deleteOperation, addOperationAndInitialSchema, updateOperationSchema, setOperationDescription, addOperationError, deleteOperationError, setOperationErrorName, toggleNoInputRequired, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
19
|
-
export {};
|
|
20
|
-
//# sourceMappingURL=modules.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"modules.d.ts","sourceRoot":"","sources":["../../../document-model-editor/components/modules.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,IAAI,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAIrE,KAAK,KAAK,GAAG;IACX,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,aAAa,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;IACrC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACzD,gBAAgB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrD,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,4BAA4B,EAAE,CAC5B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,KACT,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACjC,qBAAqB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,uBAAuB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACnE,iBAAiB,EAAE,CACjB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,KACd,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACjC,oBAAoB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,qBAAqB,EAAE,CACrB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,KACT,IAAI,CAAC;IACV,qBAAqB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,KAAK,IAAI,CAAC;CACvE,CAAC;AACF,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAC9B,OAAO,EACP,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,4BAA4B,EAC5B,qBAAqB,EACrB,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,GACtB,EAAE,KAAK,2CAoEP"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useRef, useState } from "react";
|
|
3
|
-
import { Module } from "./module.js";
|
|
4
|
-
export default function Modules({ modules, allOperations, addModule, updateModuleName, deleteModule, updateOperationName, deleteOperation, addOperationAndInitialSchema, updateOperationSchema, setOperationDescription, addOperationError, deleteOperationError, setOperationErrorName, toggleNoInputRequired, }) {
|
|
5
|
-
const [lastCreatedModuleId, setLastCreatedModuleId] = useState(null);
|
|
6
|
-
const focusTrapRef = useRef(null);
|
|
7
|
-
const onAddModule = useCallback(async (name) => {
|
|
8
|
-
const moduleId = await addModule(name);
|
|
9
|
-
if (moduleId) {
|
|
10
|
-
setLastCreatedModuleId(moduleId);
|
|
11
|
-
focusTrapRef.current?.focus();
|
|
12
|
-
}
|
|
13
|
-
return moduleId;
|
|
14
|
-
}, [addModule, setLastCreatedModuleId]);
|
|
15
|
-
return (_jsxs("div", { className: "flex flex-col gap-2", children: [modules.map((module) => (_jsx(Module, { module: module, modules: modules, allOperations: allOperations, lastCreatedModuleId: lastCreatedModuleId, onAddModule: onAddModule, updateModuleName: updateModuleName, deleteModule: deleteModule, updateOperationName: updateOperationName, deleteOperation: deleteOperation, addOperationAndInitialSchema: addOperationAndInitialSchema, updateOperationSchema: updateOperationSchema, setOperationDescription: setOperationDescription, addOperationError: addOperationError, deleteOperationError: deleteOperationError, setOperationErrorName: setOperationErrorName, toggleNoInputRequired: toggleNoInputRequired }, module.id))), _jsx(Module, { modules: modules, allOperations: allOperations, lastCreatedModuleId: lastCreatedModuleId, onAddModule: onAddModule, updateModuleName: updateModuleName, deleteModule: deleteModule, updateOperationName: updateOperationName, deleteOperation: deleteOperation, addOperationAndInitialSchema: addOperationAndInitialSchema, updateOperationSchema: updateOperationSchema, setOperationDescription: setOperationDescription, addOperationError: addOperationError, deleteOperationError: deleteOperationError, setOperationErrorName: setOperationErrorName, toggleNoInputRequired: toggleNoInputRequired }, "add-module"), _jsx("div", { ref: focusTrapRef, tabIndex: 0, className: "size-0 overflow-hidden", "aria-hidden": "true" })] }));
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=modules.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../../../document-model-editor/components/modules.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA4BrC,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,EAC9B,OAAO,EACP,aAAa,EACb,SAAS,EACT,gBA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AC,EACF,KAAC,MAAM,IAEL,OAAO,EAAE,OAAO,EAChB,aAAa,EAAE,aAAa,EAC5B,mBAAmB,EAAE,mBAAmB,EACxC,WAAW,EAAE,WAAW,EACxB,gBAAgB,EAAE,gBAAgB,EAClC,YAAY,EAAE,YAAY,EAC1B,mBAAmB,EAAE,mBAAmB,EACxC,eAAe,EAAE,eAAe,EAChC,4BAA4B,EAAE,4BAA4B,EAC1D,qBAAqB,EAAE,qBAAqB,EAC5C,uBAAuB,EAAE,uBAAuB,EAChD,iBAAiB,EAAE,iBAAiB,EACpC,oBAAoB,EAAE,oBAAoB,EAC1C,qBAAqB,EAAE,qBAAqB,EAC5C,qBAAqB,EAAE,qBAAqB,IAfxC,YAAY,CAgBhB,EAEF,cACE,GAAG,EAAE,YAAY,EACjB,QAAQ,EAAE,CAAC,EACX,SAAS,EAAC,wBAAwB,iBACtB,MAAM,GAClB,IACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { ModuleSpecification } from "document-model";
|
|
2
|
-
type Props = {
|
|
3
|
-
operation: ModuleSpecification["operations"][number];
|
|
4
|
-
focusOnMount?: boolean;
|
|
5
|
-
setOperationDescription: (id: string, description: string) => void;
|
|
6
|
-
};
|
|
7
|
-
export declare function OperationDescriptionForm({ operation, focusOnMount, setOperationDescription, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
8
|
-
export {};
|
|
9
|
-
//# sourceMappingURL=operation-description-form.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operation-description-form.d.ts","sourceRoot":"","sources":["../../../document-model-editor/components/operation-description-form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAI1D,KAAK,KAAK,GAAG;IACX,SAAS,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;IACrD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,uBAAuB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;CACpE,CAAC;AAEF,wBAAgB,wBAAwB,CAAC,EACvC,SAAS,EACT,YAAY,EACZ,uBAAuB,GACxB,EAAE,KAAK,2CAsBP"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect, useRef } from "react";
|
|
3
|
-
import { TextField } from "./text-field.js";
|
|
4
|
-
export function OperationDescriptionForm({ operation, focusOnMount, setOperationDescription, }) {
|
|
5
|
-
const textFieldRef = useRef(null);
|
|
6
|
-
useEffect(() => {
|
|
7
|
-
if (focusOnMount && textFieldRef.current) {
|
|
8
|
-
textFieldRef.current.focus();
|
|
9
|
-
}
|
|
10
|
-
}, [focusOnMount]);
|
|
11
|
-
return (_jsx(TextField, { ref: textFieldRef, name: "description", value: operation.description, onSubmit: (newDescription) => setOperationDescription(operation.id, newDescription), label: "Operation description", allowEmpty: true, placeholder: "Operation Description" }));
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=operation-description-form.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operation-description-form.js","sourceRoot":"","sources":["../../../document-model-editor/components/operation-description-form.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAQ5C,MAAM,UAAU,wBAAwB,CAAC,EACvC,SAAS,EACT,YAAY,EACZ,uBAAuB,GACjB;IACN,MAAM,YAAY,GAAG,MAAM,CAA+B,IAAI,CAAC,CAAC;IAEhE,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,YAAY,IAAI,YAAY,CAAC,OAAO,EAAE,CAAC;YACzC,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QAC/B,CAAC;IACH,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAEnB,OAAO,CACL,KAAC,SAAS,IACR,GAAG,EAAE,YAAY,EACjB,IAAI,EAAC,aAAa,EAClB,KAAK,EAAE,SAAS,CAAC,WAAW,EAC5B,QAAQ,EAAE,CAAC,cAAc,EAAE,EAAE,CAC3B,uBAAuB,CAAC,SAAS,CAAC,EAAE,EAAE,cAAc,CAAC,EAEvD,KAAK,EAAC,uBAAuB,EAC7B,UAAU,QACV,WAAW,EAAC,uBAAuB,GACnC,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { OperationErrorSpecification, ModuleSpecification } from "document-model";
|
|
2
|
-
type Props = {
|
|
3
|
-
operation: ModuleSpecification["operations"][number];
|
|
4
|
-
error?: OperationErrorSpecification;
|
|
5
|
-
focusOnMount?: boolean;
|
|
6
|
-
onSubmit?: () => void;
|
|
7
|
-
onAddOperationError: (operationId: string, errorName: string) => Promise<string | undefined>;
|
|
8
|
-
deleteOperationError: (id: string) => void;
|
|
9
|
-
setOperationErrorName: (operationId: string, errorId: string, name: string) => void;
|
|
10
|
-
};
|
|
11
|
-
export declare function OperationErrorForm({ operation, error, focusOnMount, onSubmit, onAddOperationError, deleteOperationError, setOperationErrorName, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=operation-error-form.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operation-error-form.d.ts","sourceRoot":"","sources":["../../../document-model-editor/components/operation-error-form.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,2BAA2B,EAC3B,mBAAmB,EACpB,MAAM,gBAAgB,CAAC;AAIxB,KAAK,KAAK,GAAG;IACX,SAAS,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;IACrD,KAAK,CAAC,EAAE,2BAA2B,CAAC;IACpC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;IACtB,mBAAmB,EAAE,CACnB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,KACd,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACjC,oBAAoB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,qBAAqB,EAAE,CACrB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,KACT,IAAI,CAAC;CACX,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,EACjC,SAAS,EACT,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,GACtB,EAAE,KAAK,2CA0DP"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { pascalCase } from "change-case";
|
|
3
|
-
import { useCallback, useRef } from "react";
|
|
4
|
-
import { TextField } from "./text-field.js";
|
|
5
|
-
export function OperationErrorForm({ operation, error, focusOnMount, onSubmit, onAddOperationError, deleteOperationError, setOperationErrorName, }) {
|
|
6
|
-
const textFieldRef = useRef(null);
|
|
7
|
-
const isEdit = !!error;
|
|
8
|
-
const allOperationErrorNames = operation.errors
|
|
9
|
-
.map((o) => o.name)
|
|
10
|
-
.filter((n) => n !== null);
|
|
11
|
-
const handleSubmit = useCallback((name) => {
|
|
12
|
-
if (isEdit && name === "") {
|
|
13
|
-
deleteOperationError(error.id);
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
const formattedName = pascalCase(name);
|
|
17
|
-
if (isEdit) {
|
|
18
|
-
setOperationErrorName(operation.id, error.id, formattedName);
|
|
19
|
-
}
|
|
20
|
-
else {
|
|
21
|
-
onAddOperationError(operation.id, formattedName);
|
|
22
|
-
}
|
|
23
|
-
onSubmit?.();
|
|
24
|
-
}, [
|
|
25
|
-
isEdit,
|
|
26
|
-
error?.id,
|
|
27
|
-
operation.id,
|
|
28
|
-
deleteOperationError,
|
|
29
|
-
setOperationErrorName,
|
|
30
|
-
onAddOperationError,
|
|
31
|
-
onSubmit,
|
|
32
|
-
]);
|
|
33
|
-
const handleChange = useCallback((value) => {
|
|
34
|
-
if (isEdit && value === "") {
|
|
35
|
-
deleteOperationError(error.id);
|
|
36
|
-
}
|
|
37
|
-
}, [isEdit, error?.id, deleteOperationError]);
|
|
38
|
-
return (_jsx(TextField, { ref: textFieldRef, name: "name", value: error?.name, onSubmit: handleSubmit, onChange: handleChange, placeholder: "Add exception", required: !isEdit, allowEmpty: !isEdit, shouldReset: !isEdit, unique: allOperationErrorNames, focusOnMount: focusOnMount }));
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=operation-error-form.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operation-error-form.js","sourceRoot":"","sources":["../../../document-model-editor/components/operation-error-form.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAKzC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAmB5C,MAAM,UAAU,kBAAkB,CAAC,EACjC,SAAS,EACT,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,GACf;IACN,MAAM,YAAY,GAAG,MAAM,CAA+B,IAAI,CAAC,CAAC;IAChE,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC;IACvB,MAAM,sBAAsB,GAAG,SAAS,CAAC,MAAM;SAC5C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;SAClB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;IAE7B,MAAM,YAAY,G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CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ModuleSpecification } from "document-model";
|
|
2
|
-
type Props = {
|
|
3
|
-
operation: ModuleSpecification["operations"][number];
|
|
4
|
-
addOperationError: (operationId: string, errorName: string) => Promise<string | undefined>;
|
|
5
|
-
deleteOperationError: (id: string) => void;
|
|
6
|
-
setOperationErrorName: (operationId: string, errorId: string, name: string) => void;
|
|
7
|
-
};
|
|
8
|
-
export declare function OperationErrors({ operation, addOperationError, deleteOperationError, setOperationErrorName, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=operation-errors.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operation-errors.d.ts","sourceRoot":"","sources":["../../../document-model-editor/components/operation-errors.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAI1D,KAAK,KAAK,GAAG;IACX,SAAS,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;IACrD,iBAAiB,EAAE,CACjB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,KACd,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACjC,oBAAoB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,qBAAqB,EAAE,CACrB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,KACT,IAAI,CAAC;CACX,CAAC;AAEF,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,GACtB,EAAE,KAAK,2CA8CP"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useId, useState } from "react";
|
|
3
|
-
import { OperationErrorForm } from "./operation-error-form.js";
|
|
4
|
-
export function OperationErrors({ operation, addOperationError, deleteOperationError, setOperationErrorName, }) {
|
|
5
|
-
const addErrorFormId = useId();
|
|
6
|
-
const [shouldFocusAddForm, setShouldFocusAddForm] = useState(false);
|
|
7
|
-
const onAddOperationError = useCallback(async (operationId, error) => {
|
|
8
|
-
const errorId = await addOperationError(operationId, error);
|
|
9
|
-
if (errorId) {
|
|
10
|
-
setShouldFocusAddForm(true);
|
|
11
|
-
}
|
|
12
|
-
return errorId;
|
|
13
|
-
}, [addOperationError, setShouldFocusAddForm]);
|
|
14
|
-
const onAddOperationErrorSubmit = useCallback(() => setShouldFocusAddForm(false), [setShouldFocusAddForm]);
|
|
15
|
-
return (_jsxs("ul", { className: "ml-4 list-disc", children: [operation.errors.map((error) => (_jsx("li", { children: _jsx(OperationErrorForm, { error: error, operation: operation, onAddOperationError: onAddOperationError, deleteOperationError: deleteOperationError, setOperationErrorName: setOperationErrorName }) }, error.id))), _jsx("li", { children: _jsx(OperationErrorForm, { operation: operation, onAddOperationError: onAddOperationError, deleteOperationError: deleteOperationError, setOperationErrorName: setOperationErrorName, focusOnMount: shouldFocusAddForm, onSubmit: onAddOperationErrorSubmit }, `${addErrorFormId}-${shouldFocusAddForm}`) })] }));
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=operation-errors.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operation-errors.js","sourceRoot":"","sources":["../../../document-model-editor/components/operation-errors.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAgB/D,MAAM,UAAU,eAAe,CAAC,EAC9B,SAAS,EACT,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,GACf;IACN,MAAM,cAAc,GAAG,KAAK,EAAE,CAAC;IAC/B,MAAM,CAAC,kBAA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|
-
operation?: ModuleSpecification["operations"][number];
|
|
5
|
-
focusOnMount?: boolean;
|
|
6
|
-
allOperationNames: string[];
|
|
7
|
-
onAddOperationAndInitialSchema: (moduleId: string, name: string) => Promise<string | undefined>;
|
|
8
|
-
updateOperationName: (id: string, name: string) => void;
|
|
9
|
-
deleteOperation: (id: string) => void;
|
|
10
|
-
};
|
|
11
|
-
export declare function OperationForm({ operation, module, focusOnMount, allOperationNames, onAddOperationAndInitialSchema, updateOperationName, deleteOperation, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=operation-form.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operation-form.d.ts","sourceRoot":"","sources":["../../../document-model-editor/components/operation-form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAK1D,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,mBAAmB,CAAC;IAC5B,SAAS,CAAC,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;IACtD,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,8BAA8B,EAAE,CAC9B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,KACT,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACjC,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAC5B,SAAS,EACT,MAAM,EACN,YAAY,EACZ,iBAAiB,EACjB,8BAA8B,EAC9B,mBAAmB,EACnB,eAAe,GAChB,EAAE,KAAK,2CAuDP"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback } from "react";
|
|
3
|
-
import { toConstantCase } from "../schemas/inputs.js";
|
|
4
|
-
import { TextField } from "./text-field.js";
|
|
5
|
-
export function OperationForm({ operation, module, focusOnMount, allOperationNames, onAddOperationAndInitialSchema, updateOperationName, deleteOperation, }) {
|
|
6
|
-
const isEdit = !!operation;
|
|
7
|
-
const handleSubmit = useCallback(async (name) => {
|
|
8
|
-
if (isEdit && name === "") {
|
|
9
|
-
deleteOperation(operation.id);
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
const formattedName = toConstantCase(name);
|
|
13
|
-
if (isEdit) {
|
|
14
|
-
if (formattedName !== operation.name) {
|
|
15
|
-
updateOperationName(operation.id, formattedName);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
await onAddOperationAndInitialSchema(module.id, formattedName);
|
|
20
|
-
}
|
|
21
|
-
}, [
|
|
22
|
-
isEdit,
|
|
23
|
-
operation?.id,
|
|
24
|
-
operation?.name,
|
|
25
|
-
module.id,
|
|
26
|
-
deleteOperation,
|
|
27
|
-
updateOperationName,
|
|
28
|
-
onAddOperationAndInitialSchema,
|
|
29
|
-
]);
|
|
30
|
-
const handleChange = useCallback((value) => {
|
|
31
|
-
if (isEdit && value === "") {
|
|
32
|
-
deleteOperation(operation.id);
|
|
33
|
-
}
|
|
34
|
-
}, [isEdit, operation?.id, deleteOperation]);
|
|
35
|
-
return (_jsx(TextField, { name: "name", value: operation?.name, label: isEdit ? "Operation name *" : "Add operation *", onSubmit: handleSubmit, onChange: handleChange, placeholder: "Add operation", required: !isEdit, allowEmpty: !isEdit, shouldReset: !isEdit, focusOnMount: focusOnMount, unique: allOperationNames }));
|
|
36
|
-
}
|
|
37
|
-
//# sourceMappingURL=operation-form.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operation-form.js","sourceRoot":"","sources":["../../../document-model-editor/components/operation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AAE,EAAE,eAAe,CAAC,CACzC,CAAC;IAEF,OAAO,CACL,KAAC,SAAS,IACR,IAAI,EAAC,MAAM,EACX,KAAK,EAAE,SAAS,EAAE,IAAI,EACtB,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,iBAAiB,EACtD,QAAQ,EAAE,YAAY,EACtB,QAAQ,EAAE,YAAY,EACtB,WAAW,EAAC,eAAe,EAC3B,QAAQ,EAAE,CAAC,MAAM,EACjB,UAAU,EAAE,CAAC,MAAM,EACnB,WAAW,EAAE,CAAC,MAAM,EACpB,YAAY,EAAE,YAAY,EAC1B,MAAM,EAAE,iBAAiB,GACzB,CACH,CAAC;AACJ,CAAC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { ModuleSpecification } from "document-model";
|
|
2
|
-
import type { DocumentActionHandlers } from "../types/documents.js";
|
|
3
|
-
export type WrappedHandlers = DocumentActionHandlers & {
|
|
4
|
-
addOperationAndInitialSchema: (moduleId: string, name: string) => Promise<string | undefined>;
|
|
5
|
-
};
|
|
6
|
-
type Props = {
|
|
7
|
-
lastCreatedOperationId: string | null;
|
|
8
|
-
operation: ModuleSpecification["operations"][number];
|
|
9
|
-
module: ModuleSpecification;
|
|
10
|
-
allOperationNames: string[];
|
|
11
|
-
onAddOperationAndInitialSchema: (moduleId: string, name: string) => Promise<string | undefined>;
|
|
12
|
-
updateOperationName: (id: string, name: string) => void;
|
|
13
|
-
deleteOperation: (id: string) => void;
|
|
14
|
-
updateOperationSchema: (id: string, newDoc: string) => void;
|
|
15
|
-
setOperationDescription: (id: string, description: string) => void;
|
|
16
|
-
addOperationError: (operationId: string, errorName: string) => Promise<string | undefined>;
|
|
17
|
-
deleteOperationError: (id: string) => void;
|
|
18
|
-
setOperationErrorName: (operationId: string, errorId: string, name: string) => void;
|
|
19
|
-
toggleNoInputRequired: (id: string, noInputRequired: boolean) => void;
|
|
20
|
-
};
|
|
21
|
-
export declare function Operation(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
22
|
-
export {};
|
|
23
|
-
//# sourceMappingURL=operation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../../document-model-editor/components/operation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAOpE,MAAM,MAAM,eAAe,GAAG,sBAAsB,GAAG;IACrD,4BAA4B,EAAE,CAC5B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,KACT,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;CAClC,CAAC;AACF,KAAK,KAAK,GAAG;IACX,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,SAAS,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;IACrD,MAAM,EAAE,mBAAmB,CAAC;IAC5B,iBAAiB,EAAE,MAAM,EAAE,CAAC;IAC5B,8BAA8B,EAAE,CAC9B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,KACT,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACjC,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,qBAAqB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,uBAAuB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACnE,iBAAiB,EAAE,CACjB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,KACd,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACjC,oBAAoB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,qBAAqB,EAAE,CACrB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,KACT,IAAI,CAAC;IACV,qBAAqB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,KAAK,IAAI,CAAC;CACvE,CAAC;AACF,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,2CAoGrC"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { lazy, Suspense, useCallback } from "react";
|
|
3
|
-
import { isEmptyOperationSchema } from "../utils/helpers.js";
|
|
4
|
-
import { ensureValidOperationSchemaInputName } from "../utils/linting.js";
|
|
5
|
-
import { OperationDescriptionForm } from "./operation-description-form.js";
|
|
6
|
-
import { OperationErrors } from "./operation-errors.js";
|
|
7
|
-
import { OperationForm } from "./operation-form.js";
|
|
8
|
-
const GraphqlEditor = lazy(() => import("./code-editors/graphql-editor.js"));
|
|
9
|
-
export function Operation(props) {
|
|
10
|
-
const { operation, module, allOperationNames, lastCreatedOperationId, onAddOperationAndInitialSchema, updateOperationName, deleteOperation, updateOperationSchema, setOperationDescription, addOperationError, deleteOperationError, setOperationErrorName, toggleNoInputRequired, } = props;
|
|
11
|
-
const noInputRequired = isEmptyOperationSchema(operation.schema);
|
|
12
|
-
const handleToggleNoInput = useCallback((checked) => toggleNoInputRequired(operation.id, checked), [operation.id, toggleNoInputRequired]);
|
|
13
|
-
const handleUpdateDocument = useCallback((newDoc) => updateOperationSchema(operation.id, newDoc), [operation.id, updateOperationSchema]);
|
|
14
|
-
const customLinter = useCallback((doc) => operation.name
|
|
15
|
-
? ensureValidOperationSchemaInputName(doc, operation.name)
|
|
16
|
-
: [], [operation.name]);
|
|
17
|
-
return (_jsxs("div", { className: "mt-4 grid grid-cols-2 gap-x-12", style: {
|
|
18
|
-
gridTemplateAreas: `
|
|
19
|
-
"left editor"
|
|
20
|
-
"errors editor"
|
|
21
|
-
`,
|
|
22
|
-
gridTemplateRows: "auto 1fr",
|
|
23
|
-
}, children: [_jsxs("div", { className: "flex flex-col gap-2", style: { gridArea: "left" }, children: [_jsx(OperationForm, { operation: operation, onAddOperationAndInitialSchema: onAddOperationAndInitialSchema, updateOperationName: updateOperationName, deleteOperation: deleteOperation, module: module, allOperationNames: allOperationNames }), _jsx(OperationDescriptionForm, { operation: operation, focusOnMount: operation.id === lastCreatedOperationId, setOperationDescription: setOperationDescription })] }), _jsxs("div", { className: "relative top-8", style: { gridArea: "editor" }, children: [_jsxs("label", { className: "mb-2 flex cursor-pointer items-center gap-2", children: [_jsx("input", { type: "checkbox", checked: noInputRequired, onChange: (e) => handleToggleNoInput(e.target.checked), className: "h-4 w-4 rounded border-gray-300" }), _jsx("span", { className: "text-sm text-gray-700", children: "Operation with no inputs" })] }), !noInputRequired && (_jsx(Suspense, { children: _jsx(GraphqlEditor, { doc: operation.schema ?? "", updateDocumentInModel: handleUpdateDocument, customLinter: customLinter }) }))] }), _jsxs("div", { style: { gridArea: "errors" }, children: [_jsx("h3", { className: "my-2 text-sm font-medium text-gray-700", children: "Reducer Exceptions" }), _jsx(OperationErrors, { operation: operation, addOperationError: addOperationError, deleteOperationError: deleteOperationError, setOperationErrorName: setOperationErrorName })] })] }));
|
|
24
|
-
}
|
|
25
|
-
//# sourceMappingURL=operation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operation.js","sourceRoot":"","sources":["../../../document-model-editor/components/operation.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,mCAAmC,EAAE,MAAM,qBAAqB,CAA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ACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { ModuleSpecification } from "document-model";
|
|
2
|
-
type Props = {
|
|
3
|
-
module: ModuleSpecification;
|
|
4
|
-
allOperations: ModuleSpecification["operations"];
|
|
5
|
-
shouldFocusNewOperation: boolean;
|
|
6
|
-
updateOperationName: (id: string, name: string) => void;
|
|
7
|
-
deleteOperation: (id: string) => void;
|
|
8
|
-
addOperationAndInitialSchema: (moduleId: string, name: string) => Promise<string | undefined>;
|
|
9
|
-
updateOperationSchema: (id: string, newDoc: string) => void;
|
|
10
|
-
setOperationDescription: (id: string, description: string) => void;
|
|
11
|
-
addOperationError: (operationId: string, errorName: string) => Promise<string | undefined>;
|
|
12
|
-
deleteOperationError: (id: string) => void;
|
|
13
|
-
setOperationErrorName: (operationId: string, errorId: string, name: string) => void;
|
|
14
|
-
toggleNoInputRequired: (id: string, noInputRequired: boolean) => void;
|
|
15
|
-
};
|
|
16
|
-
export declare function Operations({ module, allOperations, shouldFocusNewOperation, updateOperationName, deleteOperation, addOperationAndInitialSchema, addOperationError, deleteOperationError, setOperationErrorName, updateOperationSchema, setOperationDescription, toggleNoInputRequired, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
17
|
-
export {};
|
|
18
|
-
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../document-model-editor/components/operations.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAI1D,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,mBAAmB,CAAC;IAC5B,aAAa,EAAE,mBAAmB,CAAC,YAAY,CAAC,CAAC;IACjD,uBAAuB,EAAE,OAAO,CAAC;IACjC,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACxD,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,4BAA4B,EAAE,CAC5B,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,KACT,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACjC,qBAAqB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5D,uBAAuB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;IACnE,iBAAiB,EAAE,CACjB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,MAAM,KACd,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACjC,oBAAoB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,qBAAqB,EAAE,CACrB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,KACT,IAAI,CAAC;IACV,qBAAqB,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,OAAO,KAAK,IAAI,CAAC;CACvE,CAAC;AACF,wBAAgB,UAAU,CAAC,EACzB,MAAM,EACN,aAAa,EACb,uBAAuB,EACvB,mBAAmB,EACnB,eAAe,EACf,4BAA4B,EAC5B,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,GACtB,EAAE,KAAK,2CAsDP"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { OperationForm } from "./operation-form.js";
|
|
3
|
-
import { useCallback, useId, useState } from "react";
|
|
4
|
-
import { Operation } from "./operation.js";
|
|
5
|
-
export function Operations({ module, allOperations, shouldFocusNewOperation, updateOperationName, deleteOperation, addOperationAndInitialSchema, addOperationError, deleteOperationError, setOperationErrorName, updateOperationSchema, setOperationDescription, toggleNoInputRequired, }) {
|
|
6
|
-
const [lastCreatedOperationId, setLastCreatedOperationId] = useState(null);
|
|
7
|
-
const addOperationFormId = useId();
|
|
8
|
-
const allOperationNames = allOperations
|
|
9
|
-
.map((o) => o.name)
|
|
10
|
-
.filter((n) => n !== null);
|
|
11
|
-
const onAddOperationAndInitialSchema = useCallback(async (moduleId, name) => {
|
|
12
|
-
const operationId = await addOperationAndInitialSchema(moduleId, name);
|
|
13
|
-
if (operationId) {
|
|
14
|
-
setLastCreatedOperationId(operationId);
|
|
15
|
-
}
|
|
16
|
-
return operationId;
|
|
17
|
-
}, [addOperationAndInitialSchema, setLastCreatedOperationId]);
|
|
18
|
-
return (_jsxs("div", { children: [module.operations.map((operation) => (_jsx("div", { children: _jsx(Operation, { operation: operation, module: module, lastCreatedOperationId: lastCreatedOperationId, allOperationNames: allOperationNames, addOperationError: addOperationError, deleteOperationError: deleteOperationError, setOperationErrorName: setOperationErrorName, onAddOperationAndInitialSchema: onAddOperationAndInitialSchema, updateOperationName: updateOperationName, deleteOperation: deleteOperation, updateOperationSchema: updateOperationSchema, setOperationDescription: setOperationDescription, toggleNoInputRequired: toggleNoInputRequired }) }, operation.id))), _jsx("div", { className: "mt-6 w-1/2 pr-6", children: _jsx(OperationForm, { onAddOperationAndInitialSchema: onAddOperationAndInitialSchema, updateOperationName: updateOperationName, deleteOperation: deleteOperation, module: module, allOperationNames: allOperationNames, focusOnMount: shouldFocusNewOperation }, addOperationFormId) })] }));
|
|
19
|
-
}
|
|
20
|
-
//# sourceMappingURL=operations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"operations.js","sourceRoot":"","sources":["../../../document-model-editor/components/operations.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,SAAS,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xC,eAAe,EAAE,eAAe,EAChC,qBAAqB,EAAE,qBAAqB,EAC5C,uBAAuB,EAAE,uBAAuB,EAChD,qBAAqB,EAAE,qBAAqB,GAC5C,IAfM,SAAS,CAAC,EAAE,CAgBhB,CACP,CAAC,EACF,cAAK,SAAS,EAAC,iBAAiB,YAC9B,KAAC,aAAa,IAEZ,8BAA8B,EAAE,8BAA8B,EAC9D,mBAAmB,EAAE,mBAAmB,EACxC,eAAe,EAAE,eAAe,EAChC,MAAM,EAAE,MAAM,EACd,iBAAiB,EAAE,iBAAiB,EACpC,YAAY,EAAE,uBAAuB,IANhC,kBAAkB,CAOvB,GACE,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state-error.d.ts","sourceRoot":"","sources":["../../../document-model-editor/components/state-error.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,wBAAgB,2BAA2B,CAAC,EAC1C,KAAK,GACN,EAAE;IACD,KAAK,EAAE,oBAAoB,CAAC;CAC7B,2CA2DA"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
export function StateValidationErrorMessage({ error, }) {
|
|
3
|
-
const { payload } = error;
|
|
4
|
-
switch (payload.kind) {
|
|
5
|
-
case "MISSING":
|
|
6
|
-
return (_jsxs("span", { children: ["Field ", _jsx("strong", { children: payload.field }), " is missing."] }));
|
|
7
|
-
case "MISSING_OPTIONAL":
|
|
8
|
-
return (_jsxs("span", { children: ["Optional field ", _jsx("strong", { children: payload.field }), " is not defined."] }));
|
|
9
|
-
case "UNKNOWN_FIELD":
|
|
10
|
-
return (_jsxs("span", { children: ["Field ", _jsx("strong", { children: payload.field }), " is not a known field."] }));
|
|
11
|
-
case "NON_NULL":
|
|
12
|
-
return (_jsxs("span", { children: ["Field ", _jsx("strong", { children: payload.field }), " cannot be null."] }));
|
|
13
|
-
case "TYPE":
|
|
14
|
-
return (_jsxs("span", { children: ["Field ", _jsx("strong", { children: payload.field }), payload.expectedType ? (_jsxs(_Fragment, { children: [" ", "must be a", " ", _jsx("strong", { children: payload.expectedType.replace(/!/g, "") }), "."] })) : (_jsx(_Fragment, { children: " has an invalid value." }))] }));
|
|
15
|
-
case "RECURSIVE_TYPE":
|
|
16
|
-
return (_jsxs("span", { children: ["Field ", _jsx("strong", { children: payload.typeName }), " has a recursive type. It must be optional."] }));
|
|
17
|
-
default:
|
|
18
|
-
return _jsx("span", { children: "Invalid value." });
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=state-error.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state-error.js","sourceRoot":"","sources":["../../../document-model-editor/components/state-error.tsx"],"names":[],"mappings":";AAEA,MAAM,UAAU,2BAA2B,CAAC,EAC1C,KAAK,GAGN;IACC,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAE1B,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;QACrB,KAAK,SAAS;YACZ,OAAO,CACL,qCACQ,2BAAS,OAAO,CAAC,KAAK,GAAU,oBACjC,CACR,CAAC;QAEJ,KAAK,kBAAkB;YACrB,OAAO,CACL,8CACiB,2BAAS,OAAO,CAAC,KAAK,GAAU,wBAC1C,CACR,CAAC;QAEJ,KAAK,eAAe;YAClB,OAAO,CACL,qCACQ,2BAAS,OAAO,CAAC,KAAK,GAAU,8BACjC,CACR,CAAC;QAEJ,KAAK,UAAU;YACb,OAAO,CACL,qCACQ,2BAAS,OAAO,CAAC,KAAK,GAAU,wBACjC,CACR,CAAC;QAEJ,KAAK,MAAM;YACT,OAAO,CACL,qCACQ,2BAAS,OAAO,CAAC,KAAK,GAAU,EACrC,OAAO,CAAC,YAAY,CAAC,CAAC,CAAC,CACtB,8BACG,GAAG,eACM,GAAG,EACb,2BAAS,OAAO,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,GAAU,SACxD,CACJ,CAAC,CAAC,CAAC,CACF,uDAA2B,CAC5B,IACI,CACR,CAAC;QAEJ,KAAK,gBAAgB;YACnB,OAAO,CACL,qCACQ,2BAAS,OAAO,CAAC,QAAQ,GAAU,mDAEpC,CACR,CAAC;QAEJ;YACE,OAAO,4CAA2B,CAAC;IACvC,CAAC;AACH,CAAC"}
|