Changeset 3467105
- Timestamp:
- 02/22/2026 08:33:37 PM (13 days ago)
- Location:
- light-modal-block
- Files:
-
- 10 edited
- 1 copied
-
tags/1.9.0 (copied) (copied from light-modal-block/trunk)
-
tags/1.9.0/build/block.json (modified) (3 diffs)
-
tags/1.9.0/build/index.asset.php (modified) (1 diff)
-
tags/1.9.0/build/index.js (modified) (1 diff)
-
tags/1.9.0/light-modal-block.php (modified) (1 diff)
-
tags/1.9.0/readme.txt (modified) (2 diffs)
-
trunk/build/block.json (modified) (3 diffs)
-
trunk/build/index.asset.php (modified) (1 diff)
-
trunk/build/index.js (modified) (1 diff)
-
trunk/light-modal-block.php (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
light-modal-block/tags/1.9.0/build/block.json
r3399001 r3467105 3 3 "apiVersion": 3, 4 4 "name": "cloudcatch/light-modal-block", 5 "version": "1. 8.0",5 "version": "1.9.0", 6 6 "title": "Light Modal Block", 7 7 "category": "widgets", … … 15 15 }, 16 16 "label": { 17 "type": "string" 17 "type": "string", 18 "default": "" 18 19 }, 19 20 "backdropColor": { … … 42 43 }, 43 44 "triggerSelector": { 44 "type": "string" 45 "type": "string", 46 "default": "" 45 47 }, 46 48 "cookieDuration": { -
light-modal-block/tags/1.9.0/build/index.asset.php
r3399001 r3467105 1 <?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-edit or', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-plugins', 'wp-primitives'), 'version' => 'c01d4f2ec0d681ea6a77');1 <?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-plugins', 'wp-primitives'), 'version' => 'eb98fa866e2572ceed2f'); -
light-modal-block/tags/1.9.0/build/index.js
r3399001 r3467105 1 (()=>{var e,o={ 311:(e,o,l)=>{"use strict";var t={};l.r(t);const a=window.wp.blocks;var i=l(942),n=l.n(i);const r=window.wp.i18n,d=window.wp.blockEditor,s=window.wp.element,c=window.wp.components,h=window.wp.data,g=window.wp.editor;let u=e=>crypto.getRandomValues(new Uint8Array(e));const b=()=>((e,o=21)=>((e,o,l)=>{let t=(2<<Math.log2(e.length-1))-1,a=-~(1.6*t*o/e.length);return(i=o)=>{let n="";for(;;){let o=l(a),r=0|a;for(;r--;)if(n+=e[o[r]&t]||"",n.length>=i)return n}}})(e,0|o,u))("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",11)(),m=()=>(0,h.useSelect)(e=>{const o=[],l=e(d.store).getBlocks(),t=e=>{e?.innerBlocks&&e.innerBlocks.forEach(e=>{"cloudcatch/light-modal-block"===e.name&&o.push(e),t(e)})};return l.forEach(e=>{"cloudcatch/light-modal-block"===e.name&&o.push(e),t(e)}),o}),p=window.ReactJSXRuntime,_=(0,c.withNotices)(function(e){const{attributes:o,setAttributes:l,isSelected:t,clientId:a}=e,{id:i,label:u,width:_,backdropColor:k,enableCloseButton:x,closeIconColor:w,closeBackgroundColor:v,triggerDelay:C,enableTriggerDelay:f,triggerSelector:j,cookieDuration:y,interactionSetsCookie:B,autoplayMedia:S}=o,M=m();(0,s.useEffect)(()=>{const e=M.filter((e,o,l)=>l.find(o=>o.attributes.id===e.attributes.id&&o.clientId!==e.clientId));if(!(e.length<=1))for(let o=1;o<e.length;o++)(0,h.dispatch)("core/block-editor").updateBlockAttributes(e[o].clientId,{id:b()})},[a,M]);const[I,N]=(0,s.useState)(!1),T=(0,d.__experimentalUseMultipleOriginColorsAndGradients)(),D=(0,h.useSelect)(e=>{const{getCurrentPostType:o}=e(g.store);return o()},[]),P=(0,s.useRef)(null),[A,E]=(0,s.useState)(!1),H=(0,h.useSelect)(e=>{const{hasSelectedInnerBlock:o}=e(d.store);return o(a,!0)},[a]);(0,s.useEffect)(()=>{i||l({id:b()})},[i,l]),(0,s.useEffect)(()=>{t||H?E(!0):"wp_block"!==D||I?E(!1):(N(!0),E(!0))},[t,H,D]);const[O]=(0,d.useSettings)("spacing.units"),F=(0,c.__experimentalUseCustomUnits)({availableUnits:O||["%","px","em","rem","vw"]}),U=Number.isFinite(_)?_+"%":_,V=(0,d.useBlockProps)({style:U?{maxWidth:U}:void 0}),R={ref:P,role:"dialog","aria-modal":!0,className:n()("wp-block-cloudcatch-light-modal-block__wrapper",{"is-open":A}),style:k?{backgroundColor:k}:void 0,"data-trigger-delay":f?C:void 0,"data-trigger-selector":j||void 0,"data-cookie-duration":y||void 0,"data-cookie-interaction":B||void 0,"data-autoplay-media":S||void 0,"data-modal-id":i};return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(d.InspectorControls,{children:[(0,p.jsxs)(c.PanelBody,{children:[(0,p.jsxs)(c.Flex,{align:"center",gap:2,style:{marginBlockEnd:"12px"},children:[(0,p.jsx)(c.FlexBlock,{children:(0,p.jsxs)("p",{className:"wp-block-cloudcatch-light-modal-block__editor-id",style:{margin:0},children:[(0,r.__)("Modal ID","light-modal-block"),": ",(0,p.jsx)("code",{children:i})]})}),(0,p.jsx)(c.FlexItem,{children:(0,p.jsx)(c.Button,{icon:"update",label:(0,r.__)("Regenerate ID","light-modal-block"),onClick:()=>{window.confirm((0,r.__)("Are you sure you want to regenerate the Modal ID? This will break any existing links to this modal.","light-modal-block"))&&l({id:b()})},size:"small"})})]}),(0,p.jsx)(c.TextControl,{label:(0,r.__)("Modal Label","light-modal-block"),value:u,placeholder:(0,r.__)("New Modal","light-modal-block"),onChange:e=>l({label:e}),help:(0,r.__)("Used to differentiate modals from one another","light-modal-block"),__nextHasNoMarginBottom:!0}),(0,p.jsx)(c.__experimentalUnitControl,{label:(0,r.__)("Width"),labelPosition:"edge",__unstableInputWidth:"80px",value:_||"",onChange:e=>{e=0>parseFloat(e)?"0":e,l({width:e})},units:F}),(0,p.jsx)(c.ToggleControl,{label:(0,r.__)("Show close button","light-modal-block"),checked:x||!1,onChange:()=>{l({enableCloseButton:!x})},__nextHasNoMarginBottom:!0})]}),(0,p.jsxs)(c.PanelBody,{title:(0,r.__)("Triggers","light-modal-block"),children:[(0,p.jsx)(c.ToggleControl,{label:(0,r.__)("Show modal on page load","light-modal-block"),checked:f||!1,onChange:()=>{l({enableTriggerDelay:!f})},__nextHasNoMarginBottom:!0}),f&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(c.__experimentalUnitControl,{label:(0,r.__)("Delay","light-modal-block"),labelPosition:"edge",__unstableInputWidth:"80px",value:C,placeholder:"0",onChange:e=>l({triggerDelay:e}),unit:"ms",units:{ms:{value:"ms",label:"ms",default:"",a11yLabel:(0,r.__)("Milliseconds (ms)"),step:1}}}),(0,p.jsx)(c.__experimentalUnitControl,{label:(0,r.__)("Cookie duration","light-modal-block"),labelPosition:"edge",__unstableInputWidth:"80px",value:y,help:(0,r.__)("Duration in minutes before this modal will appear again after being closed. Leave blank to always show this modal.","light-modal-block"),placeholder:"0",onChange:e=>l({cookieDuration:e}),unit:"min",units:{ms:{value:"min",label:"min",default:"",a11yLabel:(0,r.__)("Minutes (min)"),step:1}}}),(0,p.jsx)(c.ToggleControl,{label:(0,r.__)("Interaction sets cookie","light-modal-block"),checked:B||!1,help:(0,r.__)("Interaction with the modal such as clicking a link or submitting a form, will set the cookie, respecting the cookie duration.","light-modal-block"),onChange:()=>{l({interactionSetsCookie:!B})},__nextHasNoMarginBottom:!0})]}),(0,p.jsx)(c.TextControl,{label:(0,r.__)("Selector","light-modal-block"),value:j,onChange:e=>l({triggerSelector:e}),style:{fontFamily:"monospace"},help:(0,r.__)("CSS selector for additional trigger elements that will open this modal when clicked.","light-modal-block"),placeholder:(0,r.__)(".my-button, #my-link","light-modal-block"),__nextHasNoMarginBottom:!0}),(0,p.jsx)(c.ToggleControl,{label:(0,r.__)("Autoplay media when modal opens","light-modal-block"),checked:S||!1,help:(0,r.__)("Note: Most browsers require a user action before this can run, so it may not work for modals that open automatically on page load.","light-modal-block"),onChange:()=>{l({autoplayMedia:!S})},__nextHasNoMarginBottom:!0})]})]}),(0,p.jsxs)(d.InspectorControls,{group:"color",children:[(0,p.jsx)(d.__experimentalColorGradientSettingsDropdown,{__experimentalIsRenderedInSidebar:!0,settings:[{colorValue:k,label:(0,r.__)("Backdrop","light-modal-block"),onColorChange:e=>l({backdropColor:e}),isShownByDefault:!0,enableAlpha:!0,resetAllFilter:()=>({backdropColor:void 0})}],panelId:a,...T}),(0,p.jsx)(d.__experimentalColorGradientSettingsDropdown,{__experimentalIsRenderedInSidebar:!0,settings:[{colorValue:w,label:(0,r.__)("Close Icon","light-modal-block"),onColorChange:e=>l({closeIconColor:e}),isShownByDefault:!0,enableAlpha:!0,resetAllFilter:()=>({closeIconColor:void 0})}],panelId:a,...T}),(0,p.jsx)(d.__experimentalColorGradientSettingsDropdown,{__experimentalIsRenderedInSidebar:!0,settings:[{colorValue:v,label:(0,r.__)("Close Background","light-modal-block"),onColorChange:e=>l({closeBackgroundColor:e}),isShownByDefault:!0,enableAlpha:!0,resetAllFilter:()=>({closeBackgroundColor:void 0})}],panelId:a,...T})]}),(0,p.jsx)("div",{...R,children:(0,p.jsxs)("div",{...V,children:[(0,p.jsx)("div",{...(0,d.useInnerBlocksProps)({className:"wp-block-cloudcatch-light-modal-block__content"})}),x&&(0,p.jsx)("button",{className:"wp-block-cloudcatch-light-modal-block__close",onClick:()=>{E(!1)},style:{backgroundColor:v},children:(0,p.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",children:(0,p.jsx)(c.Path,{d:"M24 1.2 22.8 0 12 10.8 1.2 0 0 1.2 10.8 12 0 22.8 1.2 24 12 13.2 22.8 24l1.2-1.2L13.2 12 24 1.2z",fill:w})})})]})})]})}),k=JSON.parse('{"UU":"cloudcatch/light-modal-block"}'),x=window.wp.primitives,w=(0,p.jsxs)(x.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:[(0,p.jsx)(x.Path,{d:"M6.4 12.1h11.2v1.5H6.4zM6.5 15.5h11.2V17H6.5z"}),(0,p.jsx)(x.Path,{d:"M23.2 4.5c0-2.1-1.7-3.7-3.7-3.7-1 0-2 .4-2.7 1.2-.3.3-.5.7-.7 1H5c-1.1 0-1.9.9-1.9 2v14c0 1.1.8 2 1.9 2h14.1c1.1 0 1.9-.9 1.9-1.9V7.9c1.3-.5 2.2-1.8 2.2-3.4zM19.5 19c0 .2-.2.4-.4.4H5c-.2 0-.4-.2-.4-.4V5c0-.2.2-.4.4-.4h10.8c0 2.1 1.7 3.7 3.7 3.7V19zm0-12.2c-1.2 0-2.2-1-2.2-2.2 0-.6.2-1.1.6-1.5.4-.5 1-.7 1.6-.7 1.2 0 2.2 1 2.2 2.2s-1 2.2-2.2 2.2z"})]}),v=window.wp.plugins;var C=(0,p.jsx)(x.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,p.jsx)(x.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"})});(0,v.registerPlugin)("light-modal-block",{render:function(){const e=m(),{selectBlock:o,removeBlock:l}=(0,h.useDispatch)(d.store);return(0,p.jsx)(g.PluginSidebar,{name:"plugin-sidebar-test",title:(0,r.__)("Modals","light-modal-block"),icon:w,children:(0,p.jsxs)("div",{className:"plugin-sidebar-content",children:[e.length>0&&e.map((e,a)=>(0,p.jsx)("div",{children:(0,p.jsx)(c.Card,{className:"light-modal-block__card",children:(0,p.jsxs)(c.CardBody,{children:[(0,p.jsx)(c.__experimentalHeading,{size:4,children:e.attributes.label||(0,r.__)("New Modal","light-modal-block")}),(0,p.jsxs)("div",{children:[(0,p.jsx)(c.Button,{icon:t.edit,label:(0,r.__)("Edit Modal","light-modal-block"),onClick:()=>o(e.clientId)}),(0,p.jsx)(c.Button,{icon:C,label:(0,r.__)("Remove Modal","light-modal-block"),onClick:()=>l(e.clientId)})]})]})})},a)),e.length<1&&(0,p.jsx)(c.Card,{isBorderless:!0,children:(0,p.jsx)(c.CardBody,{children:(0,p.jsx)("p",{children:(0,r.__)("There are no modals on this page","light-modal-block")})})})]})})}});const f=window.wp.hooks,j=window.wp.compose,y=["core/button","core/image","core/heading","core/group"],B=(0,j.createHigherOrderComponent)(e=>o=>{const{name:l,attributes:t,setAttributes:a}=o,i=m(),n=i.filter(e=>t?.modalEnabled===e?.attributes?.id)[0],{selectBlock:s}=(0,h.useDispatch)(d.store),g=[{label:(0,r.__)("Select Modal","light-modal-block"),value:""},...i.map(e=>({label:e?.attributes?.label||(0,r.__)("New Modal","light-modal-block"),value:e?.attributes?.id}))];return y.includes(l)?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(e,{...o}),"cloudcatch/light-modal-block"!==l&&(0,p.jsx)(d.InspectorAdvancedControls,{children:(0,p.jsxs)(c.BaseControl,{__nextHasNoMarginBottom:!0,children:[(0,p.jsx)(c.ToggleControl,{label:(0,r.__)("Show Modal on Click","light-modal-block"),checked:t?.modalTriggerEnabled||!1,onChange:()=>{a({modalTriggerEnabled:!t?.modalTriggerEnabled})},__nextHasNoMarginBottom:!0}),t?.modalTriggerEnabled&&(0,p.jsx)(c.SelectControl,{label:(0,r.__)("Modal","light-modal-block"),value:t?.modalEnabled,options:g,onChange:e=>{a({modalEnabled:e})},__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),null!=n&&(0,p.jsx)(c.BaseControl,{__nextHasNoMarginBottom:!0,children:(0,p.jsx)(c.Button,{label:(0,r.__)("Edit Modal","light-modal-block"),variant:"secondary",onClick:()=>s(n.clientId),children:(0,r.__)("Open Modal","light-modal-block")})})]})})]}):(0,p.jsx)(e,{...o})},"withInspectorControl");(0,f.addFilter)("blocks.registerBlockType","cloudcatch/LightModalBlockAttributes",(e,o)=>(void 0!==e?.attributes&&y.includes(o)&&(e.attributes={...e.attributes,modalTriggerEnabled:{type:"boolean",default:!1},modalEnabled:{type:"string"}}),e)),(0,f.addFilter)("editor.BlockEdit","cloudcatch/LightModalBlockAdvancedControls",B),(0,f.addFilter)("blocks.getSaveContent.extraProps","cloudcatch/LightModalBlockAttributes",(e,o,l)=>{const{modalTriggerEnabled:t,modalEnabled:a}=l;return!0===t&&null!=a?{...e,"data-trigger-modal":a}:e}),(0,a.registerBlockType)(k.UU,{edit:_,save:function(e){const{attributes:o}=e,{id:l,width:t,backdropColor:a,enableCloseButton:i,closeIconColor:r,closeBackgroundColor:s,triggerDelay:h,enableTriggerDelay:g,triggerSelector:u,cookieDuration:b,interactionSetsCookie:m,autoplayMedia:_}=o,k=Number.isFinite(t)?t+"%":t,x=d.useBlockProps.save({style:k?{maxWidth:k}:void 0}),w={role:"dialog","aria-modal":!0,className:n()("wp-block-cloudcatch-light-modal-block__wrapper"),style:a?{backgroundColor:a}:void 0,"data-trigger-delay":g?h:void 0,"data-trigger-selector":u||void 0,"data-cookie-duration":b||void 0,"data-cookie-interaction":m||void 0,"data-autoplay-media":_||void 0,"data-modal-id":l};return(0,p.jsx)("div",{...w,children:(0,p.jsxs)("div",{...x,children:[(0,p.jsx)("div",{...d.useInnerBlocksProps.save({className:"wp-block-cloudcatch-light-modal-block__content"})}),i&&(0,p.jsx)("button",{className:"wp-block-cloudcatch-light-modal-block__close",style:{backgroundColor:s},children:(0,p.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",children:(0,p.jsx)(c.Path,{d:"M24 1.2 22.8 0 12 10.8 1.2 0 0 1.2 10.8 12 0 22.8 1.2 24 12 13.2 22.8 24l1.2-1.2L13.2 12 24 1.2z",fill:r})})})]})})},icon:w})},942:(e,o)=>{var l;!function(){"use strict";var t={}.hasOwnProperty;function a(){for(var e="",o=0;o<arguments.length;o++){var l=arguments[o];l&&(e=n(e,i(l)))}return e}function i(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return a.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var o="";for(var l in e)t.call(e,l)&&e[l]&&(o=n(o,l));return o}function n(e,o){return o?e?e+" "+o:e+o:e}e.exports?(a.default=a,e.exports=a):void 0===(l=function(){return a}.apply(o,[]))||(e.exports=l)}()}},l={};function t(e){var a=l[e];if(void 0!==a)return a.exports;var i=l[e]={exports:{}};return o[e](i,i.exports,t),i.exports}t.m=o,e=[],t.O=(o,l,a,i)=>{if(!l){var n=1/0;for(c=0;c<e.length;c++){for(var[l,a,i]=e[c],r=!0,d=0;d<l.length;d++)(!1&i||n>=i)&&Object.keys(t.O).every(e=>t.O[e](l[d]))?l.splice(d--,1):(r=!1,i<n&&(n=i));if(r){e.splice(c--,1);var s=a();void 0!==s&&(o=s)}}return o}i=i||0;for(var c=e.length;c>0&&e[c-1][2]>i;c--)e[c]=e[c-1];e[c]=[l,a,i]},t.n=e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return t.d(o,{a:o}),o},t.d=(e,o)=>{for(var l in o)t.o(o,l)&&!t.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:o[l]})},t.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={57:0,350:0};t.O.j=o=>0===e[o];var o=(o,l)=>{var a,i,[n,r,d]=l,s=0;if(n.some(o=>0!==e[o])){for(a in r)t.o(r,a)&&(t.m[a]=r[a]);if(d)var c=d(t)}for(o&&o(l);s<n.length;s++)i=n[s],t.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return t.O(c)},l=globalThis.webpackChunklight_modal_block=globalThis.webpackChunklight_modal_block||[];l.forEach(o.bind(null,0)),l.push=o.bind(null,l.push.bind(l))})();var a=t.O(void 0,[350],()=>t(311));a=t.O(a)})();1 (()=>{var e,o={167(e,o,l){"use strict";const t=window.wp.blocks;var a=l(942),i=l.n(a);const n=window.wp.i18n,r=window.wp.blockEditor,d=window.wp.element,s=window.wp.components,c=window.wp.data,h=window.wp.editor;let g=e=>crypto.getRandomValues(new Uint8Array(e));const u=()=>((e,o=21)=>((e,o,l)=>{let t=(2<<Math.log2(e.length-1))-1,a=-~(1.6*t*o/e.length);return(i=o)=>{let n="";for(;;){let o=l(a),r=0|a;for(;r--;)if(n+=e[o[r]&t]||"",n.length>=i)return n}}})(e,0|o,g))("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",11)(),b=()=>(0,c.useSelect)(e=>{const{getBlocksByName:o,getBlock:l}=e(r.store);return o("cloudcatch/light-modal-block").map(l)}),m=window.ReactJSXRuntime,p=(0,s.withNotices)(function(e){const{attributes:o,setAttributes:l,isSelected:t,clientId:a}=e,{id:g,label:p,width:_,backdropColor:k,enableCloseButton:x,closeIconColor:w,closeBackgroundColor:v,triggerDelay:C,enableTriggerDelay:f,triggerSelector:j,cookieDuration:y,interactionSetsCookie:B,autoplayMedia:S}=o,M=b();(0,d.useEffect)(()=>{const e=M.filter((e,o,l)=>l.find(o=>o.attributes.id===e.attributes.id&&o.clientId!==e.clientId));if(!(e.length<=1))for(let o=1;o<e.length;o++)(0,c.dispatch)("core/block-editor").updateBlockAttributes(e[o].clientId,{id:u()})},[a,M]);const[I,D]=(0,d.useState)(!1),N=(0,r.__experimentalUseMultipleOriginColorsAndGradients)(),P=(0,c.useSelect)(e=>{const{getCurrentPostType:o}=e(h.store);return o()},[]),T=(0,d.useRef)(null),[A,E]=(0,d.useState)(!1),H=(0,c.useSelect)(e=>{const{hasSelectedInnerBlock:o}=e(r.store);return o(a,!0)},[a]);(0,d.useEffect)(()=>{g||l({id:u()})},[g,l]),(0,d.useEffect)(()=>{t||H?E(!0):"wp_block"!==P||I?E(!1):(D(!0),E(!0))},[t,H,P]);const[O]=(0,r.useSettings)("spacing.units"),F=(0,s.__experimentalUseCustomUnits)({availableUnits:O||["%","px","em","rem","vw"]}),V=Number.isFinite(_)?_+"%":_,z=(0,r.useBlockProps)({style:V?{maxWidth:V}:void 0}),U={ref:T,role:"dialog","aria-modal":!0,className:i()("wp-block-cloudcatch-light-modal-block__wrapper",{"is-open":A}),style:k?{backgroundColor:k}:void 0,"data-trigger-delay":f?C:void 0,"data-trigger-selector":j||void 0,"data-cookie-duration":y||void 0,"data-cookie-interaction":B||void 0,"data-autoplay-media":S||void 0,"data-modal-id":g};return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(r.InspectorControls,{children:[(0,m.jsxs)(s.PanelBody,{children:[(0,m.jsxs)(s.Flex,{align:"center",gap:2,style:{marginBlockEnd:"12px"},children:[(0,m.jsx)(s.FlexBlock,{children:(0,m.jsxs)("p",{className:"wp-block-cloudcatch-light-modal-block__editor-id",style:{margin:0},children:[(0,n.__)("Modal ID","light-modal-block"),": ",(0,m.jsx)("code",{children:g})]})}),(0,m.jsx)(s.FlexItem,{children:(0,m.jsx)(s.Button,{icon:"update",label:(0,n.__)("Regenerate ID","light-modal-block"),onClick:()=>{window.confirm((0,n.__)("Are you sure you want to regenerate the Modal ID? This will break any existing links to this modal.","light-modal-block"))&&l({id:u()})},size:"small"})})]}),(0,m.jsx)(s.TextControl,{label:(0,n.__)("Modal Label","light-modal-block"),value:p,placeholder:(0,n.__)("New Modal","light-modal-block"),onChange:e=>l({label:e}),help:(0,n.__)("Used to differentiate modals from one another","light-modal-block"),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),(0,m.jsx)(s.__experimentalUnitControl,{label:(0,n.__)("Width"),labelPosition:"edge",__unstableInputWidth:"80px",value:_||"",onChange:e=>{e=0>parseFloat(e)?"0":e,l({width:e})},units:F,__next40pxDefaultSize:!0}),(0,m.jsx)(s.ToggleControl,{label:(0,n.__)("Show close button","light-modal-block"),checked:x||!1,onChange:()=>{l({enableCloseButton:!x})},__nextHasNoMarginBottom:!0})]}),(0,m.jsxs)(s.PanelBody,{title:(0,n.__)("Triggers","light-modal-block"),children:[(0,m.jsx)(s.ToggleControl,{label:(0,n.__)("Show modal on page load","light-modal-block"),checked:f||!1,onChange:()=>{l({enableTriggerDelay:!f})},__nextHasNoMarginBottom:!0}),f&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(s.__experimentalUnitControl,{label:(0,n.__)("Delay","light-modal-block"),labelPosition:"edge",__unstableInputWidth:"80px",value:C,placeholder:"0",onChange:e=>l({triggerDelay:e}),unit:"ms",units:{ms:{value:"ms",label:"ms",default:"",a11yLabel:(0,n.__)("Milliseconds (ms)"),step:1}}}),(0,m.jsx)(s.__experimentalUnitControl,{label:(0,n.__)("Cookie duration","light-modal-block"),labelPosition:"edge",__unstableInputWidth:"80px",value:y,help:(0,n.__)("Duration in minutes before this modal will appear again after being closed. Leave blank to always show this modal.","light-modal-block"),placeholder:"0",onChange:e=>l({cookieDuration:e}),unit:"min",units:{ms:{value:"min",label:"min",default:"",a11yLabel:(0,n.__)("Minutes (min)"),step:1}}}),(0,m.jsx)(s.ToggleControl,{label:(0,n.__)("Interaction sets cookie","light-modal-block"),checked:B||!1,help:(0,n.__)("Interaction with the modal such as clicking a link or submitting a form, will set the cookie, respecting the cookie duration.","light-modal-block"),onChange:()=>{l({interactionSetsCookie:!B})},__nextHasNoMarginBottom:!0})]}),(0,m.jsx)(s.TextControl,{label:(0,n.__)("Selector","light-modal-block"),value:j,onChange:e=>l({triggerSelector:e}),style:{fontFamily:"monospace"},help:(0,n.__)("CSS selector for additional trigger elements that will open this modal when clicked.","light-modal-block"),placeholder:(0,n.__)(".my-button, #my-link","light-modal-block"),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),(0,m.jsx)(s.ToggleControl,{label:(0,n.__)("Autoplay media when modal opens","light-modal-block"),checked:S||!1,help:(0,n.__)("Note: Most browsers require a user action before this can run, so it may not work for modals that open automatically on page load.","light-modal-block"),onChange:()=>{l({autoplayMedia:!S})},__nextHasNoMarginBottom:!0})]})]}),(0,m.jsxs)(r.InspectorControls,{group:"color",children:[(0,m.jsx)(r.__experimentalColorGradientSettingsDropdown,{__experimentalIsRenderedInSidebar:!0,settings:[{colorValue:k,label:(0,n.__)("Backdrop","light-modal-block"),onColorChange:e=>l({backdropColor:e}),isShownByDefault:!0,enableAlpha:!0,resetAllFilter:()=>({backdropColor:void 0})}],panelId:a,...N}),(0,m.jsx)(r.__experimentalColorGradientSettingsDropdown,{__experimentalIsRenderedInSidebar:!0,settings:[{colorValue:w,label:(0,n.__)("Close Icon","light-modal-block"),onColorChange:e=>l({closeIconColor:e}),isShownByDefault:!0,enableAlpha:!0,resetAllFilter:()=>({closeIconColor:void 0})}],panelId:a,...N}),(0,m.jsx)(r.__experimentalColorGradientSettingsDropdown,{__experimentalIsRenderedInSidebar:!0,settings:[{colorValue:v,label:(0,n.__)("Close Background","light-modal-block"),onColorChange:e=>l({closeBackgroundColor:e}),isShownByDefault:!0,enableAlpha:!0,resetAllFilter:()=>({closeBackgroundColor:void 0})}],panelId:a,...N})]}),(0,m.jsx)("div",{...U,children:(0,m.jsxs)("div",{...z,children:[(0,m.jsx)("div",{...(0,r.useInnerBlocksProps)({className:"wp-block-cloudcatch-light-modal-block__content"})}),x&&(0,m.jsx)("button",{className:"wp-block-cloudcatch-light-modal-block__close",onClick:()=>{E(!1)},style:{backgroundColor:v},children:(0,m.jsx)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",children:(0,m.jsx)(s.Path,{d:"M24 1.2 22.8 0 12 10.8 1.2 0 0 1.2 10.8 12 0 22.8 1.2 24 12 13.2 22.8 24l1.2-1.2L13.2 12 24 1.2z",fill:w})})})]})})]})}),_=JSON.parse('{"UU":"cloudcatch/light-modal-block"}'),k=window.wp.primitives,x=(0,m.jsxs)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:[(0,m.jsx)(k.Path,{d:"M6.4 12.1h11.2v1.5H6.4zM6.5 15.5h11.2V17H6.5z"}),(0,m.jsx)(k.Path,{d:"M23.2 4.5c0-2.1-1.7-3.7-3.7-3.7-1 0-2 .4-2.7 1.2-.3.3-.5.7-.7 1H5c-1.1 0-1.9.9-1.9 2v14c0 1.1.8 2 1.9 2h14.1c1.1 0 1.9-.9 1.9-1.9V7.9c1.3-.5 2.2-1.8 2.2-3.4zM19.5 19c0 .2-.2.4-.4.4H5c-.2 0-.4-.2-.4-.4V5c0-.2.2-.4.4-.4h10.8c0 2.1 1.7 3.7 3.7 3.7V19zm0-12.2c-1.2 0-2.2-1-2.2-2.2 0-.6.2-1.1.6-1.5.4-.5 1-.7 1.6-.7 1.2 0 2.2 1 2.2 2.2s-1 2.2-2.2 2.2z"})]}),w=window.wp.plugins,v=window.wp.editPost;var C=(0,m.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,m.jsx)(k.Path,{d:"m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"})}),f=(0,m.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,m.jsx)(k.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"})});(0,w.registerPlugin)("light-modal-block",{render:function(){const e=b(),{selectBlock:o,removeBlock:l}=(0,c.useDispatch)(r.store),{openGeneralSidebar:t}=(0,c.useDispatch)(v.store);return(0,m.jsx)(h.PluginSidebar,{name:"plugin-sidebar-test",title:(0,n.__)("Modals","light-modal-block"),icon:x,children:(0,m.jsx)(s.PanelBody,{className:"plugin-sidebar-content",children:(0,m.jsxs)(s.__experimentalVStack,{spacing:3,children:[e.length>0&&e.map((e,a)=>(0,m.jsx)("div",{children:(0,m.jsx)(s.Card,{className:"light-modal-block__card",children:(0,m.jsxs)(s.CardBody,{children:[(0,m.jsx)(s.__experimentalHeading,{size:4,children:e.attributes.label||(0,n.__)("New Modal","light-modal-block")}),(0,m.jsxs)("div",{children:[(0,m.jsx)(s.Button,{icon:C,label:(0,n.__)("Edit Modal","light-modal-block"),onClick:async()=>{await o(e.clientId),t("edit-post/block")}}),(0,m.jsx)(s.Button,{icon:f,label:(0,n.__)("Remove Modal","light-modal-block"),onClick:()=>l(e.clientId),isDestructive:!0})]})]})})},a)),e.length<1&&(0,m.jsx)(s.Card,{isBorderless:!0,children:(0,m.jsx)(s.CardBody,{children:(0,m.jsx)("p",{children:(0,n.__)("There are no modals on this page","light-modal-block")})})})]})})})}});const j=window.wp.hooks,y=window.wp.compose,B=["core/button","core/image","core/heading","core/group"],S=(0,y.createHigherOrderComponent)(e=>o=>{const{name:l,attributes:t,setAttributes:a}=o,i=b(),d=i.filter(e=>t?.modalEnabled===e?.attributes?.id)[0],{selectBlock:h}=(0,c.useDispatch)(r.store),g=[{label:(0,n.__)("Select Modal","light-modal-block"),value:""},...i.map(e=>({label:e?.attributes?.label||(0,n.__)("New Modal","light-modal-block"),value:e?.attributes?.id}))];return B.includes(l)?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(e,{...o}),"cloudcatch/light-modal-block"!==l&&(0,m.jsx)(r.InspectorAdvancedControls,{children:(0,m.jsxs)(s.BaseControl,{__nextHasNoMarginBottom:!0,children:[(0,m.jsx)(s.ToggleControl,{label:(0,n.__)("Show Modal on Click","light-modal-block"),checked:t?.modalTriggerEnabled||!1,onChange:()=>{a({modalTriggerEnabled:!t?.modalTriggerEnabled})},__nextHasNoMarginBottom:!0}),t?.modalTriggerEnabled&&(0,m.jsx)(s.SelectControl,{label:(0,n.__)("Modal","light-modal-block"),value:t?.modalEnabled,options:g,onChange:e=>{a({modalEnabled:e})},__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),null!=d&&(0,m.jsx)(s.BaseControl,{__nextHasNoMarginBottom:!0,children:(0,m.jsx)(s.Button,{label:(0,n.__)("Edit Modal","light-modal-block"),variant:"secondary",onClick:()=>h(d.clientId),children:(0,n.__)("Open Modal","light-modal-block")})})]})})]}):(0,m.jsx)(e,{...o})},"withInspectorControl");(0,j.addFilter)("blocks.registerBlockType","cloudcatch/LightModalBlockAttributes",(e,o)=>(void 0!==e?.attributes&&B.includes(o)&&(e.attributes={...e.attributes,modalTriggerEnabled:{type:"boolean",default:!1},modalEnabled:{type:"string"}}),e)),(0,j.addFilter)("editor.BlockEdit","cloudcatch/LightModalBlockAdvancedControls",S),(0,j.addFilter)("blocks.getSaveContent.extraProps","cloudcatch/LightModalBlockAttributes",(e,o,l)=>{const{modalTriggerEnabled:t,modalEnabled:a}=l;return!0===t&&null!=a?{...e,"data-trigger-modal":a}:e}),(0,t.registerBlockType)(_.UU,{edit:p,save:function(e){const{attributes:o}=e,{id:l,width:t,backdropColor:a,enableCloseButton:n,closeIconColor:d,closeBackgroundColor:c,triggerDelay:h,enableTriggerDelay:g,triggerSelector:u,cookieDuration:b,interactionSetsCookie:p,autoplayMedia:_}=o,k=Number.isFinite(t)?t+"%":t,x=r.useBlockProps.save({style:k?{maxWidth:k}:void 0}),w={role:"dialog","aria-modal":!0,className:i()("wp-block-cloudcatch-light-modal-block__wrapper"),style:a?{backgroundColor:a}:void 0,"data-trigger-delay":g?h:void 0,"data-trigger-selector":u||void 0,"data-cookie-duration":b||void 0,"data-cookie-interaction":p||void 0,"data-autoplay-media":_||void 0,"data-modal-id":l};return(0,m.jsx)("div",{...w,children:(0,m.jsxs)("div",{...x,children:[(0,m.jsx)("div",{...r.useInnerBlocksProps.save({className:"wp-block-cloudcatch-light-modal-block__content"})}),n&&(0,m.jsx)("button",{className:"wp-block-cloudcatch-light-modal-block__close",style:{backgroundColor:c},children:(0,m.jsx)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",children:(0,m.jsx)(s.Path,{d:"M24 1.2 22.8 0 12 10.8 1.2 0 0 1.2 10.8 12 0 22.8 1.2 24 12 13.2 22.8 24l1.2-1.2L13.2 12 24 1.2z",fill:d})})})]})})},icon:x})},942(e,o){var l;!function(){"use strict";var t={}.hasOwnProperty;function a(){for(var e="",o=0;o<arguments.length;o++){var l=arguments[o];l&&(e=n(e,i(l)))}return e}function i(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return a.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var o="";for(var l in e)t.call(e,l)&&e[l]&&(o=n(o,l));return o}function n(e,o){return o?e?e+" "+o:e+o:e}e.exports?(a.default=a,e.exports=a):void 0===(l=function(){return a}.apply(o,[]))||(e.exports=l)}()}},l={};function t(e){var a=l[e];if(void 0!==a)return a.exports;var i=l[e]={exports:{}};return o[e](i,i.exports,t),i.exports}t.m=o,e=[],t.O=(o,l,a,i)=>{if(!l){var n=1/0;for(c=0;c<e.length;c++){for(var[l,a,i]=e[c],r=!0,d=0;d<l.length;d++)(!1&i||n>=i)&&Object.keys(t.O).every(e=>t.O[e](l[d]))?l.splice(d--,1):(r=!1,i<n&&(n=i));if(r){e.splice(c--,1);var s=a();void 0!==s&&(o=s)}}return o}i=i||0;for(var c=e.length;c>0&&e[c-1][2]>i;c--)e[c]=e[c-1];e[c]=[l,a,i]},t.n=e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return t.d(o,{a:o}),o},t.d=(e,o)=>{for(var l in o)t.o(o,l)&&!t.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:o[l]})},t.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),(()=>{var e={57:0,350:0};t.O.j=o=>0===e[o];var o=(o,l)=>{var a,i,[n,r,d]=l,s=0;if(n.some(o=>0!==e[o])){for(a in r)t.o(r,a)&&(t.m[a]=r[a]);if(d)var c=d(t)}for(o&&o(l);s<n.length;s++)i=n[s],t.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return t.O(c)},l=globalThis.webpackChunklight_modal_block=globalThis.webpackChunklight_modal_block||[];l.forEach(o.bind(null,0)),l.push=o.bind(null,l.push.bind(l))})();var a=t.O(void 0,[350],()=>t(167));a=t.O(a)})(); -
light-modal-block/tags/1.9.0/light-modal-block.php
r3399001 r3467105 5 5 * Requires at least: 6.6 6 6 * Requires PHP: 7.0 7 * Version: 1. 8.07 * Version: 1.9.0 8 8 * Author: CloudCatch LLC 9 9 * Author URI: https://cloudcatch.io -
light-modal-block/tags/1.9.0/readme.txt
r3399001 r3467105 3 3 Tags: block, modal, popup, lightbox, gutenberg, full-site-editing 4 4 Tested up to: 6.9 5 Stable tag: 1. 8.05 Stable tag: 1.9.0 6 6 License: GPL-2.0-or-later 7 7 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 36 36 37 37 == Changelog == 38 39 = 1.9.0 = 40 * Enhancement: When selecting edit modal from the plugin sidebar, automatically open the modal block settings 41 * Enhancement: Improve performance of `useModals()` hook via leveraging `getBlocksByName()` 38 42 39 43 = 1.8.0 = -
light-modal-block/trunk/build/block.json
r3399001 r3467105 3 3 "apiVersion": 3, 4 4 "name": "cloudcatch/light-modal-block", 5 "version": "1. 8.0",5 "version": "1.9.0", 6 6 "title": "Light Modal Block", 7 7 "category": "widgets", … … 15 15 }, 16 16 "label": { 17 "type": "string" 17 "type": "string", 18 "default": "" 18 19 }, 19 20 "backdropColor": { … … 42 43 }, 43 44 "triggerSelector": { 44 "type": "string" 45 "type": "string", 46 "default": "" 45 47 }, 46 48 "cookieDuration": { -
light-modal-block/trunk/build/index.asset.php
r3399001 r3467105 1 <?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-edit or', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-plugins', 'wp-primitives'), 'version' => 'c01d4f2ec0d681ea6a77');1 <?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-plugins', 'wp-primitives'), 'version' => 'eb98fa866e2572ceed2f'); -
light-modal-block/trunk/build/index.js
r3399001 r3467105 1 (()=>{var e,o={ 311:(e,o,l)=>{"use strict";var t={};l.r(t);const a=window.wp.blocks;var i=l(942),n=l.n(i);const r=window.wp.i18n,d=window.wp.blockEditor,s=window.wp.element,c=window.wp.components,h=window.wp.data,g=window.wp.editor;let u=e=>crypto.getRandomValues(new Uint8Array(e));const b=()=>((e,o=21)=>((e,o,l)=>{let t=(2<<Math.log2(e.length-1))-1,a=-~(1.6*t*o/e.length);return(i=o)=>{let n="";for(;;){let o=l(a),r=0|a;for(;r--;)if(n+=e[o[r]&t]||"",n.length>=i)return n}}})(e,0|o,u))("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",11)(),m=()=>(0,h.useSelect)(e=>{const o=[],l=e(d.store).getBlocks(),t=e=>{e?.innerBlocks&&e.innerBlocks.forEach(e=>{"cloudcatch/light-modal-block"===e.name&&o.push(e),t(e)})};return l.forEach(e=>{"cloudcatch/light-modal-block"===e.name&&o.push(e),t(e)}),o}),p=window.ReactJSXRuntime,_=(0,c.withNotices)(function(e){const{attributes:o,setAttributes:l,isSelected:t,clientId:a}=e,{id:i,label:u,width:_,backdropColor:k,enableCloseButton:x,closeIconColor:w,closeBackgroundColor:v,triggerDelay:C,enableTriggerDelay:f,triggerSelector:j,cookieDuration:y,interactionSetsCookie:B,autoplayMedia:S}=o,M=m();(0,s.useEffect)(()=>{const e=M.filter((e,o,l)=>l.find(o=>o.attributes.id===e.attributes.id&&o.clientId!==e.clientId));if(!(e.length<=1))for(let o=1;o<e.length;o++)(0,h.dispatch)("core/block-editor").updateBlockAttributes(e[o].clientId,{id:b()})},[a,M]);const[I,N]=(0,s.useState)(!1),T=(0,d.__experimentalUseMultipleOriginColorsAndGradients)(),D=(0,h.useSelect)(e=>{const{getCurrentPostType:o}=e(g.store);return o()},[]),P=(0,s.useRef)(null),[A,E]=(0,s.useState)(!1),H=(0,h.useSelect)(e=>{const{hasSelectedInnerBlock:o}=e(d.store);return o(a,!0)},[a]);(0,s.useEffect)(()=>{i||l({id:b()})},[i,l]),(0,s.useEffect)(()=>{t||H?E(!0):"wp_block"!==D||I?E(!1):(N(!0),E(!0))},[t,H,D]);const[O]=(0,d.useSettings)("spacing.units"),F=(0,c.__experimentalUseCustomUnits)({availableUnits:O||["%","px","em","rem","vw"]}),U=Number.isFinite(_)?_+"%":_,V=(0,d.useBlockProps)({style:U?{maxWidth:U}:void 0}),R={ref:P,role:"dialog","aria-modal":!0,className:n()("wp-block-cloudcatch-light-modal-block__wrapper",{"is-open":A}),style:k?{backgroundColor:k}:void 0,"data-trigger-delay":f?C:void 0,"data-trigger-selector":j||void 0,"data-cookie-duration":y||void 0,"data-cookie-interaction":B||void 0,"data-autoplay-media":S||void 0,"data-modal-id":i};return(0,p.jsxs)(p.Fragment,{children:[(0,p.jsxs)(d.InspectorControls,{children:[(0,p.jsxs)(c.PanelBody,{children:[(0,p.jsxs)(c.Flex,{align:"center",gap:2,style:{marginBlockEnd:"12px"},children:[(0,p.jsx)(c.FlexBlock,{children:(0,p.jsxs)("p",{className:"wp-block-cloudcatch-light-modal-block__editor-id",style:{margin:0},children:[(0,r.__)("Modal ID","light-modal-block"),": ",(0,p.jsx)("code",{children:i})]})}),(0,p.jsx)(c.FlexItem,{children:(0,p.jsx)(c.Button,{icon:"update",label:(0,r.__)("Regenerate ID","light-modal-block"),onClick:()=>{window.confirm((0,r.__)("Are you sure you want to regenerate the Modal ID? This will break any existing links to this modal.","light-modal-block"))&&l({id:b()})},size:"small"})})]}),(0,p.jsx)(c.TextControl,{label:(0,r.__)("Modal Label","light-modal-block"),value:u,placeholder:(0,r.__)("New Modal","light-modal-block"),onChange:e=>l({label:e}),help:(0,r.__)("Used to differentiate modals from one another","light-modal-block"),__nextHasNoMarginBottom:!0}),(0,p.jsx)(c.__experimentalUnitControl,{label:(0,r.__)("Width"),labelPosition:"edge",__unstableInputWidth:"80px",value:_||"",onChange:e=>{e=0>parseFloat(e)?"0":e,l({width:e})},units:F}),(0,p.jsx)(c.ToggleControl,{label:(0,r.__)("Show close button","light-modal-block"),checked:x||!1,onChange:()=>{l({enableCloseButton:!x})},__nextHasNoMarginBottom:!0})]}),(0,p.jsxs)(c.PanelBody,{title:(0,r.__)("Triggers","light-modal-block"),children:[(0,p.jsx)(c.ToggleControl,{label:(0,r.__)("Show modal on page load","light-modal-block"),checked:f||!1,onChange:()=>{l({enableTriggerDelay:!f})},__nextHasNoMarginBottom:!0}),f&&(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(c.__experimentalUnitControl,{label:(0,r.__)("Delay","light-modal-block"),labelPosition:"edge",__unstableInputWidth:"80px",value:C,placeholder:"0",onChange:e=>l({triggerDelay:e}),unit:"ms",units:{ms:{value:"ms",label:"ms",default:"",a11yLabel:(0,r.__)("Milliseconds (ms)"),step:1}}}),(0,p.jsx)(c.__experimentalUnitControl,{label:(0,r.__)("Cookie duration","light-modal-block"),labelPosition:"edge",__unstableInputWidth:"80px",value:y,help:(0,r.__)("Duration in minutes before this modal will appear again after being closed. Leave blank to always show this modal.","light-modal-block"),placeholder:"0",onChange:e=>l({cookieDuration:e}),unit:"min",units:{ms:{value:"min",label:"min",default:"",a11yLabel:(0,r.__)("Minutes (min)"),step:1}}}),(0,p.jsx)(c.ToggleControl,{label:(0,r.__)("Interaction sets cookie","light-modal-block"),checked:B||!1,help:(0,r.__)("Interaction with the modal such as clicking a link or submitting a form, will set the cookie, respecting the cookie duration.","light-modal-block"),onChange:()=>{l({interactionSetsCookie:!B})},__nextHasNoMarginBottom:!0})]}),(0,p.jsx)(c.TextControl,{label:(0,r.__)("Selector","light-modal-block"),value:j,onChange:e=>l({triggerSelector:e}),style:{fontFamily:"monospace"},help:(0,r.__)("CSS selector for additional trigger elements that will open this modal when clicked.","light-modal-block"),placeholder:(0,r.__)(".my-button, #my-link","light-modal-block"),__nextHasNoMarginBottom:!0}),(0,p.jsx)(c.ToggleControl,{label:(0,r.__)("Autoplay media when modal opens","light-modal-block"),checked:S||!1,help:(0,r.__)("Note: Most browsers require a user action before this can run, so it may not work for modals that open automatically on page load.","light-modal-block"),onChange:()=>{l({autoplayMedia:!S})},__nextHasNoMarginBottom:!0})]})]}),(0,p.jsxs)(d.InspectorControls,{group:"color",children:[(0,p.jsx)(d.__experimentalColorGradientSettingsDropdown,{__experimentalIsRenderedInSidebar:!0,settings:[{colorValue:k,label:(0,r.__)("Backdrop","light-modal-block"),onColorChange:e=>l({backdropColor:e}),isShownByDefault:!0,enableAlpha:!0,resetAllFilter:()=>({backdropColor:void 0})}],panelId:a,...T}),(0,p.jsx)(d.__experimentalColorGradientSettingsDropdown,{__experimentalIsRenderedInSidebar:!0,settings:[{colorValue:w,label:(0,r.__)("Close Icon","light-modal-block"),onColorChange:e=>l({closeIconColor:e}),isShownByDefault:!0,enableAlpha:!0,resetAllFilter:()=>({closeIconColor:void 0})}],panelId:a,...T}),(0,p.jsx)(d.__experimentalColorGradientSettingsDropdown,{__experimentalIsRenderedInSidebar:!0,settings:[{colorValue:v,label:(0,r.__)("Close Background","light-modal-block"),onColorChange:e=>l({closeBackgroundColor:e}),isShownByDefault:!0,enableAlpha:!0,resetAllFilter:()=>({closeBackgroundColor:void 0})}],panelId:a,...T})]}),(0,p.jsx)("div",{...R,children:(0,p.jsxs)("div",{...V,children:[(0,p.jsx)("div",{...(0,d.useInnerBlocksProps)({className:"wp-block-cloudcatch-light-modal-block__content"})}),x&&(0,p.jsx)("button",{className:"wp-block-cloudcatch-light-modal-block__close",onClick:()=>{E(!1)},style:{backgroundColor:v},children:(0,p.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",children:(0,p.jsx)(c.Path,{d:"M24 1.2 22.8 0 12 10.8 1.2 0 0 1.2 10.8 12 0 22.8 1.2 24 12 13.2 22.8 24l1.2-1.2L13.2 12 24 1.2z",fill:w})})})]})})]})}),k=JSON.parse('{"UU":"cloudcatch/light-modal-block"}'),x=window.wp.primitives,w=(0,p.jsxs)(x.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:[(0,p.jsx)(x.Path,{d:"M6.4 12.1h11.2v1.5H6.4zM6.5 15.5h11.2V17H6.5z"}),(0,p.jsx)(x.Path,{d:"M23.2 4.5c0-2.1-1.7-3.7-3.7-3.7-1 0-2 .4-2.7 1.2-.3.3-.5.7-.7 1H5c-1.1 0-1.9.9-1.9 2v14c0 1.1.8 2 1.9 2h14.1c1.1 0 1.9-.9 1.9-1.9V7.9c1.3-.5 2.2-1.8 2.2-3.4zM19.5 19c0 .2-.2.4-.4.4H5c-.2 0-.4-.2-.4-.4V5c0-.2.2-.4.4-.4h10.8c0 2.1 1.7 3.7 3.7 3.7V19zm0-12.2c-1.2 0-2.2-1-2.2-2.2 0-.6.2-1.1.6-1.5.4-.5 1-.7 1.6-.7 1.2 0 2.2 1 2.2 2.2s-1 2.2-2.2 2.2z"})]}),v=window.wp.plugins;var C=(0,p.jsx)(x.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,p.jsx)(x.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"})});(0,v.registerPlugin)("light-modal-block",{render:function(){const e=m(),{selectBlock:o,removeBlock:l}=(0,h.useDispatch)(d.store);return(0,p.jsx)(g.PluginSidebar,{name:"plugin-sidebar-test",title:(0,r.__)("Modals","light-modal-block"),icon:w,children:(0,p.jsxs)("div",{className:"plugin-sidebar-content",children:[e.length>0&&e.map((e,a)=>(0,p.jsx)("div",{children:(0,p.jsx)(c.Card,{className:"light-modal-block__card",children:(0,p.jsxs)(c.CardBody,{children:[(0,p.jsx)(c.__experimentalHeading,{size:4,children:e.attributes.label||(0,r.__)("New Modal","light-modal-block")}),(0,p.jsxs)("div",{children:[(0,p.jsx)(c.Button,{icon:t.edit,label:(0,r.__)("Edit Modal","light-modal-block"),onClick:()=>o(e.clientId)}),(0,p.jsx)(c.Button,{icon:C,label:(0,r.__)("Remove Modal","light-modal-block"),onClick:()=>l(e.clientId)})]})]})})},a)),e.length<1&&(0,p.jsx)(c.Card,{isBorderless:!0,children:(0,p.jsx)(c.CardBody,{children:(0,p.jsx)("p",{children:(0,r.__)("There are no modals on this page","light-modal-block")})})})]})})}});const f=window.wp.hooks,j=window.wp.compose,y=["core/button","core/image","core/heading","core/group"],B=(0,j.createHigherOrderComponent)(e=>o=>{const{name:l,attributes:t,setAttributes:a}=o,i=m(),n=i.filter(e=>t?.modalEnabled===e?.attributes?.id)[0],{selectBlock:s}=(0,h.useDispatch)(d.store),g=[{label:(0,r.__)("Select Modal","light-modal-block"),value:""},...i.map(e=>({label:e?.attributes?.label||(0,r.__)("New Modal","light-modal-block"),value:e?.attributes?.id}))];return y.includes(l)?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(e,{...o}),"cloudcatch/light-modal-block"!==l&&(0,p.jsx)(d.InspectorAdvancedControls,{children:(0,p.jsxs)(c.BaseControl,{__nextHasNoMarginBottom:!0,children:[(0,p.jsx)(c.ToggleControl,{label:(0,r.__)("Show Modal on Click","light-modal-block"),checked:t?.modalTriggerEnabled||!1,onChange:()=>{a({modalTriggerEnabled:!t?.modalTriggerEnabled})},__nextHasNoMarginBottom:!0}),t?.modalTriggerEnabled&&(0,p.jsx)(c.SelectControl,{label:(0,r.__)("Modal","light-modal-block"),value:t?.modalEnabled,options:g,onChange:e=>{a({modalEnabled:e})},__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),null!=n&&(0,p.jsx)(c.BaseControl,{__nextHasNoMarginBottom:!0,children:(0,p.jsx)(c.Button,{label:(0,r.__)("Edit Modal","light-modal-block"),variant:"secondary",onClick:()=>s(n.clientId),children:(0,r.__)("Open Modal","light-modal-block")})})]})})]}):(0,p.jsx)(e,{...o})},"withInspectorControl");(0,f.addFilter)("blocks.registerBlockType","cloudcatch/LightModalBlockAttributes",(e,o)=>(void 0!==e?.attributes&&y.includes(o)&&(e.attributes={...e.attributes,modalTriggerEnabled:{type:"boolean",default:!1},modalEnabled:{type:"string"}}),e)),(0,f.addFilter)("editor.BlockEdit","cloudcatch/LightModalBlockAdvancedControls",B),(0,f.addFilter)("blocks.getSaveContent.extraProps","cloudcatch/LightModalBlockAttributes",(e,o,l)=>{const{modalTriggerEnabled:t,modalEnabled:a}=l;return!0===t&&null!=a?{...e,"data-trigger-modal":a}:e}),(0,a.registerBlockType)(k.UU,{edit:_,save:function(e){const{attributes:o}=e,{id:l,width:t,backdropColor:a,enableCloseButton:i,closeIconColor:r,closeBackgroundColor:s,triggerDelay:h,enableTriggerDelay:g,triggerSelector:u,cookieDuration:b,interactionSetsCookie:m,autoplayMedia:_}=o,k=Number.isFinite(t)?t+"%":t,x=d.useBlockProps.save({style:k?{maxWidth:k}:void 0}),w={role:"dialog","aria-modal":!0,className:n()("wp-block-cloudcatch-light-modal-block__wrapper"),style:a?{backgroundColor:a}:void 0,"data-trigger-delay":g?h:void 0,"data-trigger-selector":u||void 0,"data-cookie-duration":b||void 0,"data-cookie-interaction":m||void 0,"data-autoplay-media":_||void 0,"data-modal-id":l};return(0,p.jsx)("div",{...w,children:(0,p.jsxs)("div",{...x,children:[(0,p.jsx)("div",{...d.useInnerBlocksProps.save({className:"wp-block-cloudcatch-light-modal-block__content"})}),i&&(0,p.jsx)("button",{className:"wp-block-cloudcatch-light-modal-block__close",style:{backgroundColor:s},children:(0,p.jsx)(c.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",children:(0,p.jsx)(c.Path,{d:"M24 1.2 22.8 0 12 10.8 1.2 0 0 1.2 10.8 12 0 22.8 1.2 24 12 13.2 22.8 24l1.2-1.2L13.2 12 24 1.2z",fill:r})})})]})})},icon:w})},942:(e,o)=>{var l;!function(){"use strict";var t={}.hasOwnProperty;function a(){for(var e="",o=0;o<arguments.length;o++){var l=arguments[o];l&&(e=n(e,i(l)))}return e}function i(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return a.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var o="";for(var l in e)t.call(e,l)&&e[l]&&(o=n(o,l));return o}function n(e,o){return o?e?e+" "+o:e+o:e}e.exports?(a.default=a,e.exports=a):void 0===(l=function(){return a}.apply(o,[]))||(e.exports=l)}()}},l={};function t(e){var a=l[e];if(void 0!==a)return a.exports;var i=l[e]={exports:{}};return o[e](i,i.exports,t),i.exports}t.m=o,e=[],t.O=(o,l,a,i)=>{if(!l){var n=1/0;for(c=0;c<e.length;c++){for(var[l,a,i]=e[c],r=!0,d=0;d<l.length;d++)(!1&i||n>=i)&&Object.keys(t.O).every(e=>t.O[e](l[d]))?l.splice(d--,1):(r=!1,i<n&&(n=i));if(r){e.splice(c--,1);var s=a();void 0!==s&&(o=s)}}return o}i=i||0;for(var c=e.length;c>0&&e[c-1][2]>i;c--)e[c]=e[c-1];e[c]=[l,a,i]},t.n=e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return t.d(o,{a:o}),o},t.d=(e,o)=>{for(var l in o)t.o(o,l)&&!t.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:o[l]})},t.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},(()=>{var e={57:0,350:0};t.O.j=o=>0===e[o];var o=(o,l)=>{var a,i,[n,r,d]=l,s=0;if(n.some(o=>0!==e[o])){for(a in r)t.o(r,a)&&(t.m[a]=r[a]);if(d)var c=d(t)}for(o&&o(l);s<n.length;s++)i=n[s],t.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return t.O(c)},l=globalThis.webpackChunklight_modal_block=globalThis.webpackChunklight_modal_block||[];l.forEach(o.bind(null,0)),l.push=o.bind(null,l.push.bind(l))})();var a=t.O(void 0,[350],()=>t(311));a=t.O(a)})();1 (()=>{var e,o={167(e,o,l){"use strict";const t=window.wp.blocks;var a=l(942),i=l.n(a);const n=window.wp.i18n,r=window.wp.blockEditor,d=window.wp.element,s=window.wp.components,c=window.wp.data,h=window.wp.editor;let g=e=>crypto.getRandomValues(new Uint8Array(e));const u=()=>((e,o=21)=>((e,o,l)=>{let t=(2<<Math.log2(e.length-1))-1,a=-~(1.6*t*o/e.length);return(i=o)=>{let n="";for(;;){let o=l(a),r=0|a;for(;r--;)if(n+=e[o[r]&t]||"",n.length>=i)return n}}})(e,0|o,g))("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",11)(),b=()=>(0,c.useSelect)(e=>{const{getBlocksByName:o,getBlock:l}=e(r.store);return o("cloudcatch/light-modal-block").map(l)}),m=window.ReactJSXRuntime,p=(0,s.withNotices)(function(e){const{attributes:o,setAttributes:l,isSelected:t,clientId:a}=e,{id:g,label:p,width:_,backdropColor:k,enableCloseButton:x,closeIconColor:w,closeBackgroundColor:v,triggerDelay:C,enableTriggerDelay:f,triggerSelector:j,cookieDuration:y,interactionSetsCookie:B,autoplayMedia:S}=o,M=b();(0,d.useEffect)(()=>{const e=M.filter((e,o,l)=>l.find(o=>o.attributes.id===e.attributes.id&&o.clientId!==e.clientId));if(!(e.length<=1))for(let o=1;o<e.length;o++)(0,c.dispatch)("core/block-editor").updateBlockAttributes(e[o].clientId,{id:u()})},[a,M]);const[I,D]=(0,d.useState)(!1),N=(0,r.__experimentalUseMultipleOriginColorsAndGradients)(),P=(0,c.useSelect)(e=>{const{getCurrentPostType:o}=e(h.store);return o()},[]),T=(0,d.useRef)(null),[A,E]=(0,d.useState)(!1),H=(0,c.useSelect)(e=>{const{hasSelectedInnerBlock:o}=e(r.store);return o(a,!0)},[a]);(0,d.useEffect)(()=>{g||l({id:u()})},[g,l]),(0,d.useEffect)(()=>{t||H?E(!0):"wp_block"!==P||I?E(!1):(D(!0),E(!0))},[t,H,P]);const[O]=(0,r.useSettings)("spacing.units"),F=(0,s.__experimentalUseCustomUnits)({availableUnits:O||["%","px","em","rem","vw"]}),V=Number.isFinite(_)?_+"%":_,z=(0,r.useBlockProps)({style:V?{maxWidth:V}:void 0}),U={ref:T,role:"dialog","aria-modal":!0,className:i()("wp-block-cloudcatch-light-modal-block__wrapper",{"is-open":A}),style:k?{backgroundColor:k}:void 0,"data-trigger-delay":f?C:void 0,"data-trigger-selector":j||void 0,"data-cookie-duration":y||void 0,"data-cookie-interaction":B||void 0,"data-autoplay-media":S||void 0,"data-modal-id":g};return(0,m.jsxs)(m.Fragment,{children:[(0,m.jsxs)(r.InspectorControls,{children:[(0,m.jsxs)(s.PanelBody,{children:[(0,m.jsxs)(s.Flex,{align:"center",gap:2,style:{marginBlockEnd:"12px"},children:[(0,m.jsx)(s.FlexBlock,{children:(0,m.jsxs)("p",{className:"wp-block-cloudcatch-light-modal-block__editor-id",style:{margin:0},children:[(0,n.__)("Modal ID","light-modal-block"),": ",(0,m.jsx)("code",{children:g})]})}),(0,m.jsx)(s.FlexItem,{children:(0,m.jsx)(s.Button,{icon:"update",label:(0,n.__)("Regenerate ID","light-modal-block"),onClick:()=>{window.confirm((0,n.__)("Are you sure you want to regenerate the Modal ID? This will break any existing links to this modal.","light-modal-block"))&&l({id:u()})},size:"small"})})]}),(0,m.jsx)(s.TextControl,{label:(0,n.__)("Modal Label","light-modal-block"),value:p,placeholder:(0,n.__)("New Modal","light-modal-block"),onChange:e=>l({label:e}),help:(0,n.__)("Used to differentiate modals from one another","light-modal-block"),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),(0,m.jsx)(s.__experimentalUnitControl,{label:(0,n.__)("Width"),labelPosition:"edge",__unstableInputWidth:"80px",value:_||"",onChange:e=>{e=0>parseFloat(e)?"0":e,l({width:e})},units:F,__next40pxDefaultSize:!0}),(0,m.jsx)(s.ToggleControl,{label:(0,n.__)("Show close button","light-modal-block"),checked:x||!1,onChange:()=>{l({enableCloseButton:!x})},__nextHasNoMarginBottom:!0})]}),(0,m.jsxs)(s.PanelBody,{title:(0,n.__)("Triggers","light-modal-block"),children:[(0,m.jsx)(s.ToggleControl,{label:(0,n.__)("Show modal on page load","light-modal-block"),checked:f||!1,onChange:()=>{l({enableTriggerDelay:!f})},__nextHasNoMarginBottom:!0}),f&&(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(s.__experimentalUnitControl,{label:(0,n.__)("Delay","light-modal-block"),labelPosition:"edge",__unstableInputWidth:"80px",value:C,placeholder:"0",onChange:e=>l({triggerDelay:e}),unit:"ms",units:{ms:{value:"ms",label:"ms",default:"",a11yLabel:(0,n.__)("Milliseconds (ms)"),step:1}}}),(0,m.jsx)(s.__experimentalUnitControl,{label:(0,n.__)("Cookie duration","light-modal-block"),labelPosition:"edge",__unstableInputWidth:"80px",value:y,help:(0,n.__)("Duration in minutes before this modal will appear again after being closed. Leave blank to always show this modal.","light-modal-block"),placeholder:"0",onChange:e=>l({cookieDuration:e}),unit:"min",units:{ms:{value:"min",label:"min",default:"",a11yLabel:(0,n.__)("Minutes (min)"),step:1}}}),(0,m.jsx)(s.ToggleControl,{label:(0,n.__)("Interaction sets cookie","light-modal-block"),checked:B||!1,help:(0,n.__)("Interaction with the modal such as clicking a link or submitting a form, will set the cookie, respecting the cookie duration.","light-modal-block"),onChange:()=>{l({interactionSetsCookie:!B})},__nextHasNoMarginBottom:!0})]}),(0,m.jsx)(s.TextControl,{label:(0,n.__)("Selector","light-modal-block"),value:j,onChange:e=>l({triggerSelector:e}),style:{fontFamily:"monospace"},help:(0,n.__)("CSS selector for additional trigger elements that will open this modal when clicked.","light-modal-block"),placeholder:(0,n.__)(".my-button, #my-link","light-modal-block"),__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),(0,m.jsx)(s.ToggleControl,{label:(0,n.__)("Autoplay media when modal opens","light-modal-block"),checked:S||!1,help:(0,n.__)("Note: Most browsers require a user action before this can run, so it may not work for modals that open automatically on page load.","light-modal-block"),onChange:()=>{l({autoplayMedia:!S})},__nextHasNoMarginBottom:!0})]})]}),(0,m.jsxs)(r.InspectorControls,{group:"color",children:[(0,m.jsx)(r.__experimentalColorGradientSettingsDropdown,{__experimentalIsRenderedInSidebar:!0,settings:[{colorValue:k,label:(0,n.__)("Backdrop","light-modal-block"),onColorChange:e=>l({backdropColor:e}),isShownByDefault:!0,enableAlpha:!0,resetAllFilter:()=>({backdropColor:void 0})}],panelId:a,...N}),(0,m.jsx)(r.__experimentalColorGradientSettingsDropdown,{__experimentalIsRenderedInSidebar:!0,settings:[{colorValue:w,label:(0,n.__)("Close Icon","light-modal-block"),onColorChange:e=>l({closeIconColor:e}),isShownByDefault:!0,enableAlpha:!0,resetAllFilter:()=>({closeIconColor:void 0})}],panelId:a,...N}),(0,m.jsx)(r.__experimentalColorGradientSettingsDropdown,{__experimentalIsRenderedInSidebar:!0,settings:[{colorValue:v,label:(0,n.__)("Close Background","light-modal-block"),onColorChange:e=>l({closeBackgroundColor:e}),isShownByDefault:!0,enableAlpha:!0,resetAllFilter:()=>({closeBackgroundColor:void 0})}],panelId:a,...N})]}),(0,m.jsx)("div",{...U,children:(0,m.jsxs)("div",{...z,children:[(0,m.jsx)("div",{...(0,r.useInnerBlocksProps)({className:"wp-block-cloudcatch-light-modal-block__content"})}),x&&(0,m.jsx)("button",{className:"wp-block-cloudcatch-light-modal-block__close",onClick:()=>{E(!1)},style:{backgroundColor:v},children:(0,m.jsx)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",children:(0,m.jsx)(s.Path,{d:"M24 1.2 22.8 0 12 10.8 1.2 0 0 1.2 10.8 12 0 22.8 1.2 24 12 13.2 22.8 24l1.2-1.2L13.2 12 24 1.2z",fill:w})})})]})})]})}),_=JSON.parse('{"UU":"cloudcatch/light-modal-block"}'),k=window.wp.primitives,x=(0,m.jsxs)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",children:[(0,m.jsx)(k.Path,{d:"M6.4 12.1h11.2v1.5H6.4zM6.5 15.5h11.2V17H6.5z"}),(0,m.jsx)(k.Path,{d:"M23.2 4.5c0-2.1-1.7-3.7-3.7-3.7-1 0-2 .4-2.7 1.2-.3.3-.5.7-.7 1H5c-1.1 0-1.9.9-1.9 2v14c0 1.1.8 2 1.9 2h14.1c1.1 0 1.9-.9 1.9-1.9V7.9c1.3-.5 2.2-1.8 2.2-3.4zM19.5 19c0 .2-.2.4-.4.4H5c-.2 0-.4-.2-.4-.4V5c0-.2.2-.4.4-.4h10.8c0 2.1 1.7 3.7 3.7 3.7V19zm0-12.2c-1.2 0-2.2-1-2.2-2.2 0-.6.2-1.1.6-1.5.4-.5 1-.7 1.6-.7 1.2 0 2.2 1 2.2 2.2s-1 2.2-2.2 2.2z"})]}),w=window.wp.plugins,v=window.wp.editPost;var C=(0,m.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,m.jsx)(k.Path,{d:"m19 7-3-3-8.5 8.5-1 4 4-1L19 7Zm-7 11.5H5V20h7v-1.5Z"})}),f=(0,m.jsx)(k.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,m.jsx)(k.Path,{fillRule:"evenodd",clipRule:"evenodd",d:"M12 5.5A2.25 2.25 0 0 0 9.878 7h4.244A2.251 2.251 0 0 0 12 5.5ZM12 4a3.751 3.751 0 0 0-3.675 3H5v1.5h1.27l.818 8.997a2.75 2.75 0 0 0 2.739 2.501h4.347a2.75 2.75 0 0 0 2.738-2.5L17.73 8.5H19V7h-3.325A3.751 3.751 0 0 0 12 4Zm4.224 4.5H7.776l.806 8.861a1.25 1.25 0 0 0 1.245 1.137h4.347a1.25 1.25 0 0 0 1.245-1.137l.805-8.861Z"})});(0,w.registerPlugin)("light-modal-block",{render:function(){const e=b(),{selectBlock:o,removeBlock:l}=(0,c.useDispatch)(r.store),{openGeneralSidebar:t}=(0,c.useDispatch)(v.store);return(0,m.jsx)(h.PluginSidebar,{name:"plugin-sidebar-test",title:(0,n.__)("Modals","light-modal-block"),icon:x,children:(0,m.jsx)(s.PanelBody,{className:"plugin-sidebar-content",children:(0,m.jsxs)(s.__experimentalVStack,{spacing:3,children:[e.length>0&&e.map((e,a)=>(0,m.jsx)("div",{children:(0,m.jsx)(s.Card,{className:"light-modal-block__card",children:(0,m.jsxs)(s.CardBody,{children:[(0,m.jsx)(s.__experimentalHeading,{size:4,children:e.attributes.label||(0,n.__)("New Modal","light-modal-block")}),(0,m.jsxs)("div",{children:[(0,m.jsx)(s.Button,{icon:C,label:(0,n.__)("Edit Modal","light-modal-block"),onClick:async()=>{await o(e.clientId),t("edit-post/block")}}),(0,m.jsx)(s.Button,{icon:f,label:(0,n.__)("Remove Modal","light-modal-block"),onClick:()=>l(e.clientId),isDestructive:!0})]})]})})},a)),e.length<1&&(0,m.jsx)(s.Card,{isBorderless:!0,children:(0,m.jsx)(s.CardBody,{children:(0,m.jsx)("p",{children:(0,n.__)("There are no modals on this page","light-modal-block")})})})]})})})}});const j=window.wp.hooks,y=window.wp.compose,B=["core/button","core/image","core/heading","core/group"],S=(0,y.createHigherOrderComponent)(e=>o=>{const{name:l,attributes:t,setAttributes:a}=o,i=b(),d=i.filter(e=>t?.modalEnabled===e?.attributes?.id)[0],{selectBlock:h}=(0,c.useDispatch)(r.store),g=[{label:(0,n.__)("Select Modal","light-modal-block"),value:""},...i.map(e=>({label:e?.attributes?.label||(0,n.__)("New Modal","light-modal-block"),value:e?.attributes?.id}))];return B.includes(l)?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(e,{...o}),"cloudcatch/light-modal-block"!==l&&(0,m.jsx)(r.InspectorAdvancedControls,{children:(0,m.jsxs)(s.BaseControl,{__nextHasNoMarginBottom:!0,children:[(0,m.jsx)(s.ToggleControl,{label:(0,n.__)("Show Modal on Click","light-modal-block"),checked:t?.modalTriggerEnabled||!1,onChange:()=>{a({modalTriggerEnabled:!t?.modalTriggerEnabled})},__nextHasNoMarginBottom:!0}),t?.modalTriggerEnabled&&(0,m.jsx)(s.SelectControl,{label:(0,n.__)("Modal","light-modal-block"),value:t?.modalEnabled,options:g,onChange:e=>{a({modalEnabled:e})},__nextHasNoMarginBottom:!0,__next40pxDefaultSize:!0}),null!=d&&(0,m.jsx)(s.BaseControl,{__nextHasNoMarginBottom:!0,children:(0,m.jsx)(s.Button,{label:(0,n.__)("Edit Modal","light-modal-block"),variant:"secondary",onClick:()=>h(d.clientId),children:(0,n.__)("Open Modal","light-modal-block")})})]})})]}):(0,m.jsx)(e,{...o})},"withInspectorControl");(0,j.addFilter)("blocks.registerBlockType","cloudcatch/LightModalBlockAttributes",(e,o)=>(void 0!==e?.attributes&&B.includes(o)&&(e.attributes={...e.attributes,modalTriggerEnabled:{type:"boolean",default:!1},modalEnabled:{type:"string"}}),e)),(0,j.addFilter)("editor.BlockEdit","cloudcatch/LightModalBlockAdvancedControls",S),(0,j.addFilter)("blocks.getSaveContent.extraProps","cloudcatch/LightModalBlockAttributes",(e,o,l)=>{const{modalTriggerEnabled:t,modalEnabled:a}=l;return!0===t&&null!=a?{...e,"data-trigger-modal":a}:e}),(0,t.registerBlockType)(_.UU,{edit:p,save:function(e){const{attributes:o}=e,{id:l,width:t,backdropColor:a,enableCloseButton:n,closeIconColor:d,closeBackgroundColor:c,triggerDelay:h,enableTriggerDelay:g,triggerSelector:u,cookieDuration:b,interactionSetsCookie:p,autoplayMedia:_}=o,k=Number.isFinite(t)?t+"%":t,x=r.useBlockProps.save({style:k?{maxWidth:k}:void 0}),w={role:"dialog","aria-modal":!0,className:i()("wp-block-cloudcatch-light-modal-block__wrapper"),style:a?{backgroundColor:a}:void 0,"data-trigger-delay":g?h:void 0,"data-trigger-selector":u||void 0,"data-cookie-duration":b||void 0,"data-cookie-interaction":p||void 0,"data-autoplay-media":_||void 0,"data-modal-id":l};return(0,m.jsx)("div",{...w,children:(0,m.jsxs)("div",{...x,children:[(0,m.jsx)("div",{...r.useInnerBlocksProps.save({className:"wp-block-cloudcatch-light-modal-block__content"})}),n&&(0,m.jsx)("button",{className:"wp-block-cloudcatch-light-modal-block__close",style:{backgroundColor:c},children:(0,m.jsx)(s.SVG,{xmlns:"http://www.w3.org/2000/svg",width:"14",height:"14",viewBox:"0 0 24 24",children:(0,m.jsx)(s.Path,{d:"M24 1.2 22.8 0 12 10.8 1.2 0 0 1.2 10.8 12 0 22.8 1.2 24 12 13.2 22.8 24l1.2-1.2L13.2 12 24 1.2z",fill:d})})})]})})},icon:x})},942(e,o){var l;!function(){"use strict";var t={}.hasOwnProperty;function a(){for(var e="",o=0;o<arguments.length;o++){var l=arguments[o];l&&(e=n(e,i(l)))}return e}function i(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return a.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var o="";for(var l in e)t.call(e,l)&&e[l]&&(o=n(o,l));return o}function n(e,o){return o?e?e+" "+o:e+o:e}e.exports?(a.default=a,e.exports=a):void 0===(l=function(){return a}.apply(o,[]))||(e.exports=l)}()}},l={};function t(e){var a=l[e];if(void 0!==a)return a.exports;var i=l[e]={exports:{}};return o[e](i,i.exports,t),i.exports}t.m=o,e=[],t.O=(o,l,a,i)=>{if(!l){var n=1/0;for(c=0;c<e.length;c++){for(var[l,a,i]=e[c],r=!0,d=0;d<l.length;d++)(!1&i||n>=i)&&Object.keys(t.O).every(e=>t.O[e](l[d]))?l.splice(d--,1):(r=!1,i<n&&(n=i));if(r){e.splice(c--,1);var s=a();void 0!==s&&(o=s)}}return o}i=i||0;for(var c=e.length;c>0&&e[c-1][2]>i;c--)e[c]=e[c-1];e[c]=[l,a,i]},t.n=e=>{var o=e&&e.__esModule?()=>e.default:()=>e;return t.d(o,{a:o}),o},t.d=(e,o)=>{for(var l in o)t.o(o,l)&&!t.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:o[l]})},t.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),(()=>{var e={57:0,350:0};t.O.j=o=>0===e[o];var o=(o,l)=>{var a,i,[n,r,d]=l,s=0;if(n.some(o=>0!==e[o])){for(a in r)t.o(r,a)&&(t.m[a]=r[a]);if(d)var c=d(t)}for(o&&o(l);s<n.length;s++)i=n[s],t.o(e,i)&&e[i]&&e[i][0](),e[i]=0;return t.O(c)},l=globalThis.webpackChunklight_modal_block=globalThis.webpackChunklight_modal_block||[];l.forEach(o.bind(null,0)),l.push=o.bind(null,l.push.bind(l))})();var a=t.O(void 0,[350],()=>t(167));a=t.O(a)})(); -
light-modal-block/trunk/light-modal-block.php
r3399001 r3467105 5 5 * Requires at least: 6.6 6 6 * Requires PHP: 7.0 7 * Version: 1. 8.07 * Version: 1.9.0 8 8 * Author: CloudCatch LLC 9 9 * Author URI: https://cloudcatch.io -
light-modal-block/trunk/readme.txt
r3399001 r3467105 3 3 Tags: block, modal, popup, lightbox, gutenberg, full-site-editing 4 4 Tested up to: 6.9 5 Stable tag: 1. 8.05 Stable tag: 1.9.0 6 6 License: GPL-2.0-or-later 7 7 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 36 36 37 37 == Changelog == 38 39 = 1.9.0 = 40 * Enhancement: When selecting edit modal from the plugin sidebar, automatically open the modal block settings 41 * Enhancement: Improve performance of `useModals()` hook via leveraging `getBlocksByName()` 38 42 39 43 = 1.8.0 =
Note: See TracChangeset
for help on using the changeset viewer.