WordPress/wp-admin/js/color-picker.min.js
desrosj 968d57a6b3 Build/Test Tools: Support NodeJS 14.x in the 4.5 branch.
This updates the 4.5 branch to support the latest LTS version of NodeJS (currently 14.x), allowing the same version to be used across all WordPress branches that receive security updates as a courtesy.

Because older branches use (really) old versions of NodeJS, the local Docker environment cannot be backported since the needed dependencies will not run on these older versions (see #48301). This also blocks the ability to move automated testing over to GitHub Actions (see #50401).

This also replaces the `npm-shrinkwrap.json` with a `package-lock.json` file. Lock files were not supported in earlier versions of NPM, but can now be used.

In addition to backporting the package updates that happened after branching 4.5, dependencies that were removed in future releases have also been updated to their latest versions.

Props desrosj, dd32, netweb, jorbin.
Merges [37185,37212,37612,38111,38688,39110,39113-39119,39478,42460-42461,42463,42887,43320,43323,43977,44219,44233,44728,45321,45765,46404,46408-46409,47404,47867-47869,47872-47873,48705,49636,49933,49937,49939,50017,50126,50176,50185,50192] to the 4.5 branch.
See #52341.
Built from https://develop.svn.wordpress.org/branches/4.5@50208


git-svn-id: http://core.svn.wordpress.org/branches/4.5@49880 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-05 04:20:44 +00:00

1 line
2.7 KiB
JavaScript

!function(i,e){var o={options:{defaultColor:!1,change:!1,clear:!1,hide:!0,palettes:!0,width:255,mode:"hsv"},_create:function(){var t,o;i.support.iris&&(o=(t=this).element,i.extend(t.options,o.data()),t.close=i.proxy(t.close,t),t.initialValue=o.val(),o.addClass("wp-color-picker").hide().wrap('<div class="wp-picker-container" />'),t.wrap=o.parent(),t.toggler=i('<a tabindex="0" class="wp-color-result" />').insertBefore(o).css({backgroundColor:t.initialValue}).attr("title",wpColorPickerL10n.pick).attr("data-current",wpColorPickerL10n.current),t.pickerContainer=i('<div class="wp-picker-holder" />').insertAfter(o),t.button=i('<input type="button" class="button button-small hidden" />'),t.options.defaultColor?t.button.addClass("wp-picker-default").val(wpColorPickerL10n.defaultString):t.button.addClass("wp-picker-clear").val(wpColorPickerL10n.clear),o.wrap('<span class="wp-picker-input-wrap" />').after(t.button),o.iris({target:t.pickerContainer,hide:t.options.hide,width:t.options.width,mode:t.options.mode,palettes:t.options.palettes,change:function(o,e){t.toggler.css({backgroundColor:e.color.toString()}),i.isFunction(t.options.change)&&t.options.change.call(this,o,e)}}),o.val(t.initialValue),t._addListeners(),t.options.hide||t.toggler.click())},_addListeners:function(){var t=this;t.wrap.on("click.wpcolorpicker",function(o){o.stopPropagation()}),t.toggler.click(function(){t.toggler.hasClass("wp-picker-open")?t.close():t.open()}),t.element.change(function(o){var e=i(this).val();""!==e&&"#"!==e||(t.toggler.css("backgroundColor",""),i.isFunction(t.options.clear)&&t.options.clear.call(this,o))}),t.toggler.on("keyup",function(o){13!==o.keyCode&&32!==o.keyCode||(o.preventDefault(),t.toggler.trigger("click").next().focus())}),t.button.click(function(o){var e=i(this);e.hasClass("wp-picker-clear")?(t.element.val(""),t.toggler.css("backgroundColor",""),i.isFunction(t.options.clear)&&t.options.clear.call(this,o)):e.hasClass("wp-picker-default")&&t.element.val(t.options.defaultColor).change()})},open:function(){this.element.show().iris("toggle").focus(),this.button.removeClass("hidden"),this.wrap.addClass("wp-picker-active"),this.toggler.addClass("wp-picker-open"),i("body").trigger("click.wpcolorpicker").on("click.wpcolorpicker",this.close)},close:function(){this.element.hide().iris("toggle"),this.button.addClass("hidden"),this.wrap.removeClass("wp-picker-active"),this.toggler.removeClass("wp-picker-open"),i("body").off("click.wpcolorpicker",this.close)},color:function(o){if(o===e)return this.element.iris("option","color");this.element.iris("option","color",o)},defaultColor:function(o){if(o===e)return this.options.defaultColor;this.options.defaultColor=o}};i.widget("wp.wpColorPicker",o)}(jQuery);