From ba57ba3f2381372f73d127587de16e3db17703d3 Mon Sep 17 00:00:00 2001 From: frostime Date: Sat, 8 Jun 2024 20:51:13 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20add=20const.ts?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libs/const.ts | 99 ++++++++++++++++++++++++++++++++++++++++++++ src/types/index.d.ts | 36 +++++++++++++--- 2 files changed, 129 insertions(+), 6 deletions(-) create mode 100644 src/libs/const.ts diff --git a/src/libs/const.ts b/src/libs/const.ts new file mode 100644 index 0000000..2dd3e06 --- /dev/null +++ b/src/libs/const.ts @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2024 by frostime. All Rights Reserved. + * @Author : frostime + * @Date : 2024-06-08 20:36:30 + * @FilePath : /src/libs/const.ts + * @LastEditTime : 2024-06-08 20:48:06 + * @Description : + */ + + +export const BlockType2NodeType: {[key in BlockType]: string} = { + d: 'NodeDocument', + p: 'NodeParagraph', + query_embed: 'NodeBlockQueryEmbed', + l: 'NodeList', + i: 'NodeListItem', + h: 'NodeHeading', + iframe: 'NodeIFrame', + tb: 'NodeThematicBreak', + b: 'NodeBlockquote', + s: 'NodeSuperBlock', + c: 'NodeCodeBlock', + widget: 'NodeWidget', + t: 'NodeTable', + html: 'NodeHTMLBlock', + m: 'NodeMathBlock', + av: 'NodeAttributeView', + audio: 'NodeAudio' +} + + +export const NodeIcons = { + NodeAttributeView: { + icon: "iconDatabase" + }, + NodeAudio: { + icon: "iconRecord" + }, + NodeBlockQueryEmbed: { + icon: "iconSQL" + }, + NodeBlockquote: { + icon: "iconQuote" + }, + NodeCodeBlock: { + icon: "iconCode" + }, + NodeDocument: { + icon: "iconFile" + }, + NodeHTMLBlock: { + icon: "iconHTML5" + }, + NodeHeading: { + icon: "iconHeadings", + subtypes: { + h1: { icon: "iconH1" }, + h2: { icon: "iconH2" }, + h3: { icon: "iconH3" }, + h4: { icon: "iconH4" }, + h5: { icon: "iconH5" }, + h6: { icon: "iconH6" } + } + }, + NodeIFrame: { + icon: "iconLanguage" + }, + NodeList: { + subtypes: { + o: { icon: "iconOrderedList" }, + t: { icon: "iconCheck" }, + u: { icon: "iconList" } + } + }, + NodeListItem: { + icon: "iconListItem" + }, + NodeMathBlock: { + icon: "iconMath" + }, + NodeParagraph: { + icon: "iconParagraph" + }, + NodeSuperBlock: { + icon: "iconSuper" + }, + NodeTable: { + icon: "iconTable" + }, + NodeThematicBreak: { + icon: "iconLine" + }, + NodeVideo: { + icon: "iconVideo" + }, + NodeWidget: { + icon: "iconBoth" + } +}; diff --git a/src/types/index.d.ts b/src/types/index.d.ts index 1891c1a..f224b3e 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -1,10 +1,13 @@ -/** - * Copyright (c) 2023 frostime. All rights reserved. +/* + * Copyright (c) 2024 by frostime. All Rights Reserved. + * @Author : frostime + * @Date : 2023-08-15 10:28:10 + * @FilePath : /src/types/index.d.ts + * @LastEditTime : 2024-06-08 20:50:53 + * @Description : Frequently used data structures in SiYuan */ -/** - * Frequently used data structures in SiYuan - */ + type DocumentId = string; type BlockId = string; type NotebookId = string; @@ -28,7 +31,25 @@ type NotebookConf = { dailyNoteTemplatePath: string; } -type BlockType = "d" | "s" | "h" | "t" | "i" | "p" | "f" | "audio" | "video" | "other"; +type BlockType = + | 'd' + | 'p' + | 'query_embed' + | 'l' + | 'i' + | 'h' + | 'iframe' + | 'tb' + | 'b' + | 's' + | 'c' + | 'widget' + | 't' + | 'html' + | 'm' + | 'av' + | 'audio'; + type BlockSubType = "d1" | "d2" | "s1" | "s2" | "s3" | "t1" | "t2" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "table" | "task" | "toggle" | "latex" | "quote" | "html" | "code" | "footnote" | "cite" | "collection" | "bookmark" | "attachment" | "comment" | "mindmap" | "spreadsheet" | "calendar" | "image" | "audio" | "video" | "other"; @@ -70,6 +91,7 @@ type doOperation = { interface Window { siyuan: { + config: any; notebooks: any; menus: any; dialogs: any; @@ -78,5 +100,7 @@ interface Window { user: any; ws: any; languages: any; + emojis: any; }; + Lute: any; }