Skip to content

Commit

Permalink
feat: WorkSpace, Page, ElementType 등의 interface 및 Type 선언
Browse files Browse the repository at this point in the history
  • Loading branch information
hyonun321 committed Nov 14, 2024
1 parent 529eb06 commit fc49717
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions @noctaCrdt/Interfaces.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { NodeId, Node } from "./Node";

export type ElementType = "p" | "h1" | "h2" | "h3" | "ul" | "ol" | "li" | "checkbox" | "blockquote";

export interface InsertOperation {
node: Node;
}
Expand Down Expand Up @@ -30,3 +32,57 @@ export interface SerializedProps {
nodeMap: { [key: string]: Node };
};
}

export interface WorkSpace {
id: string;
pageList: Page[];
authUser: object;
}

export interface Page {
id: string;
title: string;
icon: string; // 추후 수정
crdt: CRDT;
}

export interface CRDT {
clock: number;
client: number;
LinkedList: LinkedList;
localInsert(index: number, value: string): RemoteInsertOperation;
localDelete(index: number): RemoteDeleteOperation;
remoteInsert(operation: RemoteInsertOperation): void;
remoteDelete(operation: RemoteDeleteOperation): void;
read(): string;
spread(): Block[] | Char[];
}

export interface LinkedList {
head: NodeId | null;
nodeMap: { [key: string]: Block | Char };
}

export interface Block {
id: BlockId;
icon: string; // 추후 수정
type: ElementType;
animation: string;
crdt: CRDT;
indent: number;
next: NodeId;
prev: NodeId;
style: string[];
}

export interface Char {
id: NodeId;
value: string;
next: NodeId | null;
prev: NodeId | null;
}

export interface BlockId {
clock: number;
client: number;
}

0 comments on commit fc49717

Please sign in to comment.