@gem-sdk/core 1.14.0-dev.628 → 1.14.0-dev.635

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"),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([]),x=(e,t)=>{let i=c.length,o=e.getBoundingClientRect(),n=t.getBoundingClientRect();return o.top-n.top<36*i},m=(e,t)=>{let i=t||e;if(e&&!isSection(e))return notVisible(e)&&x(t,e)?e:e.parentElement?m(e.parentElement,i):void 0},p=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]);if(react.useEffect(()=>(window.addEventListener("editor:active-component",p),()=>{window.removeEventListener("editor:active-component",p)}),[p]),"section"===e.type||e.editorConfigs?.toolbar?.hide)return null;let j=()=>n?.childrens?.length||0,v=()=>"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=m(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)},g=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},R=i=>{if(i.preventDefault(),i.stopPropagation(),j()>=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},w=()=>{let t=e.tag;if("IconListV2"===t)return"Item list";if("IconList"===t)return"Advanced list";let i=e.customLabel||e.label;return i},f=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},S=()=>{a(null),window.removeEventListener("editor:close-add-section-popup",S)},T=(t,i)=>{if(t.preventDefault(),t.stopPropagation(),j()>=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",S)}return!1},V=()=>{let t=e.name&&e.name===`Section ${e.uid}`;return j()>=20?`${t?"Section":e?.name} ${v()+1}/25`:t?`Section ${v()+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":v()>=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:V()}):jsxRuntime.jsx("div",{"data-toolbar-name":!0,children:w()}),"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&&25>v()&&jsxRuntime.jsx(CreateThemeSection.CreateThemeSection,{...e}),"Sticky"==e.tag&&jsxRuntime.jsx("div",{"data-toolbar-zoom-out":!0,onClick:e=>f(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&&j()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"bottom","data-toolbar-duplicate":!0,"data-toolbar-disable":"Section"==e.tag&&j()>=25,onClick:e=>R(e),"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:"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("div",{"data-toolbar-delete":!0,onClick:e=>g(e),"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&&25>v()&&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":v()>=25}),"Section"==e.tag&&!r&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Tooltip.default,{enable:j()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-top":!0,"data-toolbar-disable":j()>=25,"data-toolbar-add-open":"above"==l,onClick:e=>T(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:j()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-bottom":!0,"data-toolbar-disable":j()>=25,"data-toolbar-add-open":"below"==l,onClick:e=>T(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");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([]),x=(e,t)=>{let i=c.length,o=e.getBoundingClientRect(),n=t.getBoundingClientRect();return o.top-n.top<36*i},m=(e,t)=>{let i=t||e;if(e&&!isSection(e))return notVisible(e)&&x(t,e)?e:e.parentElement?m(e.parentElement,i):void 0},p=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]);if(react.useEffect(()=>(window.addEventListener("editor:active-component",p),()=>{window.removeEventListener("editor:active-component",p)}),[p]),"section"===e.type||e.editorConfigs?.toolbar?.hide)return null;let j=()=>n?.childrens?.length||0,v=()=>"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=m(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)},g=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},w=i=>{if(i.preventDefault(),i.stopPropagation(),j()>=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},R=()=>{let t=e.tag;if("IconListV2"===t)return"Item list";if("IconList"===t)return"Advanced list";let i=e.customLabel||e.label;return i},f=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},S=()=>{a(null),window.removeEventListener("editor:close-add-section-popup",S)},T=(t,i)=>{if(t.preventDefault(),t.stopPropagation(),j()>=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",S)}return!1},V=()=>{let t=e.name&&e.name===`Section ${e.uid}`;return j()>=20?`${t?"Section":e?.name} ${v()+1}/25`:t?`Section ${v()+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":v()>=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:V()}):jsxRuntime.jsx("div",{"data-toolbar-name":!0,children:R()}),"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&&25>v()&&jsxRuntime.jsx(CreateThemeSection.CreateThemeSection,{...e}),"Sticky"==e.tag&&jsxRuntime.jsx("div",{"data-toolbar-zoom-out":!0,onClick:e=>f(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&&j()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"bottom","data-toolbar-duplicate":!0,"data-toolbar-disable":"Section"==e.tag&&j()>=25,onClick:e=>w(e),"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:"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("div",{"data-toolbar-delete":!0,onClick:e=>g(e),"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&&25>v()&&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":v()>=25}),"Section"==e.tag&&!r&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Tooltip.default,{enable:j()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-top":!0,"data-toolbar-disable":j()>=25,"data-toolbar-add-open":"above"==l,onClick:e=>T(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:j()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-bottom":!0,"data-toolbar-disable":j()>=25,"data-toolbar-add-open":"below"==l,onClick:e=>T(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"})})})]})]})};exports.ComponentToolbarPreview=ComponentToolbarPreview;
@@ -12,7 +12,7 @@
12
12
  ${s}
13
13
  } catch(err){}
14
14
  </script>
15
- `);return{cssCode:d,jsCode:a}},appendAnimation=(e,t)=>{let{advanced:r,tag:n}=e,{animation:i}=r??{},s=i?.desktop?.enabled||i?.tablet?.enabled||i?.mobile?.enabled;if(!s||!i?.desktop?.triggerConfig)return t;let d=(e,t)=>e?.triggerConfig?.[t]?.animation??"none",a=e=>{if("desktop"===e);else if("tablet"===e)return i?.tablet??i?.desktop;else if("mobile"===e)return i?.mobile??i?.tablet??i?.desktop;return i?.desktop},l=e=>+!(a(e)?.enabled&&!["shake","none"].includes(d(a(e),"appear"))),o={desktop:l("desktop"),tablet:l("tablet"),mobile:l("mobile")},c={all:"Section"===n?"":"inherit"};return render.template`
15
+ `);return{cssCode:d,jsCode:a}},appendAnimation=(e,t)=>{let{advanced:r,tag:n}=e,{animation:i}=r??{},s=i?.desktop?.enabled||i?.tablet?.enabled||i?.mobile?.enabled;if(!s||!i?.desktop?.triggerConfig)return t;let d=(e,t)=>e?.triggerConfig?.[t]?.animation??"none",a=e=>{if("desktop"===e);else if("tablet"===e)return i?.tablet??i?.desktop;else if("mobile"===e)return i?.mobile??i?.tablet??i?.desktop;return i?.desktop},l=e=>+!(a(e)?.enabled&&!["shake","none"].includes(d(a(e),"appear"))),o={desktop:l("desktop"),tablet:l("tablet"),mobile:l("mobile")},c={all:"Section"===n?"":"inherit",position:"static"};return render.template`
16
16
  ${render.RenderIf(convert.isLocalEnv,'<script src="{{ \'gp-animation.js\' | asset_url }}" defer="defer"></script>',`<script src="${convert.baseAssetURL}/assets-v2/gp-animation.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
17
17
  <gp-animation
18
18
  gp-data='${JSON.stringify({config:i,tag:n})}'
@@ -1 +1 @@
1
- "use strict";var react=require("react"),animations=require("./animations.js");const TAGS_SELECTOR={Button:".gp-button-base",Sticky:"gp-sticky",Dialog:"div[role=dialog]",Icon:"div div",ProductTag:"div div div"},useLivePageAnimation=(e,r,t)=>{let n=animations.animations(),[c,u]=react.useState(!1),a=react.useRef(void 0),i=react.useRef(void 0),o=react.useRef(null),l=react.useRef("none"),s=react.useRef("none"),b=react.useRef(null),d=react.useRef(null),p=react.useRef(null),m=react.useRef("animation-wrapper-"),f=react.useCallback(e=>{b.current&&(b.current.playbackRate=e??1,b.current.play())},[b]),v=react.useCallback(e=>{d.current&&(d.current.playbackRate=e??1,d.current.play())},[d]),g=react.useCallback(()=>{e.current&&(e.current.style.opacity="1"),o.current&&(o.current.style.opacity="1")},[e]),k=react.useCallback(()=>{e.current&&(e.current.style.opacity="1"),o.current&&(o.current.style.opacity="0")},[e]),C=react.useCallback(e=>{e&&e.stopPropagation(),Object.keys(TAGS_SELECTOR).includes(t)&&k(),b.current&&(d.current?.cancel(),f(),b.current.finished.then(()=>{o.current&&g()}),o.current&&a?.current?.unobserve(o.current))},[t,k,f,g]),y=react.useCallback(()=>{b.current&&b.current.cancel()},[b]),R=react.useCallback(e=>{e&&e.stopPropagation(),d.current&&(y(),v())},[d,y,v]),h=react.useCallback(()=>{if(d.current){if("zoom"===s.current){if(v(-1),!c)return;d.current.finished.then(()=>{clearTimeout(i.current),i.current=setTimeout(()=>{C()},100)});return}d.current.cancel(),c&&C()}},[v,c,C]),E=react.useCallback(()=>{if("desktop"===p.current);else if("tablet"===p.current)return r?.tablet??r?.desktop;else if("mobile"===p.current)return r?.mobile??r?.tablet??r?.desktop;return r?.desktop},[r?.desktop,r?.mobile,r?.tablet]),S=(e,r)=>e?.triggerConfig?.[r]?.animation??"none",L=react.useCallback(e=>{if("none"===l.current)return;let r=e?.triggerConfig?.appear?.setting?.[l.current];u(r.loop),b.current=n?.[l.current]?.(o.current,r)},[n]),T=react.useCallback(e=>{if("none"===s.current)return;let r=e?.triggerConfig?.hover?.setting?.[s.current];d.current=n?.[s.current]?.(o.current,r)},[n]),A=react.useCallback(()=>{b.current&&(b.current=null,o.current&&a.current?.unobserve(o.current)),d&&(d.current=null,o.current&&(o.current.removeEventListener("mouseenter",R),o.current.removeEventListener("mouseleave",h)))},[h,R]),O=react.useCallback(e=>{if(A(),o.current){if(!e?.enabled){g();return}l.current=S(e,"appear"),s.current=S(e,"hover"),"none"===l.current&&g(),"none"!==s.current&&"desktop"===p.current&&(T(e),o.current.addEventListener("mouseenter",R),o.current.addEventListener("mouseleave",h)),"none"!==l.current?(L(e),a.current=new IntersectionObserver(e=>{e.forEach(e=>{e.intersectionRatio>.1&&C()})},{root:null,rootMargin:"0px",threshold:[.1]}),a.current.observe(o.current)):g()}},[h,L,T,C,R,g,A]),P=react.useCallback(()=>{let e=document.querySelector("html");if(!o.current||!e)return;let r=new ResizeObserver(([e])=>{let r;let t=e?.target.getBoundingClientRect().width??0;r=t>=1024?"desktop":t>=768?"tablet":"mobile",p.current!==r&&(p.current=r,O(E()))});return r.observe(e),()=>r.disconnect()},[E,O]);return react.useEffect(()=>{setTimeout(()=>{if(r&&e.current)return m.current=`animation-wrapper-${Math.random().toString(36).substr(2,5)}`,e.current.setAttribute("data-animationid",m.current),o.current=document.querySelector(`[data-animationid='${m.current}'] ${TAGS_SELECTOR?.[t]??""}`),P()},100)},[P,r,t,e]),{initAnimation:O}};exports.useLivePageAnimation=useLivePageAnimation;
1
+ "use strict";var react=require("react"),animations=require("./animations.js");const TAGS_SELECTOR={Button:".gp-button-base",ProductButton:".gp-button-base",Sticky:"gp-sticky",Dialog:"div[role=dialog]",Icon:"div div",ProductTag:"div div div"},useLivePageAnimation=(e,r,t)=>{let n=animations.animations(),[c,u]=react.useState(!1),a=react.useRef(void 0),i=react.useRef(void 0),o=react.useRef(null),l=react.useRef("none"),s=react.useRef("none"),b=react.useRef(null),d=react.useRef(null),p=react.useRef(null),m=react.useRef("animation-wrapper-"),f=react.useCallback(e=>{b.current&&(b.current.playbackRate=e??1,b.current.play())},[b]),v=react.useCallback(e=>{d.current&&(d.current.playbackRate=e??1,d.current.play())},[d]),g=react.useCallback(()=>{e.current&&(e.current.style.opacity="1"),o.current&&(o.current.style.opacity="1")},[e]),k=react.useCallback(()=>{e.current&&(e.current.style.opacity="1"),o.current&&(o.current.style.opacity="0")},[e]),C=react.useCallback(e=>{e&&e.stopPropagation(),"shake"!==l.current&&k(),b.current&&(d.current?.cancel(),f(),b.current.finished.then(()=>{o.current&&g()}),o.current&&a?.current?.unobserve(o.current))},[k,f,g]),y=react.useCallback(()=>{g(),b.current&&b.current.cancel()},[g,b]),R=react.useCallback(e=>{e&&e.stopPropagation(),d.current&&(y(),v())},[d,y,v]),h=react.useCallback(()=>{if(d.current){if("zoom"===s.current){if(v(-1),!c)return;d.current.finished.then(()=>{clearTimeout(i.current),i.current=setTimeout(()=>{C()},100)});return}d.current.cancel(),c&&C()}},[v,c,C]),E=react.useCallback(()=>{if("desktop"===p.current);else if("tablet"===p.current)return r?.tablet??r?.desktop;else if("mobile"===p.current)return r?.mobile??r?.tablet??r?.desktop;return r?.desktop},[r?.desktop,r?.mobile,r?.tablet]),L=(e,r)=>e?.triggerConfig?.[r]?.animation??"none",S=react.useCallback(e=>{if("none"===l.current)return;let r=e?.triggerConfig?.appear?.setting?.[l.current];u(r.loop),b.current=n?.[l.current]?.(o.current,r)},[n]),T=react.useCallback(e=>{if("none"===s.current)return;let r=e?.triggerConfig?.hover?.setting?.[s.current];d.current=n?.[s.current]?.(o.current,r)},[n]),P=react.useCallback(()=>{b.current&&(b.current=null,o.current&&a.current?.unobserve(o.current)),d&&(d.current=null,o.current&&(o.current.removeEventListener("mouseenter",R),o.current.removeEventListener("mouseleave",h)))},[h,R]),A=react.useCallback(e=>{if(P(),o.current){if(!e?.enabled){g();return}l.current=L(e,"appear"),s.current=L(e,"hover"),"none"===l.current&&g(),"none"!==s.current&&"desktop"===p.current&&(T(e),o.current.addEventListener("mouseenter",R),o.current.addEventListener("mouseleave",h)),"none"!==l.current?(S(e),a.current=new IntersectionObserver(e=>{e.forEach(e=>{e.intersectionRatio>.1&&C()})},{root:null,rootMargin:"0px",threshold:[.1]}),a.current.observe(o.current)):g()}},[h,S,T,C,R,g,P]),w=react.useCallback(()=>{let e=document.querySelector("html");if(!o.current||!e)return;let r=new ResizeObserver(([e])=>{let r;let t=e?.target.getBoundingClientRect().width??0;r=t>=1024?"desktop":t>=768?"tablet":"mobile",p.current!==r&&(p.current=r,A(E()))});return r.observe(e),()=>r.disconnect()},[E,A]);return react.useEffect(()=>{setTimeout(()=>{if(r&&e.current)return m.current=`animation-wrapper-${Math.random().toString(36).substr(2,5)}`,e.current.setAttribute("data-animationid",m.current),o.current=document.querySelector(`[data-animationid='${m.current}'] ${TAGS_SELECTOR?.[t]??""}`),w()},100)},[w,r,t,e]),{initAnimation:A}};exports.useLivePageAnimation=useLivePageAnimation;
@@ -1 +1 @@
1
- import{jsxs as t,Fragment as e,jsx as o}from"react/jsx-runtime";import{useState as i,useCallback as n,useEffect as l}from"react";import"zustand";import{useBuilderPreviewStore as r}from"../contexts/BuilderPreviewContext.js";import{useShopStore as a}from"../contexts/ShopContext.js";import"@gem-sdk/adapter-shopify";import"swr";import"swr/mutation";import"vanilla-lazyload";import"../hooks/useCartUI.js";import{CreateThemeSection as d}from"./theme-section/CreateThemeSection.js";import C from"./toolbar/Tooltip.js";import{ThemeSectionStatusWrapper as c}from"./theme-section/ThemeSectionStatus.js";import h 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=({...s})=>{let p=s.isThemeSection,u=a(t=>t.pageType),m=r(t=>t.getParents),b=r(t=>t.getItem("ROOT")),g=r(t=>t.isThemeSectionEditor),[v,f]=i(null),[w,S]=i(!1),[V,H]=i(!1),[M,Z]=i([]),x=(t,e)=>{let o=M.length,i=t.getBoundingClientRect(),n=e.getBoundingClientRect();return i.top-n.top<36*o},L=(t,e)=>{let o=e||t;if(t&&!isSection(t))return notVisible(t)&&x(e,t)?t:t.parentElement?L(t.parentElement,o):void 0},T=n(t=>{let e=t.detail;if(e?.componentUid==s.uid){let t=m(s.uid).filter(t=>!("ROOT"===t.uid||"Section"===t.tag&&g||t.editorConfigs?.toolbar?.hide||t.editorConfigs?.component?.noSetting)).slice(0,3);Z(t)}else Z([]),S(!1)},[Z,m,s.uid,g]);if(l(()=>(window.addEventListener("editor:active-component",T),()=>{window.removeEventListener("editor:active-component",T)}),[T]),"section"===s.type||s.editorConfigs?.toolbar?.hide)return null;let E=()=>b?.childrens?.length||0,R=()=>"Section"!==s.tag?-1:b?.childrens?.length?b.childrens.findIndex(t=>t==s.uid):-1,B=t=>{if(!M.length)return;let e=t?.target||null,o=e.closest("[data-toolbar-active]");if(!e||!o)return;if(w)H(!1),S(!1);else{let t=L(o,o);if(t)H(!0);else{let t=o.getBoundingClientRect();t.top<36*M.length?H(!0):H(!1)}S(!0)}let i=new CustomEvent("editor:toolbar:show-parents",{bubbles:!0,detail:{value:!w}});window.dispatchEvent(i)},I=t=>{t.preventDefault(),t.stopPropagation();let e=new CustomEvent("editor:toolbar:delete-component",{bubbles:!0,detail:{componentUid:s.uid,isThemeSection:p}});return window.dispatchEvent(e),!1},P=t=>{if(t.preventDefault(),t.stopPropagation(),E()>=25&&"Section"==s.tag)return!1;let e=new CustomEvent("editor:toolbar:duplicate-component",{bubbles:!0,detail:{componentUid:s.uid,isThemeSection:p}});return window.dispatchEvent(e),!1},y=()=>{let t=s.tag;if("IconListV2"===t)return"Item list";if("IconList"===t)return"Advanced list";let e=s.customLabel||s.label;return e},j=t=>{t.preventDefault(),t.stopPropagation();let e=new CustomEvent("editor:toolbar:zoom-out-component",{bubbles:!0,detail:{componentUid:s.uid}});return window.dispatchEvent(e),!1},k=()=>{f(null),window.removeEventListener("editor:close-add-section-popup",k)},z=(t,e)=>{if(t.preventDefault(),t.stopPropagation(),E()>=25)return!1;let o=t.target;if(o){f(e);let t=o.getBoundingClientRect(),i=new CustomEvent("editor:toolbar:add-section",{bubbles:!0,detail:{componentUid:s.uid,position:e,top:t.top+t.height/2}});window.dispatchEvent(i),window.addEventListener("editor:close-add-section-popup",k)}return!1},U=()=>{let t=s.name&&s.name===`Section ${s.uid}`;return E()>=20?`${t?"Section":s?.name} ${R()+1}/25`:t?`Section ${R()+1}`:s?.name};return t(e,{children:[!("Section"==s.tag&&g)&&t("div",{"data-toolbar":!0,"data-toolbar-section":"Section"==s.tag,"data-toolbar-theme-section":"Section"==s.tag&&!!p||g,"data-toolbar-limit":R()>=25,children:[t("div",{"data-toolbar-show-parent":!0,onClick:t=>B(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"==s.tag?o("div",{"data-toolbar-name":!0,children:U()}):o("div",{"data-toolbar-name":!0,children:y()}),"Section"!==s.tag&&M.length>0&&o("div",{"data-toolbar-icon-parent":!0,"data-toolbar-icon-parent-open":w,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"})})})]}),w&&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":g,"data-toolbar-parent-revert":V,style:{top:V?`${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"===s.tag&&!s.isThemeSection&&"STATIC"!==u&&25>R()&&o(d,{...s}),"Sticky"==s.tag&&o("div",{"data-toolbar-zoom-out":!0,onClick:t=>j(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"==s.tag&&E()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"bottom","data-toolbar-duplicate":!0,"data-toolbar-disable":"Section"==s.tag&&E()>=25,onClick:t=>P(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:"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("div",{"data-toolbar-delete":!0,onClick:t=>I(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"!==u&&25>R()&&o(c,{...s}),o("div",{"data-outline":!0,"data-outline-section":"Section"==s.tag,"data-outline-theme-section":"Section"==s.tag&&!!p||g,"data-outline-limit":R()>=25}),"Section"==s.tag&&!g&&t(e,{children:[o(C,{enable:E()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-top":!0,"data-toolbar-disable":E()>=25,"data-toolbar-add-open":"above"==v,onClick:t=>z(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:E()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-bottom":!0,"data-toolbar-disable":E()>=25,"data-toolbar-add-open":"below"==v,onClick:t=>z(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(h,{...s})]})};export{ComponentToolbarPreview};
1
+ import{jsxs as t,Fragment as e,jsx as o}from"react/jsx-runtime";import{useState as i,useCallback as n,useEffect as l}from"react";import"zustand";import{useBuilderPreviewStore as r}from"../contexts/BuilderPreviewContext.js";import{useShopStore as a}from"../contexts/ShopContext.js";import"@gem-sdk/adapter-shopify";import"swr";import"swr/mutation";import"vanilla-lazyload";import"../hooks/useCartUI.js";import{CreateThemeSection as d}from"./theme-section/CreateThemeSection.js";import C from"./toolbar/Tooltip.js";import{ThemeSectionStatusWrapper as c}from"./theme-section/ThemeSectionStatus.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=({...h})=>{let p=h.isThemeSection,s=a(t=>t.pageType),u=r(t=>t.getParents),m=r(t=>t.getItem("ROOT")),b=r(t=>t.isThemeSectionEditor),[g,v]=i(null),[f,w]=i(!1),[S,V]=i(!1),[H,M]=i([]),Z=(t,e)=>{let o=H.length,i=t.getBoundingClientRect(),n=e.getBoundingClientRect();return i.top-n.top<36*o},x=(t,e)=>{let o=e||t;if(t&&!isSection(t))return notVisible(t)&&Z(e,t)?t:t.parentElement?x(t.parentElement,o):void 0},L=n(t=>{let e=t.detail;if(e?.componentUid==h.uid){let t=u(h.uid).filter(t=>!("ROOT"===t.uid||"Section"===t.tag&&b||t.editorConfigs?.toolbar?.hide||t.editorConfigs?.component?.noSetting)).slice(0,3);M(t)}else M([]),w(!1)},[M,u,h.uid,b]);if(l(()=>(window.addEventListener("editor:active-component",L),()=>{window.removeEventListener("editor:active-component",L)}),[L]),"section"===h.type||h.editorConfigs?.toolbar?.hide)return null;let T=()=>m?.childrens?.length||0,E=()=>"Section"!==h.tag?-1:m?.childrens?.length?m.childrens.findIndex(t=>t==h.uid):-1,B=t=>{if(!H.length)return;let e=t?.target||null,o=e.closest("[data-toolbar-active]");if(!e||!o)return;if(f)V(!1),w(!1);else{let t=x(o,o);if(t)V(!0);else{let t=o.getBoundingClientRect();t.top<36*H.length?V(!0):V(!1)}w(!0)}let i=new CustomEvent("editor:toolbar:show-parents",{bubbles:!0,detail:{value:!f}});window.dispatchEvent(i)},R=t=>{t.preventDefault(),t.stopPropagation();let e=new CustomEvent("editor:toolbar:delete-component",{bubbles:!0,detail:{componentUid:h.uid,isThemeSection:p}});return window.dispatchEvent(e),!1},I=t=>{if(t.preventDefault(),t.stopPropagation(),T()>=25&&"Section"==h.tag)return!1;let e=new CustomEvent("editor:toolbar:duplicate-component",{bubbles:!0,detail:{componentUid:h.uid,isThemeSection:p}});return window.dispatchEvent(e),!1},P=()=>{let t=h.tag;if("IconListV2"===t)return"Item list";if("IconList"===t)return"Advanced list";let e=h.customLabel||h.label;return e},y=t=>{t.preventDefault(),t.stopPropagation();let e=new CustomEvent("editor:toolbar:zoom-out-component",{bubbles:!0,detail:{componentUid:h.uid}});return window.dispatchEvent(e),!1},k=()=>{v(null),window.removeEventListener("editor:close-add-section-popup",k)},j=(t,e)=>{if(t.preventDefault(),t.stopPropagation(),T()>=25)return!1;let o=t.target;if(o){v(e);let t=o.getBoundingClientRect(),i=new CustomEvent("editor:toolbar:add-section",{bubbles:!0,detail:{componentUid:h.uid,position:e,top:t.top+t.height/2}});window.dispatchEvent(i),window.addEventListener("editor:close-add-section-popup",k)}return!1},U=()=>{let t=h.name&&h.name===`Section ${h.uid}`;return T()>=20?`${t?"Section":h?.name} ${E()+1}/25`:t?`Section ${E()+1}`:h?.name};return t(e,{children:[!("Section"==h.tag&&b)&&t("div",{"data-toolbar":!0,"data-toolbar-section":"Section"==h.tag,"data-toolbar-theme-section":"Section"==h.tag&&!!p||b,"data-toolbar-limit":E()>=25,children:[t("div",{"data-toolbar-show-parent":!0,onClick:t=>B(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"==h.tag?o("div",{"data-toolbar-name":!0,children:U()}):o("div",{"data-toolbar-name":!0,children:P()}),"Section"!==h.tag&&H.length>0&&o("div",{"data-toolbar-icon-parent":!0,"data-toolbar-icon-parent-open":f,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"})})})]}),f&&H.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":b,"data-toolbar-parent-revert":S,style:{top:S?`${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"===h.tag&&!h.isThemeSection&&"STATIC"!==s&&25>E()&&o(d,{...h}),"Sticky"==h.tag&&o("div",{"data-toolbar-zoom-out":!0,onClick:t=>y(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"==h.tag&&T()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"bottom","data-toolbar-duplicate":!0,"data-toolbar-disable":"Section"==h.tag&&T()>=25,onClick:t=>I(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:"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("div",{"data-toolbar-delete":!0,onClick:t=>R(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"!==s&&25>E()&&o(c,{...h}),o("div",{"data-outline":!0,"data-outline-section":"Section"==h.tag,"data-outline-theme-section":"Section"==h.tag&&!!p||b,"data-outline-limit":E()>=25}),"Section"==h.tag&&!b&&t(e,{children:[o(C,{enable:T()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-top":!0,"data-toolbar-disable":T()>=25,"data-toolbar-add-open":"above"==g,onClick:t=>j(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:T()>=25,text:"Page has reached Shopify’s 25 section-limit",position:"top","data-toolbar-add-bottom":!0,"data-toolbar-disable":T()>=25,"data-toolbar-add-open":"below"==g,onClick:t=>j(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"})})})]})]})};export{ComponentToolbarPreview};
@@ -12,7 +12,7 @@ import{makeStyleResponsive as e}from"../helpers/make-style.js";import"react";imp
12
12
  ${a}
13
13
  } catch(err){}
14
14
  </script>
15
- `);return{cssCode:l,jsCode:o}},appendAnimation=(s,d)=>{let{advanced:a,tag:l}=s,{animation:o}=a??{},c=o?.desktop?.enabled||o?.tablet?.enabled||o?.mobile?.enabled;if(!c||!o?.desktop?.triggerConfig)return d;let p=(e,t)=>e?.triggerConfig?.[t]?.animation??"none",u=e=>{if("desktop"===e);else if("tablet"===e)return o?.tablet??o?.desktop;else if("mobile"===e)return o?.mobile??o?.tablet??o?.desktop;return o?.desktop},m=e=>+!(u(e)?.enabled&&!["shake","none"].includes(p(u(e),"appear"))),g={desktop:m("desktop"),tablet:m("tablet"),mobile:m("mobile")},h={all:"Section"===l?"":"inherit"};return r`
15
+ `);return{cssCode:l,jsCode:o}},appendAnimation=(s,d)=>{let{advanced:a,tag:l}=s,{animation:o}=a??{},c=o?.desktop?.enabled||o?.tablet?.enabled||o?.mobile?.enabled;if(!c||!o?.desktop?.triggerConfig)return d;let p=(e,t)=>e?.triggerConfig?.[t]?.animation??"none",u=e=>{if("desktop"===e);else if("tablet"===e)return o?.tablet??o?.desktop;else if("mobile"===e)return o?.mobile??o?.tablet??o?.desktop;return o?.desktop},m=e=>+!(u(e)?.enabled&&!["shake","none"].includes(p(u(e),"appear"))),g={desktop:m("desktop"),tablet:m("tablet"),mobile:m("mobile")},h={all:"Section"===l?"":"inherit",position:"static"};return r`
16
16
  ${t(i,'<script src="{{ \'gp-animation.js\' | asset_url }}" defer="defer"></script>',`<script src="${n}/assets-v2/gp-animation.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
17
17
  <gp-animation
18
18
  gp-data='${JSON.stringify({config:o,tag:l})}'
@@ -1 +1 @@
1
- import{useState as e,useRef as r,useCallback as t,useEffect as n}from"react";import{animations as u}from"./animations.js";let TAGS_SELECTOR={Button:".gp-button-base",Sticky:"gp-sticky",Dialog:"div[role=dialog]",Icon:"div div",ProductTag:"div div div"},useLivePageAnimation=(c,o,i)=>{let a=u(),[l,s]=e(!1),d=r(void 0),p=r(void 0),m=r(null),v=r("none"),g=r("none"),b=r(null),f=r(null),y=r(null),h=r("animation-wrapper-"),k=t(e=>{b.current&&(b.current.playbackRate=e??1,b.current.play())},[b]),E=t(e=>{f.current&&(f.current.playbackRate=e??1,f.current.play())},[f]),S=t(()=>{c.current&&(c.current.style.opacity="1"),m.current&&(m.current.style.opacity="1")},[c]),T=t(()=>{c.current&&(c.current.style.opacity="1"),m.current&&(m.current.style.opacity="0")},[c]),L=t(e=>{e&&e.stopPropagation(),Object.keys(TAGS_SELECTOR).includes(i)&&T(),b.current&&(f.current?.cancel(),k(),b.current.finished.then(()=>{m.current&&S()}),m.current&&d?.current?.unobserve(m.current))},[i,T,k,S]),R=t(()=>{b.current&&b.current.cancel()},[b]),C=t(e=>{e&&e.stopPropagation(),f.current&&(R(),E())},[f,R,E]),A=t(()=>{if(f.current){if("zoom"===g.current){if(E(-1),!l)return;f.current.finished.then(()=>{clearTimeout(p.current),p.current=setTimeout(()=>{L()},100)});return}f.current.cancel(),l&&L()}},[E,l,L]),O=t(()=>{if("desktop"===y.current);else if("tablet"===y.current)return o?.tablet??o?.desktop;else if("mobile"===y.current)return o?.mobile??o?.tablet??o?.desktop;return o?.desktop},[o?.desktop,o?.mobile,o?.tablet]),w=(e,r)=>e?.triggerConfig?.[r]?.animation??"none",P=t(e=>{if("none"===v.current)return;let r=e?.triggerConfig?.appear?.setting?.[v.current];s(r.loop),b.current=a?.[v.current]?.(m.current,r)},[a]),G=t(e=>{if("none"===g.current)return;let r=e?.triggerConfig?.hover?.setting?.[g.current];f.current=a?.[g.current]?.(m.current,r)},[a]),$=t(()=>{b.current&&(b.current=null,m.current&&d.current?.unobserve(m.current)),f&&(f.current=null,m.current&&(m.current.removeEventListener("mouseenter",C),m.current.removeEventListener("mouseleave",A)))},[A,C]),_=t(e=>{if($(),m.current){if(!e?.enabled){S();return}v.current=w(e,"appear"),g.current=w(e,"hover"),"none"===v.current&&S(),"none"!==g.current&&"desktop"===y.current&&(G(e),m.current.addEventListener("mouseenter",C),m.current.addEventListener("mouseleave",A)),"none"!==v.current?(P(e),d.current=new IntersectionObserver(e=>{e.forEach(e=>{e.intersectionRatio>.1&&L()})},{root:null,rootMargin:"0px",threshold:[.1]}),d.current.observe(m.current)):S()}},[A,P,G,L,C,S,$]),j=t(()=>{let e=document.querySelector("html");if(!m.current||!e)return;let r=new ResizeObserver(([e])=>{let r;let t=e?.target.getBoundingClientRect().width??0;r=t>=1024?"desktop":t>=768?"tablet":"mobile",y.current!==r&&(y.current=r,_(O()))});return r.observe(e),()=>r.disconnect()},[O,_]);return n(()=>{setTimeout(()=>{if(o&&c.current)return h.current=`animation-wrapper-${Math.random().toString(36).substr(2,5)}`,c.current.setAttribute("data-animationid",h.current),m.current=document.querySelector(`[data-animationid='${h.current}'] ${TAGS_SELECTOR?.[i]??""}`),j()},100)},[j,o,i,c]),{initAnimation:_}};export{useLivePageAnimation};
1
+ import{useState as e,useRef as r,useCallback as t,useEffect as n}from"react";import{animations as u}from"./animations.js";let TAGS_SELECTOR={Button:".gp-button-base",ProductButton:".gp-button-base",Sticky:"gp-sticky",Dialog:"div[role=dialog]",Icon:"div div",ProductTag:"div div div"},useLivePageAnimation=(c,o,i)=>{let a=u(),[l,s]=e(!1),d=r(void 0),p=r(void 0),m=r(null),g=r("none"),v=r("none"),b=r(null),f=r(null),y=r(null),h=r("animation-wrapper-"),k=t(e=>{b.current&&(b.current.playbackRate=e??1,b.current.play())},[b]),E=t(e=>{f.current&&(f.current.playbackRate=e??1,f.current.play())},[f]),L=t(()=>{c.current&&(c.current.style.opacity="1"),m.current&&(m.current.style.opacity="1")},[c]),S=t(()=>{c.current&&(c.current.style.opacity="1"),m.current&&(m.current.style.opacity="0")},[c]),T=t(e=>{e&&e.stopPropagation(),"shake"!==g.current&&S(),b.current&&(f.current?.cancel(),k(),b.current.finished.then(()=>{m.current&&L()}),m.current&&d?.current?.unobserve(m.current))},[S,k,L]),R=t(()=>{L(),b.current&&b.current.cancel()},[L,b]),C=t(e=>{e&&e.stopPropagation(),f.current&&(R(),E())},[f,R,E]),P=t(()=>{if(f.current){if("zoom"===v.current){if(E(-1),!l)return;f.current.finished.then(()=>{clearTimeout(p.current),p.current=setTimeout(()=>{T()},100)});return}f.current.cancel(),l&&T()}},[E,l,T]),w=t(()=>{if("desktop"===y.current);else if("tablet"===y.current)return o?.tablet??o?.desktop;else if("mobile"===y.current)return o?.mobile??o?.tablet??o?.desktop;return o?.desktop},[o?.desktop,o?.mobile,o?.tablet]),A=(e,r)=>e?.triggerConfig?.[r]?.animation??"none",O=t(e=>{if("none"===g.current)return;let r=e?.triggerConfig?.appear?.setting?.[g.current];s(r.loop),b.current=a?.[g.current]?.(m.current,r)},[a]),B=t(e=>{if("none"===v.current)return;let r=e?.triggerConfig?.hover?.setting?.[v.current];f.current=a?.[v.current]?.(m.current,r)},[a]),$=t(()=>{b.current&&(b.current=null,m.current&&d.current?.unobserve(m.current)),f&&(f.current=null,m.current&&(m.current.removeEventListener("mouseenter",C),m.current.removeEventListener("mouseleave",P)))},[P,C]),q=t(e=>{if($(),m.current){if(!e?.enabled){L();return}g.current=A(e,"appear"),v.current=A(e,"hover"),"none"===g.current&&L(),"none"!==v.current&&"desktop"===y.current&&(B(e),m.current.addEventListener("mouseenter",C),m.current.addEventListener("mouseleave",P)),"none"!==g.current?(O(e),d.current=new IntersectionObserver(e=>{e.forEach(e=>{e.intersectionRatio>.1&&T()})},{root:null,rootMargin:"0px",threshold:[.1]}),d.current.observe(m.current)):L()}},[P,O,B,T,C,L,$]),x=t(()=>{let e=document.querySelector("html");if(!m.current||!e)return;let r=new ResizeObserver(([e])=>{let r;let t=e?.target.getBoundingClientRect().width??0;r=t>=1024?"desktop":t>=768?"tablet":"mobile",y.current!==r&&(y.current=r,q(w()))});return r.observe(e),()=>r.disconnect()},[w,q]);return n(()=>{setTimeout(()=>{if(o&&c.current)return h.current=`animation-wrapper-${Math.random().toString(36).substr(2,5)}`,c.current.setAttribute("data-animationid",h.current),m.current=document.querySelector(`[data-animationid='${h.current}'] ${TAGS_SELECTOR?.[i]??""}`),x()},100)},[x,o,i,c]),{initAnimation:q}};export{useLivePageAnimation};
@@ -158,7 +158,7 @@ type ObjectLayoutValue = {
158
158
  keepCol?: boolean;
159
159
  };
160
160
  type ProductReviewsWidgetType = 'reviews' | 'badge';
161
- type TrustooWidgetType = 'starRating' | 'reviews';
161
+ type TrustooWidgetType = 'starRatingInList' | 'starRating' | 'reviews';
162
162
  type WiserWidgetType = 'related' | 'recommended' | 'alsobought' | 'recentview' | 'newarrivals' | 'featured' | 'topselling' | 'trending' | 'recent_related';
163
163
  type InstantJudgeMeReviewsWidgetType = 'single_product_preview_badge' | 'review_widget' | 'reviews_carousel' | 'floating_reviews_tab' | 'all_reviews_widget' | 'verified_reviews_count_badge' | 'medals' | 'media_grid' | 'all_reviews_text';
164
164
  type InstantLooxReviewsWidgetType = 'product_reviews_widget' | 'reviews_widget_all_stores' | 'product_star_ratings_widget' | 'carousel_widget';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "1.14.0-dev.628",
3
+ "version": "1.14.0-dev.635",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -1 +0,0 @@
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");require("swr"),require("@gem-sdk/adapter-shopify"),require("swr/mutation"),require("vanilla-lazyload"),require("../../hooks/useCartUI.js");var cls=require("../../helpers/cls.js");function Column(e){let t=BuilderPreviewContext.useBuilderPreviewStore(e=>e.isThemeSectionEditor),[r,n]=react.useState(e.settings?.layout),[i,l]=react.useState(e.settings?.layout),u=e.styles?.verticalGutter,o=react.useRef(),[s,a]=react.useState(!1),d=react.useRef([]);if(react.useEffect(()=>{n(e.settings?.layout),l(e.settings?.layout)},[e]),!["Row","Product","HeroBanner"].includes(e.tag))return;let c=(e,t)=>{let r=e.slice().splice(0,t+1);return r.reduce((e,t)=>e+t,0)},m=({totalCol:e,len:t,gap:r,index:n})=>{let i=e/12;return`calc(100%*${i} - ${r}*${.5-i} + ${r}*${(12/t*(n+1)-e)/(12/t)} - 8px)`},v=()=>{if(a(!1),document.body.style.cursor="",!o.current)return;let e=o.current.device,t=i?.[e]?.cols||[];JSON.stringify(d.current)!==JSON.stringify(t)&&d.current.length&&window.dispatchEvent(new CustomEvent("editor:toolbar:change-column",{bubbles:!0,detail:{componentUid:o.current.componentUid,cols:d.current}})),window.dispatchEvent(new CustomEvent("editor:toolbar:resize-column",{bubbles:!0,detail:{value:!1}})),p(!1,[]),o.current=void 0,document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",h)},p=(e,t)=>{if(!o.current)return;let r=document.querySelectorAll(`[data-uid="${o.current.componentUid}"]`);r.length&&r.forEach(r=>{let n=r,i=n.getAttribute("data-component-tag");if("Row"!==i){let e=r.querySelector('[data-component-tag="Col"]');e&&e.parentElement&&(n=e.parentElement)}n&&(e?n.style.gridTemplateColumns=t.map(e=>`minmax(0, ${e}fr)`).join(" "):n.style.gridTemplateColumns="")})},f=e=>{if(!o.current)return;let t=e.clientX,r=t-(o.current.startX??0),l=Math.abs(r),u=o.current.index,s=o.current.device??"desktop",a=o.current.itemWidth??0,c=i?.[s]?.cols||[],m=c.slice();if(l>=a){let e=Math.round(l/a);if("minus"==(r>=0?"plus":"minus")){let t=m[u]??1;t-e>1?(m[u]=(m[u]??0)-e,m[u+1]=(m[u+1]??0)+e):(m[u+1]=(m[u+1]??0)+(m[u]??0)-1,m[u]=1)}else{let t=m[u+1]??1;t-e>1?(m[u+1]=(m[u+1]??0)-e,m[u]=(m[u]??0)+e):(m[u]=(m[u]??0)+(m[u+1]??0)-1,m[u+1]=1)}}JSON.stringify(d.current)!==JSON.stringify(m)&&JSON.stringify(d.current)!==JSON.stringify(m)&&(d.current=m,n({...i,[s]:{...i?.[s],cols:m}}),p(!0,m))},h=()=>{v()},g=(e,{device:t,totalCol:r,index:n})=>{let i=e.target;if(i){let l=i.closest("[data-uid]");if(l){document.removeEventListener("mousemove",f),document.removeEventListener("mouseup",h),document.addEventListener("mousemove",f),document.addEventListener("mouseup",h),a(!0);let u=l.getAttribute("data-uid")||void 0,s=i.getBoundingClientRect(),d=l.getBoundingClientRect();o.current={componentUid:u,device:t,index:n,startX:e.clientX,itemWidth:(s.left-d.left)/r},document.body.style.cursor="grabbing",window.dispatchEvent(new CustomEvent("editor:toolbar:resize-column",{bubbles:!0,detail:{value:!0}}))}}},x=()=>{v()},b=(t,r)=>o.current?.componentUid==e.uid&&o.current.device==t&&o.current.index==r;return jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx("div",{"data-column":!0,"data-column-theme-section":t,"data-column-is-drag-visible":s,children:(()=>{let e=[];for(let t of["desktop","tablet","mobile"])if(r?.[t]){let n=r?.[t]?.cols||r?.desktop?.cols||[],i=r?.[t]?.display||r?.desktop?.display||"fit";if("fill"==i){let r=n.length;for(let i=0;i<r-1;i++){let l=n[i];if(l){let o=c(n,i),s=u?.[t]||u?.desktop||"0px",a=m({index:i,len:r,gap:s,totalCol:o});e.push(jsxRuntime.jsxs("div",{role:"presentation","data-column-hand-drag":!0,"data-col":l,"data-gap":s,"data-column-hand-drag-active":b(t,i),className:cls.cls("absolute h-full",{hidden:"desktop"!==t,flex:"desktop"===t,"tablet:hidden":"tablet"!==t,"tablet:flex":"tablet"===t,"mobile:hidden":"mobile"!==t,"mobile:flex":"mobile"===t}),style:{width:"16px",top:"0px",left:a},onMouseDown:e=>g(e,{device:t,totalCol:o,index:i}),onMouseUp:x,children:[jsxRuntime.jsx("div",{"data-column-hand-visual":!0}),jsxRuntime.jsx("div",{"data-column-hand-visual-drag":!0,children:jsxRuntime.jsxs("svg",{viewBox:"0 0 20 20",children:[jsxRuntime.jsx("path",{d:"M12.75 3.5a.75.75 0 0 0 0 1.5h1.19l-3.22 3.22a.75.75 0 0 0 1.06 1.06l3.22-3.22v1.19a.75.75 0 0 0 1.5 0v-3a.75.75 0 0 0-.75-.75h-3Z",fill:"currentColor"}),jsxRuntime.jsx("path",{d:"M7.25 16.5a.75.75 0 0 0 0-1.5h-1.19l3.22-3.22a.75.75 0 1 0-1.06-1.06l-3.22 3.22v-1.19a.75.75 0 0 0-1.5 0v3c0 .414.336.75.75.75h3Z",fill:"currentColor"})]})})]},`${t}-${i}`))}}}}return e})()})})}require("react-transition-group"),require("@gem-sdk/core"),require("../../helpers/convert.js"),exports.default=Column;
@@ -1 +0,0 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),Column=require("./Column.js"),Spacing=require("./Spacing.js");function Resize(e){return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(Spacing.default,{...e}),jsxRuntime.jsx(Column.default,{...e})]})}exports.default=Resize;
@@ -1 +0,0 @@
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 +0,0 @@
1
- import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import{useState as n,useRef as o,useEffect as i}from"react";import"zustand";import{useBuilderPreviewStore as l}from"../../contexts/BuilderPreviewContext.js";import"swr";import"@gem-sdk/adapter-shopify";import"swr/mutation";import"vanilla-lazyload";import"../../hooks/useCartUI.js";import{cls as a}from"../../helpers/cls.js";import"react-transition-group";import"@gem-sdk/core";import"../../helpers/convert.js";function Column(d){let u=l(e=>e.isThemeSectionEditor),[s,c]=n(d.settings?.layout),[m,p]=n(d.settings?.layout),v=d.styles?.verticalGutter,f=o(),[h,g]=n(!1),b=o([]);if(i(()=>{c(d.settings?.layout),p(d.settings?.layout)},[d]),!["Row","Product","HeroBanner"].includes(d.tag))return;let y=(e,t)=>{let r=e.slice().splice(0,t+1);return r.reduce((e,t)=>e+t,0)},w=({totalCol:e,len:t,gap:r,index:n})=>{let o=e/12;return`calc(100%*${o} - ${r}*${.5-o} + ${r}*${(12/t*(n+1)-e)/(12/t)} - 8px)`},x=()=>{if(g(!1),document.body.style.cursor="",!f.current)return;let e=f.current.device,t=m?.[e]?.cols||[];JSON.stringify(b.current)!==JSON.stringify(t)&&b.current.length&&window.dispatchEvent(new CustomEvent("editor:toolbar:change-column",{bubbles:!0,detail:{componentUid:f.current.componentUid,cols:b.current}})),window.dispatchEvent(new CustomEvent("editor:toolbar:resize-column",{bubbles:!0,detail:{value:!1}})),E(!1,[]),f.current=void 0,document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",k)},E=(e,t)=>{if(!f.current)return;let r=document.querySelectorAll(`[data-uid="${f.current.componentUid}"]`);r.length&&r.forEach(r=>{let n=r,o=n.getAttribute("data-component-tag");if("Row"!==o){let e=r.querySelector('[data-component-tag="Col"]');e&&e.parentElement&&(n=e.parentElement)}n&&(e?n.style.gridTemplateColumns=t.map(e=>`minmax(0, ${e}fr)`).join(" "):n.style.gridTemplateColumns="")})},C=e=>{if(!f.current)return;let t=e.clientX,r=t-(f.current.startX??0),n=Math.abs(r),o=f.current.index,i=f.current.device??"desktop",l=f.current.itemWidth??0,a=m?.[i]?.cols||[],d=a.slice();if(n>=l){let e=Math.round(n/l);if("minus"==(r>=0?"plus":"minus")){let t=d[o]??1;t-e>1?(d[o]=(d[o]??0)-e,d[o+1]=(d[o+1]??0)+e):(d[o+1]=(d[o+1]??0)+(d[o]??0)-1,d[o]=1)}else{let t=d[o+1]??1;t-e>1?(d[o+1]=(d[o+1]??0)-e,d[o]=(d[o]??0)+e):(d[o]=(d[o]??0)+(d[o+1]??0)-1,d[o+1]=1)}}JSON.stringify(b.current)!==JSON.stringify(d)&&JSON.stringify(b.current)!==JSON.stringify(d)&&(b.current=d,c({...m,[i]:{...m?.[i],cols:d}}),E(!0,d))},k=()=>{x()},S=(e,{device:t,totalCol:r,index:n})=>{let o=e.target;if(o){let i=o.closest("[data-uid]");if(i){document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",k),document.addEventListener("mousemove",C),document.addEventListener("mouseup",k),g(!0);let l=i.getAttribute("data-uid")||void 0,a=o.getBoundingClientRect(),d=i.getBoundingClientRect();f.current={componentUid:l,device:t,index:n,startX:e.clientX,itemWidth:(a.left-d.left)/r},document.body.style.cursor="grabbing",window.dispatchEvent(new CustomEvent("editor:toolbar:resize-column",{bubbles:!0,detail:{value:!0}}))}}},$=()=>{x()},N=(e,t)=>f.current?.componentUid==d.uid&&f.current.device==e&&f.current.index==t;return e(t,{children:e("div",{"data-column":!0,"data-column-theme-section":u,"data-column-is-drag-visible":h,children:(()=>{let t=[];for(let n of["desktop","tablet","mobile"])if(s?.[n]){let o=s?.[n]?.cols||s?.desktop?.cols||[],i=s?.[n]?.display||s?.desktop?.display||"fit";if("fill"==i){let i=o.length;for(let l=0;l<i-1;l++){let d=o[l];if(d){let u=y(o,l),s=v?.[n]||v?.desktop||"0px",c=w({index:l,len:i,gap:s,totalCol:u});t.push(r("div",{role:"presentation","data-column-hand-drag":!0,"data-col":d,"data-gap":s,"data-column-hand-drag-active":N(n,l),className:a("absolute h-full",{hidden:"desktop"!==n,flex:"desktop"===n,"tablet:hidden":"tablet"!==n,"tablet:flex":"tablet"===n,"mobile:hidden":"mobile"!==n,"mobile:flex":"mobile"===n}),style:{width:"16px",top:"0px",left:c},onMouseDown:e=>S(e,{device:n,totalCol:u,index:l}),onMouseUp:$,children:[e("div",{"data-column-hand-visual":!0}),e("div",{"data-column-hand-visual-drag":!0,children:r("svg",{viewBox:"0 0 20 20",children:[e("path",{d:"M12.75 3.5a.75.75 0 0 0 0 1.5h1.19l-3.22 3.22a.75.75 0 0 0 1.06 1.06l3.22-3.22v1.19a.75.75 0 0 0 1.5 0v-3a.75.75 0 0 0-.75-.75h-3Z",fill:"currentColor"}),e("path",{d:"M7.25 16.5a.75.75 0 0 0 0-1.5h-1.19l3.22-3.22a.75.75 0 1 0-1.06-1.06l-3.22 3.22v-1.19a.75.75 0 0 0-1.5 0v3c0 .414.336.75.75.75h3Z",fill:"currentColor"})]})})]},`${n}-${l}`))}}}}return t})()})})}export{Column as default};
@@ -1 +0,0 @@
1
- import{jsxs as r,Fragment as e,jsx as i}from"react/jsx-runtime";import o from"./Column.js";import t from"./Spacing.js";function Resize(m){return r(e,{children:[i(t,{...m}),i(o,{...m})]})}export{Resize as default};
@@ -1 +0,0 @@
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};