@gem-sdk/core 1.14.0-dev.714 → 1.14.0-dev.719

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()?"!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),[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 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),react=require("react");require("zustand");var BuilderPreviewContext=require("../../contexts/BuilderPreviewContext.js");function Spacing(e){let t=BuilderPreviewContext.useBuilderPreviewStore(e=>e.isThemeSectionEditor),r=react.useRef(null),n=react.useRef(null),a=react.useRef(null),i=react.useRef(!1),o=react.useRef(0),u=react.useRef(0),s=e=>{let t=e.clientY,r=Math.ceil(t-o.current),n=u.current||0,a=n+r>=0?`${n+r}px`:"0px";return{newValue:a}},l=e=>{if(r.current&&n.current){let{newValue:t}=s(e);n.current.style.height=t,r.current.style.top=t;let a=r.current.closest("[data-toolbar-wrap]");a&&(a.style.marginBottom=t)}},c=()=>{m()},d=()=>{a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{i.current=!0;let e=new CustomEvent("editor:toolbar:resize-spacing",{bubbles:!0,detail:{value:!0}});window.dispatchEvent(e),document.addEventListener("mousemove",l),document.addEventListener("mouseup",c)},100)},m=()=>{a.current&&clearTimeout(a.current),i.current=!1;let t=new CustomEvent("editor:toolbar:resize-spacing",{bubbles:!0,detail:{value:!1}});if(window.dispatchEvent(t),r.current){let t=getComputedStyle(r.current),n=t.top,a=new CustomEvent("editor:toolbar:change-margin-bottom",{bubbles:!0,detail:{componentUid:e.uid,marginBottom:n}});window.dispatchEvent(a)}let n=r.current?.closest("[data-toolbar-wrap]");n&&(n.style.marginBottom=""),document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c)},p=(e,t)=>{let r=e.children.length;if(r)for(let n=0;n<r;n++){let r=e.children[n];if(r){let e=r.getAttribute(t);if(e)return r}}},g=e=>{let t=e.getAttribute("data-component-tag");return"Row"===t||"Product"===t},b=react.useCallback(()=>{let e=r.current?.closest("[data-toolbar-wrap]");if(!e)return;let t=p(e,"data-toolbar");if(!t)return;let a=t.getAttribute("data-toolbar-active");if(!a)return;let i=getComputedStyle(e),o=p(e,"data-spacing"),u=o?.querySelector("[data-spacing-margin-bottom]")||null;if(u&&n.current&&r.current){let t=i.marginBottom;if(0>parseFloat(t)&&(t="0"),n.current.style.height=t,r.current.style.top=t,u.setAttribute("data-spacing-margin-bottom-active","true"),g(e))n.current.style.left="0";else{let e=i.paddingLeft,t=`-${e}`,a=`translate(${t}, -100%)`;n.current.style.left=t,r.current.style.transform=a}}},[]);return react.useEffect(()=>{b()}),react.useEffect(()=>(window.addEventListener("editor:toolbar:update-margin-bottom",b),window.addEventListener("editor:toolbar:update-padding-left",b),()=>{window.removeEventListener("editor:toolbar:update-margin-bottom",b),window.removeEventListener("editor:toolbar:update-padding-left",b)}),[b]),jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Section"!==e.tag&&jsxRuntime.jsx("div",{"data-spacing":!0,"data-spacing-theme-section":t,className:"absolute w-full bottom-0",children:jsxRuntime.jsxs("div",{"data-spacing-margin-bottom":!0,children:[jsxRuntime.jsx("div",{"data-spacing-margin-bottom-bg":!0,ref:n,children:jsxRuntime.jsx("div",{"data-spacing-margin-bottom-value":!0})}),jsxRuntime.jsx("div",{ref:r,"data-spacing-margin-bottom-drag":!0,onMouseDown:e=>{if(r.current){let t=getComputedStyle(r.current);o.current=e.clientY,u.current=parseFloat(t.top),d()}},onMouseUp:()=>{m()},role:"presentation"})]})})})}require("swr"),require("@gem-sdk/adapter-shopify"),require("swr/mutation"),require("vanilla-lazyload"),require("../../hooks/useCartUI.js"),require("react-transition-group"),require("@gem-sdk/core"),require("../../helpers/convert.js"),exports.default=Spacing;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),react=require("react");require("zustand");var BuilderPreviewContext=require("../../contexts/BuilderPreviewContext.js");function Spacing(e){let t=BuilderPreviewContext.useBuilderPreviewStore(e=>e.isThemeSectionEditor),r=react.useRef(null),n=react.useRef(null),a=react.useRef(null),i=react.useRef(!1),o=react.useRef(0),u=react.useRef(0),s=e=>{let t=e.clientY,r=Math.ceil(t-o.current),n=u.current||0,a=n+r>=0?`${n+r}px`:"0px";return{newValue:a}},l=e=>{if(r.current&&n.current){let{newValue:t}=s(e);n.current.style.height=t,r.current.style.top=t;let a=r.current.closest("[data-toolbar-wrap]");a&&(a.style.marginBottom=t)}},c=()=>{m()},d=()=>{a.current&&clearTimeout(a.current),a.current=setTimeout(()=>{i.current=!0;let e=new CustomEvent("editor:toolbar:resize-spacing",{bubbles:!0,detail:{value:!0}});window.dispatchEvent(e),document.addEventListener("mousemove",l),document.addEventListener("mouseup",c)},100)},m=()=>{a.current&&clearTimeout(a.current),i.current=!1;let t=new CustomEvent("editor:toolbar:resize-spacing",{bubbles:!0,detail:{value:!1}});if(window.dispatchEvent(t),r.current){let t=getComputedStyle(r.current),n=t.top,a=new CustomEvent("editor:toolbar:change-margin-bottom",{bubbles:!0,detail:{componentUid:e.uid,marginBottom:n}});window.dispatchEvent(a)}let n=r.current?.closest("[data-toolbar-wrap]");n&&(n.style.marginBottom=""),document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",c)},p=(e,t)=>{let r=e.children.length;if(r)for(let n=0;n<r;n++){let r=e.children[n];if(r){let e=r.getAttribute(t);if(e)return r}}},g=e=>{let t=e.getAttribute("data-component-tag");return"Row"===t||"Product"===t},b=react.useCallback(()=>{let e=r.current?.closest("[data-toolbar-wrap]");if(!e)return;let t=p(e,"data-toolbar");if(!t)return;let a=t.getAttribute("data-toolbar-active");if(!a)return;let i=getComputedStyle(e),o=p(e,"data-spacing"),u=o?.querySelector("[data-spacing-margin-bottom]")||null;if(u&&n.current&&r.current){let t=i.marginBottom;if(0>parseFloat(t)&&(t="0"),n.current.style.height=t,r.current.style.top=t,u.setAttribute("data-spacing-margin-bottom-active","true"),g(e))n.current.style.left="0";else{let e=i.paddingLeft,t=`-${e}`,a=`translate(${t}, -100%)`;n.current.style.left=t,r.current.style.transform=a}}},[]);return react.useEffect(()=>{b()}),react.useEffect(()=>(window.addEventListener("editor:toolbar:update-margin-bottom",b),window.addEventListener("editor:toolbar:update-padding-left",b),()=>{window.removeEventListener("editor:toolbar:update-margin-bottom",b),window.removeEventListener("editor:toolbar:update-padding-left",b)}),[b]),jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Section"!==e.tag&&jsxRuntime.jsx("div",{"data-spacing":!0,"data-spacing-theme-section":t,className:"gp-absolute gp-w-full gp-bottom-0",children:jsxRuntime.jsxs("div",{"data-spacing-margin-bottom":!0,children:[jsxRuntime.jsx("div",{"data-spacing-margin-bottom-bg":!0,ref:n,children:jsxRuntime.jsx("div",{"data-spacing-margin-bottom-value":!0})}),jsxRuntime.jsx("div",{ref:r,"data-spacing-margin-bottom-drag":!0,onMouseDown:e=>{if(r.current){let t=getComputedStyle(r.current);o.current=e.clientY,u.current=parseFloat(t.top),d()}},onMouseUp:()=>{m()},role:"presentation"})]})})})}require("swr"),require("@gem-sdk/adapter-shopify"),require("swr/mutation"),require("vanilla-lazyload"),require("../../hooks/useCartUI.js"),require("react-transition-group"),require("@gem-sdk/core"),require("../../helpers/convert.js"),exports.default=Spacing;
@@ -1,4 +1,4 @@
1
- "use strict";var colors=require("./colors.js"),makeStyle=require("./make-style.js");const genTypoClass=e=>`g-${e}`,composeTypographyCss=e=>{let o=e?.custom,{fontFamily:t,fontSize:p,fontStyle:s,fontWeight:a,lineHeight:y,letterSpacing:l}=o?.desktop??{};return`
1
+ "use strict";var colors=require("./colors.js"),makeStyle=require("./make-style.js");const genTypoClass=e=>`gp-g-${e}`,composeTypographyCss=e=>{let o=e?.custom,{fontFamily:t,fontSize:p,fontStyle:s,fontWeight:a,lineHeight:y,letterSpacing:l}=o?.desktop??{};return`
2
2
  ${t?`font-family: var(--g-font-${t}, ${t});`:""}
3
3
  ${p?`font-size: ${p};`:""}
4
4
  ${s?`font-style: ${s};`:""}
@@ -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()?"!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),[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 +1 @@
1
- import{jsx as t,Fragment as e,jsxs as r}from"react/jsx-runtime";import{useRef as o,useCallback as n,useEffect as a}from"react";import"zustand";import{useBuilderPreviewStore as i}from"../../contexts/BuilderPreviewContext.js";import"swr";import"@gem-sdk/adapter-shopify";import"swr/mutation";import"vanilla-lazyload";import"../../hooks/useCartUI.js";import"react-transition-group";import"@gem-sdk/core";import"../../helpers/convert.js";function Spacing(l){let u=i(t=>t.isThemeSectionEditor),d=o(null),c=o(null),s=o(null),m=o(!1),p=o(0),g=o(0),b=t=>{let e=t.clientY,r=Math.ceil(e-p.current),o=g.current||0,n=o+r>=0?`${o+r}px`:"0px";return{newValue:n}},v=t=>{if(d.current&&c.current){let{newValue:e}=b(t);c.current.style.height=e,d.current.style.top=e;let r=d.current.closest("[data-toolbar-wrap]");r&&(r.style.marginBottom=e)}},f=()=>{h()},w=()=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{m.current=!0;let t=new CustomEvent("editor:toolbar:resize-spacing",{bubbles:!0,detail:{value:!0}});window.dispatchEvent(t),document.addEventListener("mousemove",v),document.addEventListener("mouseup",f)},100)},h=()=>{s.current&&clearTimeout(s.current),m.current=!1;let t=new CustomEvent("editor:toolbar:resize-spacing",{bubbles:!0,detail:{value:!1}});if(window.dispatchEvent(t),d.current){let t=getComputedStyle(d.current),e=t.top,r=new CustomEvent("editor:toolbar:change-margin-bottom",{bubbles:!0,detail:{componentUid:l.uid,marginBottom:e}});window.dispatchEvent(r)}let e=d.current?.closest("[data-toolbar-wrap]");e&&(e.style.marginBottom=""),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",f)},y=(t,e)=>{let r=t.children.length;if(r)for(let o=0;o<r;o++){let r=t.children[o];if(r){let t=r.getAttribute(e);if(t)return r}}},E=t=>{let e=t.getAttribute("data-component-tag");return"Row"===e||"Product"===e},L=n(()=>{let t=d.current?.closest("[data-toolbar-wrap]");if(!t)return;let e=y(t,"data-toolbar");if(!e)return;let r=e.getAttribute("data-toolbar-active");if(!r)return;let o=getComputedStyle(t),n=y(t,"data-spacing"),a=n?.querySelector("[data-spacing-margin-bottom]")||null;if(a&&c.current&&d.current){let e=o.marginBottom;if(0>parseFloat(e)&&(e="0"),c.current.style.height=e,d.current.style.top=e,a.setAttribute("data-spacing-margin-bottom-active","true"),E(t))c.current.style.left="0";else{let t=o.paddingLeft,e=`-${t}`,r=`translate(${e}, -100%)`;c.current.style.left=e,d.current.style.transform=r}}},[]);return a(()=>{L()}),a(()=>(window.addEventListener("editor:toolbar:update-margin-bottom",L),window.addEventListener("editor:toolbar:update-padding-left",L),()=>{window.removeEventListener("editor:toolbar:update-margin-bottom",L),window.removeEventListener("editor:toolbar:update-padding-left",L)}),[L]),t(e,{children:"Section"!==l.tag&&t("div",{"data-spacing":!0,"data-spacing-theme-section":u,className:"absolute w-full bottom-0",children:r("div",{"data-spacing-margin-bottom":!0,children:[t("div",{"data-spacing-margin-bottom-bg":!0,ref:c,children:t("div",{"data-spacing-margin-bottom-value":!0})}),t("div",{ref:d,"data-spacing-margin-bottom-drag":!0,onMouseDown:t=>{if(d.current){let e=getComputedStyle(d.current);p.current=t.clientY,g.current=parseFloat(e.top),w()}},onMouseUp:()=>{h()},role:"presentation"})]})})})}export{Spacing as default};
1
+ import{jsx as t,Fragment as e,jsxs as r}from"react/jsx-runtime";import{useRef as o,useCallback as n,useEffect as a}from"react";import"zustand";import{useBuilderPreviewStore as i}from"../../contexts/BuilderPreviewContext.js";import"swr";import"@gem-sdk/adapter-shopify";import"swr/mutation";import"vanilla-lazyload";import"../../hooks/useCartUI.js";import"react-transition-group";import"@gem-sdk/core";import"../../helpers/convert.js";function Spacing(l){let u=i(t=>t.isThemeSectionEditor),d=o(null),c=o(null),s=o(null),m=o(!1),p=o(0),g=o(0),b=t=>{let e=t.clientY,r=Math.ceil(e-p.current),o=g.current||0,n=o+r>=0?`${o+r}px`:"0px";return{newValue:n}},v=t=>{if(d.current&&c.current){let{newValue:e}=b(t);c.current.style.height=e,d.current.style.top=e;let r=d.current.closest("[data-toolbar-wrap]");r&&(r.style.marginBottom=e)}},f=()=>{h()},w=()=>{s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{m.current=!0;let t=new CustomEvent("editor:toolbar:resize-spacing",{bubbles:!0,detail:{value:!0}});window.dispatchEvent(t),document.addEventListener("mousemove",v),document.addEventListener("mouseup",f)},100)},h=()=>{s.current&&clearTimeout(s.current),m.current=!1;let t=new CustomEvent("editor:toolbar:resize-spacing",{bubbles:!0,detail:{value:!1}});if(window.dispatchEvent(t),d.current){let t=getComputedStyle(d.current),e=t.top,r=new CustomEvent("editor:toolbar:change-margin-bottom",{bubbles:!0,detail:{componentUid:l.uid,marginBottom:e}});window.dispatchEvent(r)}let e=d.current?.closest("[data-toolbar-wrap]");e&&(e.style.marginBottom=""),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",f)},y=(t,e)=>{let r=t.children.length;if(r)for(let o=0;o<r;o++){let r=t.children[o];if(r){let t=r.getAttribute(e);if(t)return r}}},E=t=>{let e=t.getAttribute("data-component-tag");return"Row"===e||"Product"===e},L=n(()=>{let t=d.current?.closest("[data-toolbar-wrap]");if(!t)return;let e=y(t,"data-toolbar");if(!e)return;let r=e.getAttribute("data-toolbar-active");if(!r)return;let o=getComputedStyle(t),n=y(t,"data-spacing"),a=n?.querySelector("[data-spacing-margin-bottom]")||null;if(a&&c.current&&d.current){let e=o.marginBottom;if(0>parseFloat(e)&&(e="0"),c.current.style.height=e,d.current.style.top=e,a.setAttribute("data-spacing-margin-bottom-active","true"),E(t))c.current.style.left="0";else{let t=o.paddingLeft,e=`-${t}`,r=`translate(${e}, -100%)`;c.current.style.left=e,d.current.style.transform=r}}},[]);return a(()=>{L()}),a(()=>(window.addEventListener("editor:toolbar:update-margin-bottom",L),window.addEventListener("editor:toolbar:update-padding-left",L),()=>{window.removeEventListener("editor:toolbar:update-margin-bottom",L),window.removeEventListener("editor:toolbar:update-padding-left",L)}),[L]),t(e,{children:"Section"!==l.tag&&t("div",{"data-spacing":!0,"data-spacing-theme-section":u,className:"gp-absolute gp-w-full gp-bottom-0",children:r("div",{"data-spacing-margin-bottom":!0,children:[t("div",{"data-spacing-margin-bottom-bg":!0,ref:c,children:t("div",{"data-spacing-margin-bottom-value":!0})}),t("div",{ref:d,"data-spacing-margin-bottom-drag":!0,onMouseDown:t=>{if(d.current){let e=getComputedStyle(d.current);p.current=t.clientY,g.current=parseFloat(e.top),w()}},onMouseUp:()=>{h()},role:"presentation"})]})})})}export{Spacing as default};
@@ -1,4 +1,4 @@
1
- import{getSingleColorVariable as o}from"./colors.js";import{removeNullUndefined as e,makeStyle as t,makeStyleResponsive as p}from"./make-style.js";let genTypoClass=o=>`g-${o}`,composeTypographyCss=o=>{let e=o?.custom,{fontFamily:t,fontSize:p,fontStyle:a,fontWeight:s,lineHeight:i,letterSpacing:y}=e?.desktop??{};return`
1
+ import{getSingleColorVariable as o}from"./colors.js";import{removeNullUndefined as e,makeStyle as t,makeStyleResponsive as p}from"./make-style.js";let genTypoClass=o=>`gp-g-${o}`,composeTypographyCss=o=>{let e=o?.custom,{fontFamily:t,fontSize:p,fontStyle:a,fontWeight:s,lineHeight:i,letterSpacing:y}=e?.desktop??{};return`
2
2
  ${t?`font-family: var(--g-font-${t}, ${t});`:""}
3
3
  ${p?`font-size: ${p};`:""}
4
4
  ${a?`font-style: ${a};`:""}
@@ -8434,14 +8434,14 @@ declare function isColor(color: string): boolean;
8434
8434
  declare const getGlobalColorStyle: (data?: ColorValueType) => React.CSSProperties;
8435
8435
  declare const composeTextColorCss: (color?: ColorValueType) => string;
8436
8436
 
8437
- type TypographyClass = `g-${TypographyType}`;
8437
+ type TypographyClass = `gp-g-${TypographyType}`;
8438
8438
  declare const genTypoClass: (name: TypographyType) => TypographyClass;
8439
8439
  declare const composeTypographyCss: (typography: TypographySetting | undefined) => string;
8440
8440
  declare const composeTypographyV2Css: (typography: TypographySettingV2 | undefined, isImportant?: boolean) => string;
8441
8441
  declare const composeTypography: (typography?: ObjectDevices<TypographyProps>) => React.CSSProperties;
8442
8442
  declare const composeTypographyV2: (value?: TypographyV2Props, attrs?: TypographyV2Attrs) => React.CSSProperties;
8443
8443
  declare const composeTypographyAttr: (attrs?: TypographyV2Attrs) => React.CSSProperties;
8444
- declare const composeTypographyClassName: (typo?: TypographySettingV2, typography?: TypographySetting) => "" | "g-heading-1" | "g-heading-2" | "g-heading-3" | "g-subheading-1" | "g-subheading-2" | "g-subheading-3" | "g-paragraph-1" | "g-paragraph-2" | "g-paragraph-3" | undefined;
8444
+ declare const composeTypographyClassName: (typo?: TypographySettingV2, typography?: TypographySetting) => "" | "gp-g-heading-1" | "gp-g-heading-2" | "gp-g-heading-3" | "gp-g-subheading-1" | "gp-g-subheading-2" | "gp-g-subheading-3" | "gp-g-paragraph-1" | "gp-g-paragraph-2" | "gp-g-paragraph-3" | undefined;
8445
8445
  declare const composeFallbackTypographyStyle: (tag: string) => "var(--g-font-heading, heading)" | "var(--g-font-body, body)";
8446
8446
  declare const composeTypographyStyle: (typo?: TypographySettingV2, typography?: TypographySetting, disableAttr?: boolean) => {
8447
8447
  [x: string]: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "1.14.0-dev.714",
3
+ "version": "1.14.0-dev.719",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "devDependencies": {
27
27
  "@gem-sdk/adapter-shopify": "1.14.0-dev.619",
28
- "@gem-sdk/styles": "1.14.0-dev.705"
28
+ "@gem-sdk/styles": "1.14.0-dev.718"
29
29
  },
30
30
  "dependencies": {
31
31
  "react-error-boundary": "4.0.10",