Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
GuilhermeF03 committed May 23, 2024
1 parent 11ad395 commit f516eee
Show file tree
Hide file tree
Showing 33 changed files with 40 additions and 40 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { type Id } from '@notespace/shared/src/document/types/nodes';
import { BlockStyle, InlineStyle } from '@notespace/shared/src/document/types/styles';
import { FugueTree } from '@notespace/shared/src/document/FugueTree';
import { generateReplicaId, nodeInsert } from './utils';
import { type FugueNode, type NodeInsert } from '@domain/editor/crdt/types';
import { Cursor, Selection } from '@notespace/shared/src/document/types/cursor';
import { type FugueNode, type NodeInsert } from '@domain/editor/fugue/types';
import { Cursor, Selection } from '@domain/editor/cursor';
import { isEmpty, last, range } from 'lodash';
import {
BlockStyleOperation,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useMemo } from 'react';
import { Fugue } from '@domain/editor/crdt/fugue';
import { Fugue } from '@domain/editor/fugue/fugue';

const useFugue = () => useMemo(() => new Fugue(), []);

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Fugue } from '@domain/editor/crdt/fugue';
import { Fugue } from '@domain/editor/fugue/fugue';
import { FugueDomainOperations } from '@domain/editor/operations/fugue/types';
import { Operation } from '@notespace/shared/src/document/types/operations';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Fugue } from '@domain/editor/crdt/fugue';
import { Fugue } from '@domain/editor/fugue/fugue';
import {
ApplyHistory,
HistoryDomainOperations,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Cursor, Selection } from '@notespace/shared/src/document/types/cursor';
import { Cursor, Selection } from '@domain/editor/cursor';
import {
BaseInsertTextOperation,
BaseRemoveTextOperation,
Expand Down
6 changes: 3 additions & 3 deletions code/client/src/domain/editor/operations/input/operations.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { BaseSelection } from 'slate';
import { Fugue } from '@domain/editor/crdt/fugue';
import { Fugue } from '@domain/editor/fugue/fugue';
import { InputDomainOperations } from '@domain/editor/operations/input/types';
import { Cursor, Selection } from '@notespace/shared/src/document/types/cursor';
import { nodeInsert } from '@domain/editor/crdt/utils';
import { Cursor, Selection } from '@domain/editor/cursor';
import { nodeInsert } from '@domain/editor/fugue/utils';
import { InlineStyle } from '@notespace/shared/src/document/types/styles';
import { Operation } from '@notespace/shared/src/document/types/operations';
import { Communication } from '@services/communication/communication';
Expand Down
2 changes: 1 addition & 1 deletion code/client/src/domain/editor/operations/input/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { InlineStyle } from '@notespace/shared/src/document/types/styles';
import { Cursor, Selection } from '@notespace/shared/src/document/types/cursor';
import { Cursor, Selection } from '@domain/editor/cursor';
import { BaseSelection } from 'slate';

export type InputDomainOperations = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Fugue } from '@domain/editor/crdt/fugue';
import { Fugue } from '@domain/editor/fugue/fugue';
import { BlockStyle, InlineStyle } from '@notespace/shared/src/document/types/styles';
import { FugueNode } from '@domain/editor/crdt/types';
import { Selection } from '@notespace/shared/src/document/types/cursor';
import { FugueNode } from '@domain/editor/fugue/types';
import { Selection } from '@domain/editor/cursor';
import { MarkdownDomainOperations } from '@domain/editor/operations/markdown/types';
import { deleteAroundSelection } from '@domain/editor/operations/markdown/utils';
import { Communication } from '@services/communication/communication';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BlockStyle, InlineStyle } from '@notespace/shared/src/document/types/styles';
import { Selection } from '@notespace/shared/src/document/types/cursor';
import { Selection } from '@domain/editor/cursor';

export type MarkdownDomainOperations = {
applyBlockStyle: ApplyBlockStyle;
Expand Down
4 changes: 2 additions & 2 deletions code/client/src/domain/editor/operations/markdown/utils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Fugue } from '@domain/editor/crdt/fugue';
import { Fugue } from '@domain/editor/fugue/fugue';
import { DeleteOperation } from '@notespace/shared/src/document/types/operations';
import { Id } from '@notespace/shared/src/document/types/nodes';
import { Selection } from '@notespace/shared/src/document/types/cursor';
import { Selection } from '@domain/editor/cursor';

