Skip to content

Commit

Permalink
Mark internal layout APIs private
Browse files Browse the repository at this point in the history
  • Loading branch information
tellthemachines committed Jun 15, 2023
1 parent 6895aeb commit c1ff0a2
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 37 deletions.
31 changes: 0 additions & 31 deletions packages/block-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -608,10 +608,6 @@ _Related_

- <https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/justify-content-control/README.md>

### LayoutStyle

Undocumented declaration.

### LineHeightControl

_Related_
Expand Down Expand Up @@ -841,33 +837,6 @@ _Parameters_
- _props_ `Object`: Optional. Props to pass to the element. Must contain the ref if one is defined.
- _options_ `Object`: Optional. Inner blocks options.

### useLayoutClasses

Generates the utility classnames for the given block's layout attributes.

_Parameters_

- _blockAttributes_ `Object`: Block attributes.
- _blockName_ `string`: Block name.

_Returns_

- `Array`: Array of CSS classname strings.

### useLayoutStyles

Generates a CSS rule with the given block's layout styles.

_Parameters_

- _blockAttributes_ `Object`: Block attributes.
- _blockName_ `string`: Block name.
- _selector_ `string`: A selector to use in generating the CSS rule.

_Returns_

- `string`: CSS rule.

### useSetting

Hook that retrieves the given setting for the block instance in use.
Expand Down
1 change: 0 additions & 1 deletion packages/block-editor/src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ export { default as __experimentalUseResizeCanvas } from './use-resize-canvas';
export { default as BlockInspector } from './block-inspector';
export { default as BlockList } from './block-list';
export { useBlockProps } from './block-list/use-block-props';
export { LayoutStyle } from './block-list/layout';
export { default as BlockMover } from './block-mover';
export {
default as BlockPreview,
Expand Down
2 changes: 0 additions & 2 deletions packages/block-editor/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ export {
getSpacingClassesAndStyles as __experimentalGetSpacingClassesAndStyles,
getGapCSSValue as __experimentalGetGapCSSValue,
useCachedTruthy,
useLayoutClasses,
useLayoutStyles,
} from './hooks';
export * from './components';
export * from './elements';
Expand Down
5 changes: 5 additions & 0 deletions packages/block-editor/src/private-apis.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import { useShouldContextualToolbarShow } from './utils/use-should-contextual-to
import { cleanEmptyObject } from './hooks/utils';
import { useBlockEditingMode } from './components/block-editing-mode';
import BlockQuickNavigation from './components/block-quick-navigation';
import { LayoutStyle } from './components/block-list/layout';
import { useLayoutClasses, useLayoutStyles } from './hooks';

/**
* Private @wordpress/block-editor APIs.
Expand All @@ -28,4 +30,7 @@ lock( privateApis, {
cleanEmptyObject,
useBlockEditingMode,
BlockQuickNavigation,
LayoutStyle,
useLayoutClasses,
useLayoutStyles,
} );
9 changes: 6 additions & 3 deletions packages/edit-post/src/components/visual-editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ import {
WritingFlow,
BlockList,
BlockTools,
LayoutStyle,
store as blockEditorStore,
__unstableUseBlockSelectionClearer as useBlockSelectionClearer,
__unstableUseTypewriter as useTypewriter,
Expand All @@ -27,8 +26,7 @@ import {
__unstableUseMouseMoveTypingReset as useMouseMoveTypingReset,
__unstableIframe as Iframe,
__experimentalRecursionProvider as RecursionProvider,
useLayoutClasses,
useLayoutStyles,
privateApis as blockEditorPrivateApis,
} from '@wordpress/block-editor';
import { useEffect, useRef, useMemo } from '@wordpress/element';
import { __unstableMotion as motion } from '@wordpress/components';
Expand All @@ -41,6 +39,11 @@ import { store as coreStore } from '@wordpress/core-data';
* Internal dependencies
*/
import { store as editPostStore } from '../../store';
import { unlock } from '../../lock-unlock';

const { LayoutStyle, useLayoutClasses, useLayoutStyles } = unlock(
blockEditorPrivateApis
);

const isGutenbergPlugin = process.env.IS_GUTENBERG_PLUGIN ? true : false;

Expand Down

0 comments on commit c1ff0a2

Please sign in to comment.