| @@ -1,6 +1,8 @@ | ||
| 1 | -import { Lang, Theme } from 'shiki'; | |
| 1 | +import { Lang as LangShiki, Theme } from 'shiki'; | |
| 2 | 2 | |
| 3 | +export type Lang = LangShiki | 'ansi' | 'plaintext'; | |
| 4 | + | |
| 3 | 5 | export type Attributes = { |
| 4 | 6 | code: string; |
| 5 | 7 | codeHTML: string; |
| 6 | 8 | language: Lang; |
| @@ -12,18 +14,28 @@ | ||
| 12 | 14 | fontFamily: string; |
| 13 | 15 | lineHeight: string; |
| 14 | 16 | lineNumbers: boolean; |
| 15 | 17 | clampFonts: boolean; |
| 18 | + editorHeight: string; | |
| 16 | 19 | headerType: string; |
| 17 | 20 | headerString?: string; |
| 18 | - footerType: string; | |
| 21 | + footerType?: string; | |
| 19 | 22 | footerString?: string; |
| 20 | 23 | footerLink?: string; |
| 24 | + enableMaxHeight?: boolean; | |
| 25 | + seeMoreType?: string; | |
| 26 | + seeMoreString?: string; | |
| 27 | + seeMoreAfterLine?: string; | |
| 28 | + seeMoreTransition?: boolean; | |
| 21 | 29 | footerLinkTarget?: boolean; |
| 22 | 30 | disablePadding: boolean; |
| 23 | 31 | startingLineNumber: string; |
| 32 | + // Defunct - Removing it would require n attribute migration | |
| 33 | + // so it's easier to just leave it unused for new blocks. | |
| 24 | 34 | lineNumbersWidth: number; |
| 35 | + highestLineNumber: number; | |
| 25 | 36 | enableHighlighting: boolean; |
| 37 | + highlightingHover: boolean; | |
| 26 | 38 | lineHighlights: string; |
| 27 | 39 | lineHighlightColor: string; |
| 28 | 40 | enableBlurring: boolean; |
| 29 | 41 | lineBlurs: string; |
| @@ -31,8 +43,12 @@ | ||
| 31 | 43 | frame: boolean; |
| 32 | 44 | renderType: string; |
| 33 | 45 | label: string; |
| 34 | 46 | copyButton: boolean; |
| 47 | + copyButtonType: string; | |
| 48 | + useDecodeURI: boolean; | |
| 49 | + tabSize: number; | |
| 50 | + useTabs: boolean; | |
| 35 | 51 | }; |
| 36 | 52 | export interface AttributesPropsAndSetter { |
| 37 | 53 | attributes: Attributes; |
| 38 | 54 | setAttributes: (attrs: Partial<Attributes>) => void; |
| @@ -44,4 +60,35 @@ | ||
| 44 | 60 | pluginUrl: string; |
| 45 | 61 | }; |
| 46 | 62 | } |
| 47 | 63 | } |
| 64 | + | |
| 65 | +export type CustomStyles = { | |
| 66 | + 'color-text'?: string; // --shiki-color-text | |
| 67 | + 'color-background'?: string; // --shiki-color-background | |
| 68 | + 'token-constant'?: string; // --shiki-token-constant | |
| 69 | + 'token-string'?: string; // --shiki-token-string | |
| 70 | + 'token-comment'?: string; // --shiki-token-comment | |
| 71 | + 'token-keyword'?: string; // --shiki-token-keyword | |
| 72 | + 'token-parameter'?: string; // --shiki-token-parameter | |
| 73 | + 'token-function'?: string; // --shiki-token-function | |
| 74 | + 'token-string-expression'?: string; // --shiki-token-string-expression | |
| 75 | + 'token-punctuation'?: string; // --shiki-token-punctuation | |
| 76 | + 'token-link'?: string; // --shiki-token-link | |
| 77 | + 'line-background'?: string; // custom for this app | |
| 78 | + 'line-number-color'?: string; // custom for this app | |
| 79 | +}; | |
| 80 | +export type HelpUrl = { | |
| 81 | + text: string; | |
| 82 | + url: string; | |
| 83 | +}; | |
| 84 | + | |
| 85 | +export type ThemeOption = Record< | |
| 86 | + string, | |
| 87 | + { | |
| 88 | + name: string; | |
| 89 | + priority?: boolean; | |
| 90 | + custom?: boolean; | |
| 91 | + styles?: CustomStyles; | |
| 92 | + helpUrl?: HelpUrl; | |
| 93 | + } | |
| 94 | +>; | |