UNPKG

@finos/legend-application-studio

Version:
80 lines 4.03 kB
/** * Copyright (c) 2020-present, Goldman Sachs * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import type { EditorStore } from '../../EditorStore.js'; import { ELEMENT_NATIVE_VIEW_MODE } from '../../EditorConfig.js'; import { EditorState } from '../../editor-state/EditorState.js'; import { type GeneratorFn } from '@finos/legend-shared'; import { type CompilationError, type PackageableElement } from '@finos/legend-graph'; import type { ElementFileGenerationState } from './ElementFileGenerationState.js'; import type { ElementXTSchemaGenerationState } from './ElementExternalFormatGenerationState.js'; import type { EditorInitialConfiguration } from './ElementEditorInitialConfiguration.js'; export declare enum ELEMENT_GENERATION_MODE { FILE_GENERATION = "FILE_GENERATION", EXTERNAL_FORMAT = "EXTERNAL_FORMAT" } export declare abstract class ElementGenerationModeState { elementEditorState: ElementEditorState; editorStore: EditorStore; constructor(editorStore: EditorStore, elementEditorState: ElementEditorState); abstract get label(): string; } export declare class ExternalFormatElementGenerationViewModeState extends ElementGenerationModeState { generationState: ElementXTSchemaGenerationState; constructor(editorStore: EditorStore, elementEditorState: ElementEditorState, generationState: ElementXTSchemaGenerationState); get label(): string; } export declare class FileGenerationViewModeState extends ElementGenerationModeState { elementGenerationState: ElementFileGenerationState; constructor(editorStore: EditorStore, elementEditorState: ElementEditorState, elementGenerationState: ElementFileGenerationState); get label(): string; } export declare abstract class ElementEditorState extends EditorState { element: PackageableElement; editMode: ELEMENT_NATIVE_VIEW_MODE; generationModeState: ElementGenerationModeState | undefined; textContent: string; isReadOnly: boolean; constructor(editorStore: EditorStore, element: PackageableElement, config?: EditorInitialConfiguration | undefined); get label(): string; get elementPath(): string; get description(): string | undefined; match(tab: EditorState): boolean; setTextContent(text: string): void; setEditMode(mode: ELEMENT_NATIVE_VIEW_MODE): void; setGenerationModeState(state: ElementGenerationModeState | undefined): void; changeGenerationModeState(mode: string, type: ELEMENT_GENERATION_MODE): void; generateElementProtocol(): void; generateElementGrammar(): GeneratorFn<void>; /** * Takes the compilation and based on its source information, attempts to reveal the error * in the editor. The return values indicates if the editor has revealed the error successfully or not. */ revealCompilationError(compilationError: CompilationError): boolean; clearCompilationError(): void; onOpen(): void; /** * Clone the element editor state to be replaced as processing graph * * FIXME: here we clone instead of reusing the old state to avoid memory leak * however, this is still not ideal, because this method can still be written * to refer to older state. Ideally, we should produce a source-information * like JSON object to indicate the current location of the editor tab instead * * @risk memory-leak */ abstract reprocess(newElement: PackageableElement, editorStore: EditorStore): ElementEditorState; } //# sourceMappingURL=ElementEditorState.d.ts.map