diff -r be944660c56a -r 3d72ae0968f4 wp/wp-includes/js/jquery/ui/effect.js --- a/wp/wp-includes/js/jquery/ui/effect.js Wed Sep 21 18:19:35 2022 +0200 +++ b/wp/wp-includes/js/jquery/ui/effect.js Tue Sep 27 16:37:53 2022 +0200 @@ -1,5 +1,5 @@ /*! - * jQuery UI Effects 1.12.1 + * jQuery UI Effects 1.13.1 * http://jqueryui.com * * Copyright jQuery Foundation and other contributors @@ -9,13 +9,15 @@ //>>label: Effects Core //>>group: Effects -// jscs:disable maximumLineLength +/* eslint-disable max-len */ //>>description: Extends the internal jQuery effects. Includes morphing and easing. Required by all other effects. -// jscs:enable maximumLineLength +/* eslint-enable max-len */ //>>docs: http://api.jqueryui.com/category/effects-core/ //>>demos: http://jqueryui.com/effect/ ( function( factory ) { + "use strict"; + if ( typeof define === "function" && define.amd ) { // AMD. Register as an anonymous module. @@ -25,43 +27,42 @@ // Browser globals factory( jQuery ); } -}( function( $ ) { +} )( function( $ ) { +"use strict"; // Include version.js $.ui = $.ui || {}; -$.ui.version = "1.12.1"; - -var dataSpace = "ui-effects-", - dataSpaceStyle = "ui-effects-style", - dataSpaceAnimated = "ui-effects-animated", +$.ui.version = "1.13.1"; - // Create a local jQuery because jQuery Color relies on it and the - // global may not exist with AMD and a custom build (#10199) - jQuery = $; +// Source: jquery-var-for-color.js +// Create a local jQuery because jQuery Color relies on it and the +// global may not exist with AMD and a custom build (#10199). +// This module is a noop if used as a regular AMD module. +// eslint-disable-next-line no-unused-vars +var jQuery = $; -$.effects = { - effect: {} -}; /*! - * jQuery Color Animations v2.1.2 + * jQuery Color Animations v2.2.0 * https://github.com/jquery/jquery-color * - * Copyright 2014 jQuery Foundation and other contributors + * Copyright OpenJS Foundation and other contributors * Released under the MIT license. * http://jquery.org/license * - * Date: Wed Jan 16 08:47:09 2013 -0600 + * Date: Sun May 10 09:02:36 2020 +0200 */ -( function( jQuery, undefined ) { var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor " + "borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor", - // Plusequals test for += 100 -= 100 + class2type = {}, + toString = class2type.toString, + + // plusequals test for += 100 -= 100 rplusequals = /^([\-+])=\s*(\d+\.?\d*)/, - // A set of RE's that can match strings and generate color tuples. + // a set of RE's that can match strings and generate color tuples. stringParsers = [ { re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/, parse: function( execResult ) { @@ -84,24 +85,31 @@ } }, { - // This regex ignores A-F because it's compared against an already lowercased string - re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/, + // this regex ignores A-F because it's compared against an already lowercased string + re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/, parse: function( execResult ) { return [ parseInt( execResult[ 1 ], 16 ), parseInt( execResult[ 2 ], 16 ), - parseInt( execResult[ 3 ], 16 ) + parseInt( execResult[ 3 ], 16 ), + execResult[ 4 ] ? + ( parseInt( execResult[ 4 ], 16 ) / 255 ).toFixed( 2 ) : + 1 ]; } }, { - // This regex ignores A-F because it's compared against an already lowercased string - re: /#([a-f0-9])([a-f0-9])([a-f0-9])/, + // this regex ignores A-F because it's compared against an already lowercased string + re: /#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/, parse: function( execResult ) { return [ parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ), parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ), - parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ) + parseInt( execResult[ 3 ] + execResult[ 3 ], 16 ), + execResult[ 4 ] ? + ( parseInt( execResult[ 4 ] + execResult[ 4 ], 16 ) / 255 ) + .toFixed( 2 ) : + 1 ]; } }, { @@ -117,7 +125,7 @@ } } ], - // JQuery.Color( ) + // jQuery.Color( ) color = jQuery.Color = function( color, green, blue, alpha ) { return new jQuery.Color.fn.parse( color, green, blue, alpha ); }, @@ -171,20 +179,20 @@ }, support = color.support = {}, - // Element for support tests + // element for support tests supportElem = jQuery( "