/**
* Deletes characters around the selection
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { type Editor } from 'slate';
import inputHandlers from '@domain/editor/slate/handlers/input/inputHandlers';
import { Fugue } from '@domain/editor/crdt/fugue';
import { Fugue } from '@domain/editor/fugue/fugue';
import inputDomainOperations from '@domain/editor/operations/input/operations';
import markdownDomainOperations from '@domain/editor/operations/markdown/operations';
import { Communication } from '@services/communication/communication';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import CustomEditor from '@domain/editor/slate/CustomEditor';
import { isEqual } from 'lodash';
import { getKeyFromInputEvent } from '@domain/editor/slate/utils/domEvents';
import { getSelection, isSelected } from '@domain/editor/slate/utils/selection';
import { Cursor, emptyCursor } from '@notespace/shared/src/document/types/cursor';
import { Cursor, emptyCursor } from '@domain/editor/cursor';
import { InlineStyle } from '@notespace/shared/src/document/types/styles';
import { InputDomainOperations } from '@domain/editor/operations/input/types';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { type Editor } from 'slate';
import operations from './operations/editorOperations';
import markdownHandlers from '@domain/editor/operations/markdown/operations';
import { MarkdownDomainOperations } from '@domain/editor/operations/markdown/types';
import { Fugue } from '@domain/editor/crdt/fugue';
import { Fugue } from '@domain/editor/fugue/fugue';
import { Communication } from '@services/communication/communication';

/**
Expand Down
2 changes: 1 addition & 1 deletion code/client/src/domain/editor/slate/utils/selection.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Editor, Node, Path, Point, Range, Text } from 'slate';
import { Cursor, emptyCursor, emptySelection, Selection } from '@notespace/shared/src/document/types/cursor';
import { Cursor, emptyCursor, emptySelection, Selection } from '@domain/editor/cursor';
import { first, isEqual } from 'lodash';

/**
Expand Down
2 changes: 1 addition & 1 deletion code/client/src/domain/editor/slate/utils/slate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { BlockStyle, InlineStyle } from '@notespace/shared/src/document/typ
import type { CustomText } from '@domain/editor/slate/types';
import { isEqual, last } from 'lodash';
import { BlockStyles } from '@notespace/shared/src/document/types/styles';
import { Fugue } from '@domain/editor/crdt/fugue';
import { Fugue } from '@domain/editor/fugue/fugue';

const multiBlocks: BlockStyle[] = [
BlockStyles.li,
Expand Down
2 changes: 1 addition & 1 deletion code/client/src/ui/pages/document/Document.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Editor from '@ui/pages/document/components/editor/Editor';
import useFugue from '@domain/editor/crdt/useFugue';
import useFugue from '@domain/editor/fugue/useFugue';
import { useEffect, useState } from 'react';
import { useParams, useNavigate } from 'react-router-dom';
import { useCommunication } from '@ui/contexts/communication/useCommunication';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { toSlate } from '@domain/editor/slate/utils/slate';
import { descendant } from '@domain/editor/slate/utils/slate';
import { Communication } from '@services/communication/communication';
import { getMarkdownPlugin } from '@domain/editor/slate/plugins/markdown/withMarkdown';
import { Fugue } from '@domain/editor/crdt/fugue';
import { Fugue } from '@domain/editor/fugue/fugue';
import useEvents from '@ui/pages/document/components/editor/hooks/useEvents';
import useRenderers from '@ui/pages/document/components/editor/hooks/useRenderers';
import Toolbar from '@ui/pages/document/components/toolbar/Toolbar';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useEffect } from 'react';
import historyDomainOperations from '@domain/editor/operations/history/operations';
import historyHandlers from '@domain/editor/slate/handlers/history/historyHandlers';
import { Editor } from 'slate';
import { Fugue } from '@domain/editor/crdt/fugue';
import { Fugue } from '@domain/editor/fugue/fugue';
import { Communication } from '@services/communication/communication';

function useHistory(editor: Editor, fugue: Fugue, communication: Communication) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { useCallback } from 'react';
import { ReactEditor, type RenderElementProps, type RenderLeafProps } from 'slate-react';
import { getElementRenderer, getLeafRenderer } from '@domain/editor/slate/plugins/markdown/rendering/renderers';
import { Editor } from 'slate';
import { Fugue } from '@domain/editor/crdt/fugue';
import { Fugue } from '@domain/editor/fugue/fugue';
import { BlockStyle } from '@notespace/shared/src/document/types/styles';
import { Communication } from '@services/communication/communication';

Expand Down
6 changes: 3 additions & 3 deletions code/client/tests/editor/crdt/fugue.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Fugue } from '@domain/editor/crdt/fugue';
import { Fugue } from '@domain/editor/fugue/fugue';
import {
InsertOperation,
DeleteOperation,
InlineStyleOperation,
BlockStyleOperation,
} from '@notespace/shared/src/document/types/operations';
import { Selection, Cursor } from '@notespace/shared/src/document/types/cursor';
import { Selection, Cursor } from '@domain/editor/cursor';
import { describe, test, expect, beforeEach } from 'vitest';
import { FugueNode } from '@domain/editor/crdt/types';
import { FugueNode } from '@domain/editor/fugue/types';

describe('Fugue', () => {
let fugue: Fugue;
Expand Down
2 changes: 1 addition & 1 deletion code/client/tests/editor/crdt/tree.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { FugueTree } from '@notespace/shared/src/document/FugueTree';
import { InsertOperation } from '@notespace/shared/src/document/types/operations';
import { describe, test, expect, beforeEach } from 'vitest';
import { FugueNode } from '@domain/editor/crdt/types';
import { FugueNode } from '@domain/editor/fugue/types';
import { Node, Nodes } from '@notespace/shared/src/document/types/nodes';

describe('FugueTree', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, test, expect, beforeEach } from 'vitest';
import { Fugue } from '@domain/editor/crdt/fugue';
import { Fugue } from '@domain/editor/fugue/fugue';
import {
InsertOperation,
DeleteOperation,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, test, expect, beforeEach } from 'vitest';
import { Fugue } from '@domain/editor/crdt/fugue';
import { Fugue } from '@domain/editor/fugue/fugue';
import getInputOperations from '@domain/editor/operations/input/operations';
import { InputDomainOperations } from '@domain/editor/operations/input/types';
import { mockCommunication } from '@tests/mocks/mockCommunication';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, test, expect, beforeEach } from 'vitest';
import { Fugue } from '@domain/editor/crdt/fugue';
import { Fugue } from '@domain/editor/fugue/fugue';
import getMarkdownOperations from '@domain/editor/operations/markdown/operations';
import { mockCommunication } from '@tests/mocks/mockCommunication';
import { MarkdownDomainOperations } from '@domain/editor/operations/markdown/types';
Expand Down
4 changes: 2 additions & 2 deletions code/client/tests/editor/slate/handlers/history/cut.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, test, expect, beforeEach } from 'vitest';
import { BaseRemoveTextOperation, Editor } from 'slate';
import { Fugue } from '@domain/editor/crdt/fugue';
import { Fugue } from '@domain/editor/fugue/fugue';
import {
removeText,
mockEditor,
Expand All @@ -13,7 +13,7 @@ import {
import { toSlate } from '@domain/editor/slate/utils/slate';
import { InsertTextOperation, RemoveTextOperation } from '@domain/editor/operations/history/types';
import { pointToCursor } from '@domain/editor/slate/utils/selection';
import { nodeInsert } from '@domain/editor/crdt/utils';
import { nodeInsert } from '@domain/editor/fugue/utils';

let editor: Editor;
let fugue: Fugue;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, beforeEach, expect, test } from 'vitest';
import { BaseInsertTextOperation, BaseSetNodeOperation, Editor } from 'slate';
import { Fugue } from '@domain/editor/crdt/fugue';
import { Fugue } from '@domain/editor/fugue/fugue';
import {
applyBatch,
removeText,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
setNode,
toBatch,
} from './utils';
import { Fugue } from '@domain/editor/crdt/fugue';
import { Fugue } from '@domain/editor/fugue/fugue';
import { toSlate } from '@domain/editor/slate/utils/slate';
import {
InsertNodeOperation,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, test, expect, beforeEach } from 'vitest';
import { BaseInsertTextOperation, Editor } from 'slate';
import { Fugue } from '@domain/editor/crdt/fugue';
import { Fugue } from '@domain/editor/fugue/fugue';
import {
applyBatch,
getRedoOperations,
Expand Down
4 changes: 2 additions & 2 deletions code/client/tests/editor/slate/toSlate.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, test, expect, beforeEach } from 'vitest';
import { Fugue } from '@domain/editor/crdt/fugue';
import { Cursor, Selection } from '@notespace/shared/src/document/types/cursor';
import { Fugue } from '@domain/editor/fugue/fugue';
import { Cursor, Selection } from '@domain/editor/cursor';
import { Descendant } from 'slate';
import { toSlate } from '@domain/editor/slate/utils/slate';

Expand Down
2 changes: 1 addition & 1 deletion code/client/tests/editor/slate/utils.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { setup } from '@tests/test-utils';
import { mockCommunication } from '../../mocks/mockCommunication';
import SlateEditor from '@ui/pages/document/components/editor/Editor';
import { Fugue } from '@domain/editor/crdt/fugue';
import { Fugue } from '@domain/editor/fugue/fugue';

/**
* Sets up the editor for testing
Expand Down

0 comments on commit f516eee

Please sign in to comment.