PluginProbe
Getwid – Gutenberg Blocks / 3.0.1
Getwid – Gutenberg Blocks v3.0.1
3.0.2 3.0.1 3.0.0 2.1.0 2.1.1 2.1.2 2.1.3 2.2.0 trunk 1.8.7 1.9.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.14 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9
getwid / assets / blocks / countdown / index.js

index.js in Getwid – Gutenberg Blocks 3.0.1, at assets/blocks/countdown/index.js

1 lines 9.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (()=>{"use strict";var e={5588(e,t,n){const o=window.wp.blocks,l=window.wp.i18n,i=window.GetwidComponents,a=window.wp.components,r=window.ReactJSXRuntime;function s(){return(0,r.jsxs)(a.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:[(0,r.jsx)(a.Polygon,{points:"12,14 12,10 10,10 10,14 10,16 12,16 16,16 16,14"}),(0,r.jsx)(a.Path,{d:"M15,4.46V1l-5,4l5,4V6.59c2.93,1.19,5,4.06,5,7.41c0,4.41-3.59,8-8,8s-8-3.59-8-8H2c0,5.52,4.48,10,10,10s10-4.48,10-10C22,9.53,19.06,5.74,15,4.46z"})]})}const d=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","apiVersion":3,"textdomain":"getwid","name":"getwid/countdown","description":"Counts down to a chosen date and time.","category":"getwid-blocks","title":"Countdown","supports":{"alignWide":true,"align":["wide","full"]},"attributes":{"dateTime":{"type":"string"},"years":{"type":"boolean","default":false},"months":{"type":"boolean","default":false},"weeks":{"type":"boolean","default":false},"days":{"type":"boolean","default":true},"hours":{"type":"boolean","default":true},"minutes":{"type":"boolean","default":true},"seconds":{"type":"boolean","default":true},"backgroundColor":{"type":"string"},"textColor":{"type":"string"},"customTextColor":{"type":"string"},"fontGroupID":{"type":"string","default":""},"fontFamily":{"type":"string","default":""},"fontSize":{"type":"string"},"fontSizeTablet":{"type":"string","default":"fs-tablet-100"},"fontSizeMobile":{"type":"string","default":"fs-mobile-100"},"fontWeight":{"type":"string"},"fontStyle":{"type":"string"},"textTransform":{"type":"string"},"lineHeight":{"type":"string"},"letterSpacing":{"type":"string"},"align":{"type":"string"},"textAlignment":{"type":"string"},"innerPadding":{"type":"string","default":"default"},"innerSpacings":{"type":"string","default":"none"},"className":{"type":"string"}},"editorScript":"file:./index.js","editorStyle":"file:./index.css","style":["file:./style-index.css"],"viewScript":["jquery-countdown","file:./view.js"]}'),g=window.wp.blockEditor,u=window.wp.element,c=window.wp.serverSideRender,w=window.jQuery;var p=n.n(w);const _=window.wp.date;function b(e){const[t,n]=(0,u.useState)("general"),{attributes:o,setAttributes:s,textColor:d,setTextColor:c}=e,{dateTime:w,years:p,months:b,weeks:f,days:h,hours:m,minutes:v,seconds:y,fontFamily:x,fontWeight:C,fontStyle:j,textTransform:S,lineHeight:k,letterSpacing:T,backgroundColor:O,innerPadding:B,innerSpacings:P}=o,F=(0,_.getDate)(),M=w?new Date(w).toLocaleString():(0,_.date)("d.m.Y, H:i:s",F);return(0,r.jsxs)(g.InspectorControls,{children:[(0,r.jsx)(i.TabsControl,{state:t,onChangeTab:e=>n(e),tabs:["general","style"]}),"general"===t&&(0,r.jsxs)(a.PanelBody,{initialOpen:!0,children:[(0,r.jsx)(a.BaseControl,{id:"",label:(0,l.__)("Time","getwid"),__nextHasNoMarginBottom:!0,children:(0,r.jsx)(a.Dropdown,{popoverProps:{placement:"bottom-end",noArrow:!1},renderToggle:({isOpen:e,onToggle:t})=>(0,r.jsx)(a.Button,{variant:"primary",onClick:t,"aria-expanded":e,children:M}),renderContent:()=>(0,r.jsx)(a.DateTimePicker,{currentDate:w||F,onChange:e=>s({dateTime:e}),__nextRemoveHelpButton:!0,__nextRemoveResetButton:!0})})}),(0,r.jsx)(a.ToggleControl,{label:(0,l.__)("Years","getwid"),checked:p,onChange:e=>s({years:e})}),(0,r.jsx)(a.ToggleControl,{label:(0,l.__)("Months","getwid"),checked:b,onChange:e=>s({months:e})}),(0,r.jsx)(a.ToggleControl,{label:(0,l.__)("Weeks","getwid"),checked:f,onChange:e=>s({weeks:e})}),(0,r.jsx)(a.ToggleControl,{label:(0,l.__)("Days","getwid"),checked:h,onChange:e=>s({days:e})}),(0,r.jsx)(a.ToggleControl,{label:(0,l.__)("Hours","getwid"),checked:m,onChange:e=>s({hours:e})}),(0,r.jsx)(a.ToggleControl,{label:(0,l.__)("Minutes","getwid"),checked:v,onChange:e=>s({minutes:e})}),(0,r.jsx)(a.ToggleControl,{label:(0,l.__)("Seconds","getwid"),checked:y,onChange:e=>s({seconds:e})})]}),"style"===t&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)(a.PanelBody,{title:(0,l.__)("Font Settings","getwid"),initialOpen:!0,children:[(0,r.jsx)(i.FontsControl,{value:x,onChangeFontGroupID:e=>s({fontGroupID:e}),onChangeFontFamily:e=>s({fontFamily:e,fontWeight:"normal"}),valueWeight:C,onChangeFontWeight:e=>s({fontWeight:e})}),(0,r.jsx)(i.FontSizeControl,{attributes:o,setAttributes:s}),(0,r.jsx)(a.SelectControl,{label:(0,l.__)("Font Style","getwid"),value:j,options:[{value:"normal",label:(0,l.__)("Normal","getwid")},{value:"italic",label:(0,l.__)("Italic","getwid")},{value:"inherit",label:(0,l.__)("Inherit","getwid")}],onChange:e=>s({fontStyle:e}),__nextHasNoMarginBottom:!0}),(0,r.jsx)(a.SelectControl,{label:(0,l.__)("Text Transform","getwid"),value:S,options:[{value:"default",label:(0,l.__)("Default","getwid")},{value:"uppercase",label:(0,l.__)("Uppercase","getwid")},{value:"lowercase",label:(0,l.__)("Lowercase","getwid")}],onChange:e=>s({textTransform:e}),__nextHasNoMarginBottom:!0}),(0,r.jsx)(i.StyleLengthControl,{label:(0,l.__)("Line Height","getwid"),value:k,onChange:e=>s({lineHeight:e})}),(0,r.jsx)(i.StyleLengthControl,{label:(0,l.__)("Letter Spacing","getwid"),value:T,allowNegative:!0,units:[{label:"px",value:"px"},{label:"em",value:"em"},{label:"pt",value:"pt"},{label:"vh",value:"vh"},{label:"vw",value:"vw"}],onChange:e=>s({letterSpacing:e})})]}),(0,r.jsxs)(a.PanelBody,{title:(0,l.__)("Layout","getwid"),initialOpen:!1,children:[(0,r.jsx)(a.SelectControl,{label:(0,l.__)("Space around numbers","getwid"),value:B,options:[{value:"default",label:(0,l.__)("Default","getwid")},{value:"small",label:(0,l.__)("Small","getwid")},{value:"medium",label:(0,l.__)("Medium","getwid")},{value:"normal",label:(0,l.__)("Normal","getwid")},{value:"large",label:(0,l.__)("Large","getwid")}],onChange:e=>s({innerPadding:e}),__nextHasNoMarginBottom:!0}),(0,r.jsx)(a.SelectControl,{label:(0,l.__)("Space between numbers","getwid"),value:P,options:[{value:"none",label:(0,l.__)("None","getwid")},{value:"small",label:(0,l.__)("Small","getwid")},{value:"medium",label:(0,l.__)("Medium","getwid")},{value:"normal",label:(0,l.__)("Normal","getwid")},{value:"large",label:(0,l.__)("Large","getwid")}],onChange:e=>s({innerSpacings:e}),__nextHasNoMarginBottom:!0})]}),(0,r.jsx)(g.PanelColorSettings,{title:(0,l.__)("Colors","getwid"),initialOpen:!1,colorSettings:[{value:d.color,onChange:c,label:(0,l.__)("Text Color","getwid")},{value:O,onChange:e=>s({backgroundColor:e}),label:(0,l.__)("Background Color","getwid")}]})]})]})}function f(e){if(!e)return;const t=p()(".wp-block-getwid-countdown__content:not('.init-countdown')",e);if(!t.length)return;t.addClass("init-countdown");const n=t.data("datetime"),o=t.data("years"),l=t.data("months"),i=t.data("weeks"),a=t.data("days"),r=t.data("hours"),s=t.data("minutes"),d=t.data("seconds"),g=t.data("bg-color"),u="negative"===n?"":n;let c="";o&&(c+="Y"),l&&(c+="O"),i&&(c+="W"),a&&(c+="D"),r&&(c+="H"),s&&(c+="M"),d&&(c+="S");const w=t;"function"==typeof w.countdown&&w.countdown({until:u,format:c,onTick:()=>{g&&p()(".countdown-section",t).css("background-color",g)}})}const h=(0,g.withColors)({textColor:"color"})(function(e){const{attributes:t,setAttributes:n}=e,{fontGroupID:o,fontFamily:s,fontWeight:d,textAlignment:w}=t,p=(0,u.useRef)(null),_=!!s&&["","google-fonts"].includes(o);(0,u.useEffect)(()=>{const e=p.current;if(!e)return;const t=new MutationObserver(()=>{f(e)});return t.observe(e,{childList:!0,subtree:!0}),f(e),()=>t.disconnect()},[]);const h=[{icon:"editor-alignleft",title:(0,l.__)("Left","getwid"),value:"left"},{icon:"editor-aligncenter",title:(0,l.__)("Center","getwid"),value:"center"},{icon:"editor-alignright",title:(0,l.__)("Right","getwid"),value:"right"},{icon:"editor-justify",title:(0,l.__)("Justify","getwid"),value:"justify"}];return(0,r.jsxs)(r.Fragment,{children:[_&&(0,r.jsx)(i.GoogleFontLoader,{fonts:[{font:s,weights:[d]}]}),(0,r.jsx)(g.BlockControls,{children:(0,r.jsx)(a.ToolbarGroup,{children:h.map(e=>(0,r.jsx)(a.ToolbarButton,{icon:e.icon,label:e.title,isPressed:w===e.value,onClick:()=>n({textAlignment:e.value})},e.value))})}),(0,r.jsx)(b,{...e}),(0,r.jsx)("div",{...(0,g.useBlockProps)(),children:(0,r.jsx)("div",{ref:p,children:(0,r.jsx)(c.ServerSideRender,{block:"getwid/countdown",attributes:t})})})]})});(0,o.registerBlockType)(d,{title:(0,l.__)("Countdown","getwid"),icon:(0,r.jsx)(s,{}),keywords:[(0,l.__)("timer","getwid")],edit:(0,i.MaybeBlockIsDisabled)("getwid/countdown")||h,save:()=>null})}};const t={};function n(o){const l=t[o];if(void 0!==l)return l.exports;const i=t[o]={exports:{}};return e[o](i,i.exports,n),i.exports}n.m=e,(()=>{const e=[];n.O=(t,o,l,i)=>{if(o){i=i||0;for(var a=e.length;a>0&&e[a-1][2]>i;a--)e[a]=e[a-1];return void(e[a]=[o,l,i])}let r=1/0;for(a=0;a<e.length;a++){let[o,l,i]=e[a],d=!0;for(var s=0;s<o.length;s++)(!1&i||r>=i)&&Object.keys(n.O).every(e=>n.O[e](o[s]))?o.splice(s--,1):(d=!1,i<r&&(r=i));if(d){e.splice(a--,1);const n=l();void 0!==n&&(t=n)}}return t}})(),n.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{if(Array.isArray(t))for(var o=0;o<t.length;){var l=t[o++],i=t[o++];n.o(e,l)?0===i&&o++:0===i?Object.defineProperty(e,l,{enumerable:!0,value:t[o++]}):Object.defineProperty(e,l,{enumerable:!0,get:i})}else for(var l in t)n.o(t,l)&&!n.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},n.o=(e,t)=>Object.hasOwn(e,t),(()=>{const e={1449:0,6797:0};n.O.j=t=>0===e[t];const t=(t,o)=>{let[l,i,a]=o;var r,s,d=0;if(l.some(t=>0!==e[t])){for(r in i)n.o(i,r)&&(n.m[r]=i[r]);if(a)var g=a(n)}for(t&&t(o);d<l.length;d++)s=l[d],n.o(e,s)&&e[s]&&e[s][0](),e[s]=0;return n.O(g)},o=globalThis.webpackChunkgetwid||=[];o.forEach(t.bind(null,0)),o.push=t.bind(null,o.push.bind(o))})();let o=n.O(void 0,[6797],()=>n(5588));o=n.O(o)})();