@gem-sdk/core 1.14.0-dev.355 → 1.14.0-dev.364
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";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),i=react.useRef(null),u=react.useRef(!1),o=react.useRef(0),a=react.useRef(0),s=e=>{let t=e.clientY,r=Math.ceil(t-o.current),n=a.current||0,i=n+r>=0?`${n+r}px`:"0px";return{newValue:i}},c=e=>{if(r.current&&n.current){let{newValue:t}=s(e);n.current.style.height=t,r.current.style.top=t;let i=r.current.closest("[data-toolbar-wrap]");i&&(i.style.marginBottom=t)}},l=()=>{m()},d=()=>{i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{u.current=!0;let e=new CustomEvent("editor:toolbar:resize-spacing",{bubbles:!0,detail:{value:!0}});window.dispatchEvent(e),document.addEventListener("mousemove",c),document.addEventListener("mouseup",l)},100)},m=()=>{i.current&&clearTimeout(i.current),u.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,i=new CustomEvent("editor:toolbar:change-margin-bottom",{bubbles:!0,detail:{componentUid:e.uid,marginBottom:n}});window.dispatchEvent(i)}let n=r.current?.closest("[data-toolbar-wrap]");n&&(n.style.marginBottom=""),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",l)};return jsxRuntime.jsx(jsxRuntime.Fragment,{children:"Section"!==e.tag&&jsxRuntime.jsx("div",{"data-spacing":!0,"data-spacing-theme-section":t,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(e.preventDefault(),e.stopPropagation(),r.current){let t=getComputedStyle(r.current);o.current=e.clientY,a.current=parseFloat(t.top),d()}return!1},onMouseUp:e=>(e.preventDefault(),e.stopPropagation(),m(),!1),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),i=react.useRef(null),u=react.useRef(!1),o=react.useRef(0),a=react.useRef(0),s=e=>{let t=e.clientY,r=Math.ceil(t-o.current),n=a.current||0,i=n+r>=0?`${n+r}px`:"0px";return{newValue:i}},c=e=>{if(r.current&&n.current){let{newValue:t}=s(e);n.current.style.height=t,r.current.style.top=t;let i=r.current.closest("[data-toolbar-wrap]");i&&(i.style.marginBottom=t)}},l=()=>{m()},d=()=>{i.current&&clearTimeout(i.current),i.current=setTimeout(()=>{u.current=!0;let e=new CustomEvent("editor:toolbar:resize-spacing",{bubbles:!0,detail:{value:!0}});window.dispatchEvent(e),document.addEventListener("mousemove",c),document.addEventListener("mouseup",l)},100)},m=()=>{i.current&&clearTimeout(i.current),u.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,i=new CustomEvent("editor:toolbar:change-margin-bottom",{bubbles:!0,detail:{componentUid:e.uid,marginBottom:n}});window.dispatchEvent(i)}let n=r.current?.closest("[data-toolbar-wrap]");n&&(n.style.marginBottom=""),document.removeEventListener("mousemove",c),document.removeEventListener("mouseup",l)};return 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(e.preventDefault(),e.stopPropagation(),r.current){let t=getComputedStyle(r.current);o.current=e.clientY,a.current=parseFloat(t.top),d()}return!1},onMouseUp:e=>(e.preventDefault(),e.stopPropagation(),m(),!1),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 +1 @@
|
|
|
1
|
-
import{jsx as t,Fragment as e,jsxs as r}from"react/jsx-runtime";import{useRef as o}from"react";import"zustand";import{useBuilderPreviewStore as n}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(i){let a=n(t=>t.isThemeSectionEditor),u=o(null),
|
|
1
|
+
import{jsx as t,Fragment as e,jsxs as r}from"react/jsx-runtime";import{useRef as o}from"react";import"zustand";import{useBuilderPreviewStore as n}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(i){let a=n(t=>t.isThemeSectionEditor),u=o(null),s=o(null),c=o(null),l=o(!1),m=o(0),p=o(0),d=t=>{let e=t.clientY,r=Math.ceil(e-m.current),o=p.current||0,n=o+r>=0?`${o+r}px`:"0px";return{newValue:n}},g=t=>{if(u.current&&s.current){let{newValue:e}=d(t);s.current.style.height=e,u.current.style.top=e;let r=u.current.closest("[data-toolbar-wrap]");r&&(r.style.marginBottom=e)}},v=()=>{h()},b=()=>{c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{l.current=!0;let t=new CustomEvent("editor:toolbar:resize-spacing",{bubbles:!0,detail:{value:!0}});window.dispatchEvent(t),document.addEventListener("mousemove",g),document.addEventListener("mouseup",v)},100)},h=()=>{c.current&&clearTimeout(c.current),l.current=!1;let t=new CustomEvent("editor:toolbar:resize-spacing",{bubbles:!0,detail:{value:!1}});if(window.dispatchEvent(t),u.current){let t=getComputedStyle(u.current),e=t.top,r=new CustomEvent("editor:toolbar:change-margin-bottom",{bubbles:!0,detail:{componentUid:i.uid,marginBottom:e}});window.dispatchEvent(r)}let e=u.current?.closest("[data-toolbar-wrap]");e&&(e.style.marginBottom=""),document.removeEventListener("mousemove",g),document.removeEventListener("mouseup",v)};return t(e,{children:"Section"!==i.tag&&t("div",{"data-spacing":!0,"data-spacing-theme-section":a,className:"absolute w-full bottom-0",children:r("div",{"data-spacing-margin-bottom":!0,children:[t("div",{"data-spacing-margin-bottom-bg":!0,ref:s,children:t("div",{"data-spacing-margin-bottom-value":!0})}),t("div",{ref:u,"data-spacing-margin-bottom-drag":!0,onMouseDown:t=>{if(t.preventDefault(),t.stopPropagation(),u.current){let e=getComputedStyle(u.current);m.current=t.clientY,p.current=parseFloat(e.top),b()}return!1},onMouseUp:t=>(t.preventDefault(),t.stopPropagation(),h(),!1),role:"presentation"})]})})})}export{Spacing as default};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -95,6 +95,7 @@ type SizeSettingGlobal = {
|
|
|
95
95
|
shape?: 'square' | 'vertical' | 'horizontal' | 'custom' | 'original';
|
|
96
96
|
shapeLinked?: boolean;
|
|
97
97
|
shapeValue?: string;
|
|
98
|
+
widthHeightLinked?: boolean;
|
|
98
99
|
padding?: {
|
|
99
100
|
type?: 'small' | 'medium' | 'large' | 'custom';
|
|
100
101
|
top?: string;
|