" )[ 0 ], - // Colors = jQuery.Color.names + // colors = jQuery.Color.names colors, - // Local aliases of functions called often + // local aliases of functions called often each = jQuery.each; -// Determine rgba support immediately +// determine rgba support immediately supportElem.style.cssText = "background-color:rgba(1,1,1,.5)"; support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1; -// Define cache name and alpha properties +// define cache name and alpha properties // for rgba and hsla spaces each( spaces, function( spaceName, space ) { space.cache = "_" + spaceName; @@ -195,6 +203,22 @@ }; } ); +// Populate the class2type map +jQuery.each( "Boolean Number String Function Array Date RegExp Object Error Symbol".split( " " ), + function( _i, name ) { + class2type[ "[object " + name + "]" ] = name.toLowerCase(); + } ); + +function getType( obj ) { + if ( obj == null ) { + return obj + ""; + } + + return typeof obj === "object" ? + class2type[ toString.call( obj ) ] || "object" : + typeof obj; +} + function clamp( value, prop, allowEmpty ) { var type = propTypes[ prop.type ] || {}; @@ -213,13 +237,13 @@ if ( type.mod ) { - // We add mod before modding to make sure that negatives values + // we add mod before modding to make sure that negatives values // get converted properly: -10 -> 350 return ( value + type.mod ) % type.mod; } - // For now all property types without mod have min and max - return 0 > value ? 0 : type.max < value ? type.max : value; + // for now all property types without mod have min and max + return Math.min( type.max, Math.max( 0, value ) ); } function stringParse( string ) { @@ -228,7 +252,7 @@ string = string.toLowerCase(); - each( stringParsers, function( i, parser ) { + each( stringParsers, function( _i, parser ) { var parsed, match = parser.re.exec( string ), values = match && parser.parse( match ), @@ -237,12 +261,12 @@ if ( values ) { parsed = inst[ spaceName ]( values ); - // If this was an rgba parse the assignment might happen twice + // if this was an rgba parse the assignment might happen twice // oh well.... inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ]; rgba = inst._rgba = parsed._rgba; - // Exit each( stringParsers ) here because we matched + // exit each( stringParsers ) here because we matched return false; } } ); @@ -250,7 +274,7 @@ // Found a stringParser that handled it if ( rgba.length ) { - // If this came from a parsed string, force "transparent" when alpha is 0 + // if this came from a parsed string, force "transparent" when alpha is 0 // chrome, (and maybe others) return "transparent" as rgba(0,0,0,0) if ( rgba.join() === "0,0,0,0" ) { jQuery.extend( rgba, colors.transparent ); @@ -258,7 +282,7 @@ return inst; } - // Named colors + // named colors return colors[ string ]; } @@ -274,10 +298,10 @@ } var inst = this, - type = jQuery.type( red ), + type = getType( red ), rgba = this._rgba = []; - // More than 1 argument specified - assume ( red, green, blue, alpha ) + // more than 1 argument specified - assume ( red, green, blue, alpha ) if ( green !== undefined ) { red = [ red, green, blue, alpha ]; type = "array"; @@ -288,7 +312,7 @@ } if ( type === "array" ) { - each( spaces.rgba.props, function( key, prop ) { + each( spaces.rgba.props, function( _key, prop ) { rgba[ prop.idx ] = clamp( red[ prop.idx ], prop ); } ); return this; @@ -296,20 +320,20 @@ if ( type === "object" ) { if ( red instanceof color ) { - each( spaces, function( spaceName, space ) { + each( spaces, function( _spaceName, space ) { if ( red[ space.cache ] ) { inst[ space.cache ] = red[ space.cache ].slice(); } } ); } else { - each( spaces, function( spaceName, space ) { + each( spaces, function( _spaceName, space ) { var cache = space.cache; each( space.props, function( key, prop ) { - // If the cache doesn't exist, and we know how to convert + // if the cache doesn't exist, and we know how to convert if ( !inst[ cache ] && space.to ) { - // If the value was null, we don't need to copy it + // if the value was null, we don't need to copy it // if the key was alpha, we don't need to copy it either if ( key === "alpha" || red[ key ] == null ) { return; @@ -317,17 +341,19 @@ inst[ cache ] = space.to( inst._rgba ); } - // This is the only case where we allow nulls for ALL properties. + // this is the only case where we allow nulls for ALL properties. // call clamp with alwaysAllowEmpty inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true ); } ); - // Everything defined but alpha? - if ( inst[ cache ] && - jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) { + // everything defined but alpha? + if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) { - // Use the default of 1 - inst[ cache ][ 3 ] = 1; + // use the default of 1 + if ( inst[ cache ][ 3 ] == null ) { + inst[ cache ][ 3 ] = 1; + } + if ( space.from ) { inst._rgba = space.from( inst[ cache ] ); } @@ -377,18 +403,18 @@ result = start.slice(); end = end[ space.cache ]; - each( space.props, function( key, prop ) { + each( space.props, function( _key, prop ) { var index = prop.idx, startValue = start[ index ], endValue = end[ index ], type = propTypes[ prop.type ] || {}; - // If null, don't override start value + // if null, don't override start value if ( endValue === null ) { return; } - // If null - use end + // if null - use end if ( startValue === null ) { result[ index ] = endValue; } else { @@ -406,7 +432,7 @@ }, blend: function( opaque ) { - // If we are already opaque - return ourself + // if we are already opaque - return ourself if ( this._rgba[ 3 ] === 1 ) { return this; } @@ -422,7 +448,10 @@ toRgbaString: function() { var prefix = "rgba(", rgba = jQuery.map( this._rgba, function( v, i ) { - return v == null ? ( i > 2 ? 1 : 0 ) : v; + if ( v != null ) { + return v; + } + return i > 2 ? 1 : 0; } ); if ( rgba[ 3 ] === 1 ) { @@ -439,7 +468,7 @@ v = i > 2 ? 1 : 0; } - // Catch 1 and 2 + // catch 1 and 2 if ( i && i < 3 ) { v = Math.round( v * 100 ) + "%"; } @@ -462,7 +491,7 @@ return "#" + jQuery.map( rgba, function( v ) { - // Default to 0 when nulls exist + // default to 0 when nulls exist v = ( v || 0 ).toString( 16 ); return v.length === 1 ? "0" + v : v; } ).join( "" ); @@ -473,7 +502,7 @@ } ); color.fn.parse.prototype = color.fn; -// Hsla conversions adapted from: +// hsla conversions adapted from: // https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021 function hue2rgb( p, q, h ) { @@ -515,7 +544,7 @@ h = ( 60 * ( r - g ) / diff ) + 240; } - // Chroma (diff) == 0 means greyscale which, by definition, saturation = 0% + // chroma (diff) == 0 means greyscale which, by definition, saturation = 0% // otherwise, saturation is based on the ratio of chroma (diff) to lightness (add) if ( diff === 0 ) { s = 0; @@ -546,16 +575,17 @@ ]; }; + each( spaces, function( spaceName, space ) { var props = space.props, cache = space.cache, to = space.to, from = space.from; - // Makes rgba() and hsla() + // makes rgba() and hsla() color.fn[ spaceName ] = function( value ) { - // Generate a cache for this space if it doesn't exist + // generate a cache for this space if it doesn't exist if ( to && !this[ cache ] ) { this[ cache ] = to( this._rgba ); } @@ -564,7 +594,7 @@ } var ret, - type = jQuery.type( value ), + type = getType( value ), arr = ( type === "array" || type === "object" ) ? value : arguments, local = this[ cache ].slice(); @@ -585,19 +615,24 @@ } }; - // Makes red() green() blue() alpha() hue() saturation() lightness() + // makes red() green() blue() alpha() hue() saturation() lightness() each( props, function( key, prop ) { - // Alpha is included in more than one space + // alpha is included in more than one space if ( color.fn[ key ] ) { return; } color.fn[ key ] = function( value ) { - var vtype = jQuery.type( value ), - fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ), - local = this[ fn ](), - cur = local[ prop.idx ], - match; + var local, cur, match, fn, + vtype = getType( value ); + + if ( key === "alpha" ) { + fn = this._hsla ? "hsla" : "rgba"; + } else { + fn = spaceName; + } + local = this[ fn ](); + cur = local[ prop.idx ]; if ( vtype === "undefined" ) { return cur; @@ -605,7 +640,7 @@ if ( vtype === "function" ) { value = value.call( this, cur ); - vtype = jQuery.type( value ); + vtype = getType( value ); } if ( value == null && prop.empty ) { return this; @@ -622,18 +657,17 @@ } ); } ); -// Add cssHook and .fx.step function for each named hook. +// add cssHook and .fx.step function for each named hook. // accept a space separated string of properties color.hook = function( hook ) { var hooks = hook.split( " " ); - each( hooks, function( i, hook ) { + each( hooks, function( _i, hook ) { jQuery.cssHooks[ hook ] = { set: function( elem, value ) { var parsed, curElem, backgroundColor = ""; - if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || - ( parsed = stringParse( value ) ) ) ) { + if ( value !== "transparent" && ( getType( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) { value = color( parsed || value ); if ( !support.rgba && value._rgba[ 3 ] !== 1 ) { curElem = hook === "backgroundColor" ? elem.parentNode : elem; @@ -659,8 +693,7 @@ elem.style[ hook ] = value; } catch ( e ) { - // Wrapped to prevent IE from throwing errors on "invalid" values like - // 'auto' or 'inherit' + // wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit' } } }; @@ -682,7 +715,7 @@ expand: function( value ) { var expanded = {}; - each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) { + each( [ "Top", "Right", "Bottom", "Left" ], function( _i, part ) { expanded[ "border" + part + "Color" ] = value; } ); return expanded; @@ -718,7 +751,14 @@ _default: "#ffffff" }; -} )( jQuery ); + +var dataSpace = "ui-effects-", + dataSpaceStyle = "ui-effects-style", + dataSpaceAnimated = "ui-effects-animated"; + +$.effects = { + effect: {} +}; /******************************************************************************/ /****************************** CLASS ANIMATIONS ******************************/ @@ -750,6 +790,12 @@ } ); +function camelCase( string ) { + return string.replace( /-([\da-z])/gi, function( all, letter ) { + return letter.toUpperCase(); + } ); +} + function getElementStyles( elem ) { var key, len, style = elem.ownerDocument.defaultView ? @@ -762,11 +808,11 @@ while ( len-- ) { key = style[ len ]; if ( typeof style[ key ] === "string" ) { - styles[ $.camelCase( key ) ] = style[ key ]; + styles[ camelCase( key ) ] = style[ key ]; } } - // Support: Opera, IE <9 + // Support: Opera, IE <9 } else { for ( key in style ) { if ( typeof style[ key ] === "string" ) { @@ -936,12 +982,12 @@ ( function() { -if ( $.expr && $.expr.filters && $.expr.filters.animated ) { - $.expr.filters.animated = ( function( orig ) { +if ( $.expr && $.expr.pseudos && $.expr.pseudos.animated ) { + $.expr.pseudos.animated = ( function( orig ) { return function( elem ) { return !!$( elem ).data( dataSpaceAnimated ) || orig( elem ); }; - } )( $.expr.filters.animated ); + } )( $.expr.pseudos.animated ); } if ( $.uiBackCompat !== false ) { @@ -1010,6 +1056,7 @@ // Firefox incorrectly exposes anonymous content // https://bugzilla.mozilla.org/show_bug.cgi?id=561664 try { + // eslint-disable-next-line no-unused-expressions active.id; } catch ( e ) { active = document.body; @@ -1072,7 +1119,7 @@ } $.extend( $.effects, { - version: "1.12.1", + version: "1.13.1", define: function( name, mode, effect ) { if ( !effect ) { @@ -1154,31 +1201,31 @@ var y, x; switch ( origin[ 0 ] ) { - case "top": - y = 0; - break; - case "middle": - y = 0.5; - break; - case "bottom": - y = 1; - break; - default: - y = origin[ 0 ] / original.height; + case "top": + y = 0; + break; + case "middle": + y = 0.5; + break; + case "bottom": + y = 1; + break; + default: + y = origin[ 0 ] / original.height; } switch ( origin[ 1 ] ) { - case "left": - x = 0; - break; - case "center": - x = 0.5; - break; - case "right": - x = 1; - break; - default: - x = origin[ 1 ] / original.width; + case "left": + x = 0; + break; + case "center": + x = 0.5; + break; + case "right": + x = 1; + break; + default: + x = origin[ 1 ] / original.width; } return { @@ -1203,8 +1250,8 @@ marginLeft: element.css( "marginLeft" ), marginRight: element.css( "marginRight" ) } ) - .outerWidth( element.outerWidth() ) - .outerHeight( element.outerHeight() ); + .outerWidth( element.outerWidth() ) + .outerHeight( element.outerHeight() ); if ( /^(static|relative)/.test( cssPosition ) ) { cssPosition = "absolute"; @@ -1225,9 +1272,9 @@ marginRight: element.css( "marginRight" ), "float": element.css( "float" ) } ) - .outerWidth( element.outerWidth() ) - .outerHeight( element.outerHeight() ) - .addClass( "ui-effects-placeholder" ); + .outerWidth( element.outerWidth() ) + .outerHeight( element.outerHeight() ) + .addClass( "ui-effects-placeholder" ); element.data( dataSpace + "placeholder", placeholder ); } @@ -1243,7 +1290,7 @@ removePlaceholder: function( element ) { var dataKey = dataSpace + "placeholder", - placeholder = element.data( dataKey ); + placeholder = element.data( dataKey ); if ( placeholder ) { placeholder.remove(); @@ -1288,7 +1335,7 @@ } // Catch (effect, callback) - if ( $.isFunction( options ) ) { + if ( typeof options === "function" ) { callback = options; speed = null; options = {}; @@ -1302,7 +1349,7 @@ } // Catch (effect, options, callback) - if ( $.isFunction( speed ) ) { + if ( typeof speed === "function" ) { callback = speed; speed = null; } @@ -1315,8 +1362,8 @@ speed = speed || options.duration; effect.duration = $.fx.off ? 0 : typeof speed === "number" ? speed : - speed in $.fx.speeds ? $.fx.speeds[ speed ] : - $.fx.speeds._default; + speed in $.fx.speeds ? $.fx.speeds[ speed ] : + $.fx.speeds._default; effect.complete = callback || options.complete; @@ -1336,7 +1383,7 @@ } // Complete callback - if ( $.isFunction( option ) ) { + if ( typeof option === "function" ) { return true; } @@ -1363,7 +1410,7 @@ var el = $( this ), normalizedMode = $.effects.mode( el, mode ) || defaultMode; - // Sentinel for duck-punching the :animated psuedo-selector + // Sentinel for duck-punching the :animated pseudo-selector el.data( dataSpaceAnimated, true ); // Save effect mode for later use, @@ -1371,9 +1418,9 @@ // as the .show() below destroys the initial state modes.push( normalizedMode ); - // See $.uiBackCompat inside of run() for removal of defaultMode in 1.13 + // See $.uiBackCompat inside of run() for removal of defaultMode in 1.14 if ( defaultMode && ( normalizedMode === "show" || - ( normalizedMode === defaultMode && normalizedMode === "hide" ) ) ) { + ( normalizedMode === defaultMode && normalizedMode === "hide" ) ) ) { el.show(); } @@ -1381,7 +1428,7 @@ $.effects.saveStyle( el ); } - if ( $.isFunction( next ) ) { + if ( typeof next === "function" ) { next(); } }; @@ -1416,11 +1463,11 @@ } function done() { - if ( $.isFunction( complete ) ) { + if ( typeof complete === "function" ) { complete.call( elem[ 0 ] ); } - if ( $.isFunction( next ) ) { + if ( typeof next === "function" ) { next(); } } @@ -1529,37 +1576,39 @@ width: target.innerWidth() }, startPosition = element.offset(), - transfer = $( "

" ) - .appendTo( "body" ) - .addClass( options.className ) - .css( { - top: startPosition.top - fixTop, - left: startPosition.left - fixLeft, - height: element.innerHeight(), - width: element.innerWidth(), - position: targetFixed ? "fixed" : "absolute" - } ) - .animate( animation, options.duration, options.easing, function() { - transfer.remove(); - if ( $.isFunction( done ) ) { - done(); - } - } ); + transfer = $( "
" ); + + transfer + .appendTo( "body" ) + .addClass( options.className ) + .css( { + top: startPosition.top - fixTop, + left: startPosition.left - fixLeft, + height: element.innerHeight(), + width: element.innerWidth(), + position: targetFixed ? "fixed" : "absolute" + } ) + .animate( animation, options.duration, options.easing, function() { + transfer.remove(); + if ( typeof done === "function" ) { + done(); + } + } ); } } ); function parseClip( str, element ) { - var outerWidth = element.outerWidth(), - outerHeight = element.outerHeight(), - clipRegex = /^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/, - values = clipRegex.exec( str ) || [ "", 0, outerWidth, outerHeight, 0 ]; + var outerWidth = element.outerWidth(), + outerHeight = element.outerHeight(), + clipRegex = /^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/, + values = clipRegex.exec( str ) || [ "", 0, outerWidth, outerHeight, 0 ]; - return { - top: parseFloat( values[ 1 ] ) || 0, - right: values[ 2 ] === "auto" ? outerWidth : parseFloat( values[ 2 ] ), - bottom: values[ 3 ] === "auto" ? outerHeight : parseFloat( values[ 3 ] ), - left: parseFloat( values[ 4 ] ) || 0 - }; + return { + top: parseFloat( values[ 1 ] ) || 0, + right: values[ 2 ] === "auto" ? outerWidth : parseFloat( values[ 2 ] ), + bottom: values[ 3 ] === "auto" ? outerHeight : parseFloat( values[ 3 ] ), + left: parseFloat( values[ 4 ] ) || 0 + }; } $.fx.step.clip = function( fx ) { @@ -1636,4 +1685,4 @@ return $.effects; -} ) ); +} );