histoire
Version:
A fast story book powered by Vite
32 lines (31 loc) • 2.22 kB
JavaScript
/** Existing category IDs stay stable; additions follow original categories. */
export const categories = [
['background-color', 'Background Color', 'backgroundColor', 'bg', 'background-color', 'color'],
['text-color', 'Text Color', 'textColor', 'text', 'color', 'text-color'],
['border-color', 'Border Color', 'borderColor', 'border', 'border-color', 'border-color'],
['padding', 'Padding', 'padding', 'p', 'padding', 'padding'],
['margin', 'Margin', 'margin', 'm', 'margin', 'margin'],
['font-size', 'Font Size', 'fontSize', 'text', 'font-size', 'text'],
['font-weight', 'Font Weight', 'fontWeight', 'font', 'font-weight', 'text'],
['font-family', 'Font Family', 'fontFamily', 'font', 'font-family', 'text'],
['letter-spacing', 'Letter Spacing', 'letterSpacing', 'tracking', 'letter-spacing', 'text'],
['line-height', 'Line Height', 'lineHeight', 'leading', 'line-height', 'text'],
['drop-shadow', 'Drop Shadow', 'dropShadow', 'drop-shadow', 'filter', 'box'],
['border-radius', 'Border Radius', 'borderRadius', 'rounded', 'border-radius', 'box'],
['border-width', 'Border Width', 'borderWidth', 'border', 'border-width', 'border'],
['width', 'Width', 'width', 'w', 'width', 'width'],
['height', 'Height', 'height', 'h', 'height', 'height'],
['box-shadow', 'Box Shadow', 'boxShadow', 'shadow', 'box-shadow', 'box'],
['opacity', 'Opacity', 'opacity', 'opacity', 'opacity', 'box'],
['breakpoints', 'Breakpoints', 'screens', '', '', 'value'],
['z-index', 'Z-index', 'zIndex', 'z', 'z-index', 'value'],
['spacing', 'Spacing', 'spacing', 'p', 'padding', 'width'],
].map(([id, title, theme, stem, property, kind]) => ({ id, title, theme, stem, property, kind }));
/** Convert CSS declaration name to Vue inline-style key. */
export function styleProperty(property) {
return property.startsWith('--') ? property : property.replace(/-([a-z])/g, (_, letter) => letter.toUpperCase());
}
/** Serialize config values without emitting executable functions or losing their existence. */
export function serializableConfig(config) {
return JSON.parse(JSON.stringify(config, (_key, value) => typeof value === 'function' ? '[Function]' : value));
}