| 1 |
{ |
| 2 |
"$schema": "https://schemas.wp.org/trunk/block.json", |
| 3 |
"apiVersion": 3, |
| 4 |
"name": "blockenberg/code-tabs", |
| 5 |
"title": "Code Tabs", |
| 6 |
"description": "Multi-language tabbed code viewer with syntax highlighting. Show the same snippet in JavaScript, Python, PHP, and more.", |
| 7 |
"category": "bkbg-dev", |
| 8 |
"icon": "editor-code", |
| 9 |
"keywords": [ |
| 10 |
"code", |
| 11 |
"tabs", |
| 12 |
"syntax", |
| 13 |
"highlight", |
| 14 |
"developer", |
| 15 |
"programming", |
| 16 |
"snippet", |
| 17 |
"multi-language" |
| 18 |
], |
| 19 |
"editorScript": "bkbg-code-tabs-editor", |
| 20 |
"editorStyle": "bkbg-code-tabs-style", |
| 21 |
"style": "bkbg-code-tabs-style", |
| 22 |
"viewScript": "bkbg-code-tabs-frontend", |
| 23 |
"supports": { |
| 24 |
"html": false, |
| 25 |
"anchor": true, |
| 26 |
"className": true, |
| 27 |
"align": [ |
| 28 |
"wide", |
| 29 |
"full" |
| 30 |
] |
| 31 |
}, |
| 32 |
"attributes": { |
| 33 |
"tabs": { |
| 34 |
"type": "array", |
| 35 |
"default": [ |
| 36 |
{ |
| 37 |
"label": "JavaScript", |
| 38 |
"lang": "javascript", |
| 39 |
"fileName": "index.js", |
| 40 |
"code": "async function fetchUser(id) {\n const res = await fetch(`/api/users/${id}`);\n if (!res.ok) throw new Error('Not found');\n return res.json();\n}\n\nconst user = await fetchUser(42);\nconsole.log(user.name);" |
| 41 |
}, |
| 42 |
{ |
| 43 |
"label": "Python", |
| 44 |
"lang": "python", |
| 45 |
"fileName": "main.py", |
| 46 |
"code": "import requests\n\ndef fetch_user(user_id: int) -> dict:\n res = requests.get(f'/api/users/{user_id}')\n res.raise_for_status()\n return res.json()\n\nuser = fetch_user(42)\nprint(user['name'])" |
| 47 |
}, |
| 48 |
{ |
| 49 |
"label": "PHP", |
| 50 |
"lang": "php", |
| 51 |
"fileName": "index.php", |
| 52 |
"code": "<?php\nfunction fetch_user(int $id): array {\n $res = file_get_contents(\"/api/users/$id\");\n if ($res === false) throw new Exception('Not found');\n return json_decode($res, true);\n}\n\n$user = fetch_user(42);\necho $user['name'];" |
| 53 |
} |
| 54 |
] |
| 55 |
}, |
| 56 |
"activeTab": { |
| 57 |
"type": "number", |
| 58 |
"default": 0 |
| 59 |
}, |
| 60 |
"theme": { |
| 61 |
"type": "string", |
| 62 |
"default": "dark" |
| 63 |
}, |
| 64 |
"showLineNumbers": { |
| 65 |
"type": "boolean", |
| 66 |
"default": true |
| 67 |
}, |
| 68 |
"showCopyButton": { |
| 69 |
"type": "boolean", |
| 70 |
"default": true |
| 71 |
}, |
| 72 |
"showFileName": { |
| 73 |
"type": "boolean", |
| 74 |
"default": true |
| 75 |
}, |
| 76 |
"showLangBadge": { |
| 77 |
"type": "boolean", |
| 78 |
"default": true |
| 79 |
}, |
| 80 |
"fontSize": { |
| 81 |
"type": "number", |
| 82 |
"default": 13 |
| 83 |
}, |
| 84 |
"lineHeight": { |
| 85 |
"type": "number", |
| 86 |
"default": 1.65 |
| 87 |
}, |
| 88 |
"maxHeight": { |
| 89 |
"type": "number", |
| 90 |
"default": 0 |
| 91 |
}, |
| 92 |
"tabStyle": { |
| 93 |
"type": "string", |
| 94 |
"default": "pills" |
| 95 |
}, |
| 96 |
"tabAlign": { |
| 97 |
"type": "string", |
| 98 |
"default": "left" |
| 99 |
}, |
| 100 |
"borderRadius": { |
| 101 |
"type": "number", |
| 102 |
"default": 10 |
| 103 |
}, |
| 104 |
"paddingTop": { |
| 105 |
"type": "number", |
| 106 |
"default": 0 |
| 107 |
}, |
| 108 |
"paddingBottom": { |
| 109 |
"type": "number", |
| 110 |
"default": 0 |
| 111 |
}, |
| 112 |
"bgColor": { |
| 113 |
"type": "string", |
| 114 |
"default": "" |
| 115 |
}, |
| 116 |
"headerBg": { |
| 117 |
"type": "string", |
| 118 |
"default": "#1e1e2e" |
| 119 |
}, |
| 120 |
"codeBg": { |
| 121 |
"type": "string", |
| 122 |
"default": "#13131f" |
| 123 |
}, |
| 124 |
"tabActiveBg": { |
| 125 |
"type": "string", |
| 126 |
"default": "#6366f1" |
| 127 |
}, |
| 128 |
"tabActiveColor": { |
| 129 |
"type": "string", |
| 130 |
"default": "#ffffff" |
| 131 |
}, |
| 132 |
"tabIdleBg": { |
| 133 |
"type": "string", |
| 134 |
"default": "#2d2d3f" |
| 135 |
}, |
| 136 |
"tabIdleColor": { |
| 137 |
"type": "string", |
| 138 |
"default": "#a0a0c0" |
| 139 |
}, |
| 140 |
"lineNumColor": { |
| 141 |
"type": "string", |
| 142 |
"default": "#4a4a6a" |
| 143 |
}, |
| 144 |
"copyBg": { |
| 145 |
"type": "string", |
| 146 |
"default": "#2d2d3f" |
| 147 |
}, |
| 148 |
"copyColor": { |
| 149 |
"type": "string", |
| 150 |
"default": "#a0a0c0" |
| 151 |
}, |
| 152 |
"typoCode": { |
| 153 |
"type": "object", |
| 154 |
"default": {} |
| 155 |
} |
| 156 |
} |
| 157 |
} |
| 158 |
|