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