From fc49717cea83ea4405ce82149ab41853e3b07e86 Mon Sep 17 00:00:00 2001 From: hyonun321 Date: Thu, 14 Nov 2024 17:59:47 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20WorkSpace,=20Page,=20ElementType=20?= =?UTF-8?q?=EB=93=B1=EC=9D=98=20interface=20=EB=B0=8F=20Type=20=EC=84=A0?= =?UTF-8?q?=EC=96=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #117 --- @noctaCrdt/Interfaces.ts | 56 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/@noctaCrdt/Interfaces.ts b/@noctaCrdt/Interfaces.ts index f3359df6..e6bd05c8 100644 --- a/@noctaCrdt/Interfaces.ts +++ b/@noctaCrdt/Interfaces.ts @@ -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; } @@ -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; +}