Changeset 3669127
- Timestamp:
- 08/27/2026 03:07:29 PM (2 months ago)
- Location:
- world-clocks/trunk
- Files:
-
- 14 edited
-
composer.json (modified) (1 diff)
-
dist/clock-block.asset.php (modified) (1 diff)
-
dist/clock-block.js (modified) (1 diff)
-
dist/clocks-block.asset.php (modified) (1 diff)
-
dist/clocks-block.js (modified) (1 diff)
-
includes/blocks/clock/edit.js (modified) (2 diffs)
-
includes/blocks/clock/markup.php (modified) (2 diffs)
-
includes/blocks/clock/timezone-selector.js (modified) (10 diffs)
-
includes/blocks/clocks/block.json (modified) (1 diff)
-
includes/blocks/clocks/markup.php (modified) (1 diff)
-
includes/helpers.php (modified) (7 diffs)
-
languages/world-clocks.pot (modified) (7 diffs)
-
readme.txt (modified) (2 diffs)
-
world-clocks.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
world-clocks/trunk/composer.json
r3137248 r3669127 18 18 }, 19 19 "require-dev": { 20 "10up/phpcs-composer": " dev-master"20 "10up/phpcs-composer": "^3.0" 21 21 }, 22 22 "scripts": { -
world-clocks/trunk/dist/clock-block.asset.php
r3469508 r3669127 1 <?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-date', 'wp-element', 'wp-i18n', 'wp-keycodes'), 'version' => ' 43e1c742f0ce585ee652');1 <?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-date', 'wp-element', 'wp-i18n', 'wp-keycodes'), 'version' => '98278e49c295a8408211'); -
world-clocks/trunk/dist/clock-block.js
r3469508 r3669127 1 (()=>{"use strict";var e,s={ 49(){const e=window.wp.blocks;function s(e){var l,t,c="";if("string"==typeof e||"number"==typeof e)c+=e;else if("object"==typeof e)if(Array.isArray(e)){var a=e.length;for(l=0;l<a;l++)e[l]&&(t=s(e[l]))&&(c&&(c+=" "),c+=t)}else for(t in e)e[t]&&(c&&(c+=" "),c+=t);return c}const l=function(){for(var e,l,t=0,c="",a=arguments.length;t<a;t++)(e=arguments[t])&&(l=s(e))&&(c&&(c+=" "),c+=l);return c},t=window.wp.blockEditor,c=window.wp.element,a=window.wp.components,o=window.wp.i18n,n=window.wp.keycodes,r=window.ReactJSXRuntime,i=e=>{const{attributes:s,setAttributes:l}=e,{timezone:t,clockLabel:i}=s,{timezones:d}=SPWPCLOCK,m=d.filter(e=>e?.disabled),u=e=>{const s=d.filter(s=>!s?.disabled&&s.value.toLowerCase().includes(e.toLowerCase())),l=[],t=[];return s.forEach(e=>{let s="UTC";if(e.value.includes("/")){const l=e.value.split("/");s=l[0]}else(e.value.includes(`${s}-`)||e.value.includes(`${s}+`))&&(s="Manual Offsets");if(!t.includes(s)){const e=m.filter(e=>e.label===s);l.push(e[0]),t.push(s)}l.push(e)}),l},k=t||"UTC",h=t?u(t):d,[p,w]=(0,c.useState)(1),[x,g]=(0,c.useState)(h),[b,j]=(0,c.useState)(!1),[v,f]=(0,c.useState)(k),N=e=>{e.target.closest(".single-clock-timezone-selector")||(j(!1),f(k))};(0,c.useEffect)(()=>(document.addEventListener("click",N),()=>{document.removeEventListener("click",N)}));const S=()=>{j(!0)},y=e=>{if(e.target.attributes?.disabled)return;const s=e.target.dataset.timezoneValue,c=u(s);t!==s&&l({clockLabel:s}),l({timezone:s}),w(1),g(c),f(s),j(!1)};let C;return b&&(C=x.length?(0,r.jsx)("ul",{className:"timezone-suggestions",children:x.map((e,s)=>{let l="timezone";s===p&&(l+=" timezone-active"),e.value===k&&(l+=" timezone-selected"),e?.disabled&&(l+=" timezone-disabled");let t=e.label;return e.value===k&&(t+=` ${(0,o.__)("(Selected)","world-clocks")}`),(0,r.jsx)("li",{className:l,"data-timezone-value":e.value,onClick:y,disabled:e?.disabled,children:t},e.value)})}):(0,r.jsx)("div",{className:"no-suggestions",children:(0,r.jsx)("em",{children:(0,o.__)("Please select a valid timezone from the available list.")})})),(0,r.jsxs)(a.PanelBody,{title:(0,o.__)("Timezone Settings","world-clocks"),className:"single-clock-timezone-setting",children:[(0,r.jsx)(a.TextControl,{className:"single-clock-timezone-selector",label:(0,o.__)("Select Timezone","world-clocks"),value:v,onChange:e=>{if(e){const s=u(e);g(s)}else g(d);w(1),f(e),j(!0)},onKeyDown:e=>{const{keyCode:s}=e;if(s===n.ENTER){if(x[p]?.disabled)return;const e=u(x[p].value);t!==x[p].value&&l({clockLabel:x[p].value}),l({timezone:x[p].value}),w(1),j(!1),f(x[p].value),g(e)}else if(s===n.UP){if(p<=1)return;w(p-1),void 0!==x[p-1]&&x[p-1]?.disabled&&w(p-2)}else if(s===n.DOWN){if(p+1===x.length)return;void 0!==x[p+1]&&x[p+1]?.disabled?w(p+2):w(p+1)}else s===n.ESCAPE&&(j(!1),f(k))},onFocus:S,onClick:S,help:(0,o.__)("Click on the textbox and start typing to find the suitable timezone. You can remove existing selected timezone and search more.","world-clocks")}),(0,r.jsx)(a.TextControl,{className:"single-clock-timezone-label",label:(0,o.__)("Timezone Label","world-clocks"),value:i,onChange:e=>{l({clockLabel:e})},help:(0,o.__)("Override default timezone label.","world-clocks")}),C]})},d=window.wp.date,m=(e,s,l=!1,t="Y-m-d")=>{const c=(0,d.getSettings)();let a={string:e};l&&(a={offset:e});const o={...c,timezone:a};(0,d.setSettings)(o);const n=(0,d.date)(t,void 0,e),r=(0,d.date)(s,void 0,e),i=(0,d.date)("h:i:s A",void 0,e),m=new Date(`${n} ${i}`),u=m.getHours(),k=m.getMinutes(),h=m.getSeconds(),p=u>=12?"pm":"am";return(0,d.setSettings)(c),{timeString:r,dateString:n,hours:u,minutes:k,seconds:h,ampm:p}},u=({timezone:e,clockLabel:s,context:t})=>{const a=["digital-column","digital-row"].includes(t["world-clocks/layout"])||t["world-clocks/showDigitalTime"],o="clock"===t["world-clocks/layout"],n="clock-reverse"===t["world-clocks/layout"];let i=e,d=!1;(e.toUpperCase().includes("UTC-")||e.toUpperCase().includes("UTC+"))&&(i=e.replace("UTC",""),d=!0);const{timeString:u,dateString:k,hours:h,minutes:p,seconds:w,ampm:x}=m(i,t["world-clocks/timeFormat"],d,t["world-clocks/dateFormat"]),[g,b]=(0,c.useState)(u),[j,v]=(0,c.useState)(k),[f,N]=(0,c.useState)(h),[S,y]=(0,c.useState)(p),[C,z]=(0,c.useState)(w),[_,F]=(0,c.useState)(x),T=()=>{const{timeString:e,dateString:s,hours:l,minutes:c,seconds:a,ampm:o}=m(i,t["world-clocks/timeFormat"],d,t["world-clocks/dateFormat"]);b(e),v(s),N(l),y(c),z(a),F(o)};(0,c.useEffect)(()=>{const e=setInterval(T);return()=>{clearInterval(e)}});const O=l({[`${_}`]:t["world-clocks/showClocksAmPmIndicator"]}),L="line"===t["world-clocks/marksFormat"],D="combine"===t["world-clocks/marksFormat"],$=l({[`${t["world-clocks/marksFormat"]}`]:t["world-clocks/marksFormat"]});return(0,r.jsxs)(r.Fragment,{children:[(o||n)&&(0,r.jsxs)(r.Fragment,{children:[n&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"clock-label",children:s}),(a||t["world-clocks/showDate"])&&(0,r.jsxs)("p",{className:"clock-datetime",children:[a&&(0,r.jsx)("span",{className:"digital-clock",children:g}),t["world-clocks/showDate"]&&(0,r.jsx)("span",{className:"clock-date",children:j})]})]}),(0,r.jsxs)("div",{className:"analog-clock",children:[(0,r.jsxs)("div",{className:`indicator ${O}`,children:[(0,r.jsx)("span",{className:"hand hour",style:{transform:`rotate(${30*f+.5*S}deg)`}}),(0,r.jsx)("span",{className:"hand minute",style:{transform:`rotate(${6*S+.1*C}deg)`}}),(0,r.jsx)("span",{className:"hand second",style:{transform:`rotate(${6*C}deg)`}})]}),(0,r.jsx)("span",{className:"number-indicator one",children:(0,r.jsx)("span",{className:$,children:L||D?"|":"1"})}),(0,r.jsx)("span",{className:"number-indicator two",children:(0,r.jsx)("span",{className:$,children:L||D?"|":"2"})}),(0,r.jsx)("span",{className:"number-indicator three",children:(0,r.jsx)("span",{className:$,children:L?"|":"3"})}),(0,r.jsx)("span",{className:"number-indicator four",children:(0,r.jsx)("span",{className:$,children:L||D?"|":"4"})}),(0,r.jsx)("span",{className:"number-indicator five",children:(0,r.jsx)("span",{className:$,children:L||D?"|":"5"})}),(0,r.jsx)("span",{className:"number-indicator six",children:(0,r.jsx)("span",{className:$,children:L?"|":"6"})}),(0,r.jsx)("span",{className:"number-indicator seven",children:(0,r.jsx)("span",{className:$,children:L||D?"|":"7"})}),(0,r.jsx)("span",{className:"number-indicator eight",children:(0,r.jsx)("span",{className:$,children:L||D?"|":"8"})}),(0,r.jsx)("span",{className:"number-indicator nine",children:(0,r.jsx)("span",{className:$,children:L?"|":"9"})}),(0,r.jsx)("span",{className:"number-indicator ten",children:(0,r.jsx)("span",{className:$,children:L||D?"|":"10"})}),(0,r.jsx)("span",{className:"number-indicator eleven",children:(0,r.jsx)("span",{className:$,children:L||D?"|":"11"})}),(0,r.jsx)("span",{className:"number-indicator twelve",children:(0,r.jsx)("span",{className:$,children:L?"|":"12"})})]}),o&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"clock-label",children:s}),(a||t["world-clocks/showDate"])&&(0,r.jsxs)("p",{className:"clock-datetime",children:[a&&(0,r.jsx)("span",{className:"digital-clock",children:g}),t["world-clocks/showDate"]&&(0,r.jsx)("span",{className:"clock-date",children:j})]})]})]}),a&&!o&&!n&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("p",{className:"clock-datetime",children:[(0,r.jsx)("span",{className:"digital-clock",children:g}),t["world-clocks/showDate"]&&(0,r.jsx)("span",{className:"clock-date",children:j})]}),(0,r.jsx)("p",{className:"clock-label",children:s})]})]})},k=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"world-clocks/clock","title":"Single clock","category":"widgets","icon":"clock","description":"Display single clock inside World Clocks block","parent":["world-clocks/clocks"],"attributes":{"timezone":{"type":"string","default":"UTC"},"clockLabel":{"type":"string","default":"UTC"}},"supports":{"html":false,"color":{"text":true,"background":true}},"usesContext":["world-clocks/showClocksAmPmIndicator","world-clocks/showDigitalTime","world-clocks/timeFormat","world-clocks/showDate","world-clocks/dateFormat","world-clocks/layout","world-clocks/marksFormat"],"textdomain":"world-clocks","editorScript":"file:../../../dist/clock-block.js","editorStyle":"file:../../../dist/clock-block.css","style":"file:../../../dist/style-clock-block.css"}');(0,e.registerBlockType)(k,{edit:e=>{const{attributes:s,context:l}=e,{timezone:c,clockLabel:a}=s,o=c.replace(" ","_"),n=(0,t.useBlockProps)();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.InspectorControls,{children:(0,r.jsx)(i,{...e})}),(0,r.jsx)("div",{...n,children:(0,r.jsx)(u,{timezone:o,clockLabel:a,context:l})})]})},save:()=>null})}},l={};function t(e){var c=l[e];if(void 0!==c)return c.exports;var a=l[e]={exports:{}};return s[e](a,a.exports,t),a.exports}t.m=s,e=[],t.O=(s,l,c,a)=>{if(!l){var o=1/0;for(d=0;d<e.length;d++){for(var[l,c,a]=e[d],n=!0,r=0;r<l.length;r++)(!1&a||o>=a)&&Object.keys(t.O).every(e=>t.O[e](l[r]))?l.splice(r--,1):(n=!1,a<o&&(o=a));if(n){e.splice(d--,1);var i=c();void 0!==i&&(s=i)}}return s}a=a||0;for(var d=e.length;d>0&&e[d-1][2]>a;d--)e[d]=e[d-1];e[d]=[l,c,a]},t.o=(e,s)=>Object.prototype.hasOwnProperty.call(e,s),(()=>{var e={683:0,632:0};t.O.j=s=>0===e[s];var s=(s,l)=>{var c,a,[o,n,r]=l,i=0;if(o.some(s=>0!==e[s])){for(c in n)t.o(n,c)&&(t.m[c]=n[c]);if(r)var d=r(t)}for(s&&s(l);i<o.length;i++)a=o[i],t.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return t.O(d)},l=globalThis.webpackChunk_sanketio_world_clocks=globalThis.webpackChunk_sanketio_world_clocks||[];l.forEach(s.bind(null,0)),l.push=s.bind(null,l.push.bind(l))})();var c=t.O(void 0,[632],()=>t(49));c=t.O(c)})();1 (()=>{"use strict";var e,s={761(){const e=window.wp.blocks;function s(e){var l,t,a="";if("string"==typeof e||"number"==typeof e)a+=e;else if("object"==typeof e)if(Array.isArray(e)){var c=e.length;for(l=0;l<c;l++)e[l]&&(t=s(e[l]))&&(a&&(a+=" "),a+=t)}else for(t in e)e[t]&&(a&&(a+=" "),a+=t);return a}const l=function(){for(var e,l,t=0,a="",c=arguments.length;t<c;t++)(e=arguments[t])&&(l=s(e))&&(a&&(a+=" "),a+=l);return a},t=window.wp.blockEditor,a=window.wp.element,c=window.wp.components,o=window.wp.i18n,n=window.wp.keycodes,i=e=>{if(!e)return"UTC";if(e.toUpperCase().startsWith("UTC"))return e;const s=SPWPCLOCK.timezones.filter(e=>!e?.disabled);if(s.some(s=>s.value===e))return e;const l=s.find(s=>s.display===e);return l?l.value:e.replace(/ /g,"_")},r=window.ReactJSXRuntime,d=e=>{const{attributes:s,setAttributes:l}=e,{timezone:t,clockLabel:d}=s,{timezones:m}=SPWPCLOCK,u=m.filter(e=>e?.disabled),p=e=>{const s=m.filter(s=>!s?.disabled&&s.display.toLowerCase().includes(e.toLowerCase())),l=[],t=[];return s.forEach(e=>{let s="UTC";if(e.display.includes("/")){const l=e.display.split("/");s=l[0]}else(e.display.includes(`${s}-`)||e.display.includes(`${s}+`))&&(s="Manual Offsets");if(!t.includes(s)){const e=u.filter(e=>e.label===s);l.push(e[0]),t.push(s)}l.push(e)}),l},h=i(t),k=(e=>{const s=SPWPCLOCK.timezones.find(s=>s.value===e);return s?.display||e})(h),w=t?p(k):m,[x,g]=(0,a.useState)(1),[b,f]=(0,a.useState)(w),[j,v]=(0,a.useState)(!1),[N,y]=(0,a.useState)(k),C=e=>{e.target.closest(".single-clock-timezone-selector")||(v(!1),y(k))};(0,a.useEffect)(()=>(document.addEventListener("click",C),()=>{document.removeEventListener("click",C)}));const S=()=>{v(!0)},z=e=>{if(e.target.attributes?.disabled)return;const s=e.target.dataset.timezoneValue,t=e.target.dataset.timezoneDisplay,a=p(t);h!==s&&l({clockLabel:t}),l({timezone:s}),g(1),f(a),y(t),v(!1)};let _;return j&&(_=b.length?(0,r.jsx)("ul",{className:"timezone-suggestions",children:b.map((e,s)=>{let l="timezone";s===x&&(l+=" timezone-active"),e.value===h&&(l+=" timezone-selected"),e?.disabled&&(l+=" timezone-disabled");let t=e.label;return e.value===h&&(t+=` ${(0,o.__)("(Selected)","world-clocks")}`),(0,r.jsx)("li",{className:l,"data-timezone-value":e.value,"data-timezone-display":e.display,onClick:z,disabled:e?.disabled,children:t},e.value)})}):(0,r.jsx)("div",{className:"no-suggestions",children:(0,r.jsx)("em",{children:(0,o.__)("Please select a valid timezone from the available list.")})})),(0,r.jsxs)(c.PanelBody,{title:(0,o.__)("Timezone Settings","world-clocks"),className:"single-clock-timezone-setting",children:[(0,r.jsx)(c.TextControl,{className:"single-clock-timezone-selector",label:(0,o.__)("Select Timezone","world-clocks"),value:N,onChange:e=>{if(e){const s=p(e);f(s)}else f(m);g(1),y(e),v(!0)},onKeyDown:e=>{const{keyCode:s}=e;if(s===n.ENTER){if(b[x]?.disabled)return;const e=b[x],s=p(e.display);h!==e.value&&l({clockLabel:e.display}),l({timezone:e.value}),g(1),v(!1),y(e.display),f(s)}else if(s===n.UP){if(x<=1)return;g(x-1),void 0!==b[x-1]&&b[x-1]?.disabled&&g(x-2)}else if(s===n.DOWN){if(x+1===b.length)return;void 0!==b[x+1]&&b[x+1]?.disabled?g(x+2):g(x+1)}else s===n.ESCAPE&&(v(!1),y(k))},onFocus:S,onClick:S,help:(0,o.__)("Click on the textbox and start typing to find the suitable timezone. You can remove existing selected timezone and search more.","world-clocks")}),(0,r.jsx)(c.TextControl,{className:"single-clock-timezone-label",label:(0,o.__)("Timezone Label","world-clocks"),value:d,onChange:e=>{l({clockLabel:e})},help:(0,o.__)("Override default timezone label.","world-clocks")}),_]})},m=window.wp.date,u=(e,s,l=!1,t="Y-m-d")=>{const a=(0,m.getSettings)();let c={string:e};l&&(c={offset:e});const o={...a,timezone:c};(0,m.setSettings)(o);const n=(0,m.date)(t,void 0,e),i=(0,m.date)(s,void 0,e),r=(0,m.date)("h:i:s A",void 0,e),d=new Date(`${n} ${r}`),u=d.getHours(),p=d.getMinutes(),h=d.getSeconds(),k=u>=12?"pm":"am";return(0,m.setSettings)(a),{timeString:i,dateString:n,hours:u,minutes:p,seconds:h,ampm:k}},p=({timezone:e,clockLabel:s,context:t})=>{const c=["digital-column","digital-row"].includes(t["world-clocks/layout"])||t["world-clocks/showDigitalTime"],o="clock"===t["world-clocks/layout"],n="clock-reverse"===t["world-clocks/layout"];let i=e,d=!1;(e.toUpperCase().includes("UTC-")||e.toUpperCase().includes("UTC+"))&&(i=e.replace("UTC",""),d=!0);const{timeString:m,dateString:p,hours:h,minutes:k,seconds:w,ampm:x}=u(i,t["world-clocks/timeFormat"],d,t["world-clocks/dateFormat"]),[g,b]=(0,a.useState)(m),[f,j]=(0,a.useState)(p),[v,N]=(0,a.useState)(h),[y,C]=(0,a.useState)(k),[S,z]=(0,a.useState)(w),[_,T]=(0,a.useState)(x),F=()=>{const{timeString:e,dateString:s,hours:l,minutes:a,seconds:c,ampm:o}=u(i,t["world-clocks/timeFormat"],d,t["world-clocks/dateFormat"]);b(e),j(s),N(l),C(a),z(c),T(o)};(0,a.useEffect)(()=>{const e=setInterval(F);return()=>{clearInterval(e)}});const O=l({[`${_}`]:t["world-clocks/showClocksAmPmIndicator"]}),L="line"===t["world-clocks/marksFormat"],P="combine"===t["world-clocks/marksFormat"],D=l({[`${t["world-clocks/marksFormat"]}`]:t["world-clocks/marksFormat"]});return(0,r.jsxs)(r.Fragment,{children:[(o||n)&&(0,r.jsxs)(r.Fragment,{children:[n&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"clock-label",children:s}),(c||t["world-clocks/showDate"])&&(0,r.jsxs)("p",{className:"clock-datetime",children:[c&&(0,r.jsx)("span",{className:"digital-clock",children:g}),t["world-clocks/showDate"]&&(0,r.jsx)("span",{className:"clock-date",children:f})]})]}),(0,r.jsxs)("div",{className:"analog-clock",children:[(0,r.jsxs)("div",{className:`indicator ${O}`,children:[(0,r.jsx)("span",{className:"hand hour",style:{transform:`rotate(${30*v+.5*y}deg)`}}),(0,r.jsx)("span",{className:"hand minute",style:{transform:`rotate(${6*y+.1*S}deg)`}}),(0,r.jsx)("span",{className:"hand second",style:{transform:`rotate(${6*S}deg)`}})]}),(0,r.jsx)("span",{className:"number-indicator one",children:(0,r.jsx)("span",{className:D,children:L||P?"|":"1"})}),(0,r.jsx)("span",{className:"number-indicator two",children:(0,r.jsx)("span",{className:D,children:L||P?"|":"2"})}),(0,r.jsx)("span",{className:"number-indicator three",children:(0,r.jsx)("span",{className:D,children:L?"|":"3"})}),(0,r.jsx)("span",{className:"number-indicator four",children:(0,r.jsx)("span",{className:D,children:L||P?"|":"4"})}),(0,r.jsx)("span",{className:"number-indicator five",children:(0,r.jsx)("span",{className:D,children:L||P?"|":"5"})}),(0,r.jsx)("span",{className:"number-indicator six",children:(0,r.jsx)("span",{className:D,children:L?"|":"6"})}),(0,r.jsx)("span",{className:"number-indicator seven",children:(0,r.jsx)("span",{className:D,children:L||P?"|":"7"})}),(0,r.jsx)("span",{className:"number-indicator eight",children:(0,r.jsx)("span",{className:D,children:L||P?"|":"8"})}),(0,r.jsx)("span",{className:"number-indicator nine",children:(0,r.jsx)("span",{className:D,children:L?"|":"9"})}),(0,r.jsx)("span",{className:"number-indicator ten",children:(0,r.jsx)("span",{className:D,children:L||P?"|":"10"})}),(0,r.jsx)("span",{className:"number-indicator eleven",children:(0,r.jsx)("span",{className:D,children:L||P?"|":"11"})}),(0,r.jsx)("span",{className:"number-indicator twelve",children:(0,r.jsx)("span",{className:D,children:L?"|":"12"})})]}),o&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("p",{className:"clock-label",children:s}),(c||t["world-clocks/showDate"])&&(0,r.jsxs)("p",{className:"clock-datetime",children:[c&&(0,r.jsx)("span",{className:"digital-clock",children:g}),t["world-clocks/showDate"]&&(0,r.jsx)("span",{className:"clock-date",children:f})]})]})]}),c&&!o&&!n&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("p",{className:"clock-datetime",children:[(0,r.jsx)("span",{className:"digital-clock",children:g}),t["world-clocks/showDate"]&&(0,r.jsx)("span",{className:"clock-date",children:f})]}),(0,r.jsx)("p",{className:"clock-label",children:s})]})]})},h=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"world-clocks/clock","title":"Single clock","category":"widgets","icon":"clock","description":"Display single clock inside World Clocks block","parent":["world-clocks/clocks"],"attributes":{"timezone":{"type":"string","default":"UTC"},"clockLabel":{"type":"string","default":"UTC"}},"supports":{"html":false,"color":{"text":true,"background":true}},"usesContext":["world-clocks/showClocksAmPmIndicator","world-clocks/showDigitalTime","world-clocks/timeFormat","world-clocks/showDate","world-clocks/dateFormat","world-clocks/layout","world-clocks/marksFormat"],"textdomain":"world-clocks","editorScript":"file:../../../dist/clock-block.js","editorStyle":"file:../../../dist/clock-block.css","style":"file:../../../dist/style-clock-block.css"}');(0,e.registerBlockType)(h,{edit:e=>{const{attributes:s,context:l}=e,{timezone:a,clockLabel:c}=s,o=i(a),n=(0,t.useBlockProps)();return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.InspectorControls,{children:(0,r.jsx)(d,{...e})}),(0,r.jsx)("div",{...n,children:(0,r.jsx)(p,{timezone:o,clockLabel:c,context:l})})]})},save:()=>null})}},l={};function t(e){var a=l[e];if(void 0!==a)return a.exports;var c=l[e]={exports:{}};return s[e](c,c.exports,t),c.exports}t.m=s,e=[],t.O=(s,l,a,c)=>{if(!l){var o=1/0;for(d=0;d<e.length;d++){for(var[l,a,c]=e[d],n=!0,i=0;i<l.length;i++)(!1&c||o>=c)&&Object.keys(t.O).every(e=>t.O[e](l[i]))?l.splice(i--,1):(n=!1,c<o&&(o=c));if(n){e.splice(d--,1);var r=a();void 0!==r&&(s=r)}}return s}c=c||0;for(var d=e.length;d>0&&e[d-1][2]>c;d--)e[d]=e[d-1];e[d]=[l,a,c]},t.o=(e,s)=>Object.prototype.hasOwnProperty.call(e,s),(()=>{var e={683:0,632:0};t.O.j=s=>0===e[s];var s=(s,l)=>{var a,c,[o,n,i]=l,r=0;if(o.some(s=>0!==e[s])){for(a in n)t.o(n,a)&&(t.m[a]=n[a]);if(i)var d=i(t)}for(s&&s(l);r<o.length;r++)c=o[r],t.o(e,c)&&e[c]&&e[c][0](),e[c]=0;return t.O(d)},l=globalThis.webpackChunk_sanketio_world_clocks=globalThis.webpackChunk_sanketio_world_clocks||[];l.forEach(s.bind(null,0)),l.push=s.bind(null,l.push.bind(l))})();var a=t.O(void 0,[632],()=>t(761));a=t.O(a)})(); -
world-clocks/trunk/dist/clocks-block.asset.php
r3469508 r3669127 1 <?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => ' 13121290b3b7775e3730');1 <?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '354ec64c0559c9fd062b'); -
world-clocks/trunk/dist/clocks-block.js
r3469508 r3669127 1 (()=>{"use strict";var o,t={912(){const o=window.wp.blocks,t=window.wp.components,e=window.ReactJSXRuntime,s=window.wp.i18n,l=()=>(0,e.jsxs)(t.SVG,{width:"58",height:"19",viewBox:"0 0 58 19",xmlns:"http://www.w3.org/2000/svg",children:[(0,e.jsx)(t.Path,{d:"M7.5 16h10s1.5 0 1.5 1.5v0s0 1.5 -1.5 1.5h-10s-1.5 0 -1.5 -1.5v0s0 -1.5 1.5 -1.5"}),(0,e.jsx)(t.Path,{d:"M40.5 16h10s1.5 0 1.5 1.5v0s0 1.5 -1.5 1.5h-10s-1.5 0 -1.5 -1.5v0s0 -1.5 1.5 -1.5"}),(0,e.jsx)(t.Path,{d:"M6 0h13s6 0 6 6v0s0 6 -6 6h-13s-6 0 -6 -6v0s0 -6 6 -6"}),(0,e.jsx)(t.Path,{d:"M39 0h13s6 0 6 6v0s0 6 -6 6h-13s-6 0 -6 -6v0s0 -6 6 -6"})]}),r=()=>(0,e.jsxs)(t.SVG,{width:"60",height:"31",viewBox:"0 0 60 31",xmlns:"http://www.w3.org/2000/svg",children:[(0,e.jsx)(t.Path,{d:"M46.5 0h10s2.5 0 2.5 2.5v0s0 2.5 -2.5 2.5h-10s-2.5 0 -2.5 -2.5v0s0 -2.5 2.5 -2.5"}),(0,e.jsx)(t.Path,{d:"M46.5 13h10s2.5 0 2.5 2.5v0s0 2.5 -2.5 2.5h-10s-2.5 0 -2.5 -2.5v0s0 -2.5 2.5 -2.5"}),(0,e.jsx)(t.Path,{d:"M46.5 26h10s2.5 0 2.5 2.5v0s0 2.5 -2.5 2.5h-10s-2.5 0 -2.5 -2.5v0s0 -2.5 2.5 -2.5"}),(0,e.jsx)(t.Path,{d:"M3.5 0h30s2.5 0 2.5 2.5v0s0 2.5 -2.5 2.5h-30s-2.5 0 -2.5 -2.5v0s0 -2.5 2.5 -2.5"}),(0,e.jsx)(t.Path,{d:"M3.5 13h30s2.5 0 2.5 2.5v0s0 2.5 -2.5 2.5h-30s-2.5 0 -2.5 -2.5v0s0 -2.5 2.5 -2.5"}),(0,e.jsx)(t.Path,{d:"M3.5 26h30s2.5 0 2.5 2.5v0s0 2.5 -2.5 2.5h-30s-2.5 0 -2.5 -2.5v0s0 -2.5 2.5 -2.5"}),(0,e.jsx)(t.Path,{d:"M1 9H59",stroke:"#1e1e1e","stroke-linecap":"round"}),(0,e.jsx)(t.Path,{d:"M1 22H59",stroke:"#1e1e1e","stroke-linecap":"round"})]}),a=()=>(0,e.jsxs)(t.SVG,{width:"58",height:"38",viewBox:"0 0 58 38",xmlns:"http://www.w3.org/2000/svg",children:[(0,e.jsx)(t.Path,{d:"M0 12.5a12.5 12.5 0 1 0 25 0a12.5 12.5 0 1 0 -25 0"}),(0,e.jsx)(t.Path,{d:"M33 12.5a12.5 12.5 0 1 0 25 0a12.5 12.5 0 1 0 -25 0"}),(0,e.jsx)(t.Path,{d:"M8 29h9s1 0 1 1v0s0 1 -1 1h-9s-1 0 -1 -1v0s0 -1 1 -1"}),(0,e.jsx)(t.Path,{d:"M41 29h9s1 0 1 1v0s0 1 -1 1h-9s-1 0 -1 -1v0s0 -1 1 -1"}),(0,e.jsx)(t.Path,{d:"M7.5 33h10s2.5 0 2.5 2.5v0s0 2.5 -2.5 2.5h-10s-2.5 0 -2.5 -2.5v0s0 -2.5 2.5 -2.5"}),(0,e.jsx)(t.Path,{d:"M40.5 33h10s2.5 0 2.5 2.5v0s0 2.5 -2.5 2.5h-10s-2.5 0 -2.5 -2.5v0s0 -2.5 2.5 -2.5"})]}),c=()=>(0,e.jsxs)(t.SVG,{width:"58",height:"38",viewBox:"0 0 58 38",xmlns:"http://www.w3.org/2000/svg",children:[(0,e.jsx)(t.Path,{d:"M0 25.5a12.5 12.5 0 1 0 25 0a12.5 12.5 0 1 0 -25 0"}),(0,e.jsx)(t.Path,{d:"M33 25.5a12.5 12.5 0 1 0 25 0a12.5 12.5 0 1 0 -25 0"}),(0,e.jsx)(t.Path,{d:"M8 0h9s1 0 1 1v0s0 1 -1 1h-9s-1 0 -1 -1v0s0 -1 1 -1"}),(0,e.jsx)(t.Path,{d:"M41 0h9s1 0 1 1v0s0 1 -1 1h-9s-1 0 -1 -1v0s0 -1 1 -1"}),(0,e.jsx)(t.Path,{d:"M7.5 4h10s2.5 0 2.5 2.5v0s0 2.5 -2.5 2.5h-10s-2.5 0 -2.5 -2.5v0s0 -2.5 2.5 -2.5"}),(0,e.jsx)(t.Path,{d:"M40.5 4h10s2.5 0 2.5 2.5v0s0 2.5 -2.5 2.5h-10s-2.5 0 -2.5 -2.5v0s0 -2.5 2.5 -2.5"})]}),n=[{name:"digital-row",title:(0,s.__)("Digital Row","world-clocks"),attributes:{layout:"digital-row"},isDefault:!0,innerBlocks:[["world-clocks/clock"]],scope:["block"],icon:r},{name:"digital-column",title:(0,s.__)("Digital Column","world-clocks"),attributes:{layout:"digital-column"},innerBlocks:[["world-clocks/clock"]],scope:["block"],icon:l},{name:"clock",title:(0,s.__)("Clock","world-clocks"),attributes:{layout:"clock"},innerBlocks:[["world-clocks/clock"]],scope:["block"],icon:a},{name:"clock-reverse",title:(0,s.__)("Clock Reverse","world-clocks"),attributes:{layout:"clock-reverse"},innerBlocks:[["world-clocks/clock"]],scope:["block"],icon:c}];function i(o){var t,e,s="";if("string"==typeof o||"number"==typeof o)s+=o;else if("object"==typeof o)if(Array.isArray(o)){var l=o.length;for(t=0;t<l;t++)o[t]&&(e=i(o[t]))&&(s&&(s+=" "),s+=e)}else for(e in o)o[e]&&(s&&(s+=" "),s+=e);return s}const d=window.wp.blockEditor,h=window.wp.data,k=window.wp.element,w=()=>(0,e.jsxs)(t.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"62",height:"26",viewBox:"0 0 62 26",children:[(0,e.jsx)(t.Path,{d:"M44.3629 7.23569C44.4839 4.92765 45.3306 3.15047 46.9032 1.90413C48.5 0.634709 50.5927 0 53.1815 0C54.9476 0 56.4597 0.300045 57.7177 0.900134C58.9758 1.47714 59.9194 2.27341 60.5484 3.28895C61.2016 4.2814 61.5282 5.41234 61.5282 6.68176C61.5282 8.13582 61.129 9.37062 60.3306 10.3862C59.5565 11.3786 58.625 12.0479 57.5363 12.3941V12.5326C58.9395 12.9481 60.0282 13.6866 60.8024 14.7483C61.6008 15.81 62 17.1718 62 18.8336C62 20.2184 61.6613 21.4532 60.9839 22.538C60.3306 23.6227 59.3508 24.4767 58.0444 25.0999C56.7621 25.7 55.2137 26 53.3992 26C50.6653 26 48.4395 25.3422 46.7218 24.0266C45.004 22.7111 44.0968 20.7723 44 18.2104H48.9355C48.9839 19.3413 49.3831 20.253 50.1331 20.9454C50.9073 21.6147 51.9597 21.9494 53.2903 21.9494C54.5242 21.9494 55.4677 21.6263 56.121 20.98C56.7984 20.3107 57.1371 19.4567 57.1371 18.4181C57.1371 17.0333 56.6774 16.0408 55.7581 15.4407C54.8387 14.8407 53.4113 14.5406 51.4758 14.5406H50.4234V10.5593H51.4758C54.9113 10.5593 56.629 9.46294 56.629 7.27031C56.629 6.27785 56.3145 5.50466 55.6855 4.95073C55.0806 4.3968 54.1976 4.11984 53.0363 4.11984C51.8992 4.11984 51.0161 4.41989 50.3871 5.01997C49.7823 5.59698 49.4315 6.33555 49.3347 7.23569H44.3629Z"}),(0,e.jsx)(t.Path,{d:"M19.9273 20.7646C22.2545 18.878 24.1091 17.3098 25.4909 16.0599C26.8727 14.7864 28.0242 13.4658 28.9455 12.098C29.8667 10.7302 30.3273 9.38594 30.3273 8.06531C30.3273 6.86259 30.0364 5.91928 29.4545 5.23538C28.8727 4.55148 27.9758 4.20953 26.7636 4.20953C25.5515 4.20953 24.6182 4.61043 23.9636 5.41225C23.3091 6.19048 22.9697 7.26349 22.9455 8.63129H18C18.097 5.80136 18.9576 3.65533 20.5818 2.1932C22.2303 0.731066 24.3152 0 26.8364 0C29.6 0 31.7212 0.719275 33.2 2.15783C34.6788 3.57279 35.4182 5.44762 35.4182 7.78231C35.4182 9.62177 34.9091 11.3787 33.8909 13.0531C32.8727 14.7274 31.7091 16.1896 30.4 17.4395C29.0909 18.6658 27.3818 20.1515 25.2727 21.8966H36V26H18.0364V22.3211L19.9273 20.7646Z"}),(0,e.jsx)(t.Path,{d:"M0 4.60082V0H9V26H3.62241V4.60082H0Z"})]}),m=()=>(0,e.jsxs)(t.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"26",viewBox:"0 0 48 26",children:[(0,e.jsx)(t.Path,{transform:"rotate(90 48 0)",d:"M51 0h9s3 0 3 3v0s0 3 -3 3h-9s-3 0 -3 -3v0s0 -3 3 -3"}),(0,e.jsx)(t.Path,{transform:"rotate(90 6 0)",d:"M9 0h9s3 0 3 3v0s0 3 -3 3h-9s-3 0 -3 -3v0s0 -3 3 -3"}),(0,e.jsx)(t.Path,{d:"M15.3629 7.23569C15.4839 4.92765 16.3306 3.15047 17.9032 1.90413C19.5 0.634709 21.5927 0 24.1815 0C25.9476 0 27.4597 0.300045 28.7177 0.900134C29.9758 1.47714 30.9194 2.27341 31.5484 3.28895C32.2016 4.2814 32.5282 5.41234 32.5282 6.68176C32.5282 8.13582 32.129 9.37062 31.3306 10.3862C30.5565 11.3786 29.625 12.0479 28.5363 12.3941V12.5326C29.9395 12.9481 31.0282 13.6866 31.8024 14.7483C32.6008 15.81 33 17.1718 33 18.8336C33 20.2184 32.6613 21.4532 31.9839 22.538C31.3306 23.6227 30.3508 24.4767 29.0444 25.0999C27.7621 25.7 26.2137 26 24.3992 26C21.6653 26 19.4395 25.3422 17.7218 24.0266C16.004 22.7111 15.0968 20.7723 15 18.2104H19.9355C19.9839 19.3413 20.3831 20.253 21.1331 20.9454C21.9073 21.6147 22.9597 21.9494 24.2903 21.9494C25.5242 21.9494 26.4677 21.6263 27.121 20.98C27.7984 20.3107 28.1371 19.4567 28.1371 18.4181C28.1371 17.0333 27.6774 16.0408 26.7581 15.4407C25.8387 14.8407 24.4113 14.5406 22.4758 14.5406H21.4234V10.5593H22.4758C25.9113 10.5593 27.629 9.46294 27.629 7.27031C27.629 6.27785 27.3145 5.50466 26.6855 4.95073C26.0806 4.3968 25.1976 4.11984 24.0363 4.11984C22.8992 4.11984 22.0161 4.41989 21.3871 5.01997C20.7823 5.59698 20.4315 6.33555 20.3347 7.23569H15.3629Z"})]}),u=()=>(0,e.jsxs)(t.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"15",viewBox:"0 0 48 15",children:[(0,e.jsx)(t.Path,{transform:"rotate(90 27 0)",d:"M30 0h9s3 0 3 3v0s0 3 -3 3h-9s-3 0 -3 -3v0s0 -3 3 -3"}),(0,e.jsx)(t.Path,{transform:"rotate(90 48 0)",d:"M51 0h9s3 0 3 3v0s0 3 -3 3h-9s-3 0 -3 -3v0s0 -3 3 -3"}),(0,e.jsx)(t.Path,{transform:"rotate(90 6 0)",d:"M9 0h9s3 0 3 3v0s0 3 -3 3h-9s-3 0 -3 -3v0s0 -3 3 -3"})]}),g=({setAttributes:o,attributes:l,shouldShowClockSettings:r})=>{const{clocksPerRow:a,clocksStackOnMobile:c,showClocksAmPmIndicator:n,showDigitalTime:i,timeFormat:d,showDate:h,dateFormat:w,layout:m}=l,u=!r||i,g="digital-row"!==m,[x,C]=(0,k.useState)(!1),[v,p]=(0,k.useState)(!1);return(0,e.jsxs)(t.PanelBody,{title:(0,s.__)("Visibility Settings","world-clocks"),children:[g&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(t.RangeControl,{label:(0,s.__)("Clocks per row","world-clocks"),value:a,onChange:t=>{o({clocksPerRow:t})},min:1,max:4}),(0,e.jsx)(t.ToggleControl,{label:(0,s.__)("Stack on mobile","world-clocks"),checked:c,onChange:t=>{o({clocksStackOnMobile:t})}})]}),r&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(t.ToggleControl,{label:(0,s.__)("Show Clocks AmPm Indicator","world-clocks"),checked:n,onChange:t=>{o({showClocksAmPmIndicator:t})}}),(0,e.jsx)(t.ToggleControl,{label:(0,s.__)("Show Digital Time","world-clocks"),checked:i,onChange:t=>{o({showDigitalTime:t})}})]}),u&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(t.TextControl,{label:(0,s.__)("Time Format","world-clocks"),help:(0,k.createInterpolateElement)((0,s.__)("Enter a time <Link>format string</Link>.","world-clocks"),{Link:(0,e.jsx)(t.ExternalLink,{href:(0,s.__)("https://wordpress.org/documentation/article/customize-date-and-time-format/","world-clocks")})}),value:d,onChange:t=>{o({timeFormat:t})},onKeyDown:o=>{const{key:t}=o;["d","j","S","l","D","m","n","F","M","Y","y","c","r","U"].includes(t)?(C(!0),o.preventDefault()):C(!1)}}),x&&(0,e.jsx)("p",{className:"not-allowed-keys-error",children:(0,s.__)('The date format keys ("d", "j", "S", "l", "D", "m", "n", "F", "M", "Y", "y", "c", "r", "U") are not allowed in time format.',"world-clocks")})]}),(0,e.jsx)(t.ToggleControl,{label:(0,s.__)("Show Date","world-clocks"),checked:h,onChange:t=>{o({showDate:t})}}),h&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(t.TextControl,{label:(0,s.__)("Date Format","world-clocks"),help:(0,k.createInterpolateElement)((0,s.__)("Enter a date <Link>format string</Link>.","world-clocks"),{Link:(0,e.jsx)(t.ExternalLink,{href:(0,s.__)("https://wordpress.org/documentation/article/customize-date-and-time-format/","world-clocks")})}),value:w,onChange:t=>{o({dateFormat:t})},onKeyDown:o=>{const{key:t}=o;["a","A","g","h","G","H","i","s","T","c","r","U"].includes(t)?(p(!0),o.preventDefault()):p(!1)}}),v&&(0,e.jsx)("p",{className:"not-allowed-keys-error",children:(0,s.__)('The time format keys ("a", "A", "g", "h", "G", "H", "i", "s", "T", "c", "r", "U") are not allowed in date format.',"world-clocks")})]})]})},x=({setAttributes:o,layout:n})=>(0,e.jsx)(t.PanelBody,{title:(0,s.__)("Layout","world-clocks"),className:"world-clocks-toggle-setting",children:(0,e.jsxs)(t.__experimentalToggleGroupControl,{isBlock:!0,onChange:t=>{o({layout:t})},value:n,className:"world-clocks-toggle-control",children:[(0,e.jsx)(t.__experimentalToggleGroupControlOptionIcon,{value:"digital-row",icon:r,label:(0,s.__)("Digital Row","world-clocks")}),(0,e.jsx)(t.__experimentalToggleGroupControlOptionIcon,{value:"digital-column",icon:l,label:(0,s.__)("Digital Column","world-clocks")}),(0,e.jsx)(t.__experimentalToggleGroupControlOptionIcon,{value:"clock",icon:a,label:(0,s.__)("Clock","world-clocks")}),(0,e.jsx)(t.__experimentalToggleGroupControlOptionIcon,{value:"clock-reverse",icon:c,label:(0,s.__)("Clock Reverse","world-clocks")})]})}),C=({setAttributes:o,marksFormat:l})=>(0,e.jsx)(t.PanelBody,{title:(0,s.__)("Marks Format","world-clocks"),className:"world-clocks-toggle-setting",children:(0,e.jsxs)(t.__experimentalToggleGroupControl,{isBlock:!0,onChange:t=>{o({marksFormat:t})},value:l,className:"world-clocks-toggle-control",children:[(0,e.jsx)(t.__experimentalToggleGroupControlOptionIcon,{value:"number",icon:w,label:(0,s.__)("Number","world-clocks")}),(0,e.jsx)(t.__experimentalToggleGroupControlOptionIcon,{value:"combine",icon:m,label:(0,s.__)("Combine","world-clocks")}),(0,e.jsx)(t.__experimentalToggleGroupControlOptionIcon,{value:"line",icon:u,label:(0,s.__)("Line","world-clocks")})]})}),v=o=>{const{attributes:t,setAttributes:s}=o,{layout:l,marksFormat:r,clocksPerRow:a,clocksStackOnMobile:c}=t,n=(o=>!!["clock","clock-reverse"].includes(o))(l),h=function(){for(var o,t,e=0,s="",l=arguments.length;e<l;e++)(o=arguments[e])&&(t=i(o))&&(s&&(s+=" "),s+=t);return s}({[`has-clocks-layout-${l}`]:l,[`has-clocks-marks-format-${r}`]:n,[`has-clocks-${a}-columns`]:a&&"digital-row"!==l,"has-clocks-not-stacked-on-mobile":!c}),k=(0,d.useBlockProps)({className:h}),w=(0,d.useInnerBlocksProps)(k,{defaultBlock:{name:"world-clocks/clock"},directInsert:!0});return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(d.InspectorControls,{children:[(0,e.jsx)(g,{setAttributes:s,attributes:t,shouldShowClockSettings:n}),(0,e.jsx)(x,{setAttributes:s,layout:l}),n&&(0,e.jsx)(C,{setAttributes:s,marksFormat:r})]}),(0,e.jsx)("div",{...w})]})},p=t=>{const{clientId:l,name:r,setAttributes:a}=t,{blockType:c,defaultVariation:n,variations:i}=(0,h.useSelect)(t=>{const{getBlockVariations:e,getBlockType:s,getDefaultBlockVariation:l}=t(o.store);return{blockType:s(r),defaultVariation:l(r,"block"),variations:e(r,"block")}},[r]),{replaceInnerBlocks:k}=(0,h.useDispatch)(d.store),w=(0,d.useBlockProps)();return(0,e.jsx)("div",{...w,children:(0,e.jsx)(d.__experimentalBlockVariationPicker,{icon:c?.icon?.src,label:c?.title,variations:i,instructions:(0,s.__)("Select a layout:","world-clocks"),onSelect:(t=n)=>{t.attributes&&a(t.attributes),t.innerBlocks&&k(l,(0,o.createBlocksFromInnerBlocksTemplate)(t.innerBlocks),!0)},allowSkip:!0})})},j=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"world-clocks/clocks","title":"World Clocks","category":"widgets","description":"Display world clocks","allowedBlocks":["world-clocks/clock"],"attributes":{"clocksPerRow":{"type":"number","default":2},"clocksStackOnMobile":{"type":"boolean","default":true},"showClocksAmPmIndicator":{"type":"boolean","default":true},"showDigitalTime":{"type":"boolean","default":false},"timeFormat":{"type":"string","default":"h:i:s A"},"showDate":{"type":"boolean","default":false},"dateFormat":{"type":"string","default":"Y-m-d"},"layout":{"type":"string","default":"digital-row"},"marksFormat":{"type":"string","default":"number"}},"providesContext":{"world-clocks/showClocksAmPmIndicator":"showClocksAmPmIndicator","world-clocks/showDigitalTime":"showDigitalTime","world-clocks/timeFormat":"timeFormat","world-clocks/showDate":"showDate","world-clocks/dateFormat":"dateFormat","world-clocks/layout":"layout","world-clocks/marksFormat":"marksFormat"},"supports":{"html":false,"color":{"text":true,"background":true}},"textdomain":"world-clocks","editorScript":"file:../../../dist/clocks-block.js","editorStyle":"file:../../../dist/clocks-block.css","style":"file:../../../dist/style-clocks-block.css","viewScript":"file:../../../dist/frontend.js","viewStyle":"file:../../../dist/ frontend.css"}');(0,o.registerBlockType)(j,{icon:()=>(0,e.jsxs)(t.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12.7 12.7",width:"24",height:"24",children:[(0,e.jsx)(t.Path,{d:"M5.0390625.95117188C2.5493319 1.5558637.79296864 3.7874988.79296875 6.3496094c7e-7 3.0654976 2.49114295 5.5566406 5.55664065 5.5566406 3.065495-.000004 5.5566396-2.4911456 5.5566406-5.5566406.000002-.3267764-.02862-.6528992-.08594-.9746094l-.521484.09375c.05186.2910712.07813.5852044.07813.8808594-.000001 2.7795124-2.2478312 5.0273406-5.0273436 5.0273436-2.7795148 0-5.0273431-2.2478288-5.0273438-5.0273436-1e-7-2.3207589 1.5865998-4.337036 3.8417969-4.8847656zM7.6621094.95117188l-.125.51367192C8.6697779 1.739997 9.6714421 2.3997572 10.371094 3.3320312L10.794922 3.015625C10.02169 1.9853059 8.913898 1.2552624 7.6621094.95117188z"}),(0,e.jsx)(t.Path,{d:"M1.5878906 3.7050781v.5273438h.9492188l.6386718.640625V5.1015625L2.5625 5.3046875A.26460981.26460981 0 0 0 2.4101562 5.6738281l.1777344.359375-.050781.052734H1.0585938V6.6152344H2.6464844A.26460981.26460981 0 0 0 2.8320312 6.5371094L3.0976562 6.2734375A.26460981.26460981 0 0 0 3.1464844 5.9667969L3.0195312 5.7109375 3.5234375 5.5429688A.26460981.26460981 0 0 0 3.7050781 5.2910156V4.7617188A.26460981.26460981 0 0 0 3.6269531 4.5761719L2.8320312 3.78125A.26460981.26460981 0 0 0 2.6464844 3.7050781zM9.2597656 8.4667969a.26460981.26460981 0 0 0-.1855468.078125l-.1875.1855469H6.3496094a.26460981.26460981 0 0 0-.1875.078125L5.8984375 9.0742188A.26460981.26460981 0 0 0 5.8652344 9.40625l.5292968.794922a.26460981.26460981 0 0 0 .15625.109375L7.5566406 10.5625 8.5722656 11.324219 8.890625 10.900391 7.8320312 10.107422A.26460981.26460981 0 0 0 7.7363281 10.0625L6.7773438 9.8222656 6.4257812 9.2949219 6.4589844 9.2597656h2.5371094a.26460981.26460981 0 0 0 .1875-.076172l.1855468-.1875H11.113281V8.4667969zM5.5410156 3.7050781A.26460981.26460981 0 0 0 5.3984375 3.7578125L4.3398438 4.5507812a.26460981.26460981 0 0 0 .011719.4316407l.7929687.5292969a.26460981.26460981 0 0 0 .2109376.037109l.9375-.234375L7.25 6.0332031A.26460981.26460981 0 0 0 7.34375 6.078125L8.4023438 6.3417969A.26460981.26460981 0 0 0 8.7304688 6.0859375V5.2910156a.26460981.26460981 0 0 0-.1796876-.25L8.0859375 4.8847656 8.421875 4.3808594A.26460981.26460981 0 0 0 8.2011719 3.96875H6.6484375L5.6210938 3.7128906a.26460981.26460981 0 0 0-.080078-.00781zm.072266.5507813l.9375.234375a.26460981.26460981 0 0 0 .064453.00781h1.09375L7.453125 4.8808594A.26460981.26460981 0 0 0 7.5898438 5.2773438L8.2011719 5.4824219V5.7460938L7.5234375 5.5761719 6.5078125 4.8144531A.26460981.26460981 0 0 0 6.2851562 4.7695312L5.3417969 5.0058594 4.9550781 4.75zM10.583984 2.9101562c-.8736177 0-1.5878903.7142726-1.5878902 1.5878907 0 .6394097.3826069 1.1540913.7382812 1.5097656.355674.3556743.712891.5683594.712891.5683594a.26460978.26460978 0 0 0 .271484 0c0 0 .357216-.2126851.712891-.5683594.355674-.3556743.738281-.8703559.738281-1.5097656 0-.8736182-.712319-1.5878907-1.585938-1.5878907zm0 .5292969c.587636 0 1.058594.4709585 1.058594 1.0585938 0 .4189236-.2782.8289816-.583984 1.1347656-.237462.2374618-.380639.3195291-.47461.3808594-.09359-.06105-.236685-.1429354-.474609-.3808594-.305784-.305784-.5839844-.715842-.5839844-1.1347656 0-.5876353.4709585-1.0585938 1.0585934-1.0585938z"}),(0,e.jsx)(t.Path,{d:"M10.552734 3.7011719A.26460981.26460981 0 0 0 10.318359 3.96875v.5292969a.26460981.26460981 0 0 0 .07813.1875l.263672.2636719a.26460981.26460981 0 1 0 .375-.3730469l-.1875-.1875V3.96875A.26460981.26460981 0 0 0 10.552734 3.7011719zM6.3496094 0C5.4759913 0 4.7617187.71427251 4.7617188 1.5878906c0 .6394097.38456 1.1540913.7402343 1.5097656.3556743.3556744.7128907.5683594.7128907.5683594a.26460978.26460978 0 0 0 .2714843 0c0 0 .3572163-.212685.7128907-.5683594C7.5548931 2.7419819 7.9375001 2.2273004 7.9375 1.5878906 7.9374999.71427255 7.2232275 0 6.3496094 0zm0 .52929688c.5876353-1e-8 1.0585936.47095842 1.0585937 1.05859372 1e-7.4189236-.2782003.8289816-.5839843 1.1347656C6.5862948 2.9605802 6.4432048 3.0424657 6.3496094 3.1035156 6.2556392 3.0421854 6.1124618 2.960118 5.875 2.7226562 5.569216 2.4168722 5.2910156 2.0068142 5.2910156 1.5878906c0-.5876352.4709585-1.05859372 1.0585938-1.05859372z"}),(0,e.jsx)(t.Path,{d:"M6.3457031.7890625A.26460981.26460981 0 0 0 6.0859375 1.0585938v.5292968a.26460981.26460981 0 0 0 .076172.1875l.265625.2636719a.26460981.26460981 0 1 0 .3730468-.375L6.6152344 1.4785156V1.0585938A.26460981.26460981 0 0 0 6.3457031.7890625zM4.2324219 6.6152344c-.8736181 0-1.5859375.7123194-1.5859375 1.5859375 0 .6394098.3826069 1.1560444.7382812 1.5117187.3556743.3556744.7128906.5683594.7128906.5683594a.26460978.26460978 0 0 0 .2714844 0c0 0 .3572162-.212685.7128906-.5683594.3556745-.3556743.7382813-.8723088.7382813-1.5117187 0-.8736182-.7142723-1.5859375-1.5878906-1.5859375zm0 .5292968c.5876356 0 1.0585937.4690054 1.0585937 1.0566407 0 .4189238-.2782003.8309347-.5839844 1.1367187C4.4697022 9.5752196 4.3284523 9.6573395 4.234375 9.71875 4.1407796 9.6577 3.9976896 9.5758146 3.7597656 9.3378906 3.4539816 9.0321066 3.1757812 8.6200957 3.1757812 8.2011719c0-.5876353.4690054-1.0566407 1.0566407-1.0566407z"}),(0,e.jsx)(t.Path,{d:"M 4.2285156,7.4042969 A 0.26460981,0.26460981 0 0 0 3.96875,7.6738281 v 0.5273438 a 0.26460981,0.26460981 0 0 0 0.078125,0.1875 l 0.2636719,0.265625 a 0.26516504,0.26516504 0 1 0 0.375,-0.375 l -0.1875,-0.1875 V 7.6738281 A 0.26460981,0.26460981 0 0 0 4.2285156,7.4042969 Z"})]}),variations:n,edit:o=>{const{clientId:t}=o,s=(0,h.useSelect)(o=>o(d.store).getBlocks(t).length>0,[t])?v:p;return(0,e.jsx)(s,{...o})},save:()=>(0,e.jsx)(d.InnerBlocks.Content,{})})}},e={};function s(o){var l=e[o];if(void 0!==l)return l.exports;var r=e[o]={exports:{}};return t[o](r,r.exports,s),r.exports}s.m=t,o=[],s.O=(t,e,l,r)=>{if(!e){var a=1/0;for(d=0;d<o.length;d++){for(var[e,l,r]=o[d],c=!0,n=0;n<e.length;n++)(!1&r||a>=r)&&Object.keys(s.O).every(o=>s.O[o](e[n]))?e.splice(n--,1):(c=!1,r<a&&(a=r));if(c){o.splice(d--,1);var i=l();void 0!==i&&(t=i)}}return t}r=r||0;for(var d=o.length;d>0&&o[d-1][2]>r;d--)o[d]=o[d-1];o[d]=[e,l,r]},s.o=(o,t)=>Object.prototype.hasOwnProperty.call(o,t),(()=>{var o={390:0,775:0};s.O.j=t=>0===o[t];var t=(t,e)=>{var l,r,[a,c,n]=e,i=0;if(a.some(t=>0!==o[t])){for(l in c)s.o(c,l)&&(s.m[l]=c[l]);if(n)var d=n(s)}for(t&&t(e);i<a.length;i++)r=a[i],s.o(o,r)&&o[r]&&o[r][0](),o[r]=0;return s.O(d)},e=globalThis.webpackChunk_sanketio_world_clocks=globalThis.webpackChunk_sanketio_world_clocks||[];e.forEach(t.bind(null,0)),e.push=t.bind(null,e.push.bind(e))})();var l=s.O(void 0,[775],()=>s(912));l=s.O(l)})();1 (()=>{"use strict";var o,t={912(){const o=window.wp.blocks,t=window.wp.components,e=window.ReactJSXRuntime,s=window.wp.i18n,l=()=>(0,e.jsxs)(t.SVG,{width:"58",height:"19",viewBox:"0 0 58 19",xmlns:"http://www.w3.org/2000/svg",children:[(0,e.jsx)(t.Path,{d:"M7.5 16h10s1.5 0 1.5 1.5v0s0 1.5 -1.5 1.5h-10s-1.5 0 -1.5 -1.5v0s0 -1.5 1.5 -1.5"}),(0,e.jsx)(t.Path,{d:"M40.5 16h10s1.5 0 1.5 1.5v0s0 1.5 -1.5 1.5h-10s-1.5 0 -1.5 -1.5v0s0 -1.5 1.5 -1.5"}),(0,e.jsx)(t.Path,{d:"M6 0h13s6 0 6 6v0s0 6 -6 6h-13s-6 0 -6 -6v0s0 -6 6 -6"}),(0,e.jsx)(t.Path,{d:"M39 0h13s6 0 6 6v0s0 6 -6 6h-13s-6 0 -6 -6v0s0 -6 6 -6"})]}),r=()=>(0,e.jsxs)(t.SVG,{width:"60",height:"31",viewBox:"0 0 60 31",xmlns:"http://www.w3.org/2000/svg",children:[(0,e.jsx)(t.Path,{d:"M46.5 0h10s2.5 0 2.5 2.5v0s0 2.5 -2.5 2.5h-10s-2.5 0 -2.5 -2.5v0s0 -2.5 2.5 -2.5"}),(0,e.jsx)(t.Path,{d:"M46.5 13h10s2.5 0 2.5 2.5v0s0 2.5 -2.5 2.5h-10s-2.5 0 -2.5 -2.5v0s0 -2.5 2.5 -2.5"}),(0,e.jsx)(t.Path,{d:"M46.5 26h10s2.5 0 2.5 2.5v0s0 2.5 -2.5 2.5h-10s-2.5 0 -2.5 -2.5v0s0 -2.5 2.5 -2.5"}),(0,e.jsx)(t.Path,{d:"M3.5 0h30s2.5 0 2.5 2.5v0s0 2.5 -2.5 2.5h-30s-2.5 0 -2.5 -2.5v0s0 -2.5 2.5 -2.5"}),(0,e.jsx)(t.Path,{d:"M3.5 13h30s2.5 0 2.5 2.5v0s0 2.5 -2.5 2.5h-30s-2.5 0 -2.5 -2.5v0s0 -2.5 2.5 -2.5"}),(0,e.jsx)(t.Path,{d:"M3.5 26h30s2.5 0 2.5 2.5v0s0 2.5 -2.5 2.5h-30s-2.5 0 -2.5 -2.5v0s0 -2.5 2.5 -2.5"}),(0,e.jsx)(t.Path,{d:"M1 9H59",stroke:"#1e1e1e","stroke-linecap":"round"}),(0,e.jsx)(t.Path,{d:"M1 22H59",stroke:"#1e1e1e","stroke-linecap":"round"})]}),a=()=>(0,e.jsxs)(t.SVG,{width:"58",height:"38",viewBox:"0 0 58 38",xmlns:"http://www.w3.org/2000/svg",children:[(0,e.jsx)(t.Path,{d:"M0 12.5a12.5 12.5 0 1 0 25 0a12.5 12.5 0 1 0 -25 0"}),(0,e.jsx)(t.Path,{d:"M33 12.5a12.5 12.5 0 1 0 25 0a12.5 12.5 0 1 0 -25 0"}),(0,e.jsx)(t.Path,{d:"M8 29h9s1 0 1 1v0s0 1 -1 1h-9s-1 0 -1 -1v0s0 -1 1 -1"}),(0,e.jsx)(t.Path,{d:"M41 29h9s1 0 1 1v0s0 1 -1 1h-9s-1 0 -1 -1v0s0 -1 1 -1"}),(0,e.jsx)(t.Path,{d:"M7.5 33h10s2.5 0 2.5 2.5v0s0 2.5 -2.5 2.5h-10s-2.5 0 -2.5 -2.5v0s0 -2.5 2.5 -2.5"}),(0,e.jsx)(t.Path,{d:"M40.5 33h10s2.5 0 2.5 2.5v0s0 2.5 -2.5 2.5h-10s-2.5 0 -2.5 -2.5v0s0 -2.5 2.5 -2.5"})]}),c=()=>(0,e.jsxs)(t.SVG,{width:"58",height:"38",viewBox:"0 0 58 38",xmlns:"http://www.w3.org/2000/svg",children:[(0,e.jsx)(t.Path,{d:"M0 25.5a12.5 12.5 0 1 0 25 0a12.5 12.5 0 1 0 -25 0"}),(0,e.jsx)(t.Path,{d:"M33 25.5a12.5 12.5 0 1 0 25 0a12.5 12.5 0 1 0 -25 0"}),(0,e.jsx)(t.Path,{d:"M8 0h9s1 0 1 1v0s0 1 -1 1h-9s-1 0 -1 -1v0s0 -1 1 -1"}),(0,e.jsx)(t.Path,{d:"M41 0h9s1 0 1 1v0s0 1 -1 1h-9s-1 0 -1 -1v0s0 -1 1 -1"}),(0,e.jsx)(t.Path,{d:"M7.5 4h10s2.5 0 2.5 2.5v0s0 2.5 -2.5 2.5h-10s-2.5 0 -2.5 -2.5v0s0 -2.5 2.5 -2.5"}),(0,e.jsx)(t.Path,{d:"M40.5 4h10s2.5 0 2.5 2.5v0s0 2.5 -2.5 2.5h-10s-2.5 0 -2.5 -2.5v0s0 -2.5 2.5 -2.5"})]}),n=[{name:"digital-row",title:(0,s.__)("Digital Row","world-clocks"),attributes:{layout:"digital-row"},isDefault:!0,innerBlocks:[["world-clocks/clock"]],scope:["block"],icon:r},{name:"digital-column",title:(0,s.__)("Digital Column","world-clocks"),attributes:{layout:"digital-column"},innerBlocks:[["world-clocks/clock"]],scope:["block"],icon:l},{name:"clock",title:(0,s.__)("Clock","world-clocks"),attributes:{layout:"clock"},innerBlocks:[["world-clocks/clock"]],scope:["block"],icon:a},{name:"clock-reverse",title:(0,s.__)("Clock Reverse","world-clocks"),attributes:{layout:"clock-reverse"},innerBlocks:[["world-clocks/clock"]],scope:["block"],icon:c}];function i(o){var t,e,s="";if("string"==typeof o||"number"==typeof o)s+=o;else if("object"==typeof o)if(Array.isArray(o)){var l=o.length;for(t=0;t<l;t++)o[t]&&(e=i(o[t]))&&(s&&(s+=" "),s+=e)}else for(e in o)o[e]&&(s&&(s+=" "),s+=e);return s}const d=window.wp.blockEditor,h=window.wp.data,k=window.wp.element,w=()=>(0,e.jsxs)(t.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"62",height:"26",viewBox:"0 0 62 26",children:[(0,e.jsx)(t.Path,{d:"M44.3629 7.23569C44.4839 4.92765 45.3306 3.15047 46.9032 1.90413C48.5 0.634709 50.5927 0 53.1815 0C54.9476 0 56.4597 0.300045 57.7177 0.900134C58.9758 1.47714 59.9194 2.27341 60.5484 3.28895C61.2016 4.2814 61.5282 5.41234 61.5282 6.68176C61.5282 8.13582 61.129 9.37062 60.3306 10.3862C59.5565 11.3786 58.625 12.0479 57.5363 12.3941V12.5326C58.9395 12.9481 60.0282 13.6866 60.8024 14.7483C61.6008 15.81 62 17.1718 62 18.8336C62 20.2184 61.6613 21.4532 60.9839 22.538C60.3306 23.6227 59.3508 24.4767 58.0444 25.0999C56.7621 25.7 55.2137 26 53.3992 26C50.6653 26 48.4395 25.3422 46.7218 24.0266C45.004 22.7111 44.0968 20.7723 44 18.2104H48.9355C48.9839 19.3413 49.3831 20.253 50.1331 20.9454C50.9073 21.6147 51.9597 21.9494 53.2903 21.9494C54.5242 21.9494 55.4677 21.6263 56.121 20.98C56.7984 20.3107 57.1371 19.4567 57.1371 18.4181C57.1371 17.0333 56.6774 16.0408 55.7581 15.4407C54.8387 14.8407 53.4113 14.5406 51.4758 14.5406H50.4234V10.5593H51.4758C54.9113 10.5593 56.629 9.46294 56.629 7.27031C56.629 6.27785 56.3145 5.50466 55.6855 4.95073C55.0806 4.3968 54.1976 4.11984 53.0363 4.11984C51.8992 4.11984 51.0161 4.41989 50.3871 5.01997C49.7823 5.59698 49.4315 6.33555 49.3347 7.23569H44.3629Z"}),(0,e.jsx)(t.Path,{d:"M19.9273 20.7646C22.2545 18.878 24.1091 17.3098 25.4909 16.0599C26.8727 14.7864 28.0242 13.4658 28.9455 12.098C29.8667 10.7302 30.3273 9.38594 30.3273 8.06531C30.3273 6.86259 30.0364 5.91928 29.4545 5.23538C28.8727 4.55148 27.9758 4.20953 26.7636 4.20953C25.5515 4.20953 24.6182 4.61043 23.9636 5.41225C23.3091 6.19048 22.9697 7.26349 22.9455 8.63129H18C18.097 5.80136 18.9576 3.65533 20.5818 2.1932C22.2303 0.731066 24.3152 0 26.8364 0C29.6 0 31.7212 0.719275 33.2 2.15783C34.6788 3.57279 35.4182 5.44762 35.4182 7.78231C35.4182 9.62177 34.9091 11.3787 33.8909 13.0531C32.8727 14.7274 31.7091 16.1896 30.4 17.4395C29.0909 18.6658 27.3818 20.1515 25.2727 21.8966H36V26H18.0364V22.3211L19.9273 20.7646Z"}),(0,e.jsx)(t.Path,{d:"M0 4.60082V0H9V26H3.62241V4.60082H0Z"})]}),m=()=>(0,e.jsxs)(t.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"26",viewBox:"0 0 48 26",children:[(0,e.jsx)(t.Path,{transform:"rotate(90 48 0)",d:"M51 0h9s3 0 3 3v0s0 3 -3 3h-9s-3 0 -3 -3v0s0 -3 3 -3"}),(0,e.jsx)(t.Path,{transform:"rotate(90 6 0)",d:"M9 0h9s3 0 3 3v0s0 3 -3 3h-9s-3 0 -3 -3v0s0 -3 3 -3"}),(0,e.jsx)(t.Path,{d:"M15.3629 7.23569C15.4839 4.92765 16.3306 3.15047 17.9032 1.90413C19.5 0.634709 21.5927 0 24.1815 0C25.9476 0 27.4597 0.300045 28.7177 0.900134C29.9758 1.47714 30.9194 2.27341 31.5484 3.28895C32.2016 4.2814 32.5282 5.41234 32.5282 6.68176C32.5282 8.13582 32.129 9.37062 31.3306 10.3862C30.5565 11.3786 29.625 12.0479 28.5363 12.3941V12.5326C29.9395 12.9481 31.0282 13.6866 31.8024 14.7483C32.6008 15.81 33 17.1718 33 18.8336C33 20.2184 32.6613 21.4532 31.9839 22.538C31.3306 23.6227 30.3508 24.4767 29.0444 25.0999C27.7621 25.7 26.2137 26 24.3992 26C21.6653 26 19.4395 25.3422 17.7218 24.0266C16.004 22.7111 15.0968 20.7723 15 18.2104H19.9355C19.9839 19.3413 20.3831 20.253 21.1331 20.9454C21.9073 21.6147 22.9597 21.9494 24.2903 21.9494C25.5242 21.9494 26.4677 21.6263 27.121 20.98C27.7984 20.3107 28.1371 19.4567 28.1371 18.4181C28.1371 17.0333 27.6774 16.0408 26.7581 15.4407C25.8387 14.8407 24.4113 14.5406 22.4758 14.5406H21.4234V10.5593H22.4758C25.9113 10.5593 27.629 9.46294 27.629 7.27031C27.629 6.27785 27.3145 5.50466 26.6855 4.95073C26.0806 4.3968 25.1976 4.11984 24.0363 4.11984C22.8992 4.11984 22.0161 4.41989 21.3871 5.01997C20.7823 5.59698 20.4315 6.33555 20.3347 7.23569H15.3629Z"})]}),u=()=>(0,e.jsxs)(t.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"48",height:"15",viewBox:"0 0 48 15",children:[(0,e.jsx)(t.Path,{transform:"rotate(90 27 0)",d:"M30 0h9s3 0 3 3v0s0 3 -3 3h-9s-3 0 -3 -3v0s0 -3 3 -3"}),(0,e.jsx)(t.Path,{transform:"rotate(90 48 0)",d:"M51 0h9s3 0 3 3v0s0 3 -3 3h-9s-3 0 -3 -3v0s0 -3 3 -3"}),(0,e.jsx)(t.Path,{transform:"rotate(90 6 0)",d:"M9 0h9s3 0 3 3v0s0 3 -3 3h-9s-3 0 -3 -3v0s0 -3 3 -3"})]}),g=({setAttributes:o,attributes:l,shouldShowClockSettings:r})=>{const{clocksPerRow:a,clocksStackOnMobile:c,showClocksAmPmIndicator:n,showDigitalTime:i,timeFormat:d,showDate:h,dateFormat:w,layout:m}=l,u=!r||i,g="digital-row"!==m,[x,C]=(0,k.useState)(!1),[v,p]=(0,k.useState)(!1);return(0,e.jsxs)(t.PanelBody,{title:(0,s.__)("Visibility Settings","world-clocks"),children:[g&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(t.RangeControl,{label:(0,s.__)("Clocks per row","world-clocks"),value:a,onChange:t=>{o({clocksPerRow:t})},min:1,max:4}),(0,e.jsx)(t.ToggleControl,{label:(0,s.__)("Stack on mobile","world-clocks"),checked:c,onChange:t=>{o({clocksStackOnMobile:t})}})]}),r&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(t.ToggleControl,{label:(0,s.__)("Show Clocks AmPm Indicator","world-clocks"),checked:n,onChange:t=>{o({showClocksAmPmIndicator:t})}}),(0,e.jsx)(t.ToggleControl,{label:(0,s.__)("Show Digital Time","world-clocks"),checked:i,onChange:t=>{o({showDigitalTime:t})}})]}),u&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(t.TextControl,{label:(0,s.__)("Time Format","world-clocks"),help:(0,k.createInterpolateElement)((0,s.__)("Enter a time <Link>format string</Link>.","world-clocks"),{Link:(0,e.jsx)(t.ExternalLink,{href:(0,s.__)("https://wordpress.org/documentation/article/customize-date-and-time-format/","world-clocks")})}),value:d,onChange:t=>{o({timeFormat:t})},onKeyDown:o=>{const{key:t}=o;["d","j","S","l","D","m","n","F","M","Y","y","c","r","U"].includes(t)?(C(!0),o.preventDefault()):C(!1)}}),x&&(0,e.jsx)("p",{className:"not-allowed-keys-error",children:(0,s.__)('The date format keys ("d", "j", "S", "l", "D", "m", "n", "F", "M", "Y", "y", "c", "r", "U") are not allowed in time format.',"world-clocks")})]}),(0,e.jsx)(t.ToggleControl,{label:(0,s.__)("Show Date","world-clocks"),checked:h,onChange:t=>{o({showDate:t})}}),h&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(t.TextControl,{label:(0,s.__)("Date Format","world-clocks"),help:(0,k.createInterpolateElement)((0,s.__)("Enter a date <Link>format string</Link>.","world-clocks"),{Link:(0,e.jsx)(t.ExternalLink,{href:(0,s.__)("https://wordpress.org/documentation/article/customize-date-and-time-format/","world-clocks")})}),value:w,onChange:t=>{o({dateFormat:t})},onKeyDown:o=>{const{key:t}=o;["a","A","g","h","G","H","i","s","T","c","r","U"].includes(t)?(p(!0),o.preventDefault()):p(!1)}}),v&&(0,e.jsx)("p",{className:"not-allowed-keys-error",children:(0,s.__)('The time format keys ("a", "A", "g", "h", "G", "H", "i", "s", "T", "c", "r", "U") are not allowed in date format.',"world-clocks")})]})]})},x=({setAttributes:o,layout:n})=>(0,e.jsx)(t.PanelBody,{title:(0,s.__)("Layout","world-clocks"),className:"world-clocks-toggle-setting",children:(0,e.jsxs)(t.__experimentalToggleGroupControl,{isBlock:!0,onChange:t=>{o({layout:t})},value:n,className:"world-clocks-toggle-control",children:[(0,e.jsx)(t.__experimentalToggleGroupControlOptionIcon,{value:"digital-row",icon:r,label:(0,s.__)("Digital Row","world-clocks")}),(0,e.jsx)(t.__experimentalToggleGroupControlOptionIcon,{value:"digital-column",icon:l,label:(0,s.__)("Digital Column","world-clocks")}),(0,e.jsx)(t.__experimentalToggleGroupControlOptionIcon,{value:"clock",icon:a,label:(0,s.__)("Clock","world-clocks")}),(0,e.jsx)(t.__experimentalToggleGroupControlOptionIcon,{value:"clock-reverse",icon:c,label:(0,s.__)("Clock Reverse","world-clocks")})]})}),C=({setAttributes:o,marksFormat:l})=>(0,e.jsx)(t.PanelBody,{title:(0,s.__)("Marks Format","world-clocks"),className:"world-clocks-toggle-setting",children:(0,e.jsxs)(t.__experimentalToggleGroupControl,{isBlock:!0,onChange:t=>{o({marksFormat:t})},value:l,className:"world-clocks-toggle-control",children:[(0,e.jsx)(t.__experimentalToggleGroupControlOptionIcon,{value:"number",icon:w,label:(0,s.__)("Number","world-clocks")}),(0,e.jsx)(t.__experimentalToggleGroupControlOptionIcon,{value:"combine",icon:m,label:(0,s.__)("Combine","world-clocks")}),(0,e.jsx)(t.__experimentalToggleGroupControlOptionIcon,{value:"line",icon:u,label:(0,s.__)("Line","world-clocks")})]})}),v=o=>{const{attributes:t,setAttributes:s}=o,{layout:l,marksFormat:r,clocksPerRow:a,clocksStackOnMobile:c}=t,n=(o=>!!["clock","clock-reverse"].includes(o))(l),h=function(){for(var o,t,e=0,s="",l=arguments.length;e<l;e++)(o=arguments[e])&&(t=i(o))&&(s&&(s+=" "),s+=t);return s}({[`has-clocks-layout-${l}`]:l,[`has-clocks-marks-format-${r}`]:n,[`has-clocks-${a}-columns`]:a&&"digital-row"!==l,"has-clocks-not-stacked-on-mobile":!c}),k=(0,d.useBlockProps)({className:h}),w=(0,d.useInnerBlocksProps)(k,{defaultBlock:{name:"world-clocks/clock"},directInsert:!0});return(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(d.InspectorControls,{children:[(0,e.jsx)(g,{setAttributes:s,attributes:t,shouldShowClockSettings:n}),(0,e.jsx)(x,{setAttributes:s,layout:l}),n&&(0,e.jsx)(C,{setAttributes:s,marksFormat:r})]}),(0,e.jsx)("div",{...w})]})},p=t=>{const{clientId:l,name:r,setAttributes:a}=t,{blockType:c,defaultVariation:n,variations:i}=(0,h.useSelect)(t=>{const{getBlockVariations:e,getBlockType:s,getDefaultBlockVariation:l}=t(o.store);return{blockType:s(r),defaultVariation:l(r,"block"),variations:e(r,"block")}},[r]),{replaceInnerBlocks:k}=(0,h.useDispatch)(d.store),w=(0,d.useBlockProps)();return(0,e.jsx)("div",{...w,children:(0,e.jsx)(d.__experimentalBlockVariationPicker,{icon:c?.icon?.src,label:c?.title,variations:i,instructions:(0,s.__)("Select a layout:","world-clocks"),onSelect:(t=n)=>{t.attributes&&a(t.attributes),t.innerBlocks&&k(l,(0,o.createBlocksFromInnerBlocksTemplate)(t.innerBlocks),!0)},allowSkip:!0})})},j=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"name":"world-clocks/clocks","title":"World Clocks","category":"widgets","description":"Display world clocks","allowedBlocks":["world-clocks/clock"],"attributes":{"clocksPerRow":{"type":"number","default":2},"clocksStackOnMobile":{"type":"boolean","default":true},"showClocksAmPmIndicator":{"type":"boolean","default":true},"showDigitalTime":{"type":"boolean","default":false},"timeFormat":{"type":"string","default":"h:i:s A"},"showDate":{"type":"boolean","default":false},"dateFormat":{"type":"string","default":"Y-m-d"},"layout":{"type":"string","default":"digital-row"},"marksFormat":{"type":"string","default":"number"}},"providesContext":{"world-clocks/showClocksAmPmIndicator":"showClocksAmPmIndicator","world-clocks/showDigitalTime":"showDigitalTime","world-clocks/timeFormat":"timeFormat","world-clocks/showDate":"showDate","world-clocks/dateFormat":"dateFormat","world-clocks/layout":"layout","world-clocks/marksFormat":"marksFormat"},"supports":{"html":false,"color":{"text":true,"background":true}},"textdomain":"world-clocks","editorScript":"file:../../../dist/clocks-block.js","editorStyle":"file:../../../dist/clocks-block.css","style":"file:../../../dist/style-clocks-block.css","viewScript":"file:../../../dist/frontend.js","viewStyle":"file:../../../dist/style-frontend.css"}');(0,o.registerBlockType)(j,{icon:()=>(0,e.jsxs)(t.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 12.7 12.7",width:"24",height:"24",children:[(0,e.jsx)(t.Path,{d:"M5.0390625.95117188C2.5493319 1.5558637.79296864 3.7874988.79296875 6.3496094c7e-7 3.0654976 2.49114295 5.5566406 5.55664065 5.5566406 3.065495-.000004 5.5566396-2.4911456 5.5566406-5.5566406.000002-.3267764-.02862-.6528992-.08594-.9746094l-.521484.09375c.05186.2910712.07813.5852044.07813.8808594-.000001 2.7795124-2.2478312 5.0273406-5.0273436 5.0273436-2.7795148 0-5.0273431-2.2478288-5.0273438-5.0273436-1e-7-2.3207589 1.5865998-4.337036 3.8417969-4.8847656zM7.6621094.95117188l-.125.51367192C8.6697779 1.739997 9.6714421 2.3997572 10.371094 3.3320312L10.794922 3.015625C10.02169 1.9853059 8.913898 1.2552624 7.6621094.95117188z"}),(0,e.jsx)(t.Path,{d:"M1.5878906 3.7050781v.5273438h.9492188l.6386718.640625V5.1015625L2.5625 5.3046875A.26460981.26460981 0 0 0 2.4101562 5.6738281l.1777344.359375-.050781.052734H1.0585938V6.6152344H2.6464844A.26460981.26460981 0 0 0 2.8320312 6.5371094L3.0976562 6.2734375A.26460981.26460981 0 0 0 3.1464844 5.9667969L3.0195312 5.7109375 3.5234375 5.5429688A.26460981.26460981 0 0 0 3.7050781 5.2910156V4.7617188A.26460981.26460981 0 0 0 3.6269531 4.5761719L2.8320312 3.78125A.26460981.26460981 0 0 0 2.6464844 3.7050781zM9.2597656 8.4667969a.26460981.26460981 0 0 0-.1855468.078125l-.1875.1855469H6.3496094a.26460981.26460981 0 0 0-.1875.078125L5.8984375 9.0742188A.26460981.26460981 0 0 0 5.8652344 9.40625l.5292968.794922a.26460981.26460981 0 0 0 .15625.109375L7.5566406 10.5625 8.5722656 11.324219 8.890625 10.900391 7.8320312 10.107422A.26460981.26460981 0 0 0 7.7363281 10.0625L6.7773438 9.8222656 6.4257812 9.2949219 6.4589844 9.2597656h2.5371094a.26460981.26460981 0 0 0 .1875-.076172l.1855468-.1875H11.113281V8.4667969zM5.5410156 3.7050781A.26460981.26460981 0 0 0 5.3984375 3.7578125L4.3398438 4.5507812a.26460981.26460981 0 0 0 .011719.4316407l.7929687.5292969a.26460981.26460981 0 0 0 .2109376.037109l.9375-.234375L7.25 6.0332031A.26460981.26460981 0 0 0 7.34375 6.078125L8.4023438 6.3417969A.26460981.26460981 0 0 0 8.7304688 6.0859375V5.2910156a.26460981.26460981 0 0 0-.1796876-.25L8.0859375 4.8847656 8.421875 4.3808594A.26460981.26460981 0 0 0 8.2011719 3.96875H6.6484375L5.6210938 3.7128906a.26460981.26460981 0 0 0-.080078-.00781zm.072266.5507813l.9375.234375a.26460981.26460981 0 0 0 .064453.00781h1.09375L7.453125 4.8808594A.26460981.26460981 0 0 0 7.5898438 5.2773438L8.2011719 5.4824219V5.7460938L7.5234375 5.5761719 6.5078125 4.8144531A.26460981.26460981 0 0 0 6.2851562 4.7695312L5.3417969 5.0058594 4.9550781 4.75zM10.583984 2.9101562c-.8736177 0-1.5878903.7142726-1.5878902 1.5878907 0 .6394097.3826069 1.1540913.7382812 1.5097656.355674.3556743.712891.5683594.712891.5683594a.26460978.26460978 0 0 0 .271484 0c0 0 .357216-.2126851.712891-.5683594.355674-.3556743.738281-.8703559.738281-1.5097656 0-.8736182-.712319-1.5878907-1.585938-1.5878907zm0 .5292969c.587636 0 1.058594.4709585 1.058594 1.0585938 0 .4189236-.2782.8289816-.583984 1.1347656-.237462.2374618-.380639.3195291-.47461.3808594-.09359-.06105-.236685-.1429354-.474609-.3808594-.305784-.305784-.5839844-.715842-.5839844-1.1347656 0-.5876353.4709585-1.0585938 1.0585934-1.0585938z"}),(0,e.jsx)(t.Path,{d:"M10.552734 3.7011719A.26460981.26460981 0 0 0 10.318359 3.96875v.5292969a.26460981.26460981 0 0 0 .07813.1875l.263672.2636719a.26460981.26460981 0 1 0 .375-.3730469l-.1875-.1875V3.96875A.26460981.26460981 0 0 0 10.552734 3.7011719zM6.3496094 0C5.4759913 0 4.7617187.71427251 4.7617188 1.5878906c0 .6394097.38456 1.1540913.7402343 1.5097656.3556743.3556744.7128907.5683594.7128907.5683594a.26460978.26460978 0 0 0 .2714843 0c0 0 .3572163-.212685.7128907-.5683594C7.5548931 2.7419819 7.9375001 2.2273004 7.9375 1.5878906 7.9374999.71427255 7.2232275 0 6.3496094 0zm0 .52929688c.5876353-1e-8 1.0585936.47095842 1.0585937 1.05859372 1e-7.4189236-.2782003.8289816-.5839843 1.1347656C6.5862948 2.9605802 6.4432048 3.0424657 6.3496094 3.1035156 6.2556392 3.0421854 6.1124618 2.960118 5.875 2.7226562 5.569216 2.4168722 5.2910156 2.0068142 5.2910156 1.5878906c0-.5876352.4709585-1.05859372 1.0585938-1.05859372z"}),(0,e.jsx)(t.Path,{d:"M6.3457031.7890625A.26460981.26460981 0 0 0 6.0859375 1.0585938v.5292968a.26460981.26460981 0 0 0 .076172.1875l.265625.2636719a.26460981.26460981 0 1 0 .3730468-.375L6.6152344 1.4785156V1.0585938A.26460981.26460981 0 0 0 6.3457031.7890625zM4.2324219 6.6152344c-.8736181 0-1.5859375.7123194-1.5859375 1.5859375 0 .6394098.3826069 1.1560444.7382812 1.5117187.3556743.3556744.7128906.5683594.7128906.5683594a.26460978.26460978 0 0 0 .2714844 0c0 0 .3572162-.212685.7128906-.5683594.3556745-.3556743.7382813-.8723088.7382813-1.5117187 0-.8736182-.7142723-1.5859375-1.5878906-1.5859375zm0 .5292968c.5876356 0 1.0585937.4690054 1.0585937 1.0566407 0 .4189238-.2782003.8309347-.5839844 1.1367187C4.4697022 9.5752196 4.3284523 9.6573395 4.234375 9.71875 4.1407796 9.6577 3.9976896 9.5758146 3.7597656 9.3378906 3.4539816 9.0321066 3.1757812 8.6200957 3.1757812 8.2011719c0-.5876353.4690054-1.0566407 1.0566407-1.0566407z"}),(0,e.jsx)(t.Path,{d:"M 4.2285156,7.4042969 A 0.26460981,0.26460981 0 0 0 3.96875,7.6738281 v 0.5273438 a 0.26460981,0.26460981 0 0 0 0.078125,0.1875 l 0.2636719,0.265625 a 0.26516504,0.26516504 0 1 0 0.375,-0.375 l -0.1875,-0.1875 V 7.6738281 A 0.26460981,0.26460981 0 0 0 4.2285156,7.4042969 Z"})]}),variations:n,edit:o=>{const{clientId:t}=o,s=(0,h.useSelect)(o=>o(d.store).getBlocks(t).length>0,[t])?v:p;return(0,e.jsx)(s,{...o})},save:()=>(0,e.jsx)(d.InnerBlocks.Content,{})})}},e={};function s(o){var l=e[o];if(void 0!==l)return l.exports;var r=e[o]={exports:{}};return t[o](r,r.exports,s),r.exports}s.m=t,o=[],s.O=(t,e,l,r)=>{if(!e){var a=1/0;for(d=0;d<o.length;d++){for(var[e,l,r]=o[d],c=!0,n=0;n<e.length;n++)(!1&r||a>=r)&&Object.keys(s.O).every(o=>s.O[o](e[n]))?e.splice(n--,1):(c=!1,r<a&&(a=r));if(c){o.splice(d--,1);var i=l();void 0!==i&&(t=i)}}return t}r=r||0;for(var d=o.length;d>0&&o[d-1][2]>r;d--)o[d]=o[d-1];o[d]=[e,l,r]},s.o=(o,t)=>Object.prototype.hasOwnProperty.call(o,t),(()=>{var o={390:0,775:0};s.O.j=t=>0===o[t];var t=(t,e)=>{var l,r,[a,c,n]=e,i=0;if(a.some(t=>0!==o[t])){for(l in c)s.o(c,l)&&(s.m[l]=c[l]);if(n)var d=n(s)}for(t&&t(e);i<a.length;i++)r=a[i],s.o(o,r)&&o[r]&&o[r][0](),o[r]=0;return s.O(d)},e=globalThis.webpackChunk_sanketio_world_clocks=globalThis.webpackChunk_sanketio_world_clocks||[];e.forEach(t.bind(null,0)),e.push=t.bind(null,e.push.bind(e))})();var l=s.O(void 0,[775],()=>s(912));l=s.O(l)})(); -
world-clocks/trunk/includes/blocks/clock/edit.js
r3137248 r3669127 14 14 */ 15 15 import TimezoneSelector from './timezone-selector'; 16 import { resolveTimezone } from './resolve-timezone'; 16 17 import { getDateTimeData } from '../../../assets/js/utils'; 17 18 … … 261 262 const { timezone, clockLabel } = attributes; 262 263 263 // Format timezone for Date object.264 const formattedTimezone = timezone.replace(' ', '_');264 // Resolve to an IANA identifier; blocks saved before 1.1.0 hold a translated display string. 265 const formattedTimezone = resolveTimezone(timezone); 265 266 266 267 const blockProps = useBlockProps(); -
world-clocks/trunk/includes/blocks/clock/markup.php
r3137248 r3669127 18 18 use function WorldClocks\Helpers\has_analog_clock_reverse_layout; 19 19 use function WorldClocks\Helpers\has_digital_clock_layout; 20 use function WorldClocks\Helpers\resolve_timezone; 20 21 21 22 $has_digital_clocks = has_digital_clock_layout( $context ); … … 28 29 $wrapper_attributes = get_block_wrapper_attributes( 29 30 [ 30 'data-timezone' => str_replace( ' ', '_',$attributes['timezone'] ),31 'data-timezone' => resolve_timezone( $attributes['timezone'] ), 31 32 ] 32 33 ); -
world-clocks/trunk/includes/blocks/clock/timezone-selector.js
r3137248 r3669127 8 8 import { __ } from '@wordpress/i18n'; 9 9 import { UP, DOWN, ENTER, ESCAPE } from '@wordpress/keycodes'; 10 11 /** 12 * Internal dependencies 13 */ 14 import { resolveTimezone, displayTimezone } from './resolve-timezone'; 10 15 11 16 /** … … 41 46 return ( 42 47 !timezoneObj?.disabled && 43 timezoneObj. value.toLowerCase().includes(timezoneString.toLowerCase())48 timezoneObj.display.toLowerCase().includes(timezoneString.toLowerCase()) 44 49 ); 45 50 }); … … 51 56 foundTimezones.forEach((timezoneObj) => { 52 57 let continentClockLabel = 'UTC'; 53 if (timezoneObj. value.includes('/')) {58 if (timezoneObj.display.includes('/')) { 54 59 // Get the continent name 55 const continentTimezone = timezoneObj. value.split('/');60 const continentTimezone = timezoneObj.display.split('/'); 56 61 57 62 continentClockLabel = continentTimezone[0]; 58 63 } else if ( 59 timezoneObj. value.includes(`${continentClockLabel}-`) ||60 timezoneObj. value.includes(`${continentClockLabel}+`)64 timezoneObj.display.includes(`${continentClockLabel}-`) || 65 timezoneObj.display.includes(`${continentClockLabel}+`) 61 66 ) { 62 67 continentClockLabel = 'Manual Offsets'; … … 84 89 }; 85 90 86 // Default values. 87 const defaultUserInput = timezone || 'UTC'; 88 const defaultFilteredTimezones = timezone ? filterTimezones(timezone) : timezones; 91 // Default values. Blocks saved before 1.1.0 hold a translated display string, so resolve first. 92 const resolvedTimezone = resolveTimezone(timezone); 93 const defaultUserInput = displayTimezone(resolvedTimezone); 94 const defaultFilteredTimezones = timezone ? filterTimezones(defaultUserInput) : timezones; 89 95 90 96 const [activeTimezone, setActiveSuggestion] = useState(1); … … 148 154 } 149 155 150 const foundTimezones = filterTimezones(filteredTimezones[activeTimezone].value); 156 const selected = filteredTimezones[activeTimezone]; 157 const foundTimezones = filterTimezones(selected.display); 151 158 152 159 // Only override timezone label if timezone is updated. 153 if ( timezone !== filteredTimezones[activeTimezone].value) {154 setAttributes({ clockLabel: filteredTimezones[activeTimezone].value});155 } 156 157 setAttributes({ timezone: filteredTimezones[activeTimezone].value });160 if (resolvedTimezone !== selected.value) { 161 setAttributes({ clockLabel: selected.display }); 162 } 163 164 setAttributes({ timezone: selected.value }); 158 165 159 166 setActiveSuggestion(1); 160 167 setShowSuggestions(false); 161 setUserInput( filteredTimezones[activeTimezone].value);168 setUserInput(selected.display); 162 169 setFilteredTimezones(foundTimezones); 163 170 } else if (keyCode === UP) { … … 213 220 214 221 const selectedTimezone = event.target.dataset.timezoneValue; 215 const foundTimezones = filterTimezones(selectedTimezone); 222 const selectedDisplay = event.target.dataset.timezoneDisplay; 223 const foundTimezones = filterTimezones(selectedDisplay); 216 224 217 225 // Only override timezone label if timezone is updated. 218 if ( timezone !== selectedTimezone) {219 setAttributes({ clockLabel: selected Timezone});226 if (resolvedTimezone !== selectedTimezone) { 227 setAttributes({ clockLabel: selectedDisplay }); 220 228 } 221 229 … … 224 232 setActiveSuggestion(1); 225 233 setFilteredTimezones(foundTimezones); 226 setUserInput(selected Timezone);234 setUserInput(selectedDisplay); 227 235 setShowSuggestions(false); 228 236 }; … … 250 258 } 251 259 252 if (timezoneObj.value === defaultUserInput) {260 if (timezoneObj.value === resolvedTimezone) { 253 261 className += ' timezone-selected'; 254 262 } … … 259 267 260 268 let clockLabelText = timezoneObj.label; 261 if (timezoneObj.value === defaultUserInput) {269 if (timezoneObj.value === resolvedTimezone) { 262 270 clockLabelText += ` ${__('(Selected)', 'world-clocks')}`; 263 271 } … … 268 276 key={timezoneObj.value} 269 277 data-timezone-value={timezoneObj.value} 278 data-timezone-display={timezoneObj.display} 270 279 onClick={onClick} 271 280 disabled={timezoneObj?.disabled} -
world-clocks/trunk/includes/blocks/clocks/block.json
r3469508 r3669127 66 66 "style": "file:../../../dist/style-clocks-block.css", 67 67 "viewScript": "file:../../../dist/frontend.js", 68 "viewStyle": "file:../../../dist/ frontend.css"68 "viewStyle": "file:../../../dist/style-frontend.css" 69 69 } -
world-clocks/trunk/includes/blocks/clocks/markup.php
r3137248 r3669127 25 25 } 26 26 27 // WordPress 7.1 drops boolean values from get_block_wrapper_attributes(); '1'/'' matches what esc_attr() produced on earlier versions. 27 28 $wrapper_attributes = get_block_wrapper_attributes( 28 29 [ 29 30 'class' => join( ' ', $css_classes ), 30 'data-showclocksampmindicator' => $attributes['showClocksAmPmIndicator'] ,31 'data-showdigitaltime' => $attributes['showDigitalTime'] ,31 'data-showclocksampmindicator' => $attributes['showClocksAmPmIndicator'] ? '1' : '', 32 'data-showdigitaltime' => $attributes['showDigitalTime'] ? '1' : '', 32 33 'data-timeformat' => $attributes['timeFormat'], 33 'data-showdate' => $attributes['showDate'] ,34 'data-showdate' => $attributes['showDate'] ? '1' : '', 34 35 'data-dateformat' => $attributes['dateFormat'], 35 36 'data-layout' => $attributes['layout'], -
world-clocks/trunk/includes/helpers.php
r3137248 r3669127 42 42 ], 43 43 [ 44 'value' => 'UTC', 45 'label' => 'UTC', 44 'value' => 'UTC', 45 'label' => 'UTC', 46 'display' => 'UTC', 46 47 ], 47 48 ]; … … 53 54 54 55 // Loop through all the timezones and save it to return array with formatted value. 55 foreach ( $tz_identifiers as $ zone) {56 57 $zone = explode( '/', $ zone);56 foreach ( $tz_identifiers as $identifier ) { 57 58 $zone = explode( '/', $identifier ); 58 59 if ( ! in_array( $zone[0], $continents, true ) ) { 59 60 continue; … … 81 82 'value' => "t{$continent}", 82 83 'label' => $continent, 84 'display' => $continent, 83 85 'disabled' => true, 84 86 ]; … … 87 89 } 88 90 91 // 'value' is the IANA identifier so it survives a locale change; 'display' carries the translated text. 89 92 $structure[] = [ 90 'value' => "{$continent}/{$value}", 91 'label' => $value, 93 'value' => $identifier, 94 'label' => $value, 95 'display' => "{$continent}/{$value}", 92 96 ]; 93 97 } … … 160 164 161 165 $structure[] = [ 162 'value' => "UTC{$offset}", 163 'label' => "UTC{$offset}", 166 'value' => "UTC{$offset}", 167 'label' => "UTC{$offset}", 168 'display' => "UTC{$offset}", 164 169 ]; 165 170 } 166 171 167 172 return $structure; 173 } 174 175 /** 176 * Resolve a saved timezone attribute to an IANA identifier. 177 * 178 * Blocks saved before 1.1.0 stored the translated display string rather than the identifier. 179 * 180 * @param string $timezone Timezone as stored on the block. 181 * 182 * @return string 183 */ 184 function resolve_timezone( $timezone ) { 185 186 if ( empty( $timezone ) ) { 187 return 'UTC'; 188 } 189 190 // UTC and manual offsets are already in their final form. 191 if ( str_starts_with( $timezone, 'UTC' ) ) { 192 return $timezone; 193 } 194 195 // Identifiers, and the pre-1.1.0 English form that only differed by spaces. 196 $candidate = str_replace( ' ', '_', $timezone ); 197 if ( in_array( $candidate, timezone_identifiers_list(), true ) ) { 198 return $candidate; 199 } 200 201 // Pre-1.1.0 translated values, resolvable while the site locale is unchanged. 202 foreach ( get_timezones() as $entry ) { 203 if ( empty( $entry['disabled'] ) && isset( $entry['display'] ) && $entry['display'] === $timezone ) { 204 return $entry['value']; 205 } 206 } 207 208 return $timezone; 168 209 } 169 210 … … 206 247 207 248 return in_array( $context['world-clocks/layout'], $digital_clock_layouts, true ) || $context['world-clocks/showDigitalTime']; 208 } ;249 } 209 250 210 251 /** … … 228 269 function has_analog_clock_reverse_layout( $context ) { 229 270 return 'clock-reverse' === $context['world-clocks/layout']; 230 } ;271 } -
world-clocks/trunk/languages/world-clocks.pot
r3469508 r3669127 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: World Clocks 1. 0.3\n"5 "Project-Id-Version: World Clocks 1.1.0\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/world-clocks\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2026-0 2-25T13:31:44+00:00\n"12 "POT-Creation-Date: 2026-08-27T19:03:30+05:30\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.12.0\n" … … 40 40 msgstr "" 41 41 42 #: includes/helpers.php:15 542 #: includes/helpers.php:159 43 43 msgid "Manual Offsets" 44 44 msgstr "" 45 45 46 #: dist/clock-block.js:1 47 #: includes/blocks/clock/timezone-selector.js:262 46 #: includes/blocks/clock/timezone-selector.js:270 48 47 msgid "(Selected)" 49 48 msgstr "" 50 49 51 #: dist/clock-block.js:1 52 #: includes/blocks/clock/timezone-selector.js:290 50 #: includes/blocks/clock/timezone-selector.js:299 53 51 msgid "Timezone Settings" 54 52 msgstr "" 55 53 56 #: dist/clock-block.js:1 57 #: includes/blocks/clock/timezone-selector.js:295 54 #: includes/blocks/clock/timezone-selector.js:304 58 55 msgid "Select Timezone" 59 56 msgstr "" 60 57 61 #: dist/clock-block.js:1 62 #: includes/blocks/clock/timezone-selector.js:301 58 #: includes/blocks/clock/timezone-selector.js:310 63 59 msgid "Click on the textbox and start typing to find the suitable timezone. You can remove existing selected timezone and search more." 64 60 msgstr "" 65 61 66 #: dist/clock-block.js:1 67 #: includes/blocks/clock/timezone-selector.js:309 62 #: includes/blocks/clock/timezone-selector.js:318 68 63 msgid "Timezone Label" 69 64 msgstr "" 70 65 71 #: dist/clock-block.js:1 72 #: includes/blocks/clock/timezone-selector.js:312 66 #: includes/blocks/clock/timezone-selector.js:321 73 67 msgid "Override default timezone label." 74 68 msgstr "" 75 69 76 #: dist/clocks-block.js:1 70 #: includes/blocks/clocks/edit.js:127 71 msgid "Visibility Settings" 72 msgstr "" 73 74 #: includes/blocks/clocks/edit.js:131 75 msgid "Clocks per row" 76 msgstr "" 77 78 #: includes/blocks/clocks/edit.js:141 79 msgid "Stack on mobile" 80 msgstr "" 81 82 #: includes/blocks/clocks/edit.js:153 83 msgid "Show Clocks AmPm Indicator" 84 msgstr "" 85 86 #: includes/blocks/clocks/edit.js:161 87 msgid "Show Digital Time" 88 msgstr "" 89 90 #: includes/blocks/clocks/edit.js:173 91 msgid "Time Format" 92 msgstr "" 93 94 #: includes/blocks/clocks/edit.js:175 95 msgid "Enter a time <Link>format string</Link>." 96 msgstr "" 97 98 #: includes/blocks/clocks/edit.js:179 99 #: includes/blocks/clocks/edit.js:222 100 msgid "https://wordpress.org/documentation/article/customize-date-and-time-format/" 101 msgstr "" 102 103 #: includes/blocks/clocks/edit.js:196 104 msgid "The date format keys (\"d\", \"j\", \"S\", \"l\", \"D\", \"m\", \"n\", \"F\", \"M\", \"Y\", \"y\", \"c\", \"r\", \"U\") are not allowed in time format." 105 msgstr "" 106 107 #: includes/blocks/clocks/edit.js:206 108 msgid "Show Date" 109 msgstr "" 110 111 #: includes/blocks/clocks/edit.js:216 112 msgid "Date Format" 113 msgstr "" 114 115 #: includes/blocks/clocks/edit.js:218 116 msgid "Enter a date <Link>format string</Link>." 117 msgstr "" 118 119 #: includes/blocks/clocks/edit.js:239 120 msgid "The time format keys (\"a\", \"A\", \"g\", \"h\", \"G\", \"H\", \"i\", \"s\", \"T\", \"c\", \"r\", \"U\") are not allowed in date format." 121 msgstr "" 122 123 #: includes/blocks/clocks/edit.js:262 124 msgid "Layout" 125 msgstr "" 126 77 127 #: includes/blocks/clocks/edit.js:274 78 128 #: includes/blocks/clocks/variations.js:20 … … 80 130 msgstr "" 81 131 82 #: dist/clocks-block.js:183 132 #: includes/blocks/clocks/edit.js:280 84 133 #: includes/blocks/clocks/variations.js:29 … … 86 135 msgstr "" 87 136 88 #: dist/clocks-block.js:189 137 #: includes/blocks/clocks/edit.js:286 90 138 #: includes/blocks/clocks/variations.js:37 … … 92 140 msgstr "" 93 141 94 #: dist/clocks-block.js:195 142 #: includes/blocks/clocks/edit.js:292 96 143 #: includes/blocks/clocks/variations.js:45 … … 98 145 msgstr "" 99 146 100 #: dist/clocks-block.js:1101 #: includes/blocks/clocks/edit.js:127102 msgid "Visibility Settings"103 msgstr ""104 105 #: dist/clocks-block.js:1106 #: includes/blocks/clocks/edit.js:131107 msgid "Clocks per row"108 msgstr ""109 110 #: dist/clocks-block.js:1111 #: includes/blocks/clocks/edit.js:141112 msgid "Stack on mobile"113 msgstr ""114 115 #: dist/clocks-block.js:1116 #: includes/blocks/clocks/edit.js:153117 msgid "Show Clocks AmPm Indicator"118 msgstr ""119 120 #: dist/clocks-block.js:1121 #: includes/blocks/clocks/edit.js:161122 msgid "Show Digital Time"123 msgstr ""124 125 #: dist/clocks-block.js:1126 #: includes/blocks/clocks/edit.js:173127 msgid "Time Format"128 msgstr ""129 130 #: dist/clocks-block.js:1131 #: includes/blocks/clocks/edit.js:175132 msgid "Enter a time <Link>format string</Link>."133 msgstr ""134 135 #: dist/clocks-block.js:1136 #: includes/blocks/clocks/edit.js:179137 #: includes/blocks/clocks/edit.js:222138 msgid "https://wordpress.org/documentation/article/customize-date-and-time-format/"139 msgstr ""140 141 #: dist/clocks-block.js:1142 #: includes/blocks/clocks/edit.js:196143 msgid "The date format keys (\"d\", \"j\", \"S\", \"l\", \"D\", \"m\", \"n\", \"F\", \"M\", \"Y\", \"y\", \"c\", \"r\", \"U\") are not allowed in time format."144 msgstr ""145 146 #: dist/clocks-block.js:1147 #: includes/blocks/clocks/edit.js:206148 msgid "Show Date"149 msgstr ""150 151 #: dist/clocks-block.js:1152 #: includes/blocks/clocks/edit.js:216153 msgid "Date Format"154 msgstr ""155 156 #: dist/clocks-block.js:1157 #: includes/blocks/clocks/edit.js:218158 msgid "Enter a date <Link>format string</Link>."159 msgstr ""160 161 #: dist/clocks-block.js:1162 #: includes/blocks/clocks/edit.js:239163 msgid "The time format keys (\"a\", \"A\", \"g\", \"h\", \"G\", \"H\", \"i\", \"s\", \"T\", \"c\", \"r\", \"U\") are not allowed in date format."164 msgstr ""165 166 #: dist/clocks-block.js:1167 #: includes/blocks/clocks/edit.js:262168 msgid "Layout"169 msgstr ""170 171 #: dist/clocks-block.js:1172 147 #: includes/blocks/clocks/edit.js:311 173 148 msgid "Marks Format" 174 149 msgstr "" 175 150 176 #: dist/clocks-block.js:1177 151 #: includes/blocks/clocks/edit.js:325 178 152 msgid "Number" 179 153 msgstr "" 180 154 181 #: dist/clocks-block.js:1182 155 #: includes/blocks/clocks/edit.js:331 183 156 msgid "Combine" 184 157 msgstr "" 185 158 186 #: dist/clocks-block.js:1187 159 #: includes/blocks/clocks/edit.js:337 188 160 msgid "Line" 189 161 msgstr "" 190 162 191 #: dist/clocks-block.js:1192 163 #: includes/blocks/clocks/edit.js:443 193 164 msgid "Select a layout:" -
world-clocks/trunk/readme.txt
r3469508 r3669127 2 2 Contributors: sanket.parmar 3 3 Tags: clock, watch, time, timezone 4 Requires at least: 6. 45 Tested up to: 6.9.16 Stable tag: 1. 0.34 Requires at least: 6.6 5 Tested up to: 7.1 6 Stable tag: 1.1.0 7 7 Requires PHP: 8.0 8 8 License: GPLv2 or later … … 146 146 == Changelog == 147 147 148 = 1.1.0 - 2026-08-27 = 149 * **Changed:** Minimum supported WordPress version is now 6.6. 150 * **Changed:** Bump WordPress "tested up to" version to 7.1. 151 * **Fixed:** AM/PM indicator no longer disappears from analog clocks on WordPress 7.1. 152 * **Fixed:** Timezones are stored as IANA identifiers, so clocks work on sites in any language. Clocks saved by earlier versions keep working without being re-saved. 153 * **Fixed:** Editor preview now matches the frontend for timezones such as Asia/Ho Chi Minh. 154 148 155 = 1.0.3 - 2026-02-25 = 149 156 * **Changed:** Bump WordPress "tested up to" version to 6.9.1. -
world-clocks/trunk/world-clocks.php
r3469508 r3669127 4 4 * Plugin URI: https://wordpress.org/plugins/world-clocks/ 5 5 * Description: Enable world clocks for the sites with different timezones, with a custom block for the WordPress block editor (Gutenberg). 6 * Version: 1. 0.37 * Requires at least: 6. 46 * Version: 1.1.0 7 * Requires at least: 6.6 8 8 * Requires PHP: 8.0 9 9 * Author: Sanket Parmar … … 23 23 } 24 24 25 define( 'CLOCKS_VERSION', '1. 0.3' );25 define( 'CLOCKS_VERSION', '1.1.0' ); 26 26 define( 'CLOCKS_PLUGIN_DIR', trailingslashit( __DIR__ ) ); 27 27 define( 'CLOCKS_PLUGIN_URL', trailingslashit( plugin_dir_url( __FILE__ ) ) );
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)