From 238d0fa667c19715135c9d20c06b1359fb0a87be Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 14 May 2023 10:50:21 +0900 Subject: [PATCH] refactor --- .../src/components/page/block.type.ts | 29 +++ .../src/components/page/page.block.vue | 34 +-- .../src/components/page/page.image.vue | 12 +- .../src/components/page/page.note.vue | 40 +-- .../src/components/page/page.section.vue | 35 +-- .../src/components/page/page.text.vue | 56 +--- .../frontend/src/components/page/page.vue | 43 +-- packages/frontend/src/scripts/hpml/block.ts | 109 -------- .../frontend/src/scripts/hpml/evaluator.ts | 171 ------------ packages/frontend/src/scripts/hpml/expr.ts | 79 ------ packages/frontend/src/scripts/hpml/index.ts | 100 ------- packages/frontend/src/scripts/hpml/lib.ts | 245 ------------------ .../frontend/src/scripts/hpml/type-checker.ts | 182 ------------- 13 files changed, 92 insertions(+), 1043 deletions(-) create mode 100644 packages/frontend/src/components/page/block.type.ts delete mode 100644 packages/frontend/src/scripts/hpml/block.ts delete mode 100644 packages/frontend/src/scripts/hpml/evaluator.ts delete mode 100644 packages/frontend/src/scripts/hpml/expr.ts delete mode 100644 packages/frontend/src/scripts/hpml/index.ts delete mode 100644 packages/frontend/src/scripts/hpml/lib.ts delete mode 100644 packages/frontend/src/scripts/hpml/type-checker.ts diff --git a/packages/frontend/src/components/page/block.type.ts b/packages/frontend/src/components/page/block.type.ts new file mode 100644 index 0000000000..71249a8aff --- /dev/null +++ b/packages/frontend/src/components/page/block.type.ts @@ -0,0 +1,29 @@ +export type BlockBase = { + id: string; + type: string; +}; + +export type TextBlock = BlockBase & { + type: 'text'; + text: string; +}; + +export type SectionBlock = BlockBase & { + type: 'section'; + title: string; + children: Block[]; +}; + +export type ImageBlock = BlockBase & { + type: 'image'; + fileId: string | null; +}; + +export type NoteBlock = BlockBase & { + type: 'note'; + detailed: boolean; + note: string | null; +}; + +export type Block = + TextBlock | SectionBlock | ImageBlock | NoteBlock; diff --git a/packages/frontend/src/components/page/page.block.vue b/packages/frontend/src/components/page/page.block.vue index 3f8a5dbc59..dddb9d76bc 100644 --- a/packages/frontend/src/components/page/page.block.vue +++ b/packages/frontend/src/components/page/page.block.vue @@ -1,33 +1,19 @@ - diff --git a/packages/frontend/src/components/page/page.image.vue b/packages/frontend/src/components/page/page.image.vue index 6ea81d257f..2edcfb8b1a 100644 --- a/packages/frontend/src/components/page/page.image.vue +++ b/packages/frontend/src/components/page/page.image.vue @@ -5,15 +5,15 @@ diff --git a/packages/frontend/src/components/page/page.note.vue b/packages/frontend/src/components/page/page.note.vue index 7c620184d7..7133a7f5a1 100644 --- a/packages/frontend/src/components/page/page.note.vue +++ b/packages/frontend/src/components/page/page.note.vue @@ -5,37 +5,25 @@ - diff --git a/packages/frontend/src/components/page/page.section.vue b/packages/frontend/src/components/page/page.section.vue index 50181b3905..dc06a231f9 100644 --- a/packages/frontend/src/components/page/page.section.vue +++ b/packages/frontend/src/components/page/page.section.vue @@ -3,34 +3,23 @@ {{ block.title }}
- +
-