Plugin Directory

Changeset 3482557


Ignore:
Timestamp:
03/14/2026 02:04:29 PM (2 weeks ago)
Author:
MarcDK
Message:

Update to version 1.0.16 from GitHub

Location:
hero-color-picker
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • hero-color-picker/tags/1.0.16/build/index.asset.php

    r3480595 r3482557  
    1 <?php return array('dependencies' => array('react-jsx-runtime', 'wp-components', 'wp-data', 'wp-editor', 'wp-i18n', 'wp-plugins'), 'version' => 'cefa3c2f161b9d1e9a4d');
     1<?php return array('dependencies' => array('react-jsx-runtime', 'wp-components', 'wp-data', 'wp-editor', 'wp-i18n', 'wp-plugins'), 'version' => '22c1b4bfd21cc6e5ad1c');
  • hero-color-picker/tags/1.0.16/build/index.js

    r3480595 r3482557  
    1 (()=>{"use strict";const e=window.wp.plugins,o=window.wp.editor,r=window.wp.i18n,t=window.wp.components,n=window.wp.data,i=window.ReactJSXRuntime,l="hero_color_picker_hero_color",s="hero_color_picker_font_color",{useEffect:c}=window.wp.element;function a(e,o){"undefined"!=typeof document&&document.querySelectorAll(".editor-post-summary").forEach(r=>{e?r.style.setProperty("background-color",e,"important"):r.style.removeProperty("background-color"),o?r.style.setProperty("color",o,"important"):r.style.removeProperty("color")})}function d(e){"undefined"!=typeof document&&document.querySelectorAll(".editor-post-featured-image__preview").forEach(o=>{e?o.style.setProperty("outline","none","important"):o.style.removeProperty("outline")})}function p(e){if("string"!=typeof e)return null;const o=e.trim().replace("#",""),r=3===o.length?o.split("").map(e=>e+e).join(""):o;return/^[0-9a-fA-F]{6}$/.test(r)?{r:parseInt(r.slice(0,2),16),g:parseInt(r.slice(2,4),16),b:parseInt(r.slice(4,6),16)}:null}function h(e){const o=e/255;return o<=.03928?o/12.92:((o+.055)/1.055)**2.4}function u(e){return.2126*h(e.r)+.7152*h(e.g)+.0722*h(e.b)}function m({label:e,value:o,onChange:n,onReset:l,resetText:s}){return(0,i.jsxs)("div",{style:{marginBottom:16},children:[(0,i.jsx)("div",{style:{marginBottom:8},children:e}),(0,i.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[(0,i.jsx)(t.Dropdown,{popoverProps:{placement:"left-start"},renderToggle:({isOpen:e,onToggle:n})=>(0,i.jsxs)(t.Button,{variant:"secondary",onClick:n,"aria-expanded":e,style:{flex:1,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,i.jsx)("span",{children:o||(0,r.__)("Select color","hero-color-picker")}),(0,i.jsx)("span",{"aria-hidden":!0,style:{display:"inline-block",marginLeft:8,width:14,height:14,borderRadius:2,border:"1px solid #ccc",backgroundColor:o||"transparent"}})]}),renderContent:()=>(0,i.jsx)("div",{style:{padding:8},children:(0,i.jsx)(t.ColorPicker,{color:o||"#111111",enableAlpha:!1,onChange:n})})}),(0,i.jsx)(t.Button,{variant:"secondary",isDestructive:!0,onClick:l,disabled:!o,children:s})]})]})}(0,e.registerPlugin)("hero-color-picker",{render:function(){const{meta:e,postType:h}=(0,n.useSelect)(e=>{const o=e("core/editor");return{meta:o.getEditedPostAttribute("meta")||{},postType:o.getCurrentPostType()}},[]),{editPost:g}=(0,n.useDispatch)("core/editor"),x=e[l]||"",y=e[s]||"",f=function(e,o){const r=p(e),t=p(o);if(!r||!t)return null;const n=u(r),i=u(t);return(Math.max(n,i)+.05)/(Math.min(n,i)+.05)}(y,x),_=Boolean(x&&y),k=_&&null!==f&&f>=7;let w=(0,r.__)("Not applicable","hero-color-picker"),j="info";return _&&(k?(w=(0,r.__)("PASS","hero-color-picker"),j="success"):(w=(0,r.__)("FAILED","hero-color-picker"),j="error")),c(()=>{if("post"!==h)return a("",""),void d("");a(x,y),d(x)},[x,y,h]),c(()=>()=>{a("",""),d("")},[]),"post"!==h?null:(0,i.jsx)(o.PluginDocumentSettingPanel,{name:"hero-color-picker",title:"Hero Color Picker",className:"hero-color",children:(0,i.jsx)(t.PanelRow,{children:(0,i.jsxs)("div",{style:{width:"100%"},children:[(0,i.jsx)(m,{label:(0,r.__)("Background Color","hero-color-picker"),value:x,onChange:o=>{g({meta:{...e,[l]:o}})},onReset:()=>{g({meta:{...e,[l]:""}})},resetText:(0,r.__)("Unset","hero-color-picker")}),(0,i.jsx)(m,{label:(0,r.__)("Font Color","hero-color-picker"),value:y,onChange:o=>{g({meta:{...e,[s]:o}})},onReset:()=>{g({meta:{...e,[s]:""}})},resetText:(0,r.__)("Unset","hero-color-picker")}),(0,i.jsxs)("div",{style:{padding:10,borderRadius:4,border:"1px solid #dcdcde",backgroundColor:x||"#f0f0f1",color:y||"#1e1e1e",marginBottom:10},children:[(0,i.jsx)("strong",{children:(0,r.__)("Preview","hero-color-picker")}),(0,i.jsx)("p",{style:{margin:"6px 0 0"},children:(0,r.__)("This is how the background and font colors look together.","hero-color-picker")})]}),(0,i.jsxs)(t.BaseControl,{id:"hero-color-picker-contrast-check",label:(0,r.__)("Contrast Check","hero-color-picker"),children:[(0,i.jsx)(t.Notice,{status:j,isDismissible:!1,style:{margin:"6px 0 0"},children:(0,i.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:8,width:"100%"},children:[(0,i.jsx)("strong",{children:w}),null!==f?(0,i.jsx)("span",{children:"("+f.toFixed(2)+":1)"}):null]})}),(0,i.jsx)("p",{style:{margin:"10px 0 0",color:"#50575e"},children:(0,r.__)("WCAG AAA, normal text, minimum ratio 7:1.","hero-color-picker")})]}),(0,i.jsx)(t.Notice,{status:"info",isDismissible:!1,style:{margin:"12px 0 0"},children:(0,i.jsx)("p",{style:{margin:0},children:(0,i.jsx)(t.ExternalLink,{href:"https://wordpress.org/plugins/hero-color-picker/#how%20do%20i%20add%20the%20%60hero-colored%60%20css%20class%20in%20templates%3F",children:(0,r.__)("Colors not showing on frontend? Read the FAQ.","hero-color-picker")})})})]})})})}})})();
     1(()=>{"use strict";const e=window.wp.plugins,o=window.wp.editor,r=window.wp.i18n,t=window.wp.components,n=window.wp.data,i=window.ReactJSXRuntime,l="hero_color_picker_hero_color",s="hero_color_picker_font_color",{useEffect:c}=window.wp.element;function a(e,o){"undefined"!=typeof document&&document.querySelectorAll(".editor-post-summary").forEach(r=>{e?r.style.setProperty("background-color",e,"important"):r.style.removeProperty("background-color"),o?r.style.setProperty("color",o,"important"):r.style.removeProperty("color")})}function d(e){"undefined"!=typeof document&&document.querySelectorAll(".editor-post-featured-image__preview").forEach(o=>{e?o.style.setProperty("outline","none","important"):o.style.removeProperty("outline")})}function p(e){if("string"!=typeof e)return null;const o=e.trim().replace("#",""),r=3===o.length?o.split("").map(e=>e+e).join(""):o;return/^[0-9a-fA-F]{6}$/.test(r)?{r:parseInt(r.slice(0,2),16),g:parseInt(r.slice(2,4),16),b:parseInt(r.slice(4,6),16)}:null}function h(e){const o=e/255;return o<=.03928?o/12.92:((o+.055)/1.055)**2.4}function u(e){return.2126*h(e.r)+.7152*h(e.g)+.0722*h(e.b)}function m({label:e,value:o,onChange:n,onReset:l,resetText:s}){return(0,i.jsxs)("div",{style:{marginBottom:16},children:[(0,i.jsx)("div",{style:{marginBottom:8},children:e}),(0,i.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[(0,i.jsx)(t.Dropdown,{popoverProps:{placement:"left-start"},renderToggle:({isOpen:e,onToggle:n})=>(0,i.jsxs)(t.Button,{variant:"secondary",onClick:n,"aria-expanded":e,style:{flex:1,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,i.jsx)("span",{children:o||(0,r.__)("Select color","hero-color-picker")}),(0,i.jsx)("span",{"aria-hidden":!0,style:{display:"inline-block",marginLeft:8,width:14,height:14,borderRadius:2,border:"1px solid #ccc",backgroundColor:o||"transparent"}})]}),renderContent:()=>(0,i.jsx)("div",{style:{padding:8},children:(0,i.jsx)(t.ColorPicker,{color:o||"#111111",enableAlpha:!1,onChange:n})})}),(0,i.jsx)(t.Button,{variant:"secondary",isDestructive:!0,onClick:l,disabled:!o,children:s})]})]})}(0,e.registerPlugin)("hero-color-picker",{render:function(){const{meta:e,postType:h}=(0,n.useSelect)(e=>{const o=e("core/editor");return{meta:o.getEditedPostAttribute("meta")||{},postType:o.getCurrentPostType()}},[]),{editPost:g}=(0,n.useDispatch)("core/editor"),x=e[l]||"",y=e[s]||"",f=function(e,o){const r=p(e),t=p(o);if(!r||!t)return null;const n=u(r),i=u(t);return(Math.max(n,i)+.05)/(Math.min(n,i)+.05)}(y,x),_=Boolean(x&&y),k=_&&null!==f&&f>=7;let w=(0,r.__)("Not applicable","hero-color-picker"),j="info";return _&&(k?(w=(0,r.__)("PASS","hero-color-picker"),j="success"):(w=(0,r.__)("FAILED","hero-color-picker"),j="error")),c(()=>{if("post"!==h)return a("",""),void d("");a(x,y),d(x)},[x,y,h]),c(()=>()=>{a("",""),d("")},[]),"post"!==h?null:(0,i.jsx)(o.PluginDocumentSettingPanel,{name:"hero-color-picker",title:(0,r.__)("Hero Color Picker","hero-color-picker"),className:"hero-color",children:(0,i.jsx)(t.PanelRow,{children:(0,i.jsxs)("div",{style:{width:"100%"},children:[(0,i.jsx)(m,{label:(0,r.__)("Background Color","hero-color-picker"),value:x,onChange:o=>{g({meta:{...e,[l]:o}})},onReset:()=>{g({meta:{...e,[l]:""}})},resetText:(0,r.__)("Unset","hero-color-picker")}),(0,i.jsx)(m,{label:(0,r.__)("Font Color","hero-color-picker"),value:y,onChange:o=>{g({meta:{...e,[s]:o}})},onReset:()=>{g({meta:{...e,[s]:""}})},resetText:(0,r.__)("Unset","hero-color-picker")}),(0,i.jsxs)("div",{style:{padding:10,borderRadius:4,border:"1px solid #dcdcde",backgroundColor:x||"#f0f0f1",color:y||"#1e1e1e",marginBottom:10},children:[(0,i.jsx)("strong",{children:(0,r.__)("Preview","hero-color-picker")}),(0,i.jsx)("p",{style:{margin:"6px 0 0"},children:(0,r.__)("This is how the background and font colors look together.","hero-color-picker")})]}),(0,i.jsxs)(t.BaseControl,{id:"hero-color-picker-contrast-check",label:(0,r.__)("Contrast Check","hero-color-picker"),children:[(0,i.jsx)(t.Notice,{status:j,isDismissible:!1,style:{margin:"6px 0 0"},children:(0,i.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:8,width:"100%"},children:[(0,i.jsx)("strong",{children:w}),null!==f?(0,i.jsx)("span",{children:"("+f.toFixed(2)+":1)"}):null]})}),(0,i.jsx)("p",{style:{margin:"10px 0 0",color:"#50575e"},children:(0,r.__)("WCAG AAA, normal text, minimum ratio 7:1.","hero-color-picker")})]}),(0,i.jsx)(t.Notice,{status:"info",isDismissible:!1,style:{margin:"12px 0 0"},children:(0,i.jsx)("p",{style:{margin:0},children:(0,i.jsx)(t.ExternalLink,{href:"https://wordpress.org/plugins/hero-color-picker/#how%20do%20i%20add%20the%20%60hero-colored%60%20css%20class%20in%20templates%3F",children:(0,r.__)("Colors not showing on frontend? Read the FAQ.","hero-color-picker")})})})]})})})}})})();
  • hero-color-picker/tags/1.0.16/hero-color-picker.php

    r3480595 r3482557  
    44 * Plugin URI:    https://github.com/mtoensing/hero-color-picker
    55 * Description:   Adds per-post color selection in the editor sidebar for hero styling via CSS.
    6  * Version:       1.0.15
     6 * Version:       1.0.16
    77 * Author:        Marc Tönsing
    88 * Author URI:    https://toensing.com
    99 * Text Domain:   hero-color-picker
     10 * Domain Path:   /languages
    1011 * License: GPL   v2 or later
    1112 * License URI:   http://www.gnu.org/licenses/gpl-2.0.html
     
    2122const HERO_COLOR_PICKER_FONT_META_KEY = 'hero_color_picker_font_color';
    2223const HERO_COLOR_PICKER_HAS_BG_QUERY_VAR = 'hero_color_picker_has_bg';
     24
     25/**
     26 * Register the plugin language path for local files and WordPress.org language packs.
     27 */
     28add_action(
     29    'init',
     30    function () {
     31        load_plugin_textdomain(
     32            'hero-color-picker',
     33            false,
     34            dirname( plugin_basename( __FILE__ ) ) . '/languages'
     35        );
     36    }
     37);
    2338
    2439/**
     
    157172            true
    158173        );
     174
     175        wp_set_script_translations(
     176            'hero-color-picker-editor',
     177            'hero-color-picker'
     178        );
    159179    }
    160180);
  • hero-color-picker/tags/1.0.16/readme.txt

    r3480595 r3482557  
    44Requires at least: 5.9
    55Tested up to: 6.9
    6 Stable tag: 1.0.15
     6Stable tag: 1.0.16
    77Requires PHP: 7.3
    88License: GPLv2 or later
     
    6666== Changelog ==
    6767
     68= 1.0.16 =
     69* Fixed loading of WordPress.org language packs for editor JavaScript strings.
     70* Marked the editor panel title as translatable.
     71
    6872= 1.0.15 =
    6973* Corrected and refined wording in the readme and editor preview text.
  • hero-color-picker/trunk/build/index.asset.php

    r3480595 r3482557  
    1 <?php return array('dependencies' => array('react-jsx-runtime', 'wp-components', 'wp-data', 'wp-editor', 'wp-i18n', 'wp-plugins'), 'version' => 'cefa3c2f161b9d1e9a4d');
     1<?php return array('dependencies' => array('react-jsx-runtime', 'wp-components', 'wp-data', 'wp-editor', 'wp-i18n', 'wp-plugins'), 'version' => '22c1b4bfd21cc6e5ad1c');
  • hero-color-picker/trunk/build/index.js

    r3480595 r3482557  
    1 (()=>{"use strict";const e=window.wp.plugins,o=window.wp.editor,r=window.wp.i18n,t=window.wp.components,n=window.wp.data,i=window.ReactJSXRuntime,l="hero_color_picker_hero_color",s="hero_color_picker_font_color",{useEffect:c}=window.wp.element;function a(e,o){"undefined"!=typeof document&&document.querySelectorAll(".editor-post-summary").forEach(r=>{e?r.style.setProperty("background-color",e,"important"):r.style.removeProperty("background-color"),o?r.style.setProperty("color",o,"important"):r.style.removeProperty("color")})}function d(e){"undefined"!=typeof document&&document.querySelectorAll(".editor-post-featured-image__preview").forEach(o=>{e?o.style.setProperty("outline","none","important"):o.style.removeProperty("outline")})}function p(e){if("string"!=typeof e)return null;const o=e.trim().replace("#",""),r=3===o.length?o.split("").map(e=>e+e).join(""):o;return/^[0-9a-fA-F]{6}$/.test(r)?{r:parseInt(r.slice(0,2),16),g:parseInt(r.slice(2,4),16),b:parseInt(r.slice(4,6),16)}:null}function h(e){const o=e/255;return o<=.03928?o/12.92:((o+.055)/1.055)**2.4}function u(e){return.2126*h(e.r)+.7152*h(e.g)+.0722*h(e.b)}function m({label:e,value:o,onChange:n,onReset:l,resetText:s}){return(0,i.jsxs)("div",{style:{marginBottom:16},children:[(0,i.jsx)("div",{style:{marginBottom:8},children:e}),(0,i.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[(0,i.jsx)(t.Dropdown,{popoverProps:{placement:"left-start"},renderToggle:({isOpen:e,onToggle:n})=>(0,i.jsxs)(t.Button,{variant:"secondary",onClick:n,"aria-expanded":e,style:{flex:1,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,i.jsx)("span",{children:o||(0,r.__)("Select color","hero-color-picker")}),(0,i.jsx)("span",{"aria-hidden":!0,style:{display:"inline-block",marginLeft:8,width:14,height:14,borderRadius:2,border:"1px solid #ccc",backgroundColor:o||"transparent"}})]}),renderContent:()=>(0,i.jsx)("div",{style:{padding:8},children:(0,i.jsx)(t.ColorPicker,{color:o||"#111111",enableAlpha:!1,onChange:n})})}),(0,i.jsx)(t.Button,{variant:"secondary",isDestructive:!0,onClick:l,disabled:!o,children:s})]})]})}(0,e.registerPlugin)("hero-color-picker",{render:function(){const{meta:e,postType:h}=(0,n.useSelect)(e=>{const o=e("core/editor");return{meta:o.getEditedPostAttribute("meta")||{},postType:o.getCurrentPostType()}},[]),{editPost:g}=(0,n.useDispatch)("core/editor"),x=e[l]||"",y=e[s]||"",f=function(e,o){const r=p(e),t=p(o);if(!r||!t)return null;const n=u(r),i=u(t);return(Math.max(n,i)+.05)/(Math.min(n,i)+.05)}(y,x),_=Boolean(x&&y),k=_&&null!==f&&f>=7;let w=(0,r.__)("Not applicable","hero-color-picker"),j="info";return _&&(k?(w=(0,r.__)("PASS","hero-color-picker"),j="success"):(w=(0,r.__)("FAILED","hero-color-picker"),j="error")),c(()=>{if("post"!==h)return a("",""),void d("");a(x,y),d(x)},[x,y,h]),c(()=>()=>{a("",""),d("")},[]),"post"!==h?null:(0,i.jsx)(o.PluginDocumentSettingPanel,{name:"hero-color-picker",title:"Hero Color Picker",className:"hero-color",children:(0,i.jsx)(t.PanelRow,{children:(0,i.jsxs)("div",{style:{width:"100%"},children:[(0,i.jsx)(m,{label:(0,r.__)("Background Color","hero-color-picker"),value:x,onChange:o=>{g({meta:{...e,[l]:o}})},onReset:()=>{g({meta:{...e,[l]:""}})},resetText:(0,r.__)("Unset","hero-color-picker")}),(0,i.jsx)(m,{label:(0,r.__)("Font Color","hero-color-picker"),value:y,onChange:o=>{g({meta:{...e,[s]:o}})},onReset:()=>{g({meta:{...e,[s]:""}})},resetText:(0,r.__)("Unset","hero-color-picker")}),(0,i.jsxs)("div",{style:{padding:10,borderRadius:4,border:"1px solid #dcdcde",backgroundColor:x||"#f0f0f1",color:y||"#1e1e1e",marginBottom:10},children:[(0,i.jsx)("strong",{children:(0,r.__)("Preview","hero-color-picker")}),(0,i.jsx)("p",{style:{margin:"6px 0 0"},children:(0,r.__)("This is how the background and font colors look together.","hero-color-picker")})]}),(0,i.jsxs)(t.BaseControl,{id:"hero-color-picker-contrast-check",label:(0,r.__)("Contrast Check","hero-color-picker"),children:[(0,i.jsx)(t.Notice,{status:j,isDismissible:!1,style:{margin:"6px 0 0"},children:(0,i.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:8,width:"100%"},children:[(0,i.jsx)("strong",{children:w}),null!==f?(0,i.jsx)("span",{children:"("+f.toFixed(2)+":1)"}):null]})}),(0,i.jsx)("p",{style:{margin:"10px 0 0",color:"#50575e"},children:(0,r.__)("WCAG AAA, normal text, minimum ratio 7:1.","hero-color-picker")})]}),(0,i.jsx)(t.Notice,{status:"info",isDismissible:!1,style:{margin:"12px 0 0"},children:(0,i.jsx)("p",{style:{margin:0},children:(0,i.jsx)(t.ExternalLink,{href:"https://wordpress.org/plugins/hero-color-picker/#how%20do%20i%20add%20the%20%60hero-colored%60%20css%20class%20in%20templates%3F",children:(0,r.__)("Colors not showing on frontend? Read the FAQ.","hero-color-picker")})})})]})})})}})})();
     1(()=>{"use strict";const e=window.wp.plugins,o=window.wp.editor,r=window.wp.i18n,t=window.wp.components,n=window.wp.data,i=window.ReactJSXRuntime,l="hero_color_picker_hero_color",s="hero_color_picker_font_color",{useEffect:c}=window.wp.element;function a(e,o){"undefined"!=typeof document&&document.querySelectorAll(".editor-post-summary").forEach(r=>{e?r.style.setProperty("background-color",e,"important"):r.style.removeProperty("background-color"),o?r.style.setProperty("color",o,"important"):r.style.removeProperty("color")})}function d(e){"undefined"!=typeof document&&document.querySelectorAll(".editor-post-featured-image__preview").forEach(o=>{e?o.style.setProperty("outline","none","important"):o.style.removeProperty("outline")})}function p(e){if("string"!=typeof e)return null;const o=e.trim().replace("#",""),r=3===o.length?o.split("").map(e=>e+e).join(""):o;return/^[0-9a-fA-F]{6}$/.test(r)?{r:parseInt(r.slice(0,2),16),g:parseInt(r.slice(2,4),16),b:parseInt(r.slice(4,6),16)}:null}function h(e){const o=e/255;return o<=.03928?o/12.92:((o+.055)/1.055)**2.4}function u(e){return.2126*h(e.r)+.7152*h(e.g)+.0722*h(e.b)}function m({label:e,value:o,onChange:n,onReset:l,resetText:s}){return(0,i.jsxs)("div",{style:{marginBottom:16},children:[(0,i.jsx)("div",{style:{marginBottom:8},children:e}),(0,i.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center"},children:[(0,i.jsx)(t.Dropdown,{popoverProps:{placement:"left-start"},renderToggle:({isOpen:e,onToggle:n})=>(0,i.jsxs)(t.Button,{variant:"secondary",onClick:n,"aria-expanded":e,style:{flex:1,display:"flex",justifyContent:"space-between",alignItems:"center"},children:[(0,i.jsx)("span",{children:o||(0,r.__)("Select color","hero-color-picker")}),(0,i.jsx)("span",{"aria-hidden":!0,style:{display:"inline-block",marginLeft:8,width:14,height:14,borderRadius:2,border:"1px solid #ccc",backgroundColor:o||"transparent"}})]}),renderContent:()=>(0,i.jsx)("div",{style:{padding:8},children:(0,i.jsx)(t.ColorPicker,{color:o||"#111111",enableAlpha:!1,onChange:n})})}),(0,i.jsx)(t.Button,{variant:"secondary",isDestructive:!0,onClick:l,disabled:!o,children:s})]})]})}(0,e.registerPlugin)("hero-color-picker",{render:function(){const{meta:e,postType:h}=(0,n.useSelect)(e=>{const o=e("core/editor");return{meta:o.getEditedPostAttribute("meta")||{},postType:o.getCurrentPostType()}},[]),{editPost:g}=(0,n.useDispatch)("core/editor"),x=e[l]||"",y=e[s]||"",f=function(e,o){const r=p(e),t=p(o);if(!r||!t)return null;const n=u(r),i=u(t);return(Math.max(n,i)+.05)/(Math.min(n,i)+.05)}(y,x),_=Boolean(x&&y),k=_&&null!==f&&f>=7;let w=(0,r.__)("Not applicable","hero-color-picker"),j="info";return _&&(k?(w=(0,r.__)("PASS","hero-color-picker"),j="success"):(w=(0,r.__)("FAILED","hero-color-picker"),j="error")),c(()=>{if("post"!==h)return a("",""),void d("");a(x,y),d(x)},[x,y,h]),c(()=>()=>{a("",""),d("")},[]),"post"!==h?null:(0,i.jsx)(o.PluginDocumentSettingPanel,{name:"hero-color-picker",title:(0,r.__)("Hero Color Picker","hero-color-picker"),className:"hero-color",children:(0,i.jsx)(t.PanelRow,{children:(0,i.jsxs)("div",{style:{width:"100%"},children:[(0,i.jsx)(m,{label:(0,r.__)("Background Color","hero-color-picker"),value:x,onChange:o=>{g({meta:{...e,[l]:o}})},onReset:()=>{g({meta:{...e,[l]:""}})},resetText:(0,r.__)("Unset","hero-color-picker")}),(0,i.jsx)(m,{label:(0,r.__)("Font Color","hero-color-picker"),value:y,onChange:o=>{g({meta:{...e,[s]:o}})},onReset:()=>{g({meta:{...e,[s]:""}})},resetText:(0,r.__)("Unset","hero-color-picker")}),(0,i.jsxs)("div",{style:{padding:10,borderRadius:4,border:"1px solid #dcdcde",backgroundColor:x||"#f0f0f1",color:y||"#1e1e1e",marginBottom:10},children:[(0,i.jsx)("strong",{children:(0,r.__)("Preview","hero-color-picker")}),(0,i.jsx)("p",{style:{margin:"6px 0 0"},children:(0,r.__)("This is how the background and font colors look together.","hero-color-picker")})]}),(0,i.jsxs)(t.BaseControl,{id:"hero-color-picker-contrast-check",label:(0,r.__)("Contrast Check","hero-color-picker"),children:[(0,i.jsx)(t.Notice,{status:j,isDismissible:!1,style:{margin:"6px 0 0"},children:(0,i.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",alignItems:"baseline",gap:8,width:"100%"},children:[(0,i.jsx)("strong",{children:w}),null!==f?(0,i.jsx)("span",{children:"("+f.toFixed(2)+":1)"}):null]})}),(0,i.jsx)("p",{style:{margin:"10px 0 0",color:"#50575e"},children:(0,r.__)("WCAG AAA, normal text, minimum ratio 7:1.","hero-color-picker")})]}),(0,i.jsx)(t.Notice,{status:"info",isDismissible:!1,style:{margin:"12px 0 0"},children:(0,i.jsx)("p",{style:{margin:0},children:(0,i.jsx)(t.ExternalLink,{href:"https://wordpress.org/plugins/hero-color-picker/#how%20do%20i%20add%20the%20%60hero-colored%60%20css%20class%20in%20templates%3F",children:(0,r.__)("Colors not showing on frontend? Read the FAQ.","hero-color-picker")})})})]})})})}})})();
  • hero-color-picker/trunk/hero-color-picker.php

    r3480595 r3482557  
    44 * Plugin URI:    https://github.com/mtoensing/hero-color-picker
    55 * Description:   Adds per-post color selection in the editor sidebar for hero styling via CSS.
    6  * Version:       1.0.15
     6 * Version:       1.0.16
    77 * Author:        Marc Tönsing
    88 * Author URI:    https://toensing.com
    99 * Text Domain:   hero-color-picker
     10 * Domain Path:   /languages
    1011 * License: GPL   v2 or later
    1112 * License URI:   http://www.gnu.org/licenses/gpl-2.0.html
     
    2122const HERO_COLOR_PICKER_FONT_META_KEY = 'hero_color_picker_font_color';
    2223const HERO_COLOR_PICKER_HAS_BG_QUERY_VAR = 'hero_color_picker_has_bg';
     24
     25/**
     26 * Register the plugin language path for local files and WordPress.org language packs.
     27 */
     28add_action(
     29    'init',
     30    function () {
     31        load_plugin_textdomain(
     32            'hero-color-picker',
     33            false,
     34            dirname( plugin_basename( __FILE__ ) ) . '/languages'
     35        );
     36    }
     37);
    2338
    2439/**
     
    157172            true
    158173        );
     174
     175        wp_set_script_translations(
     176            'hero-color-picker-editor',
     177            'hero-color-picker'
     178        );
    159179    }
    160180);
  • hero-color-picker/trunk/readme.txt

    r3480595 r3482557  
    44Requires at least: 5.9
    55Tested up to: 6.9
    6 Stable tag: 1.0.15
     6Stable tag: 1.0.16
    77Requires PHP: 7.3
    88License: GPLv2 or later
     
    6666== Changelog ==
    6767
     68= 1.0.16 =
     69* Fixed loading of WordPress.org language packs for editor JavaScript strings.
     70* Marked the editor panel title as translatable.
     71
    6872= 1.0.15 =
    6973* Corrected and refined wording in the readme and editor preview text.
Note: See TracChangeset for help on using the changeset viewer.