@gem-sdk/core 1.14.0-dev.357 → 1.14.0-dev.366
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
|
@@ -932,6 +932,7 @@ type SettingConfig = {
|
|
|
932
932
|
displayOptions?: OptionKeyword[];
|
|
933
933
|
paddingConfig?: PaddingConfig;
|
|
934
934
|
name?: string;
|
|
935
|
+
units?: string[];
|
|
935
936
|
};
|
|
936
937
|
type SizeSetting$1<T> = SharedControlType<T> & {
|
|
937
938
|
type: 'size-setting';
|
|
@@ -949,7 +950,11 @@ type ChildIconType<T> = SharedControlType<T> & {
|
|
|
949
950
|
|
|
950
951
|
type DropdownInput<T> = SharedControlType<T> & {
|
|
951
952
|
type: 'dropdown:input';
|
|
952
|
-
displayOptions?:
|
|
953
|
+
displayOptions?: {
|
|
954
|
+
label: string;
|
|
955
|
+
value: string;
|
|
956
|
+
reversed?: boolean;
|
|
957
|
+
}[];
|
|
953
958
|
};
|
|
954
959
|
|
|
955
960
|
type ControlProp<T> = AngleControlType<T> | CheckboxControlType<T> | ColorPickerControlType<T> | GroupControlType<T> | IconControlType<T> | InputFixContentControlType<T> | InputNumberControlType<T> | InputUnitControlType<T> | InputUnitSpacingControlType<T> | InputUnitWidthControlType<T> | InputControlType<T> | MarginControlType<T> | PaddingControlType<T> | PositionControlType<T> | RadioGroupControlType | RangeControlType<T> | SegmentControlType<T> | SelectControlType<T> | TextareaControlType<T> | ToggleControlType<T> | ImageControlType<T> | ChildrensControlType | GridControlType<T> | FlexControlType<T> | TextEditorControlType<T> | ProductControlType<T> | TypographyControlType<T> | TypographyV2ControlType<T> | MenuControlType<T> | BehaviorStateControlType<T> | PickLinkControlType<T> | BoxShadowControlType<T> | TextShadowControlType<T> | BorderControlType<T> | BorderRadiusControlType<T> | RadiusPresetControlType<T> | SizeControlType<T> | ChildItemType<T> | PickMultiProductControlType<T> | CollectionControlType<T> | BackgroundControlType<T> | VisibilityControlType<T> | SelectVariantControlType | CountdownEvergreenType | Timezone<T> | CustomContentControlType<T> | DateTimePickerControlType | CountdownDailyType | KlaviyoCodes | YotpoLoyaltyCodes | InputWidthControlType<T> | LayoutSegmentControlType<T> | InputSpacing<T> | UniqueIdControlType<T> | PositionSquareControlType<T> | CustomCodeEditor | LayoutControlType<T> | SwatchesLinkControlType<T> | VariantSwatchesPresetControlType<T> | ProductListControlType<T> | CollectionBannerControlType<T> | Ratio<T> | StickyDisplayControlType<T> | SyncProductPropertiesControlType<T> | StepsGuide<T> | ImageShape<T> | GridArrange<T> | SizeSetting$1<T> | ChildIconType<T> | DropdownInput<T>;
|