@powerhousedao/builder-tools 0.2.0
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-studio/helpers.d.ts +5 -0
- package/dist/connect-studio/helpers.d.ts.map +1 -0
- package/dist/connect-studio/helpers.js +43 -0
- package/dist/connect-studio/hmr.d.ts +12 -0
- package/dist/connect-studio/hmr.d.ts.map +1 -0
- package/dist/connect-studio/hmr.js +8 -0
- package/dist/connect-studio/index.d.ts +9 -0
- package/dist/connect-studio/index.d.ts.map +1 -0
- package/dist/connect-studio/index.js +7 -0
- package/dist/connect-studio/server.d.ts +3 -0
- package/dist/connect-studio/server.d.ts.map +1 -0
- package/dist/connect-studio/server.js +175 -0
- package/dist/connect-studio/studio.d.ts +3 -0
- package/dist/connect-studio/studio.d.ts.map +1 -0
- package/dist/connect-studio/studio.js +65 -0
- package/dist/connect-studio/types.d.ts +25 -0
- package/dist/connect-studio/types.d.ts.map +1 -0
- package/dist/connect-studio/types.js +1 -0
- package/dist/connect-studio/vite-plugins/base.d.ts +19 -0
- package/dist/connect-studio/vite-plugins/base.d.ts.map +1 -0
- package/dist/connect-studio/vite-plugins/base.js +162 -0
- package/dist/connect-studio/vite-plugins/external-packages.d.ts +6 -0
- package/dist/connect-studio/vite-plugins/external-packages.d.ts.map +1 -0
- package/dist/connect-studio/vite-plugins/external-packages.js +74 -0
- package/dist/connect-studio/vite-plugins/hmr.d.ts +3 -0
- package/dist/connect-studio/vite-plugins/hmr.d.ts.map +1 -0
- package/dist/connect-studio/vite-plugins/hmr.js +57 -0
- package/dist/connect-studio/vite-plugins/importmap.d.ts +20 -0
- package/dist/connect-studio/vite-plugins/importmap.d.ts.map +1 -0
- package/dist/connect-studio/vite-plugins/importmap.js +174 -0
- package/dist/connect-studio/vite-plugins/studio.d.ts +4 -0
- package/dist/connect-studio/vite-plugins/studio.d.ts.map +1 -0
- package/dist/connect-studio/vite-plugins/studio.js +112 -0
- package/dist/document-model-editor/components/button.d.ts +4 -0
- package/dist/document-model-editor/components/button.d.ts.map +1 -0
- package/dist/document-model-editor/components/button.js +7 -0
- package/dist/document-model-editor/components/code-editors/graphql-editor.d.ts +10 -0
- package/dist/document-model-editor/components/code-editors/graphql-editor.d.ts.map +1 -0
- package/dist/document-model-editor/components/code-editors/graphql-editor.js +75 -0
- package/dist/document-model-editor/components/code-editors/json-editor.d.ts +8 -0
- package/dist/document-model-editor/components/code-editors/json-editor.d.ts.map +1 -0
- package/dist/document-model-editor/components/code-editors/json-editor.js +43 -0
- package/dist/document-model-editor/components/code-editors/utils.d.ts +32 -0
- package/dist/document-model-editor/components/code-editors/utils.d.ts.map +1 -0
- package/dist/document-model-editor/components/code-editors/utils.js +191 -0
- package/dist/document-model-editor/components/divider.d.ts +8 -0
- package/dist/document-model-editor/components/divider.d.ts.map +1 -0
- package/dist/document-model-editor/components/divider.js +21 -0
- package/dist/document-model-editor/components/errors.d.ts +6 -0
- package/dist/document-model-editor/components/errors.d.ts.map +1 -0
- package/dist/document-model-editor/components/errors.js +4 -0
- package/dist/document-model-editor/components/form.d.ts +12 -0
- package/dist/document-model-editor/components/form.d.ts.map +1 -0
- package/dist/document-model-editor/components/form.js +42 -0
- package/dist/document-model-editor/components/input.d.ts +6 -0
- package/dist/document-model-editor/components/input.d.ts.map +1 -0
- package/dist/document-model-editor/components/input.js +8 -0
- package/dist/document-model-editor/components/label.d.ts +6 -0
- package/dist/document-model-editor/components/label.d.ts.map +1 -0
- package/dist/document-model-editor/components/label.js +9 -0
- package/dist/document-model-editor/components/model-metadata-form.d.ts +45 -0
- package/dist/document-model-editor/components/model-metadata-form.d.ts.map +1 -0
- package/dist/document-model-editor/components/model-metadata-form.js +69 -0
- package/dist/document-model-editor/components/module-form.d.ts +10 -0
- package/dist/document-model-editor/components/module-form.d.ts.map +1 -0
- package/dist/document-model-editor/components/module-form.js +21 -0
- package/dist/document-model-editor/components/module.d.ts +21 -0
- package/dist/document-model-editor/components/module.d.ts.map +1 -0
- package/dist/document-model-editor/components/module.js +9 -0
- package/dist/document-model-editor/components/modules.d.ts +19 -0
- package/dist/document-model-editor/components/modules.d.ts.map +1 -0
- package/dist/document-model-editor/components/modules.js +16 -0
- package/dist/document-model-editor/components/operation-description-form.d.ts +9 -0
- package/dist/document-model-editor/components/operation-description-form.d.ts.map +1 -0
- package/dist/document-model-editor/components/operation-description-form.js +12 -0
- package/dist/document-model-editor/components/operation-error-form.d.ts +13 -0
- package/dist/document-model-editor/components/operation-error-form.d.ts.map +1 -0
- package/dist/document-model-editor/components/operation-error-form.js +39 -0
- package/dist/document-model-editor/components/operation-errors.d.ts +10 -0
- package/dist/document-model-editor/components/operation-errors.d.ts.map +1 -0
- package/dist/document-model-editor/components/operation-errors.js +16 -0
- package/dist/document-model-editor/components/operation-form.d.ts +13 -0
- package/dist/document-model-editor/components/operation-form.d.ts.map +1 -0
- package/dist/document-model-editor/components/operation-form.js +36 -0
- package/dist/document-model-editor/components/operation.d.ts +22 -0
- package/dist/document-model-editor/components/operation.d.ts.map +1 -0
- package/dist/document-model-editor/components/operation.js +21 -0
- package/dist/document-model-editor/components/operations.d.ts +17 -0
- package/dist/document-model-editor/components/operations.d.ts.map +1 -0
- package/dist/document-model-editor/components/operations.js +19 -0
- package/dist/document-model-editor/components/state-schemas.d.ts +13 -0
- package/dist/document-model-editor/components/state-schemas.d.ts.map +1 -0
- package/dist/document-model-editor/components/state-schemas.js +34 -0
- package/dist/document-model-editor/components/tabs.d.ts +8 -0
- package/dist/document-model-editor/components/tabs.d.ts.map +1 -0
- package/dist/document-model-editor/components/tabs.js +12 -0
- package/dist/document-model-editor/components/text-area.d.ts +9 -0
- package/dist/document-model-editor/components/text-area.d.ts.map +1 -0
- package/dist/document-model-editor/components/text-area.js +26 -0
- package/dist/document-model-editor/components/text-field.d.ts +21 -0
- package/dist/document-model-editor/components/text-field.d.ts.map +1 -0
- package/dist/document-model-editor/components/text-field.js +78 -0
- package/dist/document-model-editor/constants/documents.d.ts +12 -0
- package/dist/document-model-editor/constants/documents.d.ts.map +1 -0
- package/dist/document-model-editor/constants/documents.js +16 -0
- package/dist/document-model-editor/context/form-context.d.ts +11 -0
- package/dist/document-model-editor/context/form-context.d.ts.map +1 -0
- package/dist/document-model-editor/context/form-context.js +3 -0
- package/dist/document-model-editor/context/schema-context.d.ts +11 -0
- package/dist/document-model-editor/context/schema-context.d.ts.map +1 -0
- package/dist/document-model-editor/context/schema-context.js +116 -0
- package/dist/document-model-editor/document-model-editor.stories.d.ts +48 -0
- package/dist/document-model-editor/document-model-editor.stories.d.ts.map +1 -0
- package/dist/document-model-editor/document-model-editor.stories.js +252 -0
- package/dist/document-model-editor/editor.d.ts +3 -0
- package/dist/document-model-editor/editor.d.ts.map +1 -0
- package/dist/document-model-editor/editor.js +186 -0
- package/dist/document-model-editor/hooks/useFormField.d.ts +13 -0
- package/dist/document-model-editor/hooks/useFormField.d.ts.map +1 -0
- package/dist/document-model-editor/hooks/useFormField.js +21 -0
- package/dist/document-model-editor/index.d.ts +3 -0
- package/dist/document-model-editor/index.d.ts.map +1 -0
- package/dist/document-model-editor/index.js +2 -0
- package/dist/document-model-editor/module.d.ts +4 -0
- package/dist/document-model-editor/module.d.ts.map +1 -0
- package/dist/document-model-editor/module.js +10 -0
- package/dist/document-model-editor/schemas/inputs.d.ts +31 -0
- package/dist/document-model-editor/schemas/inputs.d.ts.map +1 -0
- package/dist/document-model-editor/schemas/inputs.js +70 -0
- package/dist/document-model-editor/schemas/utils.d.ts +3 -0
- package/dist/document-model-editor/schemas/utils.d.ts.map +1 -0
- package/dist/document-model-editor/schemas/utils.js +2 -0
- package/dist/document-model-editor/types/documents.d.ts +27 -0
- package/dist/document-model-editor/types/documents.d.ts.map +1 -0
- package/dist/document-model-editor/types/documents.js +1 -0
- package/dist/document-model-editor/utils/helpers.d.ts +39 -0
- package/dist/document-model-editor/utils/helpers.d.ts.map +1 -0
- package/dist/document-model-editor/utils/helpers.js +293 -0
- package/dist/document-model-editor/utils/linting.d.ts +7 -0
- package/dist/document-model-editor/utils/linting.d.ts.map +1 -0
- package/dist/document-model-editor/utils/linting.js +47 -0
- package/dist/document-model-editor/utils/style.d.ts +3 -0
- package/dist/document-model-editor/utils/style.d.ts.map +1 -0
- package/dist/document-model-editor/utils/style.js +5 -0
- package/dist/editor-utils/components/documentEditor.d.ts +7 -0
- package/dist/editor-utils/components/documentEditor.d.ts.map +1 -0
- package/dist/editor-utils/components/documentEditor.js +5 -0
- package/dist/editor-utils/components/editorToolbar.d.ts +11 -0
- package/dist/editor-utils/components/editorToolbar.d.ts.map +1 -0
- package/dist/editor-utils/components/editorToolbar.js +5 -0
- package/dist/editor-utils/components/editorWorksheet.d.ts +7 -0
- package/dist/editor-utils/components/editorWorksheet.d.ts.map +1 -0
- package/dist/editor-utils/components/editorWorksheet.js +4 -0
- package/dist/editor-utils/components/index.d.ts +9 -0
- package/dist/editor-utils/components/index.d.ts.map +1 -0
- package/dist/editor-utils/components/index.js +9 -0
- package/dist/editor-utils/components/styles.d.ts +40 -0
- package/dist/editor-utils/components/styles.d.ts.map +1 -0
- package/dist/editor-utils/components/styles.js +78 -0
- package/dist/editor-utils/components/stylesVariant.d.ts +40 -0
- package/dist/editor-utils/components/stylesVariant.d.ts.map +1 -0
- package/dist/editor-utils/components/stylesVariant.js +88 -0
- package/dist/editor-utils/components/textInput.d.ts +20 -0
- package/dist/editor-utils/components/textInput.d.ts.map +1 -0
- package/dist/editor-utils/components/textInput.js +83 -0
- package/dist/editor-utils/components/textInputVariant.d.ts +21 -0
- package/dist/editor-utils/components/textInputVariant.d.ts.map +1 -0
- package/dist/editor-utils/components/textInputVariant.js +92 -0
- package/dist/editor-utils/components/toolbarButton.d.ts +7 -0
- package/dist/editor-utils/components/toolbarButton.d.ts.map +1 -0
- package/dist/editor-utils/components/toolbarButton.js +8 -0
- package/dist/editor-utils/hooks/index.d.ts +2 -0
- package/dist/editor-utils/hooks/index.d.ts.map +1 -0
- package/dist/editor-utils/hooks/index.js +1 -0
- package/dist/editor-utils/hooks/useEnsInfo.d.ts +15 -0
- package/dist/editor-utils/hooks/useEnsInfo.d.ts.map +1 -0
- package/dist/editor-utils/hooks/useEnsInfo.js +63 -0
- package/dist/editor-utils/index.d.ts +5 -0
- package/dist/editor-utils/index.d.ts.map +1 -0
- package/dist/editor-utils/index.js +4 -0
- package/dist/editor-utils/reducer.d.ts +3 -0
- package/dist/editor-utils/reducer.d.ts.map +1 -0
- package/dist/editor-utils/reducer.js +24 -0
- package/dist/editor-utils/storybook.d.ts +25 -0
- package/dist/editor-utils/storybook.d.ts.map +1 -0
- package/dist/editor-utils/storybook.js +118 -0
- package/dist/styles.css +786 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +102 -0
|
@@ -0,0 +1,16 @@
|
|
|
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 function Modules({ modules, allOperations, addModule, updateModuleName, deleteModule, updateOperationName, deleteOperation, addOperationAndInitialSchema, updateOperationSchema, setOperationDescription, addOperationError, deleteOperationError, setOperationErrorName, }) {
|
|
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 }, 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 }, "add-module"), _jsx("div", { ref: focusTrapRef, tabIndex: 0, className: "size-0 overflow-hidden", "aria-hidden": "true" })] }));
|
|
16
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Module } from "document-model";
|
|
2
|
+
type Props = {
|
|
3
|
+
operation: Module["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
|
|
@@ -0,0 +1 @@
|
|
|
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,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAI7C,KAAK,KAAK,GAAG;IACX,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;IACxC,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"}
|
|
@@ -0,0 +1,12 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { DocumentModelOperationError, Module } from "document-model";
|
|
2
|
+
type Props = {
|
|
3
|
+
operation: Module["operations"][number];
|
|
4
|
+
error?: DocumentModelOperationError;
|
|
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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-error-form.d.ts","sourceRoot":"","sources":["../../../document-model-editor/components/operation-error-form.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAI1E,KAAK,KAAK,GAAG;IACX,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;IACxC,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"}
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { Module } from "document-model";
|
|
2
|
+
type Props = {
|
|
3
|
+
operation: Module["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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-errors.d.ts","sourceRoot":"","sources":["../../../document-model-editor/components/operation-errors.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAI7C,KAAK,KAAK,GAAG;IACX,SAAS,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;IACxC,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"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Module } from "document-model";
|
|
2
|
+
type Props = {
|
|
3
|
+
module: Module;
|
|
4
|
+
operation?: Module["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
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation-form.d.ts","sourceRoot":"","sources":["../../../document-model-editor/components/operation-form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAK7C,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;IACzC,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"}
|
|
@@ -0,0 +1,36 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Module } from "document-model";
|
|
2
|
+
import { 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: Module["operations"][number];
|
|
9
|
+
module: Module;
|
|
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
|
+
};
|
|
20
|
+
export declare function Operation(props: Props): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=operation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../../document-model-editor/components/operation.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAa,MAAM,gBAAgB,CAAC;AAOxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAE/D,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,MAAM,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,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;CACX,CAAC;AACF,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,2CA6ErC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { GraphqlEditor } from "./code-editors/graphql-editor.js";
|
|
3
|
+
import { OperationDescriptionForm } from "./operation-description-form.js";
|
|
4
|
+
import { OperationErrors } from "./operation-errors.js";
|
|
5
|
+
import { OperationForm } from "./operation-form.js";
|
|
6
|
+
import { ensureValidOperationSchemaInputName } from "../utils/linting.js";
|
|
7
|
+
import { useCallback } from "react";
|
|
8
|
+
export function Operation(props) {
|
|
9
|
+
const { operation, module, allOperationNames, lastCreatedOperationId, onAddOperationAndInitialSchema, updateOperationName, deleteOperation, updateOperationSchema, setOperationDescription, addOperationError, deleteOperationError, setOperationErrorName, } = props;
|
|
10
|
+
const handleUpdateDocument = useCallback((newDoc) => updateOperationSchema(operation.id, newDoc), [operation.id, updateOperationSchema]);
|
|
11
|
+
const customLinter = useCallback((doc) => operation.name
|
|
12
|
+
? ensureValidOperationSchemaInputName(doc, operation.name)
|
|
13
|
+
: [], [operation.name]);
|
|
14
|
+
return (_jsxs("div", { className: "mt-4 grid grid-cols-2 gap-x-12", style: {
|
|
15
|
+
gridTemplateAreas: `
|
|
16
|
+
"left editor"
|
|
17
|
+
"errors editor"
|
|
18
|
+
`,
|
|
19
|
+
gridTemplateRows: "auto 1fr",
|
|
20
|
+
}, 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 })] }), _jsx("div", { className: "relative top-8", style: { gridArea: "editor" }, 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 })] })] }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Module } from "document-model";
|
|
2
|
+
type Props = {
|
|
3
|
+
module: Module;
|
|
4
|
+
allOperations: Module["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
|
+
};
|
|
15
|
+
export declare function Operations({ module, allOperations, shouldFocusNewOperation, updateOperationName, deleteOperation, addOperationAndInitialSchema, addOperationError, deleteOperationError, setOperationErrorName, updateOperationSchema, setOperationDescription, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=operations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operations.d.ts","sourceRoot":"","sources":["../../../document-model-editor/components/operations.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAI7C,KAAK,KAAK,GAAG;IACX,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;IACpC,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;CACX,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,GACxB,EAAE,KAAK,2CAqDP"}
|
|
@@ -0,0 +1,19 @@
|
|
|
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, }) {
|
|
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 }) }, 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
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Scope } from "../types/documents.js";
|
|
2
|
+
type Props = {
|
|
3
|
+
modelName: string;
|
|
4
|
+
globalStateSchema: string;
|
|
5
|
+
localStateSchema: string;
|
|
6
|
+
globalStateInitialValue: string;
|
|
7
|
+
localStateInitialValue: string;
|
|
8
|
+
setStateSchema: (doc: string, scope: Scope) => void;
|
|
9
|
+
setInitialState: (doc: string, scope: Scope) => void;
|
|
10
|
+
};
|
|
11
|
+
export declare function StateSchemas({ modelName, globalStateSchema, localStateSchema, globalStateInitialValue, localStateInitialValue, setStateSchema, setInitialState, }: Props): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=state-schemas.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"state-schemas.d.ts","sourceRoot":"","sources":["../../../document-model-editor/components/state-schemas.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAY9C,KAAK,KAAK,GAAG;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,uBAAuB,EAAE,MAAM,CAAC;IAChC,sBAAsB,EAAE,MAAM,CAAC;IAC/B,cAAc,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IACpD,eAAe,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;CACtD,CAAC;AAqHF,wBAAgB,YAAY,CAAC,EAC3B,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,sBAAsB,EACtB,cAAc,EACd,eAAe,GAChB,EAAE,KAAK,2CA8CP"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useCallback } from "react";
|
|
3
|
+
import { typeDefsDoc } from "../constants/documents.js";
|
|
4
|
+
import { useSchemaContext } from "../context/schema-context.js";
|
|
5
|
+
import { makeMinimalObjectFromSDL, makeInitialSchemaDoc, } from "../utils/helpers.js";
|
|
6
|
+
import { ensureValidStateSchemaName } from "../utils/linting.js";
|
|
7
|
+
import { cn } from "../utils/style.js";
|
|
8
|
+
import { Button } from "./button.js";
|
|
9
|
+
import { Tabs, TabsList, TabsTrigger, TabsContent } from "./tabs.js";
|
|
10
|
+
import { GraphqlEditor } from "./code-editors/graphql-editor.js";
|
|
11
|
+
import { JSONEditor } from "./code-editors/json-editor.js";
|
|
12
|
+
function StateEditor({ modelName, stateSchema, initialValue, setStateSchema, setInitialState, scope, }) {
|
|
13
|
+
const sharedSchemaSdl = useSchemaContext();
|
|
14
|
+
const [showStandardLib, setShowStandardLib] = useState(false);
|
|
15
|
+
const customLinter = useCallback((doc) => ensureValidStateSchemaName(doc, modelName, scope), [modelName, scope]);
|
|
16
|
+
const handleToggleStandardLib = useCallback(() => {
|
|
17
|
+
setShowStandardLib((prev) => !prev);
|
|
18
|
+
}, []);
|
|
19
|
+
const handleSchemaUpdate = useCallback((newDoc) => setStateSchema(newDoc, scope), [setStateSchema, scope]);
|
|
20
|
+
const handleInitialStateUpdate = useCallback((newDoc) => setInitialState(newDoc, scope), [setInitialState, scope]);
|
|
21
|
+
const handleSyncWithSchema = useCallback(() => {
|
|
22
|
+
const updatedStateDoc = makeMinimalObjectFromSDL(sharedSchemaSdl, stateSchema, initialValue ? JSON.parse(initialValue) : {});
|
|
23
|
+
setInitialState(updatedStateDoc, scope);
|
|
24
|
+
}, [sharedSchemaSdl, stateSchema, initialValue, setInitialState, scope]);
|
|
25
|
+
return (_jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { children: [_jsxs("h3", { className: "mb-2 text-lg capitalize", children: [scope, " state schema"] }), _jsxs(Button, { onClick: handleToggleStandardLib, className: "mb-2 flex w-fit items-center gap-2", children: [showStandardLib ? "Hide" : "Show", " standard library", _jsx("svg", { className: cn("inline-block transition-transform", showStandardLib ? "rotate-180" : "rotate-0"), xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", children: _jsx("path", { d: "M11.9883 6.01172C11.4363 6.01172 10.9883 6.45972 10.9883 7.01172V13.0117H6.98828L11.9883 18.0117L16.9883 13.0117H12.9883V7.01172C12.9883 6.45972 12.5403 6.01172 11.9883 6.01172Z", fill: "black" }) })] }), showStandardLib && _jsx(GraphqlEditor, { doc: typeDefsDoc, readonly: true }), _jsx(GraphqlEditor, { doc: stateSchema, updateDocumentInModel: handleSchemaUpdate, customLinter: customLinter })] }), _jsxs("div", { children: [_jsxs("div", { className: "flex flex-col items-end", children: [_jsxs("h3", { className: "mb-2 text-right text-lg capitalize", children: [scope, " state initial value"] }), _jsxs(Button, { onClick: handleSyncWithSchema, className: "mb-2 flex w-fit items-center gap-2", children: ["Sync with schema", " ", _jsx("svg", { className: "inline-block", xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", children: _jsx("path", { d: "M8.00521 1.99219C6.63588 1.99219 5.32788 2.45152 4.27588 3.28419C3.98721 3.51219 3.94321 3.93285 4.17188 4.22151C4.40054 4.51018 4.82055 4.55418 5.10921 4.32552C5.92721 3.67819 6.93921 3.32552 8.00521 3.32552C10.5825 3.32552 12.6719 5.41485 12.6719 7.99218H11.3385L13.3385 10.6588L15.3385 7.99218H14.0052C14.0052 4.67818 11.3192 1.99219 8.00521 1.99219ZM2.67188 5.32552L0.671875 7.99218H2.00521C2.00521 11.3062 4.69121 13.9922 8.00521 13.9922C9.37521 13.9922 10.6825 13.5335 11.7345 12.7002C12.0232 12.4722 12.0672 12.0515 11.8385 11.7628C11.6099 11.4742 11.1899 11.4302 10.9012 11.6588C10.0825 12.3068 9.07188 12.6588 8.00521 12.6588C5.42788 12.6588 3.33854 10.5695 3.33854 7.99218H4.67188L2.67188 5.32552Z", fill: "#343839" }) })] })] }), _jsx(JSONEditor, { doc: initialValue, updateDocumentInModel: handleInitialStateUpdate })] })] }));
|
|
26
|
+
}
|
|
27
|
+
export function StateSchemas({ modelName, globalStateSchema, localStateSchema, globalStateInitialValue, localStateInitialValue, setStateSchema, setInitialState, }) {
|
|
28
|
+
const handleAddLocalState = useCallback(() => {
|
|
29
|
+
const initialDoc = makeInitialSchemaDoc(modelName, "local");
|
|
30
|
+
setStateSchema(initialDoc, "local");
|
|
31
|
+
setInitialState("", "local");
|
|
32
|
+
}, [modelName, setStateSchema, setInitialState]);
|
|
33
|
+
return (_jsxs(Tabs, { className: "pb-8", activationMode: "manual", defaultValue: "global", children: [_jsx("div", { className: "my-6", children: _jsxs(TabsList, { className: "mx-auto flex max-w-sm", children: [_jsx(TabsTrigger, { value: "global", children: "Global" }), _jsx(TabsTrigger, { value: "local", children: "Local" })] }) }), _jsx(TabsContent, { value: "global", tabIndex: -1, children: _jsx(StateEditor, { modelName: modelName, stateSchema: globalStateSchema, initialValue: globalStateInitialValue, setStateSchema: setStateSchema, setInitialState: setInitialState, scope: "global" }) }), _jsx(TabsContent, { value: "local", tabIndex: -1, children: !localStateSchema ? (_jsxs("div", { className: "", children: [_jsx("h3", { className: "mb-2 text-lg capitalize", children: "local state schema" }), _jsx(Button, { onClick: handleAddLocalState, children: "Add local state" })] })) : (_jsx(StateEditor, { modelName: modelName, stateSchema: localStateSchema, initialValue: localStateInitialValue, setStateSchema: setStateSchema, setInitialState: setInitialState, scope: "local" })) })] }));
|
|
34
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
3
|
+
declare const Tabs: React.ForwardRefExoticComponent<TabsPrimitive.TabsProps & React.RefAttributes<HTMLDivElement>>;
|
|
4
|
+
declare const TabsList: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsListProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const TabsTrigger: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsTriggerProps & React.RefAttributes<HTMLButtonElement>, "ref"> & React.RefAttributes<HTMLButtonElement>>;
|
|
6
|
+
declare const TabsContent: React.ForwardRefExoticComponent<Omit<TabsPrimitive.TabsContentProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
7
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
|
8
|
+
//# sourceMappingURL=tabs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tabs.d.ts","sourceRoot":"","sources":["../../../document-model-editor/components/tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,aAAa,MAAM,sBAAsB,CAAC;AAGtD,QAAA,MAAM,IAAI,gGAAqB,CAAC;AAEhC,QAAA,MAAM,QAAQ,uJAYZ,CAAC;AAGH,QAAA,MAAM,WAAW,gKAYf,CAAC;AAGH,QAAA,MAAM,WAAW,0JAKf,CAAC;AAGH,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import * as TabsPrimitive from "@radix-ui/react-tabs";
|
|
4
|
+
import { cn } from "../utils/style.js";
|
|
5
|
+
const Tabs = TabsPrimitive.Root;
|
|
6
|
+
const TabsList = React.forwardRef(({ className, ...props }, ref) => (_jsx(TabsPrimitive.List, { ref: ref, className: cn("flex items-center justify-center rounded-xl bg-slate-50 p-1 shadow-[inset_0px_0px_2px_rgba(255,255,255,0.50)]", className), ...props })));
|
|
7
|
+
TabsList.displayName = TabsPrimitive.List.displayName;
|
|
8
|
+
const TabsTrigger = React.forwardRef(({ className, ...props }, ref) => (_jsx(TabsPrimitive.Trigger, { ref: ref, className: cn("flex w-full items-center justify-center whitespace-nowrap rounded-lg p-1 text-sm text-gray-500 transition-all disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-gray-50 data-[state=active]:text-gray-800 data-[state=active]:shadow-[0px_16px_16px_-4px_rgba(0,0,0,0.10)]", className), ...props })));
|
|
9
|
+
TabsTrigger.displayName = TabsPrimitive.Trigger.displayName;
|
|
10
|
+
const TabsContent = React.forwardRef(({ className, ...props }, ref) => (_jsx(TabsPrimitive.Content, { ref: ref, className: cn("", className), ...props })));
|
|
11
|
+
TabsContent.displayName = TabsPrimitive.Content.displayName;
|
|
12
|
+
export { Tabs, TabsList, TabsTrigger, TabsContent };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface TextareaProps extends React.TextareaHTMLAttributes<HTMLTextAreaElement> {
|
|
3
|
+
}
|
|
4
|
+
export interface TextareaHandle {
|
|
5
|
+
focus: () => void;
|
|
6
|
+
element: HTMLTextAreaElement | null;
|
|
7
|
+
}
|
|
8
|
+
export declare const Textarea: React.ForwardRefExoticComponent<TextareaProps & React.RefAttributes<TextareaHandle>>;
|
|
9
|
+
//# sourceMappingURL=text-area.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-area.d.ts","sourceRoot":"","sources":["../../../document-model-editor/components/text-area.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAI/B,MAAM,WAAW,aACf,SAAQ,KAAK,CAAC,sBAAsB,CAAC,mBAAmB,CAAC;CAAG;AAE9D,MAAM,WAAW,cAAc;IAC7B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAAC;CACrC;AAED,eAAO,MAAM,QAAQ,sFAwCpB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { forwardRef, useImperativeHandle, useRef, useCallback } from "react";
|
|
4
|
+
import { cn } from "../utils/style.js";
|
|
5
|
+
export const Textarea = forwardRef(({ className, ...props }, ref) => {
|
|
6
|
+
const textareaRef = useRef(null);
|
|
7
|
+
const adjustHeight = useCallback((textarea) => {
|
|
8
|
+
textarea.style.height = "auto";
|
|
9
|
+
const newHeight = Math.max(textarea.scrollHeight, textarea.offsetHeight);
|
|
10
|
+
textarea.style.height = `${newHeight}px`;
|
|
11
|
+
}, []);
|
|
12
|
+
const handleInput = useCallback((e) => {
|
|
13
|
+
adjustHeight(e.currentTarget);
|
|
14
|
+
}, [adjustHeight]);
|
|
15
|
+
React.useEffect(() => {
|
|
16
|
+
if (textareaRef.current) {
|
|
17
|
+
adjustHeight(textareaRef.current);
|
|
18
|
+
}
|
|
19
|
+
}, [adjustHeight]);
|
|
20
|
+
useImperativeHandle(ref, () => ({
|
|
21
|
+
focus: () => textareaRef.current?.focus(),
|
|
22
|
+
element: textareaRef.current,
|
|
23
|
+
}));
|
|
24
|
+
return (_jsx("textarea", { ...props, className: cn("min-h-10 w-full resize-none rounded-md border border-gray-200 bg-gray-50 px-3 py-2 text-sm text-gray-800 placeholder:text-gray-600 focus-visible:outline-none disabled:cursor-not-allowed disabled:opacity-50", className), ref: textareaRef, onInput: handleInput }));
|
|
25
|
+
});
|
|
26
|
+
Textarea.displayName = "Textarea";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
type TextFieldProps = {
|
|
2
|
+
name: string;
|
|
3
|
+
value: string | null | undefined;
|
|
4
|
+
onSubmit: (value: string) => void;
|
|
5
|
+
label?: string;
|
|
6
|
+
placeholder?: string;
|
|
7
|
+
className?: string;
|
|
8
|
+
rows?: number;
|
|
9
|
+
focusOnMount?: boolean;
|
|
10
|
+
required?: boolean;
|
|
11
|
+
allowEmpty?: boolean;
|
|
12
|
+
unique?: string[];
|
|
13
|
+
shouldReset?: boolean;
|
|
14
|
+
onChange?: (value: string) => void;
|
|
15
|
+
};
|
|
16
|
+
type TextFieldHandle = {
|
|
17
|
+
focus: () => void;
|
|
18
|
+
};
|
|
19
|
+
export declare const TextField: import("react").ForwardRefExoticComponent<TextFieldProps & import("react").RefAttributes<TextFieldHandle>>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=text-field.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"text-field.d.ts","sourceRoot":"","sources":["../../../document-model-editor/components/text-field.tsx"],"names":[],"mappings":"AAsBA,KAAK,cAAc,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACjC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC,CAAC;AAEF,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,SAAS,4GA0IrB,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useEffect, useRef, forwardRef, useImperativeHandle, } from "react";
|
|
3
|
+
import { useForm } from "react-hook-form";
|
|
4
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
import { createNameSchema } from "../schemas/inputs.js";
|
|
7
|
+
import { compareStringsWithoutWhitespace } from "../utils/helpers.js";
|
|
8
|
+
import { FormField, FormItem, FormLabel, FormControl, FormMessage, Form, } from "./form.js";
|
|
9
|
+
import { Textarea } from "./text-area.js";
|
|
10
|
+
export const TextField = forwardRef(({ name, value, onSubmit, label, placeholder, unique, className = "", rows = 1, focusOnMount = false, required = false, allowEmpty = false, shouldReset = false, onChange, }, ref) => {
|
|
11
|
+
const textareaRef = useRef(null);
|
|
12
|
+
useEffect(() => {
|
|
13
|
+
if (focusOnMount && textareaRef.current) {
|
|
14
|
+
textareaRef.current.focus();
|
|
15
|
+
}
|
|
16
|
+
}, [focusOnMount]);
|
|
17
|
+
const fieldSchema = z.object({
|
|
18
|
+
[name]: createNameSchema({ required, allowEmpty, unique }),
|
|
19
|
+
});
|
|
20
|
+
const form = useForm({
|
|
21
|
+
resolver: zodResolver(fieldSchema),
|
|
22
|
+
defaultValues: {
|
|
23
|
+
[name]: value ?? "",
|
|
24
|
+
},
|
|
25
|
+
});
|
|
26
|
+
const handleSubmit = useCallback((values) => {
|
|
27
|
+
const newValue = values[name];
|
|
28
|
+
if (newValue === undefined || value === newValue)
|
|
29
|
+
return;
|
|
30
|
+
onSubmit(newValue);
|
|
31
|
+
if (shouldReset)
|
|
32
|
+
form.reset({ [name]: "" });
|
|
33
|
+
}, [name, value, onSubmit, form, shouldReset]);
|
|
34
|
+
const handleBlur = useCallback(async () => {
|
|
35
|
+
const currentValue = form.getValues()[name] ?? "";
|
|
36
|
+
if (value === null || value === undefined) {
|
|
37
|
+
if (!currentValue || currentValue.trim() === "")
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
if (compareStringsWithoutWhitespace(currentValue, value ?? ""))
|
|
41
|
+
return;
|
|
42
|
+
try {
|
|
43
|
+
await form.trigger(); // Trigger validation
|
|
44
|
+
if (form.formState.isValid) {
|
|
45
|
+
await form.handleSubmit(handleSubmit)();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch (e) {
|
|
49
|
+
// Allow blur to proceed even if validation fails
|
|
50
|
+
}
|
|
51
|
+
}, [form, handleSubmit, name, value]);
|
|
52
|
+
const onEnterKeyDown = useCallback((e) => {
|
|
53
|
+
if (e.key === "Enter") {
|
|
54
|
+
e.preventDefault();
|
|
55
|
+
e.target.blur();
|
|
56
|
+
}
|
|
57
|
+
}, []);
|
|
58
|
+
const handleChange = useCallback((e) => {
|
|
59
|
+
const newValue = e.target.value;
|
|
60
|
+
onChange?.(newValue);
|
|
61
|
+
}, [onChange]);
|
|
62
|
+
useImperativeHandle(ref, () => ({
|
|
63
|
+
focus: () => textareaRef.current?.focus(),
|
|
64
|
+
}));
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
form.reset({ [name]: value ?? "" });
|
|
67
|
+
}, [form, name, value]);
|
|
68
|
+
return (_jsx(Form, { ...form, children: _jsx(FormField, { control: form.control, name: name, render: ({ field }) => (_jsxs(FormItem, { className: "grid h-full grid-rows-[auto,1fr] gap-2 overflow-visible", children: [!!label && (_jsx(FormLabel, { htmlFor: name, className: "text-sm font-medium text-gray-700", children: label })), _jsx(FormControl, { children: _jsx(Textarea, { ...field, id: name, ref: (node) => {
|
|
69
|
+
if (node) {
|
|
70
|
+
field.ref(node.element);
|
|
71
|
+
textareaRef.current = node;
|
|
72
|
+
}
|
|
73
|
+
}, placeholder: placeholder, onBlur: handleBlur, onChange: (e) => {
|
|
74
|
+
field.onChange(e);
|
|
75
|
+
handleChange(e);
|
|
76
|
+
}, onKeyDown: onEnterKeyDown, rows: rows, className: className }) }), _jsx(FormMessage, {})] })) }) }));
|
|
77
|
+
});
|
|
78
|
+
TextField.displayName = "TextField";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const hiddenQueryTypeDefDoc = "type Query {\n _hidden: String\n}\n";
|
|
2
|
+
export declare const typeDefsDoc: string;
|
|
3
|
+
export declare const initialSchemaDoc: string;
|
|
4
|
+
export declare const initialSchema: import("graphql").GraphQLSchema;
|
|
5
|
+
export declare const specialDocIds: {
|
|
6
|
+
readonly hiddenQueryTypeDef: "hidden-query-type-defs";
|
|
7
|
+
readonly standardLib: "standard-lib";
|
|
8
|
+
readonly global: "global";
|
|
9
|
+
readonly local: "local";
|
|
10
|
+
};
|
|
11
|
+
export declare const updateTimeout = 5000;
|
|
12
|
+
//# sourceMappingURL=documents.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documents.d.ts","sourceRoot":"","sources":["../../../document-model-editor/constants/documents.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,qBAAqB,yCAGjC,CAAC;AAEF,eAAO,MAAM,WAAW,QAAsB,CAAC;AAE/C,eAAO,MAAM,gBAAgB,QAA6C,CAAC;AAE3E,eAAO,MAAM,aAAa,iCAAgC,CAAC;AAE3D,eAAO,MAAM,aAAa;;;;;CAKhB,CAAC;AAEX,eAAO,MAAM,aAAa,OAAO,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { buildSchema } from "graphql";
|
|
2
|
+
import { typeDefs } from "@powerhousedao/scalars";
|
|
3
|
+
export const hiddenQueryTypeDefDoc = `type Query {
|
|
4
|
+
_hidden: String
|
|
5
|
+
}
|
|
6
|
+
`;
|
|
7
|
+
export const typeDefsDoc = typeDefs.join("\n");
|
|
8
|
+
export const initialSchemaDoc = `${hiddenQueryTypeDefDoc}\n${typeDefsDoc}`;
|
|
9
|
+
export const initialSchema = buildSchema(initialSchemaDoc);
|
|
10
|
+
export const specialDocIds = {
|
|
11
|
+
hiddenQueryTypeDef: "hidden-query-type-defs",
|
|
12
|
+
standardLib: "standard-lib",
|
|
13
|
+
global: "global",
|
|
14
|
+
local: "local",
|
|
15
|
+
};
|
|
16
|
+
export const updateTimeout = 5000;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FieldValues, FieldPath } from "react-hook-form";
|
|
3
|
+
export type FormFieldContextValue<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = {
|
|
4
|
+
name: TName;
|
|
5
|
+
};
|
|
6
|
+
export declare const FormFieldContext: React.Context<FormFieldContextValue<FieldValues, string>>;
|
|
7
|
+
export type FormItemContextValue = {
|
|
8
|
+
id: string;
|
|
9
|
+
};
|
|
10
|
+
export declare const FormItemContext: React.Context<FormItemContextValue>;
|
|
11
|
+
//# sourceMappingURL=form-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-context.d.ts","sourceRoot":"","sources":["../../../document-model-editor/context/form-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEzD,MAAM,MAAM,qBAAqB,CAC/B,YAAY,SAAS,WAAW,GAAG,WAAW,EAC9C,KAAK,SAAS,SAAS,CAAC,YAAY,CAAC,GAAG,SAAS,CAAC,YAAY,CAAC,IAC7D;IACF,IAAI,EAAE,KAAK,CAAC;CACb,CAAC;AAEF,eAAO,MAAM,gBAAgB,2DAE5B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,eAAO,MAAM,eAAe,qCAE3B,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
type TSchemaContextProps = {
|
|
2
|
+
globalStateSchemaSdl: string;
|
|
3
|
+
localStateSchemaSdl: string;
|
|
4
|
+
operationSchemasSdl: string;
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
};
|
|
7
|
+
export declare const SchemaContext: import("react").Context<string>;
|
|
8
|
+
export declare function SchemaContextProvider(props: TSchemaContextProps): import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export declare function useSchemaContext(): string;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=schema-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema-context.d.ts","sourceRoot":"","sources":["../../../document-model-editor/context/schema-context.tsx"],"names":[],"mappings":"AAoCA,KAAK,mBAAmB,GAAG;IACzB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAC;AA0FF,eAAO,MAAM,aAAa,iCAEzB,CAAC;AAMF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,mBAAmB,2CAgC/D;AAED,wBAAgB,gBAAgB,WAE/B"}
|