@gem-sdk/core 1.14.0-dev.724 → 1.14.0-dev.731

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";var jsxRuntime=require("react/jsx-runtime"),react=require("react");require("zustand");var BuilderPreviewContext=require("../contexts/BuilderPreviewContext.js"),ShopContext=require("../contexts/ShopContext.js");require("@gem-sdk/adapter-shopify"),require("swr"),require("swr/mutation"),require("vanilla-lazyload"),require("../hooks/useCartUI.js");var CreateThemeSection=require("./theme-section/CreateThemeSection.js"),Tooltip=require("./toolbar/Tooltip.js"),ThemeSectionStatus=require("./theme-section/ThemeSectionStatus.js"),useToolbarPostPurchase=require("../hooks/useToolbarPostPurchase.js"),Resize=require("./resize/Resize.js");require("../helpers/convert.js");const SECTION_LIMIT=25,notVisible=e=>{let t=getComputedStyle(e).overflow;return"visible"!==t},isSection=e=>{let t=e.getAttribute("data-component-tag");return"Section"===t},ComponentToolbarPreview=({...e})=>{let t=e.isThemeSection,i=ShopContext.useShopStore(e=>e.pageType),o=BuilderPreviewContext.useBuilderPreviewStore(e=>e.getParents),n=BuilderPreviewContext.useBuilderPreviewStore(e=>e.getItem("ROOT")),r=BuilderPreviewContext.useBuilderPreviewStore(e=>e.isThemeSectionEditor),[l,a]=react.useState(null),[s,d]=react.useState(!1),[u,c]=react.useState(!1),[C,h]=react.useState([]),[m,x]=react.useState("top"),{isUnableDelete:p,tooltipText:j,isDisableDuplicate:v}=useToolbarPostPurchase.usePostPurchase(e.uid,e.tag||""),b=react.useMemo(()=>p(),[p]),g=(e,t)=>{let i=C.length,o=e.getBoundingClientRect(),n=t.getBoundingClientRect();return o.top-n.top<36*i},w=(e,t)=>{let i=t||e;if(e&&!isSection(e))return notVisible(e)&&g(t,e)?e:e.parentElement?w(e.parentElement,i):void 0},R=react.useCallback(t=>{let i=t.detail;if(i?.componentUid==e.uid){let t=o(e.uid).filter(e=>!("ROOT"===e.uid||"Section"===e.tag&&r||e.editorConfigs?.toolbar?.hide||e.editorConfigs?.component?.noSetting)).slice(0,3);h(t)}else h([]),d(!1)},[h,o,e.uid,r]),S=react.useCallback(()=>{if("Section"==e.tag)return"bottom";let t=document.querySelector('[data-toolbar-active="true"]');if(t){let e=t.getBoundingClientRect();e.top<60?x("bottom"):x("top")}},[e.tag]);if(react.useEffect(()=>{let e=document.querySelector('[data-toolbar-delete="true"]');return e&&window.addEventListener("mouseover",S),window.addEventListener("editor:active-component",R),()=>{window.removeEventListener("editor:active-component",R),window.removeEventListener("mousemove",R)}},[S,R]),"section"===e.type||e.editorConfigs?.toolbar?.hide)return null;let f=()=>n?.childrens?.length||0,T=()=>"Section"!==e.tag?-1:n?.childrens?.length?n.childrens.findIndex(t=>t==e.uid):-1,P=e=>{if(!C.length)return;let t=e?.target||null,i=t.closest("[data-toolbar-active]");if(!t||!i)return;if(s)c(!1),d(!1);else{let e=w(i,i);if(e)c(!0);else{let e=i.getBoundingClientRect();e.top<36*C.length?c(!0):c(!1)}d(!0)}let o=new CustomEvent("editor:toolbar:show-parents",{bubbles:!0,detail:{value:!s}});window.dispatchEvent(o)},H=i=>{i.preventDefault(),i.stopPropagation();let o=new CustomEvent("editor:toolbar:delete-component",{bubbles:!0,detail:{componentUid:e.uid,isThemeSection:t}});return window.dispatchEvent(o),!1},V=i=>{if(i.preventDefault(),i.stopPropagation(),f()>=25&&"Section"==e.tag)return!1;let o=new CustomEvent("editor:toolbar:duplicate-component",{bubbles:!0,detail:{componentUid:e.uid,isThemeSection:t}});return window.dispatchEvent(o),!1},M=t=>{t.preventDefault(),t.stopPropagation();let i=new CustomEvent("editor:toolbar:zoom-out-component",{bubbles:!0,detail:{componentUid:e.uid}});return window.dispatchEvent(i),!1},E=()=>{a(null),window.removeEventListener("editor:close-add-section-popup",E)},Z=(t,i)=>{if(t.preventDefault(),t.stopPropagation(),f()>=25)return!1;let o=t.target;if(o){a(i);let t=o.getBoundingClientRect(),n=new CustomEvent("editor:toolbar:add-section",{bubbles:!0,detail:{componentUid:e.uid,position:i,top:t.top+t.height/2}});window.dispatchEvent(n),window.addEventListener("editor:close-add-section-popup",E)}return!1},B=()=>{let t=e.name&&e.name===`Section ${e.uid}`;return f()>=20?`${t?"Section":e?.name} ${T()+1}/25`:t?`Section ${T()+1}`:e?.name};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[!("Section"==e.tag&&r)&&jsxRuntime.jsxs("div",{"data-toolbar":!0,"data-toolbar-section":"Section"==e.tag,"data-toolbar-theme-section":"Section"==e.tag&&!!t||r,"data-toolbar-limit":T()>=25,children:[jsxRuntime.jsxs("div",{"data-toolbar-show-parent":!0,onClick:e=>P(e),"aria-hidden":"true",children:[jsxRuntime.jsx("div",{"data-toolbar-icon-drag":!0,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),"Section"==e.tag?jsxRuntime.jsx("div",{"data-toolbar-name":!0,children:B()}):jsxRuntime.jsx("div",{"data-toolbar-name":!0,children:e.customLabel||e.label}),"Section"!==e.tag&&C.length>0&&jsxRuntime.jsx("div",{"data-toolbar-icon-parent":!0,"data-toolbar-icon-parent-open":s,children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M5.65522 10C5.07265 10 4.7809 9.22865 5.19284 8.77753L7.53762 6.20974C7.79298 5.93009 8.20702 5.93009 8.46238 6.20974L10.8072 8.77754C11.2191 9.22866 10.9274 10 10.3448 10H5.65522Z",fill:"currentColor"})})})]}),s&&C.map((e,t)=>{let i=e?.childrens?.length??0,o=e.label;return"Row"===e.label&&(o=i<=1?e.label+" "+i+" col":e.label+" "+i+" cols"),jsxRuntime.jsxs("div",{"data-toolbar-parent":!0,"data-parent-uid":e.uid,"data-toolbar-theme-section":r,"data-toolbar-parent-revert":u,style:{top:u?`${36*(t+1)}px`:`${-36*(t+1)}px`},children:[jsxRuntime.jsx("div",{"data-toolbar-icon-drag":!0,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),jsxRuntime.jsx("div",{"data-toolbar-name":!0,children:o})]},e.uid)}),"Section"===e.tag&&!e.isThemeSection&&"STATIC"!==i&&"POST_PURCHASE"!==i&&25>T()&&jsxRuntime.jsx(CreateThemeSection.CreateThemeSection,{...e}),"Sticky"==e.tag&&jsxRuntime.jsx("div",{"data-toolbar-zoom-out":!0,onClick:e=>M(e),"aria-hidden":"true",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.5 7C14.7761 7 15 6.77614 15 6.5C15 6.22386 14.7761 6 14.5 6L10.7072 6L14.8536 1.85355C15.0489 1.65829 15.0489 1.34171 14.8536 1.14645C14.6584 0.951186 14.3418 0.951185 14.1465 1.14645L10 5.29297L10 1.5C10 1.22386 9.77614 1 9.5 1C9.22386 1 9 1.22386 9 1.5L9 6.5C9 6.77614 9.22386 7 9.5 7L14.5 7ZM6 10.7073L6 14.5C6 14.7761 6.22386 15 6.5 15C6.77614 15 7 14.7761 7 14.5L7 9.5C7 9.22386 6.77614 9 6.5 9H1.5C1.22386 9 1 9.22386 1 9.5C1 9.77614 1.22386 10 1.5 10H5.29306L1.14662 14.1464C0.951353 14.3417 0.951353 14.6583 1.14662 14.8536C1.34188 15.0488 1.65846 15.0488 1.85372 14.8536L6 10.7073Z",fill:"currentColor"})})}),jsxRuntime.jsx(Tooltip.default,{enable:"Section"==e.tag&&f()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"bottom","data-toolbar-duplicate":!0,"data-toolbar-disable":"Section"==e.tag&&f()>=25||v(),onClick:v()?void 0:e=>V(e),"aria-hidden":"true",className:v()?"!gp-cursor-not-allowed":"",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.08423 1.21289C5.53194 1.21289 5.08423 1.66061 5.08423 2.21289V3.78711H4.26172C3.43329 3.78711 2.76172 4.45868 2.76172 5.28711V13.2871C2.76172 14.1155 3.43329 14.7871 4.26172 14.7871H10.2617C11.0901 14.7871 11.7617 14.1155 11.7617 13.2871V12.4629H13.0842C13.6365 12.4629 14.0842 12.0152 14.0842 11.4629V2.21289C14.0842 1.66061 13.6365 1.21289 13.0842 1.21289H6.08423ZM10.7617 12.4629H6.08423C5.53194 12.4629 5.08423 12.0152 5.08423 11.4629V4.78711H4.26172C3.98558 4.78711 3.76172 5.01097 3.76172 5.28711V13.2871C3.76172 13.5633 3.98558 13.7871 4.26172 13.7871H10.2617C10.5379 13.7871 10.7617 13.5633 10.7617 13.2871V12.4629Z",fill:"currentColor"})})}),jsxRuntime.jsx(Tooltip.default,{"data-toolbar-delete":!0,onClick:e=>b?null:H(e),enable:b,"data-toolbar-disable":b,width:j().width,text:j().text,position:m,"aria-hidden":"true",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2.88965V2.38965C11 1.56122 10.3284 0.889648 9.5 0.889648H6.5C5.67157 0.889648 5 1.56122 5 2.38965V2.88965H2C1.72386 2.88965 1.5 3.11351 1.5 3.38965C1.5 3.66579 1.72386 3.88965 2 3.88965H3.21997V13.1099C3.21997 14.2144 4.1154 15.1099 5.21997 15.1099H11.22C12.3245 15.1099 13.22 14.2144 13.22 13.1099V3.88965H14C14.2761 3.88965 14.5 3.66579 14.5 3.38965C14.5 3.11351 14.2761 2.88965 14 2.88965H11ZM6 2.88965H10V2.38965C10 2.11351 9.77614 1.88965 9.5 1.88965H6.5C6.22386 1.88965 6 2.11351 6 2.38965V2.88965ZM6.24976 6.13965C6.66397 6.13965 6.99976 6.47543 6.99976 6.88965V11.3896C6.99976 11.8039 6.66397 12.1396 6.24976 12.1396C5.83554 12.1396 5.49976 11.8039 5.49976 11.3896V6.88965C5.49976 6.47543 5.83554 6.13965 6.24976 6.13965ZM10.4998 6.88965C10.4998 6.47543 10.164 6.13965 9.74976 6.13965C9.33554 6.13965 8.99976 6.47543 8.99976 6.88965V11.3896C8.99976 11.8039 9.33554 12.1396 9.74976 12.1396C10.164 12.1396 10.4998 11.8039 10.4998 11.3896V6.88965Z",fill:"currentColor"})})})]}),"STATIC"!==i&&"POST_PURCHASE"!==i&&25>T()&&jsxRuntime.jsx(ThemeSectionStatus.ThemeSectionStatusWrapper,{...e}),jsxRuntime.jsx("div",{"data-outline":!0,"data-outline-section":"Section"==e.tag,"data-outline-theme-section":"Section"==e.tag&&!!t||r,"data-outline-limit":T()>=25}),"Section"==e.tag&&!r&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Tooltip.default,{enable:f()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-top":!0,"data-toolbar-disable":f()>=25,"data-toolbar-add-open":"above"==l,onClick:e=>Z(e,"above"),"aria-hidden":"true",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})}),jsxRuntime.jsx(Tooltip.default,{enable:f()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-bottom":!0,"data-toolbar-disable":f()>=25,"data-toolbar-add-open":"below"==l,onClick:e=>Z(e,"below"),"aria-hidden":"true",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})})]}),jsxRuntime.jsx(Resize.default,{...e})]})};exports.ComponentToolbarPreview=ComponentToolbarPreview;
1
+ "use strict";var jsxRuntime=require("react/jsx-runtime"),react=require("react");require("zustand");var BuilderPreviewContext=require("../contexts/BuilderPreviewContext.js"),ShopContext=require("../contexts/ShopContext.js");require("@gem-sdk/adapter-shopify"),require("swr"),require("swr/mutation"),require("vanilla-lazyload"),require("../hooks/useCartUI.js");var CreateThemeSection=require("./theme-section/CreateThemeSection.js"),Tooltip=require("./toolbar/Tooltip.js"),ThemeSectionStatus=require("./theme-section/ThemeSectionStatus.js"),useToolbarPostPurchase=require("../hooks/useToolbarPostPurchase.js"),Resize=require("./resize/Resize.js");require("../helpers/convert.js");const SECTION_LIMIT=25,notVisible=e=>{let t=getComputedStyle(e).overflow;return"visible"!==t},isSection=e=>{let t=e.getAttribute("data-component-tag");return"Section"===t},ComponentToolbarPreview=({...e})=>{let t=e.isThemeSection,i=ShopContext.useShopStore(e=>e.pageType),o=BuilderPreviewContext.useBuilderPreviewStore(e=>e.getParents),n=BuilderPreviewContext.useBuilderPreviewStore(e=>e.getItem("ROOT")),r=BuilderPreviewContext.useBuilderPreviewStore(e=>e.isThemeSectionEditor),[a,l]=react.useState(null),[s,d]=react.useState(!1),[u,c]=react.useState(!1),[C,h]=react.useState([]),[m,x]=react.useState("top"),[p,j]=react.useState(!0),[v,b]=react.useState({width:"",text:""}),[g,S]=react.useState(!0),w=react.useMemo(()=>"POST_PURCHASE"===i||"GP_FUNNEL_PAGE"===i,[i]),{checkDisableDelete:R,getTooltipText:f,checkDisableDuplicate:T}=useToolbarPostPurchase.usePostPurchase(e.uid,e.tag||""),P=(e,t)=>{let i=C.length,o=e.getBoundingClientRect(),n=t.getBoundingClientRect();return o.top-n.top<36*i},H=(e,t)=>{let i=t||e;if(e&&!isSection(e))return notVisible(e)&&P(t,e)?e:e.parentElement?H(e.parentElement,i):void 0},V=react.useCallback(t=>{let i=t.detail;if(i?.componentUid==e.uid){w&&(j(R()),b(f()),S(T()));let t=o(e.uid).filter(e=>!("ROOT"===e.uid||"Section"===e.tag&&r||e.editorConfigs?.toolbar?.hide||e.editorConfigs?.component?.noSetting)).slice(0,3);h(t)}else h([]),d(!1)},[e.uid,w,o,R,f,T,r]),E=react.useCallback(()=>{if("Section"==e.tag)return"bottom";let t=document.querySelector('[data-toolbar-active="true"]');if(t){let e=t.getBoundingClientRect();e.top<60?x("bottom"):x("top")}},[e.tag]);if(react.useEffect(()=>{let e=document.querySelector('[data-toolbar-delete="true"]');return e&&window.addEventListener("mouseover",E),window.addEventListener("editor:active-component",V),()=>{window.removeEventListener("editor:active-component",V),window.removeEventListener("mousemove",V)}},[E,V]),"section"===e.type||e.editorConfigs?.toolbar?.hide)return null;let M=()=>n?.childrens?.length||0,Z=()=>"Section"!==e.tag?-1:n?.childrens?.length?n.childrens.findIndex(t=>t==e.uid):-1,B=e=>{if(!C.length)return;let t=e?.target||null,i=t.closest("[data-toolbar-active]");if(!t||!i)return;if(s)c(!1),d(!1);else{let e=H(i,i);if(e)c(!0);else{let e=i.getBoundingClientRect();e.top<36*C.length?c(!0):c(!1)}d(!0)}let o=new CustomEvent("editor:toolbar:show-parents",{bubbles:!0,detail:{value:!s}});window.dispatchEvent(o)},L=i=>{i.preventDefault(),i.stopPropagation();let o=new CustomEvent("editor:toolbar:delete-component",{bubbles:!0,detail:{componentUid:e.uid,isThemeSection:t}});return window.dispatchEvent(o),!1},q=i=>{if(i.preventDefault(),i.stopPropagation(),M()>=25&&"Section"==e.tag)return!1;let o=new CustomEvent("editor:toolbar:duplicate-component",{bubbles:!0,detail:{componentUid:e.uid,isThemeSection:t}});return window.dispatchEvent(o),!1},k=t=>{t.preventDefault(),t.stopPropagation();let i=new CustomEvent("editor:toolbar:zoom-out-component",{bubbles:!0,detail:{componentUid:e.uid}});return window.dispatchEvent(i),!1},y=()=>{l(null),window.removeEventListener("editor:close-add-section-popup",y)},U=(t,i)=>{if(t.preventDefault(),t.stopPropagation(),M()>=25)return!1;let o=t.target;if(o){l(i);let t=o.getBoundingClientRect(),n=new CustomEvent("editor:toolbar:add-section",{bubbles:!0,detail:{componentUid:e.uid,position:i,top:t.top+t.height/2}});window.dispatchEvent(n),window.addEventListener("editor:close-add-section-popup",y)}return!1},z=()=>{let t=e.name&&e.name===`Section ${e.uid}`;return M()>=20?`${t?"Section":e?.name} ${Z()+1}/25`:t?`Section ${Z()+1}`:e?.name};return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[!("Section"==e.tag&&r)&&jsxRuntime.jsxs("div",{"data-toolbar":!0,"data-toolbar-section":"Section"==e.tag,"data-toolbar-theme-section":"Section"==e.tag&&!!t||r,"data-toolbar-limit":Z()>=25,children:[jsxRuntime.jsxs("div",{"data-toolbar-show-parent":!0,onClick:e=>B(e),"aria-hidden":"true",children:[jsxRuntime.jsx("div",{"data-toolbar-icon-drag":!0,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),"Section"==e.tag?jsxRuntime.jsx("div",{"data-toolbar-name":!0,children:z()}):jsxRuntime.jsx("div",{"data-toolbar-name":!0,children:e.customLabel||e.label}),"Section"!==e.tag&&C.length>0&&jsxRuntime.jsx("div",{"data-toolbar-icon-parent":!0,"data-toolbar-icon-parent-open":s,children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M5.65522 10C5.07265 10 4.7809 9.22865 5.19284 8.77753L7.53762 6.20974C7.79298 5.93009 8.20702 5.93009 8.46238 6.20974L10.8072 8.77754C11.2191 9.22866 10.9274 10 10.3448 10H5.65522Z",fill:"currentColor"})})})]}),s&&C.map((e,t)=>{let i=e?.childrens?.length??0,o=e.label;return"Row"===e.label&&(o=i<=1?e.label+" "+i+" col":e.label+" "+i+" cols"),jsxRuntime.jsxs("div",{"data-toolbar-parent":!0,"data-parent-uid":e.uid,"data-toolbar-theme-section":r,"data-toolbar-parent-revert":u,style:{top:u?`${36*(t+1)}px`:`${-36*(t+1)}px`},children:[jsxRuntime.jsx("div",{"data-toolbar-icon-drag":!0,children:jsxRuntime.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[jsxRuntime.jsx("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),jsxRuntime.jsx("div",{"data-toolbar-name":!0,children:o})]},e.uid)}),"Section"===e.tag&&!e.isThemeSection&&"STATIC"!==i&&"POST_PURCHASE"!==i&&25>Z()&&jsxRuntime.jsx(CreateThemeSection.CreateThemeSection,{...e}),"Sticky"==e.tag&&jsxRuntime.jsx("div",{"data-toolbar-zoom-out":!0,onClick:e=>k(e),"aria-hidden":"true",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.5 7C14.7761 7 15 6.77614 15 6.5C15 6.22386 14.7761 6 14.5 6L10.7072 6L14.8536 1.85355C15.0489 1.65829 15.0489 1.34171 14.8536 1.14645C14.6584 0.951186 14.3418 0.951185 14.1465 1.14645L10 5.29297L10 1.5C10 1.22386 9.77614 1 9.5 1C9.22386 1 9 1.22386 9 1.5L9 6.5C9 6.77614 9.22386 7 9.5 7L14.5 7ZM6 10.7073L6 14.5C6 14.7761 6.22386 15 6.5 15C6.77614 15 7 14.7761 7 14.5L7 9.5C7 9.22386 6.77614 9 6.5 9H1.5C1.22386 9 1 9.22386 1 9.5C1 9.77614 1.22386 10 1.5 10H5.29306L1.14662 14.1464C0.951353 14.3417 0.951353 14.6583 1.14662 14.8536C1.34188 15.0488 1.65846 15.0488 1.85372 14.8536L6 10.7073Z",fill:"currentColor"})})}),jsxRuntime.jsx(Tooltip.default,{enable:"Section"==e.tag&&M()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"bottom","data-toolbar-duplicate":!0,"data-toolbar-disable":"Section"==e.tag&&M()>=25||g,onClick:g?void 0:e=>q(e),"aria-hidden":"true",className:g?"!gp-cursor-not-allowed":"",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.08423 1.21289C5.53194 1.21289 5.08423 1.66061 5.08423 2.21289V3.78711H4.26172C3.43329 3.78711 2.76172 4.45868 2.76172 5.28711V13.2871C2.76172 14.1155 3.43329 14.7871 4.26172 14.7871H10.2617C11.0901 14.7871 11.7617 14.1155 11.7617 13.2871V12.4629H13.0842C13.6365 12.4629 14.0842 12.0152 14.0842 11.4629V2.21289C14.0842 1.66061 13.6365 1.21289 13.0842 1.21289H6.08423ZM10.7617 12.4629H6.08423C5.53194 12.4629 5.08423 12.0152 5.08423 11.4629V4.78711H4.26172C3.98558 4.78711 3.76172 5.01097 3.76172 5.28711V13.2871C3.76172 13.5633 3.98558 13.7871 4.26172 13.7871H10.2617C10.5379 13.7871 10.7617 13.5633 10.7617 13.2871V12.4629Z",fill:"currentColor"})})}),jsxRuntime.jsx(Tooltip.default,{"data-toolbar-delete":!0,onClick:e=>p?null:L(e),enable:p,"data-toolbar-disable":p,width:v.width,text:v.text,position:m,"aria-hidden":"true",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2.88965V2.38965C11 1.56122 10.3284 0.889648 9.5 0.889648H6.5C5.67157 0.889648 5 1.56122 5 2.38965V2.88965H2C1.72386 2.88965 1.5 3.11351 1.5 3.38965C1.5 3.66579 1.72386 3.88965 2 3.88965H3.21997V13.1099C3.21997 14.2144 4.1154 15.1099 5.21997 15.1099H11.22C12.3245 15.1099 13.22 14.2144 13.22 13.1099V3.88965H14C14.2761 3.88965 14.5 3.66579 14.5 3.38965C14.5 3.11351 14.2761 2.88965 14 2.88965H11ZM6 2.88965H10V2.38965C10 2.11351 9.77614 1.88965 9.5 1.88965H6.5C6.22386 1.88965 6 2.11351 6 2.38965V2.88965ZM6.24976 6.13965C6.66397 6.13965 6.99976 6.47543 6.99976 6.88965V11.3896C6.99976 11.8039 6.66397 12.1396 6.24976 12.1396C5.83554 12.1396 5.49976 11.8039 5.49976 11.3896V6.88965C5.49976 6.47543 5.83554 6.13965 6.24976 6.13965ZM10.4998 6.88965C10.4998 6.47543 10.164 6.13965 9.74976 6.13965C9.33554 6.13965 8.99976 6.47543 8.99976 6.88965V11.3896C8.99976 11.8039 9.33554 12.1396 9.74976 12.1396C10.164 12.1396 10.4998 11.8039 10.4998 11.3896V6.88965Z",fill:"currentColor"})})})]}),"STATIC"!==i&&"POST_PURCHASE"!==i&&25>Z()&&jsxRuntime.jsx(ThemeSectionStatus.ThemeSectionStatusWrapper,{...e}),jsxRuntime.jsx("div",{"data-outline":!0,"data-outline-section":"Section"==e.tag,"data-outline-theme-section":"Section"==e.tag&&!!t||r,"data-outline-limit":Z()>=25}),"Section"==e.tag&&!r&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Tooltip.default,{enable:M()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-top":!0,"data-toolbar-disable":M()>=25,"data-toolbar-add-open":"above"==a,onClick:e=>U(e,"above"),"aria-hidden":"true",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})}),jsxRuntime.jsx(Tooltip.default,{enable:M()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-bottom":!0,"data-toolbar-disable":M()>=25,"data-toolbar-add-open":"below"==a,onClick:e=>U(e,"below"),"aria-hidden":"true",children:jsxRuntime.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:jsxRuntime.jsx("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})})]}),jsxRuntime.jsx(Resize.default,{...e})]})};exports.ComponentToolbarPreview=ComponentToolbarPreview;
@@ -1 +1 @@
1
- "use strict";var isDefined=require("./is-defined.js"),constant=require("./constant.js");const getGlobalColorCSSProp=e=>getSingleColorVariable(e),getGlobalColorClass=(e,t)=>"string"!=typeof t||!t||t?.startsWith("#")||t?.startsWith("rgb")||t?.startsWith("hsl")||t?.startsWith("transparent")?"":`${e}-g-${t}`,getGlobalColorResponsiveClass=(e,t)=>t?Object.entries(t).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"desktop"===t?l:`${t}:${l}`}).filter(isDefined.isDefined).join(" "):"",getGlobalColorStateClass=(e,t)=>t?Object.entries(t).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"normal"===t?l:`${t}:${l}`}).filter(isDefined.isDefined).join(" "):"",getGlobalColorStateClassDynamicBtn=(e,t)=>t?Object.entries(t).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"normal"===t?String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${l}`:String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${t}:${l}`}).filter(isDefined.isDefined).join(" "):"",getGlobalColorStateResponsiveClass=(e,t)=>t?Object.entries(t).map(([t,o])=>"desktop"===t?Object.entries(o).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"normal"===t?l:`${t}:${l}`}).filter(isDefined.isDefined).join(" "):Object.entries(o).map(([o,l])=>{let s=getGlobalColorClass(e,l);if(s)return"normal"===o?`${t}:${s}`:`${t}:${o}:${s}`}).filter(isDefined.isDefined).join(" ")).filter(Boolean).join(" "):"",getGlobalColorStateResponsiveClassDynamicBtn=(e,t)=>t?Object.entries(t).map(([t,o])=>"desktop"===t?Object.entries(o).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"normal"===t?String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${l}`:String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${t}:${l}`}).filter(isDefined.isDefined).join(" "):Object.entries(o).map(([o,l])=>{let s=getGlobalColorClass(e,l);if(s)return"normal"===o?String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${t}:${s}`:String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${t}:${o}:${s}`}).filter(isDefined.isDefined).join(" ")).filter(Boolean).join(" "):"",getGlobalColorResponsiveStyle=(e,t)=>t?Object.fromEntries(Object.entries(t).map(([t,o])=>"desktop"===t?[`--${e}`,getSingleColorVariable(o)]:[`--${e}-${t}`,getSingleColorVariable(o)])):{},getGlobalColorStateStyle=(e,t)=>t?Object.fromEntries(Object.entries(t).map(([t,o])=>"active"===t?[]:[`-${constant.stateMapping?.[t]}-${e}`,getSingleColorVariable(o)]).filter(isDefined.isDefined)):{},getGlobalColorStateResponsiveStyle=(e,t)=>t?Object.entries(t).map(([t,o])=>"desktop"===t?Object.fromEntries(Object.entries(o).map(([t,o])=>"active"===t?[]:[`-${constant.stateMapping[t]}-${e}`,getSingleColorVariable(o)]).filter(isDefined.isDefined)):Object.fromEntries(Object.entries(o).map(([o,l])=>"active"===o?[]:[`-${constant.stateMapping[o]}-${e}-${t}`,getSingleColorVariable(l)]).filter(isDefined.isDefined))).reduce((e,t)=>({...e,...t}),{}):{},getSingleColorVariable=e=>{if(e&&"string"==typeof e)return isColor(e)?e:`var(--g-c-${e}, ${e})`};function isColor(e){return!!e&&"string"==typeof e&&(e?.startsWith("#")||e?.startsWith("rgb")||e?.startsWith("hsl")||e?.startsWith("transparent"))}const getGlobalColorStyle=e=>e?{"--c":getSingleColorVariable(e)}:{},composeTextColorCss=e=>`${e?`color: ${getSingleColorVariable(e)} !important;`:""}`;exports.composeTextColorCss=composeTextColorCss,exports.getGlobalColorCSSProp=getGlobalColorCSSProp,exports.getGlobalColorClass=getGlobalColorClass,exports.getGlobalColorResponsiveClass=getGlobalColorResponsiveClass,exports.getGlobalColorResponsiveStyle=getGlobalColorResponsiveStyle,exports.getGlobalColorStateClass=getGlobalColorStateClass,exports.getGlobalColorStateClassDynamicBtn=getGlobalColorStateClassDynamicBtn,exports.getGlobalColorStateResponsiveClass=getGlobalColorStateResponsiveClass,exports.getGlobalColorStateResponsiveClassDynamicBtn=getGlobalColorStateResponsiveClassDynamicBtn,exports.getGlobalColorStateResponsiveStyle=getGlobalColorStateResponsiveStyle,exports.getGlobalColorStateStyle=getGlobalColorStateStyle,exports.getGlobalColorStyle=getGlobalColorStyle,exports.getSingleColorVariable=getSingleColorVariable,exports.isColor=isColor;
1
+ "use strict";var isDefined=require("./is-defined.js"),constant=require("./constant.js");const getGlobalColorCSSProp=e=>getSingleColorVariable(e),getGlobalColorClass=(e,t)=>"string"!=typeof t||!t||t?.startsWith("#")||t?.startsWith("rgb")||t?.startsWith("hsl")||t?.startsWith("transparent")?"":`gp-${e}-g-${t}`,getGlobalColorResponsiveClass=(e,t)=>t?Object.entries(t).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"desktop"===t?l:`${t}:${l}`}).filter(isDefined.isDefined).join(" "):"",getGlobalColorStateClass=(e,t)=>t?Object.entries(t).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"normal"===t?l:`${t}:${l}`}).filter(isDefined.isDefined).join(" "):"",getGlobalColorStateClassDynamicBtn=(e,t)=>t?Object.entries(t).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"normal"===t?String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${l}`:String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${t}:${l}`}).filter(isDefined.isDefined).join(" "):"",getGlobalColorStateResponsiveClass=(e,t)=>t?Object.entries(t).map(([t,o])=>"desktop"===t?Object.entries(o).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"normal"===t?l:`${t}:${l}`}).filter(isDefined.isDefined).join(" "):Object.entries(o).map(([o,l])=>{let s=getGlobalColorClass(e,l);if(s)return"normal"===o?`${t}:${s}`:`${t}:${o}:${s}`}).filter(isDefined.isDefined).join(" ")).filter(Boolean).join(" "):"",getGlobalColorStateResponsiveClassDynamicBtn=(e,t)=>t?Object.entries(t).map(([t,o])=>"desktop"===t?Object.entries(o).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"normal"===t?String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${l}`:String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${t}:${l}`}).filter(isDefined.isDefined).join(" "):Object.entries(o).map(([o,l])=>{let s=getGlobalColorClass(e,l);if(s)return"normal"===o?String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${t}:${s}`:String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${t}:${o}:${s}`}).filter(isDefined.isDefined).join(" ")).filter(Boolean).join(" "):"",getGlobalColorResponsiveStyle=(e,t)=>t?Object.fromEntries(Object.entries(t).map(([t,o])=>"desktop"===t?[`--${e}`,getSingleColorVariable(o)]:[`--${e}-${t}`,getSingleColorVariable(o)])):{},getGlobalColorStateStyle=(e,t)=>t?Object.fromEntries(Object.entries(t).map(([t,o])=>"active"===t?[]:[`-${constant.stateMapping?.[t]}-${e}`,getSingleColorVariable(o)]).filter(isDefined.isDefined)):{},getGlobalColorStateResponsiveStyle=(e,t)=>t?Object.entries(t).map(([t,o])=>"desktop"===t?Object.fromEntries(Object.entries(o).map(([t,o])=>"active"===t?[]:[`-${constant.stateMapping[t]}-${e}`,getSingleColorVariable(o)]).filter(isDefined.isDefined)):Object.fromEntries(Object.entries(o).map(([o,l])=>"active"===o?[]:[`-${constant.stateMapping[o]}-${e}-${t}`,getSingleColorVariable(l)]).filter(isDefined.isDefined))).reduce((e,t)=>({...e,...t}),{}):{},getSingleColorVariable=e=>{if(e&&"string"==typeof e)return isColor(e)?e:`var(--g-c-${e}, ${e})`};function isColor(e){return!!e&&"string"==typeof e&&(e?.startsWith("#")||e?.startsWith("rgb")||e?.startsWith("hsl")||e?.startsWith("transparent"))}const getGlobalColorStyle=e=>e?{"--c":getSingleColorVariable(e)}:{},composeTextColorCss=e=>`${e?`color: ${getSingleColorVariable(e)} !important;`:""}`;exports.composeTextColorCss=composeTextColorCss,exports.getGlobalColorCSSProp=getGlobalColorCSSProp,exports.getGlobalColorClass=getGlobalColorClass,exports.getGlobalColorResponsiveClass=getGlobalColorResponsiveClass,exports.getGlobalColorResponsiveStyle=getGlobalColorResponsiveStyle,exports.getGlobalColorStateClass=getGlobalColorStateClass,exports.getGlobalColorStateClassDynamicBtn=getGlobalColorStateClassDynamicBtn,exports.getGlobalColorStateResponsiveClass=getGlobalColorStateResponsiveClass,exports.getGlobalColorStateResponsiveClassDynamicBtn=getGlobalColorStateResponsiveClassDynamicBtn,exports.getGlobalColorStateResponsiveStyle=getGlobalColorStateResponsiveStyle,exports.getGlobalColorStateStyle=getGlobalColorStateStyle,exports.getGlobalColorStyle=getGlobalColorStyle,exports.getSingleColorVariable=getSingleColorVariable,exports.isColor=isColor;
@@ -1,4 +1,4 @@
1
- "use strict";var makeStyle=require("./make-style.js"),constant=require("./constant.js"),getResonsiveValue=require("./get-resonsive-value.js");function getCustomSizeCSSByDevice(e,t){if(!e||!t)return{};let i=constant.devicesMapping[t]??"";return{[`--pl${i}`]:e?.[t]?.horizontal,[`--pr${i}`]:e?.[t]?.horizontal,[`--pt${i}`]:e?.[t]?.vertical,[`--pb${i}`]:e?.[t]?.vertical}}const composeSize=e=>Object.assign({},getCustomSizeCSSByDevice(e,"desktop"),getCustomSizeCSSByDevice(e,"tablet"),getCustomSizeCSSByDevice(e,"mobile"));function genSizeClass(e){return`g-s-${e}`}const composeSizeCss=e=>{if(void 0===e)return"";let t=e?.custom?.desktop?.horizontal,i=e?.custom?.desktop?.vertical;if(e?.custom)return`
1
+ "use strict";var makeStyle=require("./make-style.js"),constant=require("./constant.js"),getResonsiveValue=require("./get-resonsive-value.js");function getCustomSizeCSSByDevice(e,t){if(!e||!t)return{};let i=constant.devicesMapping[t]??"";return{[`--pl${i}`]:e?.[t]?.horizontal,[`--pr${i}`]:e?.[t]?.horizontal,[`--pt${i}`]:e?.[t]?.vertical,[`--pb${i}`]:e?.[t]?.vertical}}const composeSize=e=>Object.assign({},getCustomSizeCSSByDevice(e,"desktop"),getCustomSizeCSSByDevice(e,"tablet"),getCustomSizeCSSByDevice(e,"mobile"));function genSizeClass(e){return`gp-g-s-${e}`}const composeSizeCss=e=>{if(void 0===e)return"";let t=e?.custom?.desktop?.horizontal,i=e?.custom?.desktop?.vertical;if(e?.custom)return`
2
2
  ${t?`padding-left: ${t}; padding-right: ${t};`:void 0}
3
3
  ${i?`padding-top: ${i}; padding-bottom: ${i};`:void 0}
4
4
  `},makeGlobalSize=e=>({width:makeStyleWithDefault("w",getWidthHeightGlobalSize("width",e),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),height:makeStyle.makeStyleResponsive("h",getWidthHeightGlobalSize("height",e)),padding:getPaddingGlobalSize(e),gap:getGlobalSizeGap(e)}),getGlobalSizeGap=e=>({"--gg":e?.desktop?.gap,"--gg-tablet":e?.tablet?.gap,"--gg-mobile":e?.mobile?.gap}),makeStyleWithDefault=(e,t,i)=>({[`--${e}`]:t?.desktop==="default"?`var(${i?.desktop})`:t?.desktop,[`--${e}-tablet`]:t?.tablet==="default"?`var(${i?.tablet})`:t?.tablet,[`--${e}-mobile`]:t?.mobile==="default"?`var(${i?.mobile})`:t?.mobile}),getWidthHeightGlobalSize=(e,t)=>{if(!t)return{};let i={},a=["desktop","mobile","tablet"];return a.forEach(a=>{i={...i,[a]:getResonsiveValue.getResponsiveValueByScreen(t,a)?.[e]}}),i},getHeightByShapeGlobalSize=e=>{let t={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let a=getResonsiveValue.getResponsiveValueByScreen(e,i),o=a?.shapeValue,l=a?.height;t={...t,[i]:o?"auto":l||"auto"}}),t},getWidthByShapeGlobalSize=(e,t)=>{let i={},a=["desktop","mobile","tablet"];return a.forEach(a=>{let o=getResonsiveValue.getResponsiveValueByScreen(e,a),l=t?o?.width||"auto":o?.width;l&&(i={...i,[a]:l})}),i},getAspectRatioGlobalSize=e=>{let t={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let a=getResonsiveValue.getResponsiveValueByScreen(e,i)?.shapeValue;if(a)t={...t,[i]:a};else{let a=getResonsiveValue.getResponsiveValueByScreen(e,i)?.shape;switch(a){case"square":t={...t,[i]:"1/1"};break;case"vertical":t={...t,[i]:"3/4"};break;case"horizontal":t={...t,[i]:"4/3"};break;case"original":t={...t,[i]:"auto"}}}}),t};function getCustomPaddingSizeCSSByDevice(e,t){if(!e||!t)return{};let i=constant.devicesMapping[t]??"";return{[`--pl${i}`]:e?.[t]?.padding?.left,[`--pr${i}`]:e?.[t]?.padding?.right,[`--pt${i}`]:e?.[t]?.padding?.top,[`--pb${i}`]:e?.[t]?.padding?.bottom}}const getPaddingGlobalSize=e=>Object.assign({},getCustomPaddingSizeCSSByDevice(e,"desktop"),getCustomPaddingSizeCSSByDevice(e,"tablet"),getCustomPaddingSizeCSSByDevice(e,"mobile"));exports.composeSize=composeSize,exports.composeSizeCss=composeSizeCss,exports.genSizeClass=genSizeClass,exports.getAspectRatioGlobalSize=getAspectRatioGlobalSize,exports.getGlobalSizeGap=getGlobalSizeGap,exports.getHeightByShapeGlobalSize=getHeightByShapeGlobalSize,exports.getPaddingGlobalSize=getPaddingGlobalSize,exports.getWidthByShapeGlobalSize=getWidthByShapeGlobalSize,exports.getWidthHeightGlobalSize=getWidthHeightGlobalSize,exports.makeGlobalSize=makeGlobalSize,exports.makeStyleWithDefault=makeStyleWithDefault;
@@ -1 +1 @@
1
- "use strict";var constant=require("../components/constant.js"),ShopContext=require("../contexts/ShopContext.js");const usePostPurchase=(e,t)=>{let r=ShopContext.useShopStore(e=>e.pageType),n=(e,r)=>{let n=e||t,o=0,s=(r||document).querySelectorAll(`[data-component-tag="${n}"]`);if("PostPurchaseProductOffer"===n)return s.length;let u="";return r?s.length:(s.forEach(e=>{let t=e.closest('[data-component-tag="PostPurchaseProductOffer"]'),r=t?.getAttribute("data-uid")||"",s=e.closest('[data-component-tag="Product"]'),c=s?.querySelectorAll(`[data-component-tag="${n}"]`).length||0,a=t?r!==u?c:0:1;t&&(u=r),o+=a}),o)},o=()=>{let e=n();return e<=1},s=()=>{let t=document.querySelector(`[data-uid="${e}"]`);if(!t)return!1;for(let e of constant.postPurchaseRequiredElements){let r=n(e),o=n(e,t);if(o>0&&r-o<1)return!0}return!1},u=constant.postPurchaseRequiredElements.reduce((t,r)=>{let n=document.querySelector(`[data-uid="${e}"]`);if(!n)return 0;let o=n.querySelectorAll(`[data-component-tag="${r}"]`).length;return t+o},0),c=()=>{if("POST_PURCHASE"!==r)return!1;let e=!1;return constant.postPurchaseRequiredElements.includes(t)&&(e=o())?e:!!constant.postPurchaseWrapElements.includes(t)&&u>0&&s()},a=()=>{if(constant.postPurchaseRequiredElements.includes(t))return{text:"This element is required <br> and can’t be deleted",width:"175px"};{let e="Section"===t?"section":"element";return{text:`This ${e} contains required <br> elements and cannot be deleted`,width:"206px"}}};return{isUnableDelete:c,tooltipText:a,isDisableDuplicate:()=>"GP_FUNNEL_PAGE"===r&&"ProductList"===t}};exports.usePostPurchase=usePostPurchase;
1
+ "use strict";var constant=require("../components/constant.js"),ShopContext=require("../contexts/ShopContext.js");const usePostPurchase=(e,t)=>{let r=ShopContext.useShopStore(e=>e.pageType),n=(e,r)=>{let n=e||t,o=0,s=(r||document).querySelectorAll(`[data-component-tag="${n}"]`);if("PostPurchaseProductOffer"===n)return s.length;let u="";return r?s.length:(s.forEach(e=>{let t=e.closest('[data-component-tag="PostPurchaseProductOffer"]'),r=t?.getAttribute("data-uid")||"",s=e.closest('[data-component-tag="Product"]'),c=s?.querySelectorAll(`[data-component-tag="${n}"]`).length||0,a=t?r!==u?c:0:1;t&&(u=r),o+=a}),o)},o=()=>{let e=n();return e<=1},s=()=>{let t=document.querySelector(`[data-uid="${e}"]`);if(!t)return!1;for(let e of constant.postPurchaseRequiredElements){let r=n(e),o=n(e,t);if(o>0&&r-o<1)return!0}return!1},u=()=>constant.postPurchaseRequiredElements.reduce((t,r)=>{let n=document.querySelector(`[data-uid="${e}"]`);if(!n)return 0;let o=n.querySelectorAll(`[data-component-tag="${r}"]`).length;return t+o},0),c=()=>{if("POST_PURCHASE"!==r)return!1;let e=!1;return constant.postPurchaseRequiredElements.includes(t)&&(e=o())?e:!!(constant.postPurchaseWrapElements.includes(t)&&u()>0)&&s()},a=()=>{if(constant.postPurchaseRequiredElements.includes(t))return{text:"This element is required <br> and can’t be deleted",width:"175px"};{let e="Section"===t?"section":"element";return{text:`This ${e} contains required <br> elements and cannot be deleted`,width:"206px"}}};return{checkDisableDelete:c,getTooltipText:a,checkDisableDuplicate:()=>"GP_FUNNEL_PAGE"===r&&"ProductList"===t}};exports.usePostPurchase=usePostPurchase;
@@ -1 +1 @@
1
- import{jsxs as t,Fragment as e,jsx as o}from"react/jsx-runtime";import{useState as i,useMemo as n,useCallback as l,useEffect as r}from"react";import"zustand";import{useBuilderPreviewStore as a}from"../contexts/BuilderPreviewContext.js";import{useShopStore as d}from"../contexts/ShopContext.js";import"@gem-sdk/adapter-shopify";import"swr";import"swr/mutation";import"vanilla-lazyload";import"../hooks/useCartUI.js";import{CreateThemeSection as C}from"./theme-section/CreateThemeSection.js";import c from"./toolbar/Tooltip.js";import{ThemeSectionStatusWrapper as s}from"./theme-section/ThemeSectionStatus.js";import{usePostPurchase as h}from"../hooks/useToolbarPostPurchase.js";import p from"./resize/Resize.js";import"../helpers/convert.js";let SECTION_LIMIT=25,notVisible=t=>{let e=getComputedStyle(t).overflow;return"visible"!==e},isSection=t=>{let e=t.getAttribute("data-component-tag");return"Section"===e},ComponentToolbarPreview=({...u})=>{let m=u.isThemeSection,b=d(t=>t.pageType),g=a(t=>t.getParents),v=a(t=>t.getItem("ROOT")),f=a(t=>t.isThemeSectionEditor),[w,S]=i(null),[H,V]=i(!1),[M,x]=i(!1),[Z,E]=i([]),[T,L]=i("top"),{isUnableDelete:P,tooltipText:R,isDisableDuplicate:B}=h(u.uid,u.tag||""),y=n(()=>P(),[P]),j=(t,e)=>{let o=Z.length,i=t.getBoundingClientRect(),n=e.getBoundingClientRect();return i.top-n.top<36*o},k=(t,e)=>{let o=e||t;if(t&&!isSection(t))return notVisible(t)&&j(e,t)?t:t.parentElement?k(t.parentElement,o):void 0},I=l(t=>{let e=t.detail;if(e?.componentUid==u.uid){let t=g(u.uid).filter(t=>!("ROOT"===t.uid||"Section"===t.tag&&f||t.editorConfigs?.toolbar?.hide||t.editorConfigs?.component?.noSetting)).slice(0,3);E(t)}else E([]),V(!1)},[E,g,u.uid,f]),U=l(()=>{if("Section"==u.tag)return"bottom";let t=document.querySelector('[data-toolbar-active="true"]');if(t){let e=t.getBoundingClientRect();e.top<60?L("bottom"):L("top")}},[u.tag]);if(r(()=>{let t=document.querySelector('[data-toolbar-delete="true"]');return t&&window.addEventListener("mouseover",U),window.addEventListener("editor:active-component",I),()=>{window.removeEventListener("editor:active-component",I),window.removeEventListener("mousemove",I)}},[U,I]),"section"===u.type||u.editorConfigs?.toolbar?.hide)return null;let O=()=>v?.childrens?.length||0,z=()=>"Section"!==u.tag?-1:v?.childrens?.length?v.childrens.findIndex(t=>t==u.uid):-1,$=t=>{if(!Z.length)return;let e=t?.target||null,o=e.closest("[data-toolbar-active]");if(!e||!o)return;if(H)x(!1),V(!1);else{let t=k(o,o);if(t)x(!0);else{let t=o.getBoundingClientRect();t.top<36*Z.length?x(!0):x(!1)}V(!0)}let i=new CustomEvent("editor:toolbar:show-parents",{bubbles:!0,detail:{value:!H}});window.dispatchEvent(i)},A=t=>{t.preventDefault(),t.stopPropagation();let e=new CustomEvent("editor:toolbar:delete-component",{bubbles:!0,detail:{componentUid:u.uid,isThemeSection:m}});return window.dispatchEvent(e),!1},D=t=>{if(t.preventDefault(),t.stopPropagation(),O()>=25&&"Section"==u.tag)return!1;let e=new CustomEvent("editor:toolbar:duplicate-component",{bubbles:!0,detail:{componentUid:u.uid,isThemeSection:m}});return window.dispatchEvent(e),!1},_=t=>{t.preventDefault(),t.stopPropagation();let e=new CustomEvent("editor:toolbar:zoom-out-component",{bubbles:!0,detail:{componentUid:u.uid}});return window.dispatchEvent(e),!1},q=()=>{S(null),window.removeEventListener("editor:close-add-section-popup",q)},N=(t,e)=>{if(t.preventDefault(),t.stopPropagation(),O()>=25)return!1;let o=t.target;if(o){S(e);let t=o.getBoundingClientRect(),i=new CustomEvent("editor:toolbar:add-section",{bubbles:!0,detail:{componentUid:u.uid,position:e,top:t.top+t.height/2}});window.dispatchEvent(i),window.addEventListener("editor:close-add-section-popup",q)}return!1},F=()=>{let t=u.name&&u.name===`Section ${u.uid}`;return O()>=20?`${t?"Section":u?.name} ${z()+1}/25`:t?`Section ${z()+1}`:u?.name};return t(e,{children:[!("Section"==u.tag&&f)&&t("div",{"data-toolbar":!0,"data-toolbar-section":"Section"==u.tag,"data-toolbar-theme-section":"Section"==u.tag&&!!m||f,"data-toolbar-limit":z()>=25,children:[t("div",{"data-toolbar-show-parent":!0,onClick:t=>$(t),"aria-hidden":"true",children:[o("div",{"data-toolbar-icon-drag":!0,children:t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[o("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),o("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),o("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),o("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),o("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),o("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),"Section"==u.tag?o("div",{"data-toolbar-name":!0,children:F()}):o("div",{"data-toolbar-name":!0,children:u.customLabel||u.label}),"Section"!==u.tag&&Z.length>0&&o("div",{"data-toolbar-icon-parent":!0,"data-toolbar-icon-parent-open":H,children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{d:"M5.65522 10C5.07265 10 4.7809 9.22865 5.19284 8.77753L7.53762 6.20974C7.79298 5.93009 8.20702 5.93009 8.46238 6.20974L10.8072 8.77754C11.2191 9.22866 10.9274 10 10.3448 10H5.65522Z",fill:"currentColor"})})})]}),H&&Z.map((e,i)=>{let n=e?.childrens?.length??0,l=e.label;return"Row"===e.label&&(l=n<=1?e.label+" "+n+" col":e.label+" "+n+" cols"),t("div",{"data-toolbar-parent":!0,"data-parent-uid":e.uid,"data-toolbar-theme-section":f,"data-toolbar-parent-revert":M,style:{top:M?`${36*(i+1)}px`:`${-36*(i+1)}px`},children:[o("div",{"data-toolbar-icon-drag":!0,children:t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[o("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),o("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),o("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),o("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),o("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),o("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),o("div",{"data-toolbar-name":!0,children:l})]},e.uid)}),"Section"===u.tag&&!u.isThemeSection&&"STATIC"!==b&&"POST_PURCHASE"!==b&&25>z()&&o(C,{...u}),"Sticky"==u.tag&&o("div",{"data-toolbar-zoom-out":!0,onClick:t=>_(t),"aria-hidden":"true",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.5 7C14.7761 7 15 6.77614 15 6.5C15 6.22386 14.7761 6 14.5 6L10.7072 6L14.8536 1.85355C15.0489 1.65829 15.0489 1.34171 14.8536 1.14645C14.6584 0.951186 14.3418 0.951185 14.1465 1.14645L10 5.29297L10 1.5C10 1.22386 9.77614 1 9.5 1C9.22386 1 9 1.22386 9 1.5L9 6.5C9 6.77614 9.22386 7 9.5 7L14.5 7ZM6 10.7073L6 14.5C6 14.7761 6.22386 15 6.5 15C6.77614 15 7 14.7761 7 14.5L7 9.5C7 9.22386 6.77614 9 6.5 9H1.5C1.22386 9 1 9.22386 1 9.5C1 9.77614 1.22386 10 1.5 10H5.29306L1.14662 14.1464C0.951353 14.3417 0.951353 14.6583 1.14662 14.8536C1.34188 15.0488 1.65846 15.0488 1.85372 14.8536L6 10.7073Z",fill:"currentColor"})})}),o(c,{enable:"Section"==u.tag&&O()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"bottom","data-toolbar-duplicate":!0,"data-toolbar-disable":"Section"==u.tag&&O()>=25||B(),onClick:B()?void 0:t=>D(t),"aria-hidden":"true",className:B()?"!gp-cursor-not-allowed":"",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.08423 1.21289C5.53194 1.21289 5.08423 1.66061 5.08423 2.21289V3.78711H4.26172C3.43329 3.78711 2.76172 4.45868 2.76172 5.28711V13.2871C2.76172 14.1155 3.43329 14.7871 4.26172 14.7871H10.2617C11.0901 14.7871 11.7617 14.1155 11.7617 13.2871V12.4629H13.0842C13.6365 12.4629 14.0842 12.0152 14.0842 11.4629V2.21289C14.0842 1.66061 13.6365 1.21289 13.0842 1.21289H6.08423ZM10.7617 12.4629H6.08423C5.53194 12.4629 5.08423 12.0152 5.08423 11.4629V4.78711H4.26172C3.98558 4.78711 3.76172 5.01097 3.76172 5.28711V13.2871C3.76172 13.5633 3.98558 13.7871 4.26172 13.7871H10.2617C10.5379 13.7871 10.7617 13.5633 10.7617 13.2871V12.4629Z",fill:"currentColor"})})}),o(c,{"data-toolbar-delete":!0,onClick:t=>y?null:A(t),enable:y,"data-toolbar-disable":y,width:R().width,text:R().text,position:T,"aria-hidden":"true",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2.88965V2.38965C11 1.56122 10.3284 0.889648 9.5 0.889648H6.5C5.67157 0.889648 5 1.56122 5 2.38965V2.88965H2C1.72386 2.88965 1.5 3.11351 1.5 3.38965C1.5 3.66579 1.72386 3.88965 2 3.88965H3.21997V13.1099C3.21997 14.2144 4.1154 15.1099 5.21997 15.1099H11.22C12.3245 15.1099 13.22 14.2144 13.22 13.1099V3.88965H14C14.2761 3.88965 14.5 3.66579 14.5 3.38965C14.5 3.11351 14.2761 2.88965 14 2.88965H11ZM6 2.88965H10V2.38965C10 2.11351 9.77614 1.88965 9.5 1.88965H6.5C6.22386 1.88965 6 2.11351 6 2.38965V2.88965ZM6.24976 6.13965C6.66397 6.13965 6.99976 6.47543 6.99976 6.88965V11.3896C6.99976 11.8039 6.66397 12.1396 6.24976 12.1396C5.83554 12.1396 5.49976 11.8039 5.49976 11.3896V6.88965C5.49976 6.47543 5.83554 6.13965 6.24976 6.13965ZM10.4998 6.88965C10.4998 6.47543 10.164 6.13965 9.74976 6.13965C9.33554 6.13965 8.99976 6.47543 8.99976 6.88965V11.3896C8.99976 11.8039 9.33554 12.1396 9.74976 12.1396C10.164 12.1396 10.4998 11.8039 10.4998 11.3896V6.88965Z",fill:"currentColor"})})})]}),"STATIC"!==b&&"POST_PURCHASE"!==b&&25>z()&&o(s,{...u}),o("div",{"data-outline":!0,"data-outline-section":"Section"==u.tag,"data-outline-theme-section":"Section"==u.tag&&!!m||f,"data-outline-limit":z()>=25}),"Section"==u.tag&&!f&&t(e,{children:[o(c,{enable:O()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-top":!0,"data-toolbar-disable":O()>=25,"data-toolbar-add-open":"above"==w,onClick:t=>N(t,"above"),"aria-hidden":"true",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})}),o(c,{enable:O()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-bottom":!0,"data-toolbar-disable":O()>=25,"data-toolbar-add-open":"below"==w,onClick:t=>N(t,"below"),"aria-hidden":"true",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})})]}),o(p,{...u})]})};export{ComponentToolbarPreview};
1
+ import{jsxs as t,Fragment as e,jsx as o}from"react/jsx-runtime";import{useState as i,useMemo as n,useCallback as l,useEffect as r}from"react";import"zustand";import{useBuilderPreviewStore as a}from"../contexts/BuilderPreviewContext.js";import{useShopStore as d}from"../contexts/ShopContext.js";import"@gem-sdk/adapter-shopify";import"swr";import"swr/mutation";import"vanilla-lazyload";import"../hooks/useCartUI.js";import{CreateThemeSection as C}from"./theme-section/CreateThemeSection.js";import c from"./toolbar/Tooltip.js";import{ThemeSectionStatusWrapper as s}from"./theme-section/ThemeSectionStatus.js";import{usePostPurchase as h}from"../hooks/useToolbarPostPurchase.js";import p from"./resize/Resize.js";import"../helpers/convert.js";let SECTION_LIMIT=25,notVisible=t=>{let e=getComputedStyle(t).overflow;return"visible"!==e},isSection=t=>{let e=t.getAttribute("data-component-tag");return"Section"===e},ComponentToolbarPreview=({...u})=>{let m=u.isThemeSection,b=d(t=>t.pageType),g=a(t=>t.getParents),v=a(t=>t.getItem("ROOT")),f=a(t=>t.isThemeSectionEditor),[w,S]=i(null),[H,V]=i(!1),[E,x]=i(!1),[M,T]=i([]),[Z,L]=i("top"),[P,R]=i(!0),[B,y]=i({width:"",text:""}),[j,k]=i(!0),U=n(()=>"POST_PURCHASE"===b||"GP_FUNNEL_PAGE"===b,[b]),{checkDisableDelete:I,getTooltipText:O,checkDisableDuplicate:A}=h(u.uid,u.tag||""),z=(t,e)=>{let o=M.length,i=t.getBoundingClientRect(),n=e.getBoundingClientRect();return i.top-n.top<36*o},$=(t,e)=>{let o=e||t;if(t&&!isSection(t))return notVisible(t)&&z(e,t)?t:t.parentElement?$(t.parentElement,o):void 0},_=l(t=>{let e=t.detail;if(e?.componentUid==u.uid){U&&(R(I()),y(O()),k(A()));let t=g(u.uid).filter(t=>!("ROOT"===t.uid||"Section"===t.tag&&f||t.editorConfigs?.toolbar?.hide||t.editorConfigs?.component?.noSetting)).slice(0,3);T(t)}else T([]),V(!1)},[u.uid,U,g,I,O,A,f]),D=l(()=>{if("Section"==u.tag)return"bottom";let t=document.querySelector('[data-toolbar-active="true"]');if(t){let e=t.getBoundingClientRect();e.top<60?L("bottom"):L("top")}},[u.tag]);if(r(()=>{let t=document.querySelector('[data-toolbar-delete="true"]');return t&&window.addEventListener("mouseover",D),window.addEventListener("editor:active-component",_),()=>{window.removeEventListener("editor:active-component",_),window.removeEventListener("mousemove",_)}},[D,_]),"section"===u.type||u.editorConfigs?.toolbar?.hide)return null;let N=()=>v?.childrens?.length||0,q=()=>"Section"!==u.tag?-1:v?.childrens?.length?v.childrens.findIndex(t=>t==u.uid):-1,G=t=>{if(!M.length)return;let e=t?.target||null,o=e.closest("[data-toolbar-active]");if(!e||!o)return;if(H)x(!1),V(!1);else{let t=$(o,o);if(t)x(!0);else{let t=o.getBoundingClientRect();t.top<36*M.length?x(!0):x(!1)}V(!0)}let i=new CustomEvent("editor:toolbar:show-parents",{bubbles:!0,detail:{value:!H}});window.dispatchEvent(i)},F=t=>{t.preventDefault(),t.stopPropagation();let e=new CustomEvent("editor:toolbar:delete-component",{bubbles:!0,detail:{componentUid:u.uid,isThemeSection:m}});return window.dispatchEvent(e),!1},J=t=>{if(t.preventDefault(),t.stopPropagation(),N()>=25&&"Section"==u.tag)return!1;let e=new CustomEvent("editor:toolbar:duplicate-component",{bubbles:!0,detail:{componentUid:u.uid,isThemeSection:m}});return window.dispatchEvent(e),!1},K=t=>{t.preventDefault(),t.stopPropagation();let e=new CustomEvent("editor:toolbar:zoom-out-component",{bubbles:!0,detail:{componentUid:u.uid}});return window.dispatchEvent(e),!1},Q=()=>{S(null),window.removeEventListener("editor:close-add-section-popup",Q)},W=(t,e)=>{if(t.preventDefault(),t.stopPropagation(),N()>=25)return!1;let o=t.target;if(o){S(e);let t=o.getBoundingClientRect(),i=new CustomEvent("editor:toolbar:add-section",{bubbles:!0,detail:{componentUid:u.uid,position:e,top:t.top+t.height/2}});window.dispatchEvent(i),window.addEventListener("editor:close-add-section-popup",Q)}return!1},X=()=>{let t=u.name&&u.name===`Section ${u.uid}`;return N()>=20?`${t?"Section":u?.name} ${q()+1}/25`:t?`Section ${q()+1}`:u?.name};return t(e,{children:[!("Section"==u.tag&&f)&&t("div",{"data-toolbar":!0,"data-toolbar-section":"Section"==u.tag,"data-toolbar-theme-section":"Section"==u.tag&&!!m||f,"data-toolbar-limit":q()>=25,children:[t("div",{"data-toolbar-show-parent":!0,onClick:t=>G(t),"aria-hidden":"true",children:[o("div",{"data-toolbar-icon-drag":!0,children:t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[o("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),o("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),o("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),o("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),o("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),o("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),"Section"==u.tag?o("div",{"data-toolbar-name":!0,children:X()}):o("div",{"data-toolbar-name":!0,children:u.customLabel||u.label}),"Section"!==u.tag&&M.length>0&&o("div",{"data-toolbar-icon-parent":!0,"data-toolbar-icon-parent-open":H,children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{d:"M5.65522 10C5.07265 10 4.7809 9.22865 5.19284 8.77753L7.53762 6.20974C7.79298 5.93009 8.20702 5.93009 8.46238 6.20974L10.8072 8.77754C11.2191 9.22866 10.9274 10 10.3448 10H5.65522Z",fill:"currentColor"})})})]}),H&&M.map((e,i)=>{let n=e?.childrens?.length??0,l=e.label;return"Row"===e.label&&(l=n<=1?e.label+" "+n+" col":e.label+" "+n+" cols"),t("div",{"data-toolbar-parent":!0,"data-parent-uid":e.uid,"data-toolbar-theme-section":f,"data-toolbar-parent-revert":E,style:{top:E?`${36*(i+1)}px`:`${-36*(i+1)}px`},children:[o("div",{"data-toolbar-icon-drag":!0,children:t("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:[o("path",{d:"M5.5 4.5C6.32843 4.5 7 3.82843 7 3C7 2.17157 6.32843 1.5 5.5 1.5C4.67157 1.5 4 2.17157 4 3C4 3.82843 4.67157 4.5 5.5 4.5Z",fill:"currentColor"}),o("path",{d:"M5.5 9.5C6.32843 9.5 7 8.82843 7 8C7 7.17157 6.32843 6.5 5.5 6.5C4.67157 6.5 4 7.17157 4 8C4 8.82843 4.67157 9.5 5.5 9.5Z",fill:"currentColor"}),o("path",{d:"M7 13C7 13.8284 6.32843 14.5 5.5 14.5C4.67157 14.5 4 13.8284 4 13C4 12.1716 4.67157 11.5 5.5 11.5C6.32843 11.5 7 12.1716 7 13Z",fill:"currentColor"}),o("path",{d:"M10.5 4.5C11.3284 4.5 12 3.82843 12 3C12 2.17157 11.3284 1.5 10.5 1.5C9.67157 1.5 9 2.17157 9 3C9 3.82843 9.67157 4.5 10.5 4.5Z",fill:"currentColor"}),o("path",{d:"M12 8C12 8.82843 11.3284 9.5 10.5 9.5C9.67157 9.5 9 8.82843 9 8C9 7.17157 9.67157 6.5 10.5 6.5C11.3284 6.5 12 7.17157 12 8Z",fill:"currentColor"}),o("path",{d:"M10.5 14.5C11.3284 14.5 12 13.8284 12 13C12 12.1716 11.3284 11.5 10.5 11.5C9.67157 11.5 9 12.1716 9 13C9 13.8284 9.67157 14.5 10.5 14.5Z",fill:"currentColor"})]})}),o("div",{"data-toolbar-name":!0,children:l})]},e.uid)}),"Section"===u.tag&&!u.isThemeSection&&"STATIC"!==b&&"POST_PURCHASE"!==b&&25>q()&&o(C,{...u}),"Sticky"==u.tag&&o("div",{"data-toolbar-zoom-out":!0,onClick:t=>K(t),"aria-hidden":"true",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:o("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M14.5 7C14.7761 7 15 6.77614 15 6.5C15 6.22386 14.7761 6 14.5 6L10.7072 6L14.8536 1.85355C15.0489 1.65829 15.0489 1.34171 14.8536 1.14645C14.6584 0.951186 14.3418 0.951185 14.1465 1.14645L10 5.29297L10 1.5C10 1.22386 9.77614 1 9.5 1C9.22386 1 9 1.22386 9 1.5L9 6.5C9 6.77614 9.22386 7 9.5 7L14.5 7ZM6 10.7073L6 14.5C6 14.7761 6.22386 15 6.5 15C6.77614 15 7 14.7761 7 14.5L7 9.5C7 9.22386 6.77614 9 6.5 9H1.5C1.22386 9 1 9.22386 1 9.5C1 9.77614 1.22386 10 1.5 10H5.29306L1.14662 14.1464C0.951353 14.3417 0.951353 14.6583 1.14662 14.8536C1.34188 15.0488 1.65846 15.0488 1.85372 14.8536L6 10.7073Z",fill:"currentColor"})})}),o(c,{enable:"Section"==u.tag&&N()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"bottom","data-toolbar-duplicate":!0,"data-toolbar-disable":"Section"==u.tag&&N()>=25||j,onClick:j?void 0:t=>J(t),"aria-hidden":"true",className:j?"!gp-cursor-not-allowed":"",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M6.08423 1.21289C5.53194 1.21289 5.08423 1.66061 5.08423 2.21289V3.78711H4.26172C3.43329 3.78711 2.76172 4.45868 2.76172 5.28711V13.2871C2.76172 14.1155 3.43329 14.7871 4.26172 14.7871H10.2617C11.0901 14.7871 11.7617 14.1155 11.7617 13.2871V12.4629H13.0842C13.6365 12.4629 14.0842 12.0152 14.0842 11.4629V2.21289C14.0842 1.66061 13.6365 1.21289 13.0842 1.21289H6.08423ZM10.7617 12.4629H6.08423C5.53194 12.4629 5.08423 12.0152 5.08423 11.4629V4.78711H4.26172C3.98558 4.78711 3.76172 5.01097 3.76172 5.28711V13.2871C3.76172 13.5633 3.98558 13.7871 4.26172 13.7871H10.2617C10.5379 13.7871 10.7617 13.5633 10.7617 13.2871V12.4629Z",fill:"currentColor"})})}),o(c,{"data-toolbar-delete":!0,onClick:t=>P?null:F(t),enable:P,"data-toolbar-disable":P,width:B.width,text:B.text,position:Z,"aria-hidden":"true",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M11 2.88965V2.38965C11 1.56122 10.3284 0.889648 9.5 0.889648H6.5C5.67157 0.889648 5 1.56122 5 2.38965V2.88965H2C1.72386 2.88965 1.5 3.11351 1.5 3.38965C1.5 3.66579 1.72386 3.88965 2 3.88965H3.21997V13.1099C3.21997 14.2144 4.1154 15.1099 5.21997 15.1099H11.22C12.3245 15.1099 13.22 14.2144 13.22 13.1099V3.88965H14C14.2761 3.88965 14.5 3.66579 14.5 3.38965C14.5 3.11351 14.2761 2.88965 14 2.88965H11ZM6 2.88965H10V2.38965C10 2.11351 9.77614 1.88965 9.5 1.88965H6.5C6.22386 1.88965 6 2.11351 6 2.38965V2.88965ZM6.24976 6.13965C6.66397 6.13965 6.99976 6.47543 6.99976 6.88965V11.3896C6.99976 11.8039 6.66397 12.1396 6.24976 12.1396C5.83554 12.1396 5.49976 11.8039 5.49976 11.3896V6.88965C5.49976 6.47543 5.83554 6.13965 6.24976 6.13965ZM10.4998 6.88965C10.4998 6.47543 10.164 6.13965 9.74976 6.13965C9.33554 6.13965 8.99976 6.47543 8.99976 6.88965V11.3896C8.99976 11.8039 9.33554 12.1396 9.74976 12.1396C10.164 12.1396 10.4998 11.8039 10.4998 11.3896V6.88965Z",fill:"currentColor"})})})]}),"STATIC"!==b&&"POST_PURCHASE"!==b&&25>q()&&o(s,{...u}),o("div",{"data-outline":!0,"data-outline-section":"Section"==u.tag,"data-outline-theme-section":"Section"==u.tag&&!!m||f,"data-outline-limit":q()>=25}),"Section"==u.tag&&!f&&t(e,{children:[o(c,{enable:N()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-top":!0,"data-toolbar-disable":N()>=25,"data-toolbar-add-open":"above"==w,onClick:t=>W(t,"above"),"aria-hidden":"true",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})}),o(c,{enable:N()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-bottom":!0,"data-toolbar-disable":N()>=25,"data-toolbar-add-open":"below"==w,onClick:t=>W(t,"below"),"aria-hidden":"true",children:o("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:o("path",{d:"M8.45 3.95C8.45 3.70147 8.24853 3.5 8 3.5C7.75147 3.5 7.55 3.70147 7.55 3.95V7.55H3.95C3.70147 7.55 3.5 7.75147 3.5 8C3.5 8.24853 3.70147 8.45 3.95 8.45H7.55V12.05C7.55 12.2985 7.75147 12.5 8 12.5C8.24853 12.5 8.45 12.2985 8.45 12.05V8.45H12.05C12.2985 8.45 12.5 8.24853 12.5 8C12.5 7.75147 12.2985 7.55 12.05 7.55H8.45V3.95Z",fill:"#212121"})})})]}),o(p,{...u})]})};export{ComponentToolbarPreview};
@@ -1 +1 @@
1
- import{isDefined as t}from"./is-defined.js";import{stateMapping as e}from"./constant.js";let getGlobalColorCSSProp=t=>getSingleColorVariable(t),getGlobalColorClass=(t,e)=>"string"!=typeof e||!e||e?.startsWith("#")||e?.startsWith("rgb")||e?.startsWith("hsl")||e?.startsWith("transparent")?"":`${t}-g-${e}`,getGlobalColorResponsiveClass=(e,o)=>o?Object.entries(o).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"desktop"===t?l:`${t}:${l}`}).filter(t).join(" "):"",getGlobalColorStateClass=(e,o)=>o?Object.entries(o).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"normal"===t?l:`${t}:${l}`}).filter(t).join(" "):"",getGlobalColorStateClassDynamicBtn=(e,o)=>o?Object.entries(o).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"normal"===t?String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${l}`:String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${t}:${l}`}).filter(t).join(" "):"",getGlobalColorStateResponsiveClass=(e,o)=>o?Object.entries(o).map(([o,l])=>"desktop"===o?Object.entries(l).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"normal"===t?l:`${t}:${l}`}).filter(t).join(" "):Object.entries(l).map(([t,l])=>{let r=getGlobalColorClass(e,l);if(r)return"normal"===t?`${o}:${r}`:`${o}:${t}:${r}`}).filter(t).join(" ")).filter(Boolean).join(" "):"",getGlobalColorStateResponsiveClassDynamicBtn=(e,o)=>o?Object.entries(o).map(([o,l])=>"desktop"===o?Object.entries(l).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"normal"===t?String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${l}`:String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${t}:${l}`}).filter(t).join(" "):Object.entries(l).map(([t,l])=>{let r=getGlobalColorClass(e,l);if(r)return"normal"===t?String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${o}:${r}`:String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${o}:${t}:${r}`}).filter(t).join(" ")).filter(Boolean).join(" "):"",getGlobalColorResponsiveStyle=(t,e)=>e?Object.fromEntries(Object.entries(e).map(([e,o])=>"desktop"===e?[`--${t}`,getSingleColorVariable(o)]:[`--${t}-${e}`,getSingleColorVariable(o)])):{},getGlobalColorStateStyle=(o,l)=>l?Object.fromEntries(Object.entries(l).map(([t,l])=>"active"===t?[]:[`-${e?.[t]}-${o}`,getSingleColorVariable(l)]).filter(t)):{},getGlobalColorStateResponsiveStyle=(o,l)=>l?Object.entries(l).map(([l,r])=>"desktop"===l?Object.fromEntries(Object.entries(r).map(([t,l])=>"active"===t?[]:[`-${e[t]}-${o}`,getSingleColorVariable(l)]).filter(t)):Object.fromEntries(Object.entries(r).map(([t,r])=>"active"===t?[]:[`-${e[t]}-${o}-${l}`,getSingleColorVariable(r)]).filter(t))).reduce((t,e)=>({...t,...e}),{}):{},getSingleColorVariable=t=>{if(t&&"string"==typeof t)return isColor(t)?t:`var(--g-c-${t}, ${t})`};function isColor(t){return!!t&&"string"==typeof t&&(t?.startsWith("#")||t?.startsWith("rgb")||t?.startsWith("hsl")||t?.startsWith("transparent"))}let getGlobalColorStyle=t=>t?{"--c":getSingleColorVariable(t)}:{},composeTextColorCss=t=>`${t?`color: ${getSingleColorVariable(t)} !important;`:""}`;export{composeTextColorCss,getGlobalColorCSSProp,getGlobalColorClass,getGlobalColorResponsiveClass,getGlobalColorResponsiveStyle,getGlobalColorStateClass,getGlobalColorStateClassDynamicBtn,getGlobalColorStateResponsiveClass,getGlobalColorStateResponsiveClassDynamicBtn,getGlobalColorStateResponsiveStyle,getGlobalColorStateStyle,getGlobalColorStyle,getSingleColorVariable,isColor};
1
+ import{isDefined as t}from"./is-defined.js";import{stateMapping as e}from"./constant.js";let getGlobalColorCSSProp=t=>getSingleColorVariable(t),getGlobalColorClass=(t,e)=>"string"!=typeof e||!e||e?.startsWith("#")||e?.startsWith("rgb")||e?.startsWith("hsl")||e?.startsWith("transparent")?"":`gp-${t}-g-${e}`,getGlobalColorResponsiveClass=(e,o)=>o?Object.entries(o).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"desktop"===t?l:`${t}:${l}`}).filter(t).join(" "):"",getGlobalColorStateClass=(e,o)=>o?Object.entries(o).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"normal"===t?l:`${t}:${l}`}).filter(t).join(" "):"",getGlobalColorStateClassDynamicBtn=(e,o)=>o?Object.entries(o).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"normal"===t?String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${l}`:String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${t}:${l}`}).filter(t).join(" "):"",getGlobalColorStateResponsiveClass=(e,o)=>o?Object.entries(o).map(([o,l])=>"desktop"===o?Object.entries(l).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"normal"===t?l:`${t}:${l}`}).filter(t).join(" "):Object.entries(l).map(([t,l])=>{let r=getGlobalColorClass(e,l);if(r)return"normal"===t?`${o}:${r}`:`${o}:${t}:${r}`}).filter(t).join(" ")).filter(Boolean).join(" "):"",getGlobalColorStateResponsiveClassDynamicBtn=(e,o)=>o?Object.entries(o).map(([o,l])=>"desktop"===o?Object.entries(l).map(([t,o])=>{let l=getGlobalColorClass(e,o);if(l)return"normal"===t?String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${l}`:String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${t}:${l}`}).filter(t).join(" "):Object.entries(l).map(([t,l])=>{let r=getGlobalColorClass(e,l);if(r)return"normal"===t?String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${o}:${r}`:String.raw`[&_.shopify-payment-button\_\_button--unbranded]:${o}:${t}:${r}`}).filter(t).join(" ")).filter(Boolean).join(" "):"",getGlobalColorResponsiveStyle=(t,e)=>e?Object.fromEntries(Object.entries(e).map(([e,o])=>"desktop"===e?[`--${t}`,getSingleColorVariable(o)]:[`--${t}-${e}`,getSingleColorVariable(o)])):{},getGlobalColorStateStyle=(o,l)=>l?Object.fromEntries(Object.entries(l).map(([t,l])=>"active"===t?[]:[`-${e?.[t]}-${o}`,getSingleColorVariable(l)]).filter(t)):{},getGlobalColorStateResponsiveStyle=(o,l)=>l?Object.entries(l).map(([l,r])=>"desktop"===l?Object.fromEntries(Object.entries(r).map(([t,l])=>"active"===t?[]:[`-${e[t]}-${o}`,getSingleColorVariable(l)]).filter(t)):Object.fromEntries(Object.entries(r).map(([t,r])=>"active"===t?[]:[`-${e[t]}-${o}-${l}`,getSingleColorVariable(r)]).filter(t))).reduce((t,e)=>({...t,...e}),{}):{},getSingleColorVariable=t=>{if(t&&"string"==typeof t)return isColor(t)?t:`var(--g-c-${t}, ${t})`};function isColor(t){return!!t&&"string"==typeof t&&(t?.startsWith("#")||t?.startsWith("rgb")||t?.startsWith("hsl")||t?.startsWith("transparent"))}let getGlobalColorStyle=t=>t?{"--c":getSingleColorVariable(t)}:{},composeTextColorCss=t=>`${t?`color: ${getSingleColorVariable(t)} !important;`:""}`;export{composeTextColorCss,getGlobalColorCSSProp,getGlobalColorClass,getGlobalColorResponsiveClass,getGlobalColorResponsiveStyle,getGlobalColorStateClass,getGlobalColorStateClassDynamicBtn,getGlobalColorStateResponsiveClass,getGlobalColorStateResponsiveClassDynamicBtn,getGlobalColorStateResponsiveStyle,getGlobalColorStateStyle,getGlobalColorStyle,getSingleColorVariable,isColor};
@@ -1,4 +1,4 @@
1
- import{makeStyleResponsive as e}from"./make-style.js";import{devicesMapping as t}from"./constant.js";import{getResponsiveValueByScreen as i}from"./get-resonsive-value.js";function getCustomSizeCSSByDevice(e,i){if(!e||!i)return{};let a=t[i]??"";return{[`--pl${a}`]:e?.[i]?.horizontal,[`--pr${a}`]:e?.[i]?.horizontal,[`--pt${a}`]:e?.[i]?.vertical,[`--pb${a}`]:e?.[i]?.vertical}}let composeSize=e=>Object.assign({},getCustomSizeCSSByDevice(e,"desktop"),getCustomSizeCSSByDevice(e,"tablet"),getCustomSizeCSSByDevice(e,"mobile"));function genSizeClass(e){return`g-s-${e}`}let composeSizeCss=e=>{if(void 0===e)return"";let t=e?.custom?.desktop?.horizontal,i=e?.custom?.desktop?.vertical;if(e?.custom)return`
1
+ import{makeStyleResponsive as e}from"./make-style.js";import{devicesMapping as t}from"./constant.js";import{getResponsiveValueByScreen as i}from"./get-resonsive-value.js";function getCustomSizeCSSByDevice(e,i){if(!e||!i)return{};let a=t[i]??"";return{[`--pl${a}`]:e?.[i]?.horizontal,[`--pr${a}`]:e?.[i]?.horizontal,[`--pt${a}`]:e?.[i]?.vertical,[`--pb${a}`]:e?.[i]?.vertical}}let composeSize=e=>Object.assign({},getCustomSizeCSSByDevice(e,"desktop"),getCustomSizeCSSByDevice(e,"tablet"),getCustomSizeCSSByDevice(e,"mobile"));function genSizeClass(e){return`gp-g-s-${e}`}let composeSizeCss=e=>{if(void 0===e)return"";let t=e?.custom?.desktop?.horizontal,i=e?.custom?.desktop?.vertical;if(e?.custom)return`
2
2
  ${t?`padding-left: ${t}; padding-right: ${t};`:void 0}
3
3
  ${i?`padding-top: ${i}; padding-bottom: ${i};`:void 0}
4
4
  `},makeGlobalSize=t=>({width:makeStyleWithDefault("w",getWidthHeightGlobalSize("width",t),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),height:e("h",getWidthHeightGlobalSize("height",t)),padding:getPaddingGlobalSize(t),gap:getGlobalSizeGap(t)}),getGlobalSizeGap=e=>({"--gg":e?.desktop?.gap,"--gg-tablet":e?.tablet?.gap,"--gg-mobile":e?.mobile?.gap}),makeStyleWithDefault=(e,t,i)=>({[`--${e}`]:t?.desktop==="default"?`var(${i?.desktop})`:t?.desktop,[`--${e}-tablet`]:t?.tablet==="default"?`var(${i?.tablet})`:t?.tablet,[`--${e}-mobile`]:t?.mobile==="default"?`var(${i?.mobile})`:t?.mobile}),getWidthHeightGlobalSize=(e,t)=>{if(!t)return{};let a={},l=["desktop","mobile","tablet"];return l.forEach(l=>{a={...a,[l]:i(t,l)?.[e]}}),a},getHeightByShapeGlobalSize=e=>{let t={},a=["desktop","mobile","tablet"];return a.forEach(a=>{let l=i(e,a),o=l?.shapeValue,g=l?.height;t={...t,[a]:o?"auto":g||"auto"}}),t},getWidthByShapeGlobalSize=(e,t)=>{let a={},l=["desktop","mobile","tablet"];return l.forEach(l=>{let o=i(e,l),g=t?o?.width||"auto":o?.width;g&&(a={...a,[l]:g})}),a},getAspectRatioGlobalSize=e=>{let t={},a=["desktop","mobile","tablet"];return a.forEach(a=>{let l=i(e,a)?.shapeValue;if(l)t={...t,[a]:l};else{let l=i(e,a)?.shape;switch(l){case"square":t={...t,[a]:"1/1"};break;case"vertical":t={...t,[a]:"3/4"};break;case"horizontal":t={...t,[a]:"4/3"};break;case"original":t={...t,[a]:"auto"}}}}),t};function getCustomPaddingSizeCSSByDevice(e,i){if(!e||!i)return{};let a=t[i]??"";return{[`--pl${a}`]:e?.[i]?.padding?.left,[`--pr${a}`]:e?.[i]?.padding?.right,[`--pt${a}`]:e?.[i]?.padding?.top,[`--pb${a}`]:e?.[i]?.padding?.bottom}}let getPaddingGlobalSize=e=>Object.assign({},getCustomPaddingSizeCSSByDevice(e,"desktop"),getCustomPaddingSizeCSSByDevice(e,"tablet"),getCustomPaddingSizeCSSByDevice(e,"mobile"));export{composeSize,composeSizeCss,genSizeClass,getAspectRatioGlobalSize,getGlobalSizeGap,getHeightByShapeGlobalSize,getPaddingGlobalSize,getWidthByShapeGlobalSize,getWidthHeightGlobalSize,makeGlobalSize,makeStyleWithDefault};
@@ -1 +1 @@
1
- import{postPurchaseRequiredElements as e,postPurchaseWrapElements as t}from"../components/constant.js";import{useShopStore as r}from"../contexts/ShopContext.js";let usePostPurchase=(n,o)=>{let u=r(e=>e.pageType),l=(e,t)=>{let r=e||o,n=0,u=(t||document).querySelectorAll(`[data-component-tag="${r}"]`);if("PostPurchaseProductOffer"===r)return u.length;let l="";return t?u.length:(u.forEach(e=>{let t=e.closest('[data-component-tag="PostPurchaseProductOffer"]'),o=t?.getAttribute("data-uid")||"",u=e.closest('[data-component-tag="Product"]'),c=u?.querySelectorAll(`[data-component-tag="${r}"]`).length||0,a=t?o!==l?c:0:1;t&&(l=o),n+=a}),n)},c=()=>{let e=l();return e<=1},a=()=>{let t=document.querySelector(`[data-uid="${n}"]`);if(!t)return!1;for(let r of e){let e=l(r),n=l(r,t);if(n>0&&e-n<1)return!0}return!1},d=e.reduce((e,t)=>{let r=document.querySelector(`[data-uid="${n}"]`);if(!r)return 0;let o=r.querySelectorAll(`[data-component-tag="${t}"]`).length;return e+o},0),s=()=>{if("POST_PURCHASE"!==u)return!1;let r=!1;return e.includes(o)&&(r=c())?r:!!t.includes(o)&&d>0&&a()},i=()=>{if(e.includes(o))return{text:"This element is required <br> and can’t be deleted",width:"175px"};{let e="Section"===o?"section":"element";return{text:`This ${e} contains required <br> elements and cannot be deleted`,width:"206px"}}};return{isUnableDelete:s,tooltipText:i,isDisableDuplicate:()=>"GP_FUNNEL_PAGE"===u&&"ProductList"===o}};export{usePostPurchase};
1
+ import{postPurchaseRequiredElements as e,postPurchaseWrapElements as t}from"../components/constant.js";import{useShopStore as r}from"../contexts/ShopContext.js";let usePostPurchase=(n,o)=>{let u=r(e=>e.pageType),l=(e,t)=>{let r=e||o,n=0,u=(t||document).querySelectorAll(`[data-component-tag="${r}"]`);if("PostPurchaseProductOffer"===r)return u.length;let l="";return t?u.length:(u.forEach(e=>{let t=e.closest('[data-component-tag="PostPurchaseProductOffer"]'),o=t?.getAttribute("data-uid")||"",u=e.closest('[data-component-tag="Product"]'),c=u?.querySelectorAll(`[data-component-tag="${r}"]`).length||0,a=t?o!==l?c:0:1;t&&(l=o),n+=a}),n)},c=()=>{let e=l();return e<=1},a=()=>{let t=document.querySelector(`[data-uid="${n}"]`);if(!t)return!1;for(let r of e){let e=l(r),n=l(r,t);if(n>0&&e-n<1)return!0}return!1},d=()=>e.reduce((e,t)=>{let r=document.querySelector(`[data-uid="${n}"]`);if(!r)return 0;let o=r.querySelectorAll(`[data-component-tag="${t}"]`).length;return e+o},0),s=()=>{if("POST_PURCHASE"!==u)return!1;let r=!1;return e.includes(o)&&(r=c())?r:!!(t.includes(o)&&d()>0)&&a()},i=()=>{if(e.includes(o))return{text:"This element is required <br> and can’t be deleted",width:"175px"};{let e="Section"===o?"section":"element";return{text:`This ${e} contains required <br> elements and cannot be deleted`,width:"206px"}}};return{checkDisableDelete:s,getTooltipText:i,checkDisableDuplicate:()=>"GP_FUNNEL_PAGE"===u&&"ProductList"===o}};export{usePostPurchase};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "1.14.0-dev.724",
3
+ "version": "1.14.0-dev.731",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "devDependencies": {
30
30
  "@gem-sdk/adapter-shopify": "1.14.0-dev.619",
31
- "@gem-sdk/styles": "1.14.0-dev.718"
31
+ "@gem-sdk/styles": "1.14.0-dev.731"
32
32
  },
33
33
  "dependencies": {
34
34
  "react-error-boundary": "4.0.10",