import React from 'react'; import type { ProjectDefinitionContainer } from '#src/definition/project-definition-container.js'; import type { SchemaParserContext } from '#src/parser/types.js'; import type { PluginSpecStore } from '#src/plugins/index.js'; import type { DefinitionIssue } from '#src/schema/creator/definition-issue-types.js'; import type { DefinitionSchemaParserContext } from '#src/schema/index.js'; import type { ProjectDefinition } from '#src/schema/project-definition.js'; /** * A function that sets the project definition. * * This can be a function that returns a new project definition, or a function that * mutates the existing project definition (using Immer). */ export type ProjectDefinitionSetter = (draftConfig: ProjectDefinition) => void; export interface SaveDefinitionWithFeedbackOptions { disableDeleteRefDialog?: boolean; successMessage?: string; onSuccess?: () => void; } export interface SaveDefinitionResult { warnings: DefinitionIssue[]; } /** * The result of the `useProjectDefinition` hook. */ export interface UseProjectDefinitionResult { /** * The current project definition. */ definition: ProjectDefinition; /** * The project definition container. */ definitionContainer: ProjectDefinitionContainer; /** * Whether the project definition has been updated externally. */ updatedExternally: boolean; /** * Save the project definition. Returns the number of warnings encountered. */ saveDefinition: (definition: ProjectDefinitionSetter) => Promise; /** * Save the project definition with feedback showing a toast * when there are errors or a success message when the definition is saved. */ saveDefinitionWithFeedback: (definition: ProjectDefinitionSetter, options?: SaveDefinitionWithFeedbackOptions) => Promise<{ success: boolean; }>; /** * Save the project definition with feedback showing a toast * when there are errors or a success message when the definition is saved. */ saveDefinitionWithFeedbackSync: (definition: ProjectDefinitionSetter, options?: SaveDefinitionWithFeedbackOptions) => void; /** * Whether the project definition is being saved. */ isSavingDefinition: boolean; /** * The plugin container. */ pluginContainer: PluginSpecStore; /** * The schema parser context. */ schemaParserContext: SchemaParserContext; /** * The definition schema parser context. */ definitionSchemaParserContext: DefinitionSchemaParserContext; /** * Warning-severity definition issues that allow saving but should be shown before syncing. */ definitionWarnings: DefinitionIssue[]; } export declare const ProjectDefinitionContext: React.Context; export declare function useProjectDefinition(): UseProjectDefinitionResult; //# sourceMappingURL=use-project-definition.d.ts.map