UNPKG

@wordpress/block-editor

Version:
27 lines (26 loc) 951 B
// packages/block-editor/src/hooks/gap.js import { getSpacingPresetCssVar } from "../components/spacing-sizes-control/utils.mjs"; function getGapBoxControlValueFromStyle(blockGapValue) { if (!blockGapValue) { return null; } const isValueString = typeof blockGapValue === "string"; return { top: isValueString ? blockGapValue : blockGapValue?.top, left: isValueString ? blockGapValue : blockGapValue?.left }; } function getGapCSSValue(blockGapValue, defaultValue = "0") { const blockGapBoxControlValue = getGapBoxControlValueFromStyle(blockGapValue); if (!blockGapBoxControlValue) { return null; } const row = getSpacingPresetCssVar(blockGapBoxControlValue?.top) || defaultValue; const column = getSpacingPresetCssVar(blockGapBoxControlValue?.left) || defaultValue; return row === column ? row : `${row} ${column}`; } export { getGapBoxControlValueFromStyle, getGapCSSValue }; //# sourceMappingURL=gap.mjs.map