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

Mobile: fix getPxFromCssUnit circular dependency #57045

Merged
merged 4 commits into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 0 additions & 13 deletions packages/block-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -537,19 +537,6 @@ _Returns_

- `string`: Gradient value.

### getPxFromCssUnit

Returns the px value of a cssUnit. The memoized version of getPxFromCssUnit;

_Parameters_

- _cssUnit_ `string`:
- _options_ `Object`:

_Returns_

- `string`: returns the cssUnit value in a simple px format.

### getSpacingPresetCssVar

Converts a spacing preset into a custom value.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import { TextInput, Platform, Dimensions } from 'react-native';
* WordPress dependencies
*/
import { Component } from '@wordpress/element';
import { RichText, getPxFromCssUnit } from '@wordpress/block-editor';
import { RichText } from '@wordpress/block-editor';
ellatrix marked this conversation as resolved.
Show resolved Hide resolved
import { getPxFromCssUnit } from '@wordpress/components';

/**
* Internal dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ import {
showUserSuggestions,
showXpostSuggestions,
} from '@wordpress/react-native-bridge';
import { BlockFormatControls, getPxFromCssUnit } from '@wordpress/block-editor';
import { BlockFormatControls } from '@wordpress/block-editor';
import { getPxFromCssUnit } from '@wordpress/components';
import { Component } from '@wordpress/element';
import {
compose,
Expand Down
1 change: 0 additions & 1 deletion packages/block-editor/src/utils/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
export { default as transformStyles } from './transform-styles';
export * from './block-variation-transforms';
export { default as getPxFromCssUnit } from './parse-css-unit-to-px';
ntsekouras marked this conversation as resolved.
Show resolved Hide resolved
6 changes: 4 additions & 2 deletions packages/block-library/src/spacer/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,16 @@ import { View, useWindowDimensions } from 'react-native';
/**
* WordPress dependencies
*/
import { useConvertUnitToMobile } from '@wordpress/components';
import {
useConvertUnitToMobile,
getPxFromCssUnit,
} from '@wordpress/components';
import { withPreferredColorScheme } from '@wordpress/compose';
import {
InspectorControls,
isValueSpacingPreset,
useSettings,
getCustomValueFromPreset,
getPxFromCssUnit,
} from '@wordpress/block-editor';
import { useEffect } from '@wordpress/element';

Expand Down
2 changes: 1 addition & 1 deletion packages/components/src/font-size-picker/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@ import { useState } from '@wordpress/element';
import { Icon, chevronRight, check } from '@wordpress/icons';
import { __, sprintf } from '@wordpress/i18n';
import { BottomSheet } from '@wordpress/components';
import { getPxFromCssUnit } from '@wordpress/block-editor';

/**
* Internal dependencies
*/
import { default as getPxFromCssUnit } from '../utils/get-px-from-css-unit';
import { default as UnitControl, useCustomUnits } from '../unit-control';
import styles from './style.scss';

Expand Down
1 change: 1 addition & 0 deletions packages/components/src/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export {
ALIGNMENT_BREAKPOINTS,
alignmentHelpers,
} from './mobile/utils/alignments';
export { default as getPxFromCssUnit } from './mobile/utils/get-px-from-css-unit';

// Hooks.
export {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { colord } from 'colord';
* WordPress dependencies
*/
import {
getPxFromCssUnit,
useSettings,
useMultipleOriginColorsAndGradients,
SETTINGS_DEFAULTS,
Expand All @@ -19,6 +18,7 @@ import { usePreferredColorSchemeStyle } from '@wordpress/compose';
/**
* Internal dependencies
*/
import { default as getPxFromCssUnit } from '../utils/get-px-from-css-unit';
import { useGlobalStyles } from './index.native';

export const BLOCK_STYLE_ATTRIBUTES = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import {
default as memoizedGetPxFromCssUnit,
getPxFromCssUnit,
} from '../parse-css-unit-to-px';
} from '../get-px-from-css-unit';

describe( 'getPxFromCssUnit', () => {
// Absolute units.
Expand Down