| 1 |
import { applyFilters } from '@wordpress/hooks'; |
| 2 |
import defaultThemes from '../defaultThemes.json'; |
| 3 |
|
| 4 |
const themes = () => |
| 5 |
applyFilters('blocks.codeBlockPro.themes', defaultThemes) as Record< |
| 6 |
string, |
| 7 |
{ name: string; priority?: boolean } |
| 8 |
>; |
| 9 |
|
| 10 |
const themesNormalized = () => |
| 11 |
Object.entries(themes()).map(([slug, { name, priority }]) => ({ |
| 12 |
name, |
| 13 |
slug, |
| 14 |
priority, |
| 15 |
})); |
| 16 |
export const getPriorityThemes = () => |
| 17 |
themesNormalized().filter(({ priority }) => priority); |
| 18 |
|
| 19 |
export const getNormalThemes = () => |
| 20 |
themesNormalized().filter(({ priority }) => !priority); |
| 21 |
|