@wordpress/editor
Version:
Enhanced block editor for WordPress posts.
8 lines (7 loc) • 3.57 kB
Source Map (JSON)
{
"version": 3,
"sources": ["../../../src/hooks/push-changes-to-global-styles/style-labels.js"],
"sourcesContent": ["import { capitalCase } from 'change-case';\nimport { __ } from '@wordpress/i18n';\n\n/**\n * Readable labels for style paths, keyed by `path.join( '.' )`.\n *\n * The block style config (`__EXPERIMENTAL_STYLE_PROPERTY`) has no labels of its\n * own, so they live here. A path with no entry falls back to a readable version\n * of its last part (see `getStyleLabel`).\n *\n * @type {Record<string, string>}\n */\nexport const STYLE_LABELS = {\n\t// Typography.\n\t'typography.fontFamily': __( 'Font family' ),\n\t'typography.fontSize': __( 'Font size' ),\n\t'typography.fontStyle': __( 'Font style' ),\n\t'typography.fontWeight': __( 'Font weight' ),\n\t'typography.lineHeight': __( 'Line height' ),\n\t'typography.letterSpacing': __( 'Letter spacing' ),\n\t'typography.textDecoration': __( 'Text decoration' ),\n\t'typography.textTransform': __( 'Letter case' ),\n\t'typography.textColumns': __( 'Text columns' ),\n\t'typography.writingMode': __( 'Orientation' ),\n\n\t// Color.\n\t'color.text': __( 'Text color' ),\n\t'color.background': __( 'Background color' ),\n\t'color.gradient': __( 'Gradient' ),\n\t'elements.link.color.text': __( 'Link color' ),\n\n\t// Spacing.\n\t'spacing.padding': __( 'Padding' ),\n\t'spacing.margin': __( 'Margin' ),\n\t'spacing.blockGap': __( 'Block spacing' ),\n\n\t// Border.\n\tborder: __( 'Border' ),\n\t'border.top': __( 'Border top' ),\n\t'border.right': __( 'Border right' ),\n\t'border.bottom': __( 'Border bottom' ),\n\t'border.left': __( 'Border left' ),\n\t'border.color': __( 'Border color' ),\n\t'border.width': __( 'Border width' ),\n\t'border.style': __( 'Border style' ),\n\t'border.radius': __( 'Border radius' ),\n\n\t// Dimensions.\n\t'dimensions.minHeight': __( 'Minimum height' ),\n\t'dimensions.aspectRatio': __( 'Aspect ratio' ),\n};\n\n/**\n * Returns a readable label for a style path.\n *\n * When the path has no label of its own, it falls back to a readable version of\n * the path's last part so nothing shows up blank.\n *\n * @param {string[]} path Style path, e.g. `[ 'color', 'background' ]`.\n *\n * @return {string} A readable label.\n */\nexport function getStyleLabel( path ) {\n\tconst key = path.join( '.' );\n\tif ( STYLE_LABELS[ key ] ) {\n\t\treturn STYLE_LABELS[ key ];\n\t}\n\treturn capitalCase( path[ path.length - 1 ] ?? '' );\n}\n"],
"mappings": ";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,yBAA4B;AAC5B,kBAAmB;AAWZ,IAAM,eAAe;AAAA;AAAA,EAE3B,6BAAyB,gBAAI,aAAc;AAAA,EAC3C,2BAAuB,gBAAI,WAAY;AAAA,EACvC,4BAAwB,gBAAI,YAAa;AAAA,EACzC,6BAAyB,gBAAI,aAAc;AAAA,EAC3C,6BAAyB,gBAAI,aAAc;AAAA,EAC3C,gCAA4B,gBAAI,gBAAiB;AAAA,EACjD,iCAA6B,gBAAI,iBAAkB;AAAA,EACnD,gCAA4B,gBAAI,aAAc;AAAA,EAC9C,8BAA0B,gBAAI,cAAe;AAAA,EAC7C,8BAA0B,gBAAI,aAAc;AAAA;AAAA,EAG5C,kBAAc,gBAAI,YAAa;AAAA,EAC/B,wBAAoB,gBAAI,kBAAmB;AAAA,EAC3C,sBAAkB,gBAAI,UAAW;AAAA,EACjC,gCAA4B,gBAAI,YAAa;AAAA;AAAA,EAG7C,uBAAmB,gBAAI,SAAU;AAAA,EACjC,sBAAkB,gBAAI,QAAS;AAAA,EAC/B,wBAAoB,gBAAI,eAAgB;AAAA;AAAA,EAGxC,YAAQ,gBAAI,QAAS;AAAA,EACrB,kBAAc,gBAAI,YAAa;AAAA,EAC/B,oBAAgB,gBAAI,cAAe;AAAA,EACnC,qBAAiB,gBAAI,eAAgB;AAAA,EACrC,mBAAe,gBAAI,aAAc;AAAA,EACjC,oBAAgB,gBAAI,cAAe;AAAA,EACnC,oBAAgB,gBAAI,cAAe;AAAA,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