diff --git a/app/src/types/config.d.ts b/app/src/types/config.d.ts new file mode 100644 index 000000000..27dfd36ae --- /dev/null +++ b/app/src/types/config.d.ts @@ -0,0 +1,1764 @@ +/** + * Copyright (C) 2023 SiYuan Community + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + */ + +declare namespace Config { + + /** + * Configuration object + */ + export interface IConf { + /** + * Access authorization code + */ + accessAuthCode: AccessAuthCode; + account: IAccount; + ai: IAI; + api: IAPI; + appearance: IAppearance; + bazaar: IBazaar; + /** + * Cloud Service Provider Region + * - `0`: Chinese mainland + * - `1`: North America + */ + cloudRegion: number; + editor: IEditor; + export: IExport; + fileTree: IFileTree; + flashcard: IFlashCard; + graph: IGraph; + keymap: IKeymap; + /** + * User interface language + * Same as {@link IAppearance.lang} + */ + lang: TLang; + /** + * List of supported languages + */ + langs: ILang[]; + /** + * A list of the IP addresses of the devices on which the kernel resides + */ + localIPs: string[]; + /** + * Log level + */ + logLevel: TLogLevel; + /** + * Whether to open the user guide after startup + */ + openHelp: boolean; + /** + * Whether it is running in read-only mode + */ + readonly: boolean; + repo: IRepo; + search: ISearch; + /** + * Whether to display the changelog for this release version + */ + showChangelog: boolean; + snippet: ISnippet; + stat: IStat; + sync: ISync; + system: ISystem; + tag: ITag; + uiLayout: IiLayout; + /** + * Community user data (Encrypted) + */ + userData: string; + } + + /** + * Access authorization code + */ + export type AccessAuthCode = "" | "*******"; + + /** + * Account configuration + */ + export interface IAccount { + /** + * Display the title icon + */ + displayTitle: boolean; + /** + * Display the VIP icon + */ + displayVIP: boolean; + } + + /** + * Artificial Intelligence (AI) related configuration + */ + export interface IAI { + openAI: IOpenAI; + } + + /** + * Open AI related configuration + */ + export interface IOpenAI { + /** + * API base URL + */ + apiBaseURL: string; + /** + * API key + */ + apiKey: string; + /** + * Maximum number of tokens (0 means no limit) + */ + apiMaxTokens: number; + /** + * The model name called by the API + */ + apiModel: TOpenAIModel; + /** + * API Provider + */ + apiProvider: APIProvider; + /** + * API request proxy address + */ + apiProxy: string; + /** + * API request timeout (unit: seconds) + */ + apiTimeout: number; + /** + * API request additional user agent field + */ + apiUserAgent: string; + /** + * API version number + */ + apiVersion: string; + } + + /** + * The model name called by the API + */ + export type TOpenAIModel = "gpt-4" | "gpt-4-32k" | "gpt-3.5-turbo" | "gpt-3.5-turbo-16k"; + + /** + * API Provider + */ + export type APIProvider = "OpenAI" | "Azure"; + + /** + * SiYuan API related configuration + */ + export interface IAPI { + /** + * API Token + */ + token: string; + } + + /** + * SiYuan appearance related configuration + */ + export interface IAppearance { + /** + * Close button behavior + * - `0`: Exit application + * - `1`: Minimize to pallets + */ + closeButtonBehavior: number; + /** + * Dark code block theme + */ + codeBlockThemeDark: string; + /** + * Light code block theme + */ + codeBlockThemeLight: string; + /** + * List of installed dark themes + */ + darkThemes: string[]; + /** + * Whether to hide status bar + */ + hideStatusBar: boolean; + /** + * The name of the icon currently in use + */ + icon: string; + /** + * List of installed icon names + */ + icons: string[]; + /** + * The version number of the icon currently in use + */ + iconVer: string; + /** + * The language used by the current user + */ + lang: TLang; + /** + * List of installed light themes + */ + lightThemes: string[]; + /** + * The current theme mode + * - `0`: Light theme + * - `1`: Dark theme + */ + mode: number; + /** + * Whether the theme mode follows the system theme + */ + modeOS: boolean; + /** + * The name of the dark theme currently in use + */ + themeDark: string; + /** + * Whether the current theme has enabled theme JavaScript + */ + themeJS: boolean; + /** + * The name of the light theme currently in use + */ + themeLight: string; + /** + * The version number of the theme currently in use + */ + themeVer: string; + } + + /** + * The language used by the current user + * + * User interface language + * Same as {@link IAppearance.lang} + */ + export type TLang = "en_US" | "es_ES" | "fr_FR" | "zh_CHT" | "zh_CN"; + + /** + * SiYuan bazaar related configuration + */ + export interface IBazaar { + /** + * Whether to disable all plug-ins + */ + petalDisabled: boolean; + /** + * Whether to trust (enable) the resources for the bazaar + */ + trust: boolean; + } + + /** + * SiYuan editor related configuration + */ + export interface IEditor { + /** + * The default number of backlinks to expand + */ + backlinkExpandCount: number; + /** + * The default number of backlinks to mention + */ + backmentionExpandCount: number; + /** + * The maximum length of the dynamic anchor text for block references + */ + blockRefDynamicAnchorTextMaxLen: number; + /** + * Whether the code block has enabled ligatures + */ + codeLigatures: boolean; + /** + * Whether the code block is automatically wrapped + */ + codeLineWrap: boolean; + /** + * Whether the code block displays line numbers + */ + codeSyntaxHighlightLineNum: boolean; + /** + * The number of spaces generated by the Tab key in the code block, configured as 0 means no + * conversion to spaces + */ + codeTabSpaces: number; + /** + * Whether to display the bookmark icon + */ + displayBookmarkIcon: boolean; + /** + * Whether to display the network image mark + */ + displayNetImgMark: boolean; + /** + * The number of blocks loaded each time they are dynamically loaded + */ + dynamicLoadBlocks: number; + /** + * Whether the embedded block displays breadcrumbs + */ + embedBlockBreadcrumb: boolean; + /** + * Common emoji icons + */ + emoji: string[]; + /** + * The trigger mode of the preview window + * - `0`: Hover over the cursor + * - `1`: Hover over the cursor while holding down Ctrl + * - `2`: Do not trigger the floating window + */ + floatWindowMode: number; + /** + * The font used in the editor + */ + fontFamily: string; + /** + * The font size used in the editor + */ + fontSize: number; + /** + * Whether to enable the use of the mouse wheel to adjust the font size of the editor + */ + fontSizeScrollZoom: boolean; + /** + * Whether the editor uses maximum width + */ + fullWidth: boolean; + /** + * The time interval for generating document history, set to 0 to disable document history + * (unit: minutes) + */ + generateHistoryInterval: number; + /** + * History retention days + */ + historyRetentionDays: number; + /** + * Whether to enable text justification + */ + justify: boolean; + /** + * KeTex macro definition (JSON string) + */ + katexMacros: string; + /** + * Whether to enable single-click list item mark focus + */ + listItemDotNumberClickFocus: boolean; + /** + * Whether to enable the list logical reverse indentation scheme + */ + listLogicalOutdent: boolean; + /** + * Whether to enable the `[[` symbol to search only for document blocks + */ + onlySearchForDoc: boolean; + /** + * PlantUML rendering service address + */ + plantUMLServePath: string; + /** + * Whether to enable read-only mode + */ + readOnly: boolean; + /** + * Whether to enable RTL (left-to-right chirography) mode + */ + rtl: boolean; + /** + * Whether to enable spell checking + */ + spellcheck: boolean; + /** + * Whether to enable virtual references + */ + virtualBlockRef: boolean; + /** + * Virtual reference keyword exclusion list (separated by commas `,`) + */ + virtualBlockRefExclude: string; + /** + * Virtual reference keyword inclusion list (separated by commas `,`) + */ + virtualBlockRefInclude: string; + } + + /** + * SiYuan export related configuration + */ + export interface IExport { + /** + * Add article title (insert the article title as a first-level title at the beginning of + * the document) + */ + addTitle: boolean; + /** + * Embedded block export mode + * - `0`: Original block content + * - `1`: Quotation block + */ + blockEmbedMode: number; + /** + * Content block reference export mode + * - `0`: Original text (deprecated) + * - `1`: Quotation block (deprecated) + * - `2`: Anchor text block link + * - `3`: Anchor text only + * - `4`: Footnote + * - `5`: Anchor hash + */ + blockRefMode: number; + /** + * The symbol on the left side of the block reference anchor text during export + */ + blockRefTextLeft: string; + /** + * The symbol on the right side of the block reference anchor text during export + */ + blockRefTextRight: string; + /** + * The path of the template file used when exporting to Docx + */ + docxTemplate: string; + /** + * File annotation reference export mode + * - `0`: File name - page number - anchor text + * - `1`: Anchor text only + */ + fileAnnotationRefMode: number; + /** + * Custom watermark position, size, style, etc. when exporting to an image + */ + imageWatermarkDesc: string; + /** + * The watermark text or watermark file path used when exporting to an image + */ + imageWatermarkStr: string; + /** + * Whether to add YAML Front Matter when exporting to Markdown + */ + markdownYFM: boolean; + /** + * Pandoc executable file path + */ + pandocBin: string; + /** + * Whether the beginning of the paragraph is empty two spaces. + * Insert two full-width spaces `U+3000` at the beginning of the paragraph. + */ + paragraphBeginningSpace: boolean; + /** + * Custom footer content when exporting to PDF + */ + pdfFooter: string; + /** + * Custom watermark position, size, style, etc. when exporting to PDF + */ + pdfWatermarkDesc: string; + /** + * The watermark text or watermark file path used when exporting to PDF + */ + pdfWatermarkStr: string; + /** + * Tag close marker symbol + */ + tagCloseMarker: string; + /** + * Tag start marker symbol + */ + tagOpenMarker: string; + } + + /** + * Document tree related configuration + */ + export interface IFileTree { + /** + * Whether to allow the creation of sub-documents deeper than 7 levels + */ + allowCreateDeeper: boolean; + /** + * Whether to automatically locate the currently open document in the document tree + */ + alwaysSelectOpenedFile: boolean; + /** + * Whether to close all tabs when starting + */ + closeTabsOnStart: boolean; + /** + * The storage path of the new document + */ + docCreateSavePath: string; + /** + * The maximum number of documents listed + */ + maxListCount: number; + /** + * The maximum number of open tabs + */ + maxOpenTabCount: number; + /** + * Whether to open the file in the current tab + */ + openFilesUseCurrentTab: boolean; + /** + * The storage path of the new document created using block references + */ + refCreateSavePath: string; + /** + * Close the secondary confirmation when deleting a document + */ + removeDocWithoutConfirm: boolean; + /** + * Document sorting method + * - `0`: File name ascending + * - `1`: File name descending + * - `2`: File update time ascending + * - `3`: File update time descending + * - `4`: File name natural number ascending + * - `5`: File name natural number descending + * - `6`: Custom sorting + * - `7`: Reference count ascending + * - `8`: Reference count descending + * - `9`: File creation time ascending + * - `10`: File creation time descending + * - `11`: File size ascending + * - `12`: File size descending + * - `13`: Sub-document count ascending + * - `14`: Sub-document count descending + * - `15`: Use document tree sorting rules + * - `256`: Unspecified sorting rules, according to the notebook priority over the document + * tree to obtain sorting rules + */ + sort: number; + /** + * Whether to save the content of the .sy file as a single-line JSON object + */ + useSingleLineSave: boolean; + } + + /** + * Flashcard related configuration + */ + export interface IFlashCard { + /** + * Whether to enable deck card making + */ + deck: boolean; + /** + * Whether to enable heading block card making + */ + heading: boolean; + /** + * Whether to enable list block card making + */ + list: boolean; + /** + * Whether to enable mark element card making + */ + mark: boolean; + /** + * Maximum interval days + */ + maximumInterval: number; + /** + * New card limit + */ + newCardLimit: number; + /** + * FSRS request retention parameter + */ + requestRetention: number; + /** + * Review card limit + */ + reviewCardLimit: number; + /** + * Review mode + * - `0`: New and old mixed + * - `1`: New card priority + * - `2`: Old card priority + */ + reviewMode: number; + /** + * Whether to enable super block card making + */ + superBlock: boolean; + /** + * FSRS weight parameter list + */ + weights: string; + } + + /** + * SiYuan graph related configuration + */ + export interface IGraph { + global: IGraphGlobal; + local: IGraphLocal; + /** + * Maximum number of content blocks displayed + */ + maxBlocks: number; + } + + /** + * Global graph configuration + */ + export interface IGraphGlobal { + d3: IGraphD3; + /** + * Whether to display nodes in daily notes + */ + dailyNote: boolean; + /** + * The minimum number of references to the displayed node + */ + minRefs: number; + type: IGraphType; + } + + /** + * d3.js graph configuration + */ + export interface IGraphD3 { + /** + * Whether to display the arrow + */ + arrow: boolean; + /** + * Central gravity intensity + */ + centerStrength: number; + /** + * Repulsion radius + */ + collideRadius: number; + /** + * Repulsion intensity + */ + collideStrength: number; + /** + * Line opacity + */ + lineOpacity: number; + /** + * Link distance + */ + linkDistance: number; + /** + * Line width + */ + linkWidth: number; + /** + * Node size + */ + nodeSize: number; + } + + /** + * SiYuan node type filter + */ + export interface IGraphType { + /** + * Display quote block + */ + blockquote: boolean; + /** + * Display code block + */ + code: boolean; + /** + * Display heading block + */ + heading: boolean; + /** + * Display list block + */ + list: boolean; + /** + * Display list item + */ + listItem: boolean; + /** + * Display formula block + */ + math: boolean; + /** + * Display paragraph block + */ + paragraph: boolean; + /** + * Display super block + */ + super: boolean; + /** + * Display table block + */ + table: boolean; + /** + * Display tag + */ + tag: boolean; + } + + /** + * Local graph configuration + */ + export interface IGraphLocal { + d3: IGraphD3; + /** + * Whether to display nodes in daily notes + */ + dailyNote: boolean; + type: IGraphType; + } + + /** + * SiYuan keymap related configuration + */ + export interface IKeymap { + editor: IKeymapEditor; + general: IKeymapGeneral; + plugin: { [key: string]: { [key: string]: IKey } }; + } + + /** + * SiYuan editor shortcut keys + */ + export interface IKeymapEditor { + general: IKeymapEditorGeneral; + heading: IKeymapEditorHeading; + insert: IKeymapEditorInsert; + list: IKeymapEditorList; + table: IKeymapEditorTable; + } + + /** + * SiYuan editor general shortcut keys + */ + export interface IKeymapEditorGeneral { + ai: IKey; + alignCenter: IKey; + alignLeft: IKey; + alignRight: IKey; + attr: IKey; + backlinks: IKey; + collapse: IKey; + copyBlockEmbed: IKey; + copyBlockRef: IKey; + copyHPath: IKey; + copyID: IKey; + copyPlainText: IKey; + copyProtocol: IKey; + copyProtocolInMd: IKey; + copyText: IKey; + duplicate: IKey; + exitFocus: IKey; + expand: IKey; + expandDown: IKey; + expandUp: IKey; + fullscreen: IKey; + graphView: IKey; + hLayout: IKey; + insertAfter: IKey; + insertBefore: IKey; + insertBottom: IKey; + insertRight: IKey; + jumpToParentNext: IKey; + moveToDown: IKey; + moveToUp: IKey; + netAssets2LocalAssets: IKey; + netImg2LocalAsset: IKey; + newContentFile: IKey; + newNameFile: IKey; + newNameSettingFile: IKey; + openBy: IKey; + optimizeTypography: IKey; + outline: IKey; + preview: IKey; + quickMakeCard: IKey; + redo: IKey; + refPopover: IKey; + refresh: IKey; + refTab: IKey; + rename: IKey; + showInFolder: IKey; + spaceRepetition: IKey; + switchReadonly: IKey; + undo: IKey; + vLayout: IKey; + wysiwyg: IKey; + } + + /** + * SiYuan shortcut key + */ + export interface IKey { + /** + * Custom shortcut key + */ + custom: string; + /** + * Default shortcut key + */ + default: string; + } + + /** + * SiYuan editor heading shortcut keys + */ + export interface IKeymapEditorHeading { + heading1: IKey; + heading2: IKey; + heading3: IKey; + heading4: IKey; + heading5: IKey; + heading6: IKey; + paragraph: IKey; + } + + /** + * SiYuan editor insert shortcut keys + */ + export interface IKeymapEditorInsert { + appearance: IKey; + bold: IKey; + check: IKey; + clearInline: IKey; + code: IKey; + "inline-code": IKey; + "inline-math": IKey; + italic: IKey; + kbd: IKey; + lastUsed: IKey; + link: IKey; + mark: IKey; + memo: IKey; + ref: IKey; + strike: IKey; + sub: IKey; + sup: IKey; + table: IKey; + tag: IKey; + underline: IKey; + } + + /** + * SiYuan editor list shortcut keys + */ + export interface IKeymapEditorList { + checkToggle: IKey; + indent: IKey; + outdent: IKey; + } + + /** + * SiYuan editor table shortcut keys + */ + export interface IKeymapEditorTable { + "delete-column": IKey; + "delete-row": IKey; + insertColumnLeft: IKey; + insertColumnRight: IKey; + insertRowAbove: IKey; + insertRowBelow: IKey; + moveToDown: IKey; + moveToLeft: IKey; + moveToRight: IKey; + moveToUp: IKey; + } + + /** + * SiYuan general shortcut keys + */ + export interface IKeymapGeneral { + addToDatabase: IKey; + backlinks: IKey; + bookmark: IKey; + closeAll: IKey; + closeLeft: IKey; + closeOthers: IKey; + closeRight: IKey; + closeTab: IKey; + closeUnmodified: IKey; + commandPanel: IKey; + config: IKey; + dailyNote: IKey; + dataHistory: IKey; + editReadonly: IKey; + enter: IKey; + enterBack: IKey; + fileTree: IKey; + globalGraph: IKey; + globalSearch: IKey; + goBack: IKey; + goForward: IKey; + goToEditTabNext: IKey; + goToEditTabPrev: IKey; + goToTab1: IKey; + goToTab2: IKey; + goToTab3: IKey; + goToTab4: IKey; + goToTab5: IKey; + goToTab6: IKey; + goToTab7: IKey; + goToTab8: IKey; + goToTab9: IKey; + goToTabNext: IKey; + goToTabPrev: IKey; + graphView: IKey; + inbox: IKey; + lockScreen: IKey; + mainMenu: IKey; + move: IKey; + newFile: IKey; + outline: IKey; + recentDocs: IKey; + replace: IKey; + riffCard: IKey; + search: IKey; + selectOpen1: IKey; + splitLR: IKey; + splitMoveB: IKey; + splitMoveR: IKey; + splitTB: IKey; + stickSearch: IKey; + syncNow: IKey; + tabToWindow: IKey; + tag: IKey; + toggleDock: IKey; + toggleWin: IKey; + } + + /** + * Supported language + */ + export interface ILang { + /** + * Language name + */ + label: string; + /** + * Language identifier + */ + name: string; + } + + /** + * Log level + */ + export type TLogLevel = "off" | "trace" | "debug" | "info" | "warn" | "error" | "fatal"; + + /** + * Snapshot repository related configuration + */ + export interface IRepo { + /** + * Snapshot encryption key (base64 encoded 256-bit key) + */ + key: string; + /** + * Synchronous index timing, if it exceeds this time, the user is prompted that the index + * performance is degraded (unit: milliseconds) + */ + syncIndexTiming: number; + } + + /** + * SiYuan search related configuration + */ + export interface ISearch { + /** + * Whether to search in block aliases + */ + alias: boolean; + /** + * Extract backlink mention keywords from block aliases + */ + backlinkMentionAlias: boolean; + /** + * Extract backlink mention keywords from block reference anchor text + */ + backlinkMentionAnchor: boolean; + /** + * Extract backlink mention keywords from document names + */ + backlinkMentionDoc: boolean; + /** + * Maximum number of backlink mention keywords + */ + backlinkMentionKeywordsLimit: number; + /** + * Extract backlink mention keywords from block names + */ + backlinkMentionName: boolean; + /** + * Whether to search quote blocks + */ + blockquote: boolean; + /** + * Whether to distinguish between uppercase and lowercase letters when searching + */ + caseSensitive: boolean; + /** + * Whether to search code blocks + */ + codeBlock: boolean; + /** + * Whether to search database blocks + */ + databaseBlock: boolean; + /** + * Whether to search document blocks + */ + document: boolean; + /** + * Whether to search embedded blocks + */ + embedBlock: boolean; + /** + * Whether to search heading blocks + */ + heading: boolean; + /** + * Whether to search HTML blocks + */ + htmlBlock: boolean; + /** + * Whether to search block attributes + */ + ial: boolean; + /** + * Whether to search resource file paths + */ + indexAssetPath: boolean; + /** + * Number of search results displayed + */ + limit: number; + /** + * Whether to search list blocks + */ + list: boolean; + /** + * Whether to search list items + */ + listItem: boolean; + /** + * Whether to search formula blocks + */ + mathBlock: boolean; + /** + * Whether to search block notes + */ + memo: boolean; + /** + * Whether to search block names + */ + name: boolean; + /** + * Whether to search paragraph blocks + */ + paragraph: boolean; + /** + * Whether to search super blocks + */ + superBlock: boolean; + /** + * Whether to search table blocks + */ + table: boolean; + /** + * Whether to get virtual reference keywords from block aliases + */ + virtualRefAlias: boolean; + /** + * Whether to get virtual reference keywords from block reference anchor text + */ + virtualRefAnchor: boolean; + /** + * Whether to get virtual reference keywords from document names + */ + virtualRefDoc: boolean; + /** + * Whether to get virtual reference keywords from block names + */ + virtualRefName: boolean; + } + + /** + * SiYuan code snippets related configuration + */ + export interface ISnippet { + /** + * Whether to enable CSS code snippets + */ + enabledCSS: boolean; + /** + * Whether to enable JavaScript code snippets + */ + enabledJS: boolean; + } + + /** + * SiYuan workspace content statistics + */ + export interface IStat { + /** + * Asset file size (unit: bytes) + */ + assetsSize: number; + /** + * Number of content blocks + */ + blockCount: number; + /** + * Size of resource files after chunk encryption (unit: bytes) + */ + cAssetsSize: number; + /** + * Number of content blocks after chunk encryption + */ + cBlockCount: number; + /** + * Size of the data directory after chunk encryption (unit: bytes) + */ + cDataSize: number; + /** + * Number of content block trees after chunk encryption (number of documents) + */ + cTreeCount: number; + /** + * Data directory size (unit: bytes) + */ + dataSize: number; + /** + * Number of content block trees (number of documents) + */ + treeCount: number; + } + + /** + * SiYuan synchronization related configuration + */ + export interface ISync { + /** + * Cloud workspace name + */ + cloudName: string; + /** + * Whether to enable synchronization + */ + enabled: boolean; + /** + * Whether to create a conflict document when a conflict occurs during synchronization + */ + generateConflictDoc: boolean; + /** + * Synchronization mode + * - `0`: Not set + * - `1`: Automatic synchronization + * - `2`: Manual synchronization + * - `3`: Completely manual synchronization + */ + mode: number; + /** + * Whether to enable synchronization perception + */ + perception: boolean; + /** + * Cloud storage service provider + * - `0`: SiYuan official cloud storage service + * - `1`: Object storage service compatible with S3 protocol + * - `2`: Network storage service using WebDAV protocol + */ + provider: number; + s3: ISyncS3; + /** + * The prompt information of the last synchronization + */ + stat: string; + /** + * The time of the last synchronization (Unix timestamp) + */ + synced: number; + webdav: ISyncWebDAV; + } + + /** + * S3 compatible object storage related configuration + */ + export interface ISyncS3 { + /** + * Access key + */ + accessKey: string; + /** + * Bucket name + */ + bucket: string; + /** + * Service endpoint address + */ + endpoint: string; + /** + * Whether to use path-style URLs + */ + pathStyle: boolean; + /** + * Storage region + */ + region: string; + /** + * Security key + */ + secretKey: string; + /** + * Whether to skip TLS verification + */ + skipTlsVerify: boolean; + /** + * Timeout (unit: seconds) + */ + timeout: number; + } + + /** + * WebDAV related configuration + */ + export interface ISyncWebDAV { + /** + * Service endpoint + */ + endpoint: string; + /** + * Password + */ + password: string; + /** + * Whether to skip TLS verification + */ + skipTlsVerify: boolean; + /** + * Timeout (unit: seconds) + */ + timeout: number; + /** + * Username + */ + username: string; + } + + /** + * System related information + */ + export interface ISystem { + /** + * The absolute path of the `resources` directory under the SiYuan installation directory + */ + appDir: string; + /** + * Boot automatically + */ + autoLaunch: boolean; + /** + * The absolute path of the `conf` directory of the current workspace + */ + confDir: string; + /** + * Kernel operating environment + * - `docker`: Docker container + * - `android`: Android device + * - `ios`: iOS device + * - `std`: Desktop Electron environment + */ + container: Container; + /** + * The absolute path of the `data` directory of the current workspace + */ + dataDir: string; + /** + * Whether to disable Google Analytics + */ + disableGoogleAnalytics: boolean; + /** + * Whether to automatically download the installation package for the new version + */ + downloadInstallPkg: boolean; + /** + * The absolute path of the user's home directory for the current operating system user + */ + homeDir: string; + /** + * The UUID of the current session + */ + id: string; + /** + * Whether the current version is an internal test version + */ + isInsider: boolean; + /** + * Whether the current version is a Microsoft Store version + */ + isMicrosoftStore: boolean; + /** + * Kernel version number + */ + kernelVersion: string; + /** + * Lock screen mode + * - `0`: Manual + * - `1`: Manual + Follow the operating system + */ + lockScreenMode: number; + /** + * The name of the current device + */ + name: string; + networkProxy: INetworkProxy; + /** + * Whether to enable network serve (whether to allow connections from other devices) + */ + networkServe: boolean; + /** + * The operating system name determined at compile time (obtained using the command `go tool + * dist list`) + * - `android`: Android + * - `darwin`: macOS + * - `ios`: iOS + * - `linux`: Linux + * - `windows`: Windows + */ + os: OS; + /** + * Operating system platform name + */ + osPlatform: string; + /** + * Whether to upload error logs + */ + uploadErrLog: boolean; + /** + * The absolute path of the workspace directory + */ + workspaceDir: string; + } + + /** + * Kernel operating environment + * - `docker`: Docker container + * - `android`: Android device + * - `ios`: iOS device + * - `std`: Desktop Electron environment + */ + export type Container = "docker" | "android" | "ios" | "std"; + + /** + * SiYuan Network proxy configuration + */ + export interface INetworkProxy { + /** + * Host name or host address + */ + host: string; + /** + * Proxy server port number + */ + port: string; + /** + * The protocol used by the proxy server + * - Empty String: Use the system proxy settings + * - `http`: HTTP + * - `https`: HTTPS + * - `socks5`: SOCKS5 + */ + scheme: Scheme; + } + + /** + * The protocol used by the proxy server + * - Empty String: Use the system proxy settings + * - `http`: HTTP + * - `https`: HTTPS + * - `socks5`: SOCKS5 + */ + export type Scheme = "" | "http" | "https" | "socks5"; + + /** + * The operating system name determined at compile time (obtained using the command `go tool + * dist list`) + * - `android`: Android + * - `darwin`: macOS + * - `ios`: iOS + * - `linux`: Linux + * - `windows`: Windows + */ + export type OS = "android" | "darwin" | "ios" | "linux" | "windows"; + + /** + * SiYuan tag dock related configuration + */ + export interface ITag { + /** + * Tag sorting scheme + * - `0`: Name alphabetically ascending + * - `1`: Name alphabetically descending + * - `4`: Name natural ascending + * - `5`: Name natural descending + * - `7`: Reference count ascending + * - `8`: Reference count descending + */ + sort: number; + } + + /** + * SiYuan UI layout related configuration + */ + export interface IiLayout { + bottom: IUILayoutDock; + /** + * Whether to hide the sidebar + */ + hideDock: boolean; + layout: IUILayoutLayout; + left: IUILayoutDock; + right: IUILayoutDock; + } + + /** + * SiYuan dock related configuration + */ + export interface IUILayoutDock { + /** + * Dock area list + */ + data: Array; + /** + * Whether to pin the dock + */ + pin: boolean; + } + + /** + * Dock panel list + * + * SiYuan dock panel data + */ + export interface IUILayoutDockPanel { + /** + * Panel hotkey + */ + hotkey: string; + /** + * Hotkey description ID + */ + hotkeyLangId: string; + /** + * Panel icon ID + */ + icon: string; + /** + * Whether to display the panel + */ + show: boolean; + size: IUILayoutDockPanelSize; + /** + * Panel title + */ + title: string; + /** + * Panel type + */ + type: string; + } + + /** + * SiYuan dock panel size + */ + export interface IUILayoutDockPanelSize { + /** + * Panel height (unit: px) + */ + height: number | null; + /** + * Panel width (unit: px) + */ + width: number | null; + } + + /** + * SiYuan panel layout + */ + export interface IUILayoutLayout { + /** + * Internal elements + */ + children: IUILayoutLayoutChild[]; + /** + * Panel content layout direction + * - `tb`: Top and bottom layout + * - `lr`: Left and right layout + */ + direction?: Direction; + /** + * Object name + */ + instance: LayoutInstance; + /** + * The direction in which the size can be adjusted + * - `tb`: Can adjust the size up and down + * - `lr`: Can adjust the size left and right + */ + resize?: Direction; + /** + * Panel size + */ + size?: string; + /** + * Layout type + * - `normal`: Normal panel + * - `center`: Center panel + * - `top`: Top panel + * - `bottom`: Bottom panel + * - `left`: Left panel + * - `right`: Right panel + */ + type?: Type; + } + + /** + * SiYuan panel layout + * + * SiYuan window layout + */ + export interface IUILayoutLayoutChild { + /** + * Internal elements + */ + children: ChildElement[]; + /** + * Panel content layout direction + * - `tb`: Top and bottom layout + * - `lr`: Left and right layout + */ + direction?: Direction; + /** + * Object name + */ + instance: IUILayoutLayoutChildInstance; + /** + * The direction in which the size can be adjusted + * - `tb`: Can adjust the size up and down + * - `lr`: Can adjust the size left and right + */ + resize?: Direction; + /** + * Panel size + */ + size?: string; + /** + * Layout type + * - `normal`: Normal panel + * - `center`: Center panel + * - `top`: Top panel + * - `bottom`: Bottom panel + * - `left`: Left panel + * - `right`: Right panel + */ + type?: Type; + /** + * Panel height + */ + height?: string; + /** + * Panel width + */ + width?: string; + } + + export type Children = ChildElement[] | IUILayoutTabContent; + + /** + * SiYuan panel layout + * + * SiYuan window layout + * + * SiYuan tab + */ + export interface ChildElement { + /** + * Internal elements + * + * Tab content + */ + children: Children; + /** + * Panel content layout direction + * - `tb`: Top and bottom layout + * - `lr`: Left and right layout + */ + direction?: Direction; + /** + * Object name + */ + instance: ChildInstance; + /** + * The direction in which the size can be adjusted + * - `tb`: Can adjust the size up and down + * - `lr`: Can adjust the size left and right + */ + resize?: Direction; + /** + * Panel size + */ + size?: string; + /** + * Layout type + * - `normal`: Normal panel + * - `center`: Center panel + * - `top`: Top panel + * - `bottom`: Bottom panel + * - `left`: Left panel + * - `right`: Right panel + */ + type?: Type; + /** + * Panel height + */ + height?: string; + /** + * Panel width + */ + width?: string; + /** + * Whether the tab is active + */ + active?: boolean; + /** + * Tab icon + */ + docIcon?: string; + /** + * Whether the tab is pinned + */ + pin?: boolean; + /** + * Tab title + */ + title?: string; + } + + /** + * Tab content + * + * SiYuan editor tab + * + * SiYuan asset file tab + * + * SiYuan custom tab + */ + export interface IUILayoutTabContent { + /** + * (Editor) Actions to be performed after the tab is loaded + */ + action?: string; + /** + * (Editor) Block ID + */ + blockId?: string; + /** + * Object name + */ + instance: IUILayoutTabContentInstance; + /** + * (Editor) Editor mode + * - `wysiwyg`: WYSIWYG mode + * - `preview`: Export preview mode + */ + mode?: Mode; + /** + * (Editor) Notebook ID + */ + notebookId?: string; + /** + * (Editor) Document block ID + */ + rootId?: string; + /** + * (Asset) PDF file page number + */ + page?: number; + /** + * (Asset) Asset reference path + */ + path?: string; + /** + * (Custom) Data of the custom tab + */ + customModelData?: any; + /** + * (Custom) Type of the custom tab + */ + customModelType?: string; + } + + export type IUILayoutTabContentInstance = "Editor" | "Asset" | "Custom"; + + /** + * (Editor) Editor mode + * - `wysiwyg`: WYSIWYG mode + * - `preview`: Export preview mode + */ + export type Mode = "wysiwyg" | "preview"; + + /** + * Panel content layout direction + * - `tb`: Top and bottom layout + * - `lr`: Left and right layout + * + * The direction in which the size can be adjusted + * - `tb`: Can adjust the size up and down + * - `lr`: Can adjust the size left and right + */ + export type Direction = "tb" | "lr"; + + export type ChildInstance = "Layout" | "Wnd" | "Tab"; + + /** + * Layout type + * - `normal`: Normal panel + * - `center`: Center panel + * - `top`: Top panel + * - `bottom`: Bottom panel + * - `left`: Left panel + * - `right`: Right panel + */ + export type Type = "normal" | "center" | "top" | "bottom" | "left" | "right"; + + export type IUILayoutLayoutChildInstance = "Layout" | "Wnd"; + + export type LayoutInstance = "Layout"; + +} diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts index 13f817b70..e5f1e2aa5 100644 --- a/app/src/types/index.d.ts +++ b/app/src/types/index.d.ts @@ -427,7 +427,7 @@ interface ISiyuan { rightDock?: import("../layout/dock").Dock, bottomDock?: import("../layout/dock").Dock, } - config?: IConfig; + config?: Config.IConf; ws: import("../layout/Model").Model, ctrlIsPressed?: boolean, altIsPressed?: boolean,