| 1 |
import { __ } from '@wordpress/i18n'; |
| 2 |
import { |
| 3 |
generateTypographyAttributes, |
| 4 |
generateResponsiveRangeAttributes, |
| 5 |
generateDimensionsAttributes, |
| 6 |
generateBackgroundAttributes, |
| 7 |
generateBorderShadowAttributes, |
| 8 |
} from '../../../util/helpers' |
| 9 |
|
| 10 |
import { |
| 11 |
CONTAINER_MARGIN, |
| 12 |
CONTAINER_PADDING, |
| 13 |
CONTAINER_BACKGROUND, |
| 14 |
GRID_COLUMNS, |
| 15 |
GRID_SPACE, |
| 16 |
GRID_MARGIN, |
| 17 |
GRID_PADDING, |
| 18 |
GRID_BACKGROUND, |
| 19 |
GRID_BORDER, |
| 20 |
TITLE_MARGIN, |
| 21 |
TITLE_PADDING, |
| 22 |
TITLE_BACKGROUND, |
| 23 |
TITLE_BORDER, |
| 24 |
LIST_MARGIN, |
| 25 |
LIST_PADDING, |
| 26 |
LIST_BACKGROUND, |
| 27 |
LIST_BORDER, |
| 28 |
} from './constants' |
| 29 |
import * as typoPrefixs from './typographyPrefixConstants' |
| 30 |
|
| 31 |
const attributes = { |
| 32 |
// Required attributes for responsive options and asset generation |
| 33 |
resOption: { |
| 34 |
type: 'string', |
| 35 |
default: 'Desktop', |
| 36 |
}, |
| 37 |
blockId: { |
| 38 |
type: 'string', |
| 39 |
}, |
| 40 |
blockRoot: { |
| 41 |
type: 'string', |
| 42 |
default: 'better_docs', |
| 43 |
}, |
| 44 |
blockMeta: { |
| 45 |
type: 'object', |
| 46 |
}, |
| 47 |
|
| 48 |
// Content Options |
| 49 |
selectKB: { |
| 50 |
type: 'string', |
| 51 |
default: '', |
| 52 |
}, |
| 53 |
includeCategories: { |
| 54 |
type: 'string', |
| 55 |
default: '', |
| 56 |
}, |
| 57 |
excludeCategories: { |
| 58 |
type: 'string', |
| 59 |
}, |
| 60 |
gridPerPage: { |
| 61 |
type: 'number', |
| 62 |
default: 9, |
| 63 |
}, |
| 64 |
offset: { |
| 65 |
type: 'number', |
| 66 |
default: 0, |
| 67 |
}, |
| 68 |
orderBy: { |
| 69 |
type: 'string', |
| 70 |
default: 'doc_category_order', |
| 71 |
}, |
| 72 |
order: { |
| 73 |
type: 'string', |
| 74 |
default: 'asc', |
| 75 |
}, |
| 76 |
|
| 77 |
// Grid List Docs Options |
| 78 |
postsPerPage: { |
| 79 |
type: 'number', |
| 80 |
default: 5, |
| 81 |
}, |
| 82 |
postsOrderBy: { |
| 83 |
type: 'string', |
| 84 |
default: 'betterdocs_order', |
| 85 |
}, |
| 86 |
postsOrder: { |
| 87 |
type: 'string', |
| 88 |
default: 'asc', |
| 89 |
}, |
| 90 |
|
| 91 |
// Layout Options |
| 92 |
layout: { |
| 93 |
type: 'string', |
| 94 |
default: 'layout-3', |
| 95 |
}, |
| 96 |
showIcon: { |
| 97 |
type: 'boolean', |
| 98 |
default: true, |
| 99 |
}, |
| 100 |
categoryIcon: { |
| 101 |
type: 'string', |
| 102 |
default: 'folder', |
| 103 |
}, |
| 104 |
showTitle: { |
| 105 |
type: 'boolean', |
| 106 |
default: true, |
| 107 |
}, |
| 108 |
titleTag: { |
| 109 |
type: 'string', |
| 110 |
default: 'h2', |
| 111 |
}, |
| 112 |
|
| 113 |
categoryTitleLink: { |
| 114 |
type: 'boolean', |
| 115 |
default: true, |
| 116 |
}, |
| 117 |
|
| 118 |
// Colors |
| 119 |
titleColor: { |
| 120 |
type: 'string', |
| 121 |
default: '', |
| 122 |
}, |
| 123 |
titleHoverColor: { |
| 124 |
type: 'string', |
| 125 |
default: '', |
| 126 |
}, |
| 127 |
listColor: { |
| 128 |
type: 'string', |
| 129 |
default: '', |
| 130 |
}, |
| 131 |
listHoverColor: { |
| 132 |
type: 'string', |
| 133 |
default: '', |
| 134 |
}, |
| 135 |
|
| 136 |
// Background Colors (for backward compatibility) |
| 137 |
containerBgColor: { |
| 138 |
type: 'string', |
| 139 |
default: '', |
| 140 |
}, |
| 141 |
gridBgColor: { |
| 142 |
type: 'string', |
| 143 |
default: '', |
| 144 |
}, |
| 145 |
|
| 146 |
// Typography attributes |
| 147 |
...generateTypographyAttributes(Object.values(typoPrefixs)), |
| 148 |
|
| 149 |
// Responsive range attributes |
| 150 |
...generateResponsiveRangeAttributes(GRID_COLUMNS, { |
| 151 |
defaultRange: 3, |
| 152 |
noUnits: true, |
| 153 |
}), |
| 154 |
...generateResponsiveRangeAttributes(GRID_SPACE, { |
| 155 |
defaultRange: 48, |
| 156 |
noUnits: true, |
| 157 |
}), |
| 158 |
|
| 159 |
// Dimension attributes |
| 160 |
...generateDimensionsAttributes(CONTAINER_MARGIN), |
| 161 |
...generateDimensionsAttributes(CONTAINER_PADDING), |
| 162 |
...generateDimensionsAttributes(GRID_PADDING), |
| 163 |
...generateDimensionsAttributes(GRID_MARGIN), |
| 164 |
...generateDimensionsAttributes(TITLE_MARGIN), |
| 165 |
...generateDimensionsAttributes(TITLE_PADDING), |
| 166 |
...generateDimensionsAttributes(LIST_MARGIN), |
| 167 |
...generateDimensionsAttributes(LIST_PADDING), |
| 168 |
|
| 169 |
|
| 170 |
// Background attributes |
| 171 |
...generateBackgroundAttributes(CONTAINER_BACKGROUND, { |
| 172 |
defaultFillColor: '', |
| 173 |
noOverlay: true, |
| 174 |
}), |
| 175 |
...generateBackgroundAttributes(GRID_BACKGROUND, { |
| 176 |
defaultFillColor: '', |
| 177 |
noOverlay: true, |
| 178 |
}), |
| 179 |
...generateBackgroundAttributes(TITLE_BACKGROUND, { |
| 180 |
defaultFillColor: '', |
| 181 |
noOverlay: true, |
| 182 |
noMainBgi: true, |
| 183 |
}), |
| 184 |
...generateBackgroundAttributes(LIST_BACKGROUND, { |
| 185 |
defaultFillColor: '', |
| 186 |
noOverlay: true, |
| 187 |
noMainBgi: true, |
| 188 |
}), |
| 189 |
|
| 190 |
// Border shadow attributes |
| 191 |
...generateBorderShadowAttributes(GRID_BORDER), |
| 192 |
...generateBorderShadowAttributes(TITLE_BORDER), |
| 193 |
...generateBorderShadowAttributes(LIST_BORDER), |
| 194 |
} |
| 195 |
|
| 196 |
export default attributes |
| 197 |
|