Skip to content

Commit

Permalink
Framework: Remove deprecated utils
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Jun 21, 2018
1 parent 8bf8d21 commit 818acd1
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 39 deletions.
2 changes: 1 addition & 1 deletion lib/client-assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ function gutenberg_register_scripts_and_styles() {
wp_register_script(
'wp-utils',
gutenberg_url( 'build/utils/index.js' ),
array( 'lodash', 'wp-blob', 'wp-deprecated', 'wp-dom', 'wp-api-request', 'wp-i18n' ),
array( 'lodash', 'wp-blob', 'wp-deprecated', 'wp-api-request', 'wp-i18n' ),
filemtime( gutenberg_dir_path() . 'build/utils/index.js' ),
true
);
Expand Down
38 changes: 0 additions & 38 deletions utils/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* WordPress dependencies
*/
import * as blob from '@wordpress/blob';
import * as dom from '@wordpress/dom';
import originalDeprecated from '@wordpress/deprecated';

const wrapFunction = ( source, sourceName, version ) =>
Expand All @@ -21,32 +20,6 @@ export const createBlobURL = wrapBlobFunction( 'createBlobURL' );
export const getBlobByURL = wrapBlobFunction( 'getBlobByURL' );
export const revokeBlobURL = wrapBlobFunction( 'revokeBlobURL' );

// dom
const wrapDomFunction = wrapFunction( dom, 'dom', '3.1' );
export const computeCaretRect = wrapDomFunction( 'computeCaretRect' );
export const documentHasSelection = wrapDomFunction( 'documentHasSelection' );
export const focus = {
focusable: {
find: wrapFunction( dom.focus.focusable, 'dom.focus.focusable', '3.1' )( 'find' ),
},
tabbable: {
find: wrapFunction( dom.focus.tabbable, 'dom.focus.tabbable', '3.1' )( 'find' ),
isTabbableIndex: wrapFunction( dom.focus.tabbable, 'dom.focus.tabbable', '3.1' )( 'isTabbableIndex' ),
},
};
export const getRectangleFromRange = wrapDomFunction( 'getRectangleFromRange' );
export const getScrollContainer = wrapDomFunction( 'getScrollContainer' );
export const insertAfter = wrapDomFunction( 'insertAfter' );
export const isHorizontalEdge = wrapDomFunction( 'isHorizontalEdge' );
export const isTextField = wrapDomFunction( 'isTextField' );
export const isVerticalEdge = wrapDomFunction( 'isVerticalEdge' );
export const placeCaretAtHorizontalEdge = wrapDomFunction( 'placeCaretAtHorizontalEdge' );
export const placeCaretAtVerticalEdge = wrapDomFunction( 'placeCaretAtVerticalEdge' );
export const remove = wrapDomFunction( 'remove' );
export const replace = wrapDomFunction( 'replace' );
export const replaceTag = wrapDomFunction( 'replaceTag' );
export const unwrap = wrapDomFunction( 'unwrap' );

// deprecated
export function deprecated( ...params ) {
originalDeprecated( 'wp.utils.deprecated', {
Expand All @@ -57,14 +30,3 @@ export function deprecated( ...params ) {

return originalDeprecated( ...params );
}

// viewport
export function isExtraSmall() {
originalDeprecated( 'wp.utils.isExtraSmall', {
version: '3.1',
alternative: 'wp.viewport.isExtraSmall',
plugin: 'Gutenberg',
} );

return window && window.innerWidth < 782;
}

0 comments on commit 818acd1

Please sign in to comment.