| 1 |
import { |
| 2 |
CODE_SNIPPET_WRAPPER_MARGIN, |
| 3 |
CODE_SNIPPET_WRAPPER_PADDING, |
| 4 |
CODE_SNIPPET_HEADER_PADDING, |
| 5 |
CODE_SNIPPET_LINE_NUMBERS_PADDING, |
| 6 |
CODE_SNIPPET_CODE_PADDING, |
| 7 |
} from '../../code-snippet/src/constants'; |
| 8 |
|
| 9 |
import { |
| 10 |
generateTypographyAttributes, |
| 11 |
generateDimensionsAttributes, |
| 12 |
} from '../../../util/helpers'; |
| 13 |
|
| 14 |
import * as prefixes from '../../code-snippet/src/typographyPrefixConstants'; |
| 15 |
|
| 16 |
const attributes = { |
| 17 |
// Required attributes for responsive options and asset generation |
| 18 |
resOption: { |
| 19 |
type: 'string', |
| 20 |
default: 'Desktop', |
| 21 |
}, |
| 22 |
blockId: { |
| 23 |
type: 'string', |
| 24 |
}, |
| 25 |
blockRoot: { |
| 26 |
type: 'string', |
| 27 |
default: 'better_docs', |
| 28 |
}, |
| 29 |
blockMeta: { |
| 30 |
type: 'object', |
| 31 |
}, |
| 32 |
|
| 33 |
// Content: one entry per HTTP status → a tab. { status, language, codeContent }. |
| 34 |
responses: { |
| 35 |
type: 'array', |
| 36 |
default: [ |
| 37 |
{ status: '200', language: 'json', codeContent: '{\n "success": true\n}' }, |
| 38 |
], |
| 39 |
}, |
| 40 |
|
| 41 |
showCopyButton: { |
| 42 |
type: 'boolean', |
| 43 |
default: true, |
| 44 |
}, |
| 45 |
showHeader: { |
| 46 |
type: 'boolean', |
| 47 |
default: true, |
| 48 |
}, |
| 49 |
showLineNumbers: { |
| 50 |
type: 'boolean', |
| 51 |
default: false, |
| 52 |
}, |
| 53 |
theme: { |
| 54 |
type: 'string', |
| 55 |
default: 'light', |
| 56 |
}, |
| 57 |
|
| 58 |
// Typography attributes (shared with Code Snippet) |
| 59 |
...generateTypographyAttributes(Object.values(prefixes)), |
| 60 |
|
| 61 |
// Color / border attributes (reuse the Code Snippet style machinery) |
| 62 |
lineNumberColor: { |
| 63 |
type: 'string', |
| 64 |
default: null, |
| 65 |
}, |
| 66 |
lineNumberBgColor: { |
| 67 |
type: 'string', |
| 68 |
default: null, |
| 69 |
}, |
| 70 |
lineNumberBorderColor: { |
| 71 |
type: 'string', |
| 72 |
default: null, |
| 73 |
}, |
| 74 |
lineNumberBorderWidth: { |
| 75 |
type: 'number', |
| 76 |
default: 1, |
| 77 |
}, |
| 78 |
wrapperBackgroundColor: { |
| 79 |
type: 'string', |
| 80 |
default: null, |
| 81 |
}, |
| 82 |
wrapperBorderColor: { |
| 83 |
type: 'string', |
| 84 |
default: null, |
| 85 |
}, |
| 86 |
wrapperBorderWidth: { |
| 87 |
type: 'number', |
| 88 |
default: 0, |
| 89 |
}, |
| 90 |
wrapperBorderRadius: { |
| 91 |
type: 'number', |
| 92 |
default: 0, |
| 93 |
}, |
| 94 |
headerBackgroundColor: { |
| 95 |
type: 'string', |
| 96 |
default: null, |
| 97 |
}, |
| 98 |
headerBorderColor: { |
| 99 |
type: 'string', |
| 100 |
default: null, |
| 101 |
}, |
| 102 |
headerBorderWidth: { |
| 103 |
type: 'number', |
| 104 |
default: 1, |
| 105 |
}, |
| 106 |
fileNameColor: { |
| 107 |
type: 'string', |
| 108 |
default: null, |
| 109 |
}, |
| 110 |
copyButtonColor: { |
| 111 |
type: 'string', |
| 112 |
default: null, |
| 113 |
}, |
| 114 |
copyButtonBorderColor: { |
| 115 |
type: 'string', |
| 116 |
default: null, |
| 117 |
}, |
| 118 |
codeBackgroundColor: { |
| 119 |
type: 'string', |
| 120 |
default: null, |
| 121 |
}, |
| 122 |
|
| 123 |
// Dimension attributes with null defaults for responsive consistency |
| 124 |
...generateDimensionsAttributes(CODE_SNIPPET_WRAPPER_MARGIN), |
| 125 |
...generateDimensionsAttributes(CODE_SNIPPET_WRAPPER_PADDING), |
| 126 |
...generateDimensionsAttributes(CODE_SNIPPET_HEADER_PADDING), |
| 127 |
...generateDimensionsAttributes(CODE_SNIPPET_LINE_NUMBERS_PADDING), |
| 128 |
...generateDimensionsAttributes(CODE_SNIPPET_CODE_PADDING), |
| 129 |
}; |
| 130 |
|
| 131 |
export default attributes; |
| 132 |
|