Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Try unlocking kebabCase once #57042

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/block-editor/src/hooks/font-family.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import { shouldSkipSerialization } from './utils';
import { TYPOGRAPHY_SUPPORT_KEY } from './typography';
import { unlock } from '../lock-unlock';

const { kebabCase } = unlock( componentsPrivateApis );

export const FONT_FAMILY_SUPPORT_KEY = 'typography.__experimentalFontFamily';

/**
Expand Down Expand Up @@ -68,7 +70,6 @@ function addSaveProps( props, blockType, attributes ) {

// Use TokenList to dedupe classes.
const classes = new TokenList( props.className );
const { kebabCase } = unlock( componentsPrivateApis );
classes.add( `has-${ kebabCase( attributes?.fontFamily ) }-font-family` );
const newClassName = classes.value;
props.className = newClassName ? newClassName : undefined;
Expand Down
5 changes: 2 additions & 3 deletions packages/block-editor/src/hooks/layout.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ import { LAYOUT_DEFINITIONS } from '../layouts/definitions';
import { useBlockSettings, useStyleOverride } from './utils';
import { unlock } from '../lock-unlock';

const { kebabCase } = unlock( componentsPrivateApis );

const layoutBlockSupportKey = 'layout';

function hasLayoutBlockSupport( blockName ) {
Expand All @@ -49,7 +51,6 @@ function hasLayoutBlockSupport( blockName ) {
* @return { Array } Array of CSS classname strings.
*/
export function useLayoutClasses( blockAttributes = {}, blockName = '' ) {
const { kebabCase } = unlock( componentsPrivateApis );
const rootPaddingAlignment = useSelect( ( select ) => {
const { getSettings } = select( blockEditorStore );
return getSettings().__experimentalFeatures
Expand Down Expand Up @@ -349,8 +350,6 @@ function BlockWithLayoutStyles( { block: BlockListBlock, props } ) {
? { ...layout, type: 'constrained' }
: layout || defaultBlockLayout || {};
const layoutClasses = useLayoutClasses( attributes, name );

const { kebabCase } = unlock( componentsPrivateApis );
const selectorPrefix = `wp-container-${ kebabCase( name ) }-layout-`;
// Higher specificity to override defaults from theme.json.
const selector = `.${ selectorPrefix }${ id }.${ selectorPrefix }${ id }`;
Expand Down
3 changes: 2 additions & 1 deletion packages/block-editor/src/hooks/use-typography-props.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import {
} from '../components/global-styles/typography-utils';
import { unlock } from '../lock-unlock';

const { kebabCase } = unlock( componentsPrivateApis );

/*
* This utility is intended to assist where the serialization of the typography
* block support is being skipped for a block but the typography related CSS
Expand All @@ -34,7 +36,6 @@ import { unlock } from '../lock-unlock';
* @return {Object} Typography block support derived CSS classes & styles.
*/
export function getTypographyClassesAndStyles( attributes, settings ) {
const { kebabCase } = unlock( componentsPrivateApis );
let typographyStyles = attributes?.style?.typography || {};
const fluidTypographySettings =
getFluidTypographyOptionsFromSettings( settings );
Expand Down
Loading