From 652450a878fdfb538686bec87a666fe737367e9f Mon Sep 17 00:00:00 2001 From: Jos Warmer Date: Sat, 28 Sep 2024 09:52:43 +0200 Subject: [PATCH] Cleanup merge problems --- .../core/src/change-manager/AstChanger.ts | 2 +- .../core/src/change-manager/FreUndoManager.ts | 2 +- .../core/src/editor/actions/FreCommand.ts | 85 +------------------ .../FreCreateBinaryExpressionAction.ts | 2 +- .../FreCreateBinaryExpressionCommand.ts | 18 ++-- .../src/editor/actions/FreCustomCommand.ts | 14 +-- packages/core/src/editor/boxes/ButtonBox.ts | 4 +- .../boxes/externalBoxes/ExternalBooleanBox.ts | 2 +- .../boxes/externalBoxes/ExternalNumberBox.ts | 2 +- .../boxes/externalBoxes/ExternalStringBox.ts | 2 +- .../box-util-helpers/UtilLimitedHelpers.ts | 2 +- .../box-util-helpers/UtilPrimHelper.ts | 4 +- packages/core/src/editor/util/ListUtil.ts | 2 +- packages/core/src/storage/InMemoryModel.ts | 2 +- .../src/storage/server/ServerCommunication.ts | 2 +- 15 files changed, 31 insertions(+), 114 deletions(-) diff --git a/packages/core/src/change-manager/AstChanger.ts b/packages/core/src/change-manager/AstChanger.ts index 6e24cdba7..c5269afb0 100644 --- a/packages/core/src/change-manager/AstChanger.ts +++ b/packages/core/src/change-manager/AstChanger.ts @@ -1,5 +1,5 @@ import { runInAction } from "mobx" -import { FreUndoManager } from "./FreUndoManager" +import { FreUndoManager } from "./FreUndoManager.js" export type errorFunction = (msg: string) => void diff --git a/packages/core/src/change-manager/FreUndoManager.ts b/packages/core/src/change-manager/FreUndoManager.ts index a187a5c99..0bc33cb9c 100644 --- a/packages/core/src/change-manager/FreUndoManager.ts +++ b/packages/core/src/change-manager/FreUndoManager.ts @@ -1,4 +1,4 @@ -import { FreLogger } from "../logging/index"; +import { FreLogger } from "../logging/index.js"; import { FreChangeManager } from "./FreChangeManager.js"; import { FreModelUnit } from "../ast/index.js"; import { FreDelta } from "./FreDelta.js"; diff --git a/packages/core/src/editor/actions/FreCommand.ts b/packages/core/src/editor/actions/FreCommand.ts index 11e33c2be..49f2ec398 100644 --- a/packages/core/src/editor/actions/FreCommand.ts +++ b/packages/core/src/editor/actions/FreCommand.ts @@ -1,7 +1,7 @@ import { Box } from "../boxes/index.js"; import { FreEditor } from "../FreEditor.js"; import { EMPTY_POST_ACTION, FrePostAction } from "./FreAction.js"; -import { FreTriggerUse } from "./FreTriggers.js"; +import { FreTriggerUse } from "./FreTriggers.js" import { FreLogger } from "../../logging/index.js"; export const FRECOMMAND_LOGGER = new FreLogger("FreCommand"); // .mute(); @@ -52,86 +52,3 @@ class FreNullCommand extends FreCommand { } export const FRE_NULL_COMMAND: FreCommand = new FreNullCommand(); - -export type FreBinaryExpressionBuilder = (box: Box, text: string, editor: FreEditor) => FreBinaryExpression; - -export class FreCreateBinaryExpressionCommand extends FreCommand { - expressionBuilder: FreBinaryExpressionBuilder; - boxRoleToSelect: string; - caretPosition: FreCaret; - - constructor(expressionBuilder: FreBinaryExpressionBuilder) { - super(); - this.expressionBuilder = expressionBuilder; - } - - execute(box: Box, trigger: FreTriggerUse, editor: FreEditor): FrePostAction { - // console.log("FreCreateBinaryExpressionCommand: trigger [" + triggerTypeToString(trigger) + "] part: "); - const selected = BTREE.insertBinaryExpression( - this.expressionBuilder(box, triggerTypeToString(trigger), editor), - box, - editor, - ); - // TODO Check whether this fix works consistently correct. - const childProperty = selected.boxRoleToSelect === FRE_BINARY_EXPRESSION_LEFT ? "left" : "right"; - return function () { - LOGGER.log( - "FreCreateBinaryExpressionCommand select after: " + - selected.element.freLanguageConcept() + - " ID " + - selected.element.freId() + - " rolr " + - childProperty, - ); - editor.selectElement(selected.element, childProperty); - editor.selectFirstEditableChildBox(selected.element); - }; - } - - // @ts-ignore - // parameters present to adhere to base class signature - undo() { - /* to be done */ - } -} - -export class FreCustomCommand extends FreCommand { - boxRoleToSelect: string; - caretPosition: FreCaret; - action: CustomAction; - - constructor(action: CustomAction, boxRoleToSelect: string, caretPosition: FreCaret) { - super(); - this.action = action; - this.boxRoleToSelect = boxRoleToSelect; - this.caretPosition = caretPosition; - } - - execute(box: Box, trigger: FreTriggerUse, editor: FreEditor): FrePostAction { - // LOGGER.log("execute custom action, text is [" + text + "] refShort [" + this.referenceShortcut + "]" ); - // console.log("FreCustomCommand: trigger [" + triggerTypeToString(trigger) + "]"); - const self = this; - const selected = self.action(box, triggerTypeToString(trigger), editor); - - if (!!selected) { - if (!!self.boxRoleToSelect) { - return function () { - // console.log("FreCommand select " + box.element.freLanguageConcept() + " box " + self.boxRoleToSelect); - editor.selectElementBox(selected, self.boxRoleToSelect, self.caretPosition); - }; - } else { - // Default: select the first editable child of the selected element - return function () { - editor.selectFirstEditableChildBox(selected); - }; - } - } - return EMPTY_POST_ACTION; - } - - // @ts-ignore - // parameters present to adhere to base class signature - undo() { - /* to be done */ - } -} diff --git a/packages/core/src/editor/actions/FreCreateBinaryExpressionAction.ts b/packages/core/src/editor/actions/FreCreateBinaryExpressionAction.ts index b65721bc9..0ef8bab41 100644 --- a/packages/core/src/editor/actions/FreCreateBinaryExpressionAction.ts +++ b/packages/core/src/editor/actions/FreCreateBinaryExpressionAction.ts @@ -3,7 +3,7 @@ import { FreUtils } from "../../util/index.js"; import { Box } from "../boxes/index.js"; import { FreEditor } from "../FreEditor.js"; import { FreAction } from "./FreAction.js"; -import { FreCommand, FreCreateBinaryExpressionCommand } from "./FreCommand.js"; +import { FreCommand } from "./FreCommand.js"; import { FreCreateBinaryExpressionCommand } from "./FreCreateBinaryExpressionCommand.js"; diff --git a/packages/core/src/editor/actions/FreCreateBinaryExpressionCommand.ts b/packages/core/src/editor/actions/FreCreateBinaryExpressionCommand.ts index 6db753010..3a08387b3 100644 --- a/packages/core/src/editor/actions/FreCreateBinaryExpressionCommand.ts +++ b/packages/core/src/editor/actions/FreCreateBinaryExpressionCommand.ts @@ -1,12 +1,12 @@ -import { FreBinaryExpression } from "../../ast/index"; -import { AST } from "../../change-manager/index"; -import { BTREE, FRE_BINARY_EXPRESSION_LEFT, Selected } from "../../util/index"; -import { Box } from "../boxes/index"; -import { FreEditor } from "../FreEditor"; -import { FreCaret } from "../util/index"; -import { FrePostAction } from "./FreAction"; -import { FreCommand, FRECOMMAND_LOGGER } from "./FreCommand"; -import { FreTriggerUse, triggerTypeToString } from "./FreTriggers"; +import { FreBinaryExpression } from "../../ast/index.js"; +import { AST } from "../../change-manager/index.js"; +import { BTREE, FRE_BINARY_EXPRESSION_LEFT, Selected } from "../../util/index.js"; +import { Box } from "../boxes/index.js"; +import { FreEditor } from "../FreEditor.js"; +import { FreCaret } from "../util/index.js"; +import { FrePostAction } from "./FreAction.js"; +import { FreCommand, FRECOMMAND_LOGGER } from "./FreCommand.js"; +import { FreTriggerUse, triggerTypeToString } from "./FreTriggers.js"; export type FreBinaryExpressionBuilder = (box: Box, text: string, editor: FreEditor) => FreBinaryExpression; diff --git a/packages/core/src/editor/actions/FreCustomCommand.ts b/packages/core/src/editor/actions/FreCustomCommand.ts index 3a43e336d..933a6755e 100644 --- a/packages/core/src/editor/actions/FreCustomCommand.ts +++ b/packages/core/src/editor/actions/FreCustomCommand.ts @@ -1,10 +1,10 @@ -import { AST } from "../../change-manager/index"; -import { Box } from "../boxes/index"; -import { FreEditor } from "../FreEditor"; -import { FreCaret } from "../util/index"; -import { CustomAction, EMPTY_POST_ACTION, FrePostAction } from "./FreAction"; -import { FreCommand } from "./FreCommand"; -import { FreTriggerUse, triggerTypeToString } from "./FreTriggers"; +import { AST } from "../../change-manager/index.js"; +import { Box } from "../boxes/index.js"; +import { FreEditor } from "../FreEditor.js"; +import { FreCaret } from "../util/index.js"; +import { CustomAction, EMPTY_POST_ACTION, FrePostAction } from "./FreAction.js"; +import { FreCommand } from "./FreCommand.js"; +import { FreTriggerUse, triggerTypeToString } from "./FreTriggers.js"; export class FreCustomCommand extends FreCommand { boxRoleToSelect: string; diff --git a/packages/core/src/editor/boxes/ButtonBox.ts b/packages/core/src/editor/boxes/ButtonBox.ts index 0a3b18609..49bb8c10f 100644 --- a/packages/core/src/editor/boxes/ButtonBox.ts +++ b/packages/core/src/editor/boxes/ButtonBox.ts @@ -1,4 +1,4 @@ -import { AST } from "../../change-manager/index"; +import { AST } from "../../change-manager/index.js"; import { Box } from "./internal.js"; import { FreNode } from "../../ast/index.js"; import { FreLogger } from "../../logging/index.js"; @@ -7,7 +7,7 @@ import { BehaviorExecutionResult } from "../util/index.js"; import { FrePostAction } from "../actions/index.js"; import { FreEditor } from "../FreEditor.js"; -const LOGGER: FreLogger = new FreLogger("ButtonBox"); //.mute(); +const LOGGER: FreLogger = new FreLogger("ButtonBox").mute(); export class ButtonBox extends Box { readonly kind: string = "ButtonBox"; diff --git a/packages/core/src/editor/boxes/externalBoxes/ExternalBooleanBox.ts b/packages/core/src/editor/boxes/externalBoxes/ExternalBooleanBox.ts index 41b45ddc5..8ce472155 100644 --- a/packages/core/src/editor/boxes/externalBoxes/ExternalBooleanBox.ts +++ b/packages/core/src/editor/boxes/externalBoxes/ExternalBooleanBox.ts @@ -1,4 +1,4 @@ -import { AST } from "../../../change-manager/index"; +import { AST } from "../../../change-manager/index.js"; import { Box } from "../Box.js"; import { FreNode } from "../../../ast/index.js"; import { FreUtils } from "../../../util/index.js"; diff --git a/packages/core/src/editor/boxes/externalBoxes/ExternalNumberBox.ts b/packages/core/src/editor/boxes/externalBoxes/ExternalNumberBox.ts index 9c4c68233..fa05c8dea 100644 --- a/packages/core/src/editor/boxes/externalBoxes/ExternalNumberBox.ts +++ b/packages/core/src/editor/boxes/externalBoxes/ExternalNumberBox.ts @@ -1,4 +1,4 @@ -import { AST } from "../../../change-manager/index"; +import { AST } from "../../../change-manager/index.js"; import { Box } from "../Box.js"; import { FreNode } from "../../../ast/index.js"; import { FreUtils } from "../../../util/index.js"; diff --git a/packages/core/src/editor/boxes/externalBoxes/ExternalStringBox.ts b/packages/core/src/editor/boxes/externalBoxes/ExternalStringBox.ts index b6ea1035e..8665bd739 100644 --- a/packages/core/src/editor/boxes/externalBoxes/ExternalStringBox.ts +++ b/packages/core/src/editor/boxes/externalBoxes/ExternalStringBox.ts @@ -1,4 +1,4 @@ -import { AST } from "../../../change-manager/index"; +import { AST } from "../../../change-manager/index.js"; import { Box } from "../Box.js"; import { FreNode } from "../../../ast/index.js"; import { FreUtils } from "../../../util/index.js"; diff --git a/packages/core/src/editor/simplifiedBoxAPI/box-util-helpers/UtilLimitedHelpers.ts b/packages/core/src/editor/simplifiedBoxAPI/box-util-helpers/UtilLimitedHelpers.ts index b33e5805f..7c5267d74 100644 --- a/packages/core/src/editor/simplifiedBoxAPI/box-util-helpers/UtilLimitedHelpers.ts +++ b/packages/core/src/editor/simplifiedBoxAPI/box-util-helpers/UtilLimitedHelpers.ts @@ -1,5 +1,5 @@ import { FreNode } from "../../../ast/index.js"; -import { AST } from "../../../change-manager/index"; +import { AST } from "../../../change-manager/index.js"; import {BoxFactory, LimitedControlBox, LimitedDisplay, SelectBox, SelectOption} from "../../boxes/index.js"; import { FreLanguage, FreLanguageProperty } from "../../../language/index.js"; import { UtilCheckers } from "./UtilCheckers.js"; diff --git a/packages/core/src/editor/simplifiedBoxAPI/box-util-helpers/UtilPrimHelper.ts b/packages/core/src/editor/simplifiedBoxAPI/box-util-helpers/UtilPrimHelper.ts index 413b9c412..48cef3f95 100644 --- a/packages/core/src/editor/simplifiedBoxAPI/box-util-helpers/UtilPrimHelper.ts +++ b/packages/core/src/editor/simplifiedBoxAPI/box-util-helpers/UtilPrimHelper.ts @@ -1,5 +1,5 @@ import { FreNode } from "../../../ast/index.js"; -import { AST } from "../../../change-manager/index"; +import { AST } from "../../../change-manager/index.js"; import { BoolDisplay, BooleanControlBox, @@ -13,7 +13,7 @@ import { SelectOption, TextBox, } from "../../boxes/index.js"; -\import { FreEditor } from "../../FreEditor.js"; +import { FreEditor } from "../../FreEditor.js"; import { BehaviorExecutionResult } from "../../util/index.js"; import { UtilCheckers } from "./UtilCheckers.js"; import { FreLanguage, FreLanguageProperty } from "../../../language/index.js"; diff --git a/packages/core/src/editor/util/ListUtil.ts b/packages/core/src/editor/util/ListUtil.ts index 71e869d74..962e69ac4 100644 --- a/packages/core/src/editor/util/ListUtil.ts +++ b/packages/core/src/editor/util/ListUtil.ts @@ -3,7 +3,7 @@ * They support drag-and-drop and cut/copy-paste functionality. */ -import { AST } from "../../change-manager/index,js"; +import { AST } from "../../change-manager/index.js" import { jsonAsString } from "../../util/index.js"; // the following two imports are needed, to enable use of the names without the prefix 'Keys', avoiding 'Keys.MetaKey' import * as Keys from "./Keys.js"; diff --git a/packages/core/src/storage/InMemoryModel.ts b/packages/core/src/storage/InMemoryModel.ts index 4b72b30d7..182adb00f 100644 --- a/packages/core/src/storage/InMemoryModel.ts +++ b/packages/core/src/storage/InMemoryModel.ts @@ -1,5 +1,5 @@ import { FreModel, FreModelUnit } from "../ast/index.js"; -import { AST } from "../change-manager/index"; +import { AST } from "../change-manager/index.js"; import { FreEnvironment } from "../environment/index.js"; import { FreLogger } from "../logging/index.js"; import { IServerCommunication, ModelUnitIdentifier } from "./server/index.js"; diff --git a/packages/core/src/storage/server/ServerCommunication.ts b/packages/core/src/storage/server/ServerCommunication.ts index 0743ee08a..bad226d80 100644 --- a/packages/core/src/storage/server/ServerCommunication.ts +++ b/packages/core/src/storage/server/ServerCommunication.ts @@ -1,6 +1,6 @@ import { FreModelUnit, FreNamedNode, FreNode } from "../../ast/index.js"; import { FreLogger } from "../../logging/index.js"; -import { FreLionwebSerializer, FreModelSerializer, FreSerializer } from "../index.js"; +import { FreLionwebSerializer, FreModelSerializer } from "../index.js"; import { FreErrorSeverity } from "../../validator/index.js"; import { IServerCommunication, ModelUnitIdentifier } from "./IServerCommunication.js";