@gem-sdk/core 1.23.0-staging.37 → 1.23.0-staging.43

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.
@@ -92,21 +92,15 @@ function Spacing(props) {
92
92
  document.removeEventListener('mouseup', onMouseUpDocument);
93
93
  };
94
94
  const onMouseDown = (event)=>{
95
- event.preventDefault();
96
- event.stopPropagation();
97
95
  if ($bottomDrag.current) {
98
96
  const style = getComputedStyle($bottomDrag.current);
99
97
  startY.current = event.clientY;
100
98
  marginBottom.current = parseFloat(style.top);
101
99
  startDrag();
102
100
  }
103
- return false;
104
101
  };
105
- const onMouseUp = (event)=>{
106
- event.preventDefault();
107
- event.stopPropagation();
102
+ const onMouseUp = ()=>{
108
103
  endDrag();
109
- return false;
110
104
  };
111
105
  return /*#__PURE__*/ jsxRuntime.jsx(jsxRuntime.Fragment, {
112
106
  children: props.tag !== 'Section' && /*#__PURE__*/ jsxRuntime.jsx("div", {
@@ -32,11 +32,22 @@ const composeSizeCss = (spacing)=>{
32
32
  };
33
33
  const makeGlobalSize = (globalSize)=>{
34
34
  return {
35
- width: makeStyle.makeStyleResponsive('w', getWidthHeightGlobalSize('width', globalSize)),
35
+ width: makeStyleWithDefault('w', getWidthHeightGlobalSize('width', globalSize), {
36
+ desktop: '--g-ct-w',
37
+ tablet: '--g-ct-w',
38
+ mobile: '--g-ct-w'
39
+ }),
36
40
  height: makeStyle.makeStyleResponsive('h', getWidthHeightGlobalSize('height', globalSize)),
37
41
  padding: getPaddingGlobalSize(globalSize)
38
42
  };
39
43
  };
44
+ const makeStyleWithDefault = (name, value, defaultVal)=>{
45
+ return {
46
+ [`--${name}`]: value?.desktop === 'default' ? `var(${defaultVal?.desktop})` : value?.desktop,
47
+ [`--${name}-tablet`]: value?.tablet === 'default' ? `var(${defaultVal?.tablet})` : value?.tablet,
48
+ [`--${name}-mobile`]: value?.mobile === 'default' ? `var(${defaultVal?.mobile})` : value?.mobile
49
+ };
50
+ };
40
51
  const getWidthHeightGlobalSize = (type, globalSize)=>{
41
52
  if (!globalSize) return {};
42
53
  const data = {
@@ -75,3 +86,4 @@ exports.genSizeClass = genSizeClass;
75
86
  exports.getPaddingGlobalSize = getPaddingGlobalSize;
76
87
  exports.getWidthHeightGlobalSize = getWidthHeightGlobalSize;
77
88
  exports.makeGlobalSize = makeGlobalSize;
89
+ exports.makeStyleWithDefault = makeStyleWithDefault;
package/dist/cjs/index.js CHANGED
@@ -221,6 +221,7 @@ exports.genSizeClass = size.genSizeClass;
221
221
  exports.getPaddingGlobalSize = size.getPaddingGlobalSize;
222
222
  exports.getWidthHeightGlobalSize = size.getWidthHeightGlobalSize;
223
223
  exports.makeGlobalSize = size.makeGlobalSize;
224
+ exports.makeStyleWithDefault = size.makeStyleWithDefault;
224
225
  exports.composeShadowCss = shadow.composeShadowCss;
225
226
  exports.getStyleShadow = shadow.getStyleShadow;
226
227
  exports.getStyleShadowState = shadow.getStyleShadowState;
@@ -88,21 +88,15 @@ function Spacing(props) {
88
88
  document.removeEventListener('mouseup', onMouseUpDocument);
89
89
  };
90
90
  const onMouseDown = (event)=>{
91
- event.preventDefault();
92
- event.stopPropagation();
93
91
  if ($bottomDrag.current) {
94
92
  const style = getComputedStyle($bottomDrag.current);
95
93
  startY.current = event.clientY;
96
94
  marginBottom.current = parseFloat(style.top);
97
95
  startDrag();
98
96
  }
99
- return false;
100
97
  };
101
- const onMouseUp = (event)=>{
102
- event.preventDefault();
103
- event.stopPropagation();
98
+ const onMouseUp = ()=>{
104
99
  endDrag();
105
- return false;
106
100
  };
107
101
  return /*#__PURE__*/ jsx(Fragment, {
108
102
  children: props.tag !== 'Section' && /*#__PURE__*/ jsx("div", {
@@ -30,11 +30,22 @@ const composeSizeCss = (spacing)=>{
30
30
  };
31
31
  const makeGlobalSize = (globalSize)=>{
32
32
  return {
33
- width: makeStyleResponsive('w', getWidthHeightGlobalSize('width', globalSize)),
33
+ width: makeStyleWithDefault('w', getWidthHeightGlobalSize('width', globalSize), {
34
+ desktop: '--g-ct-w',
35
+ tablet: '--g-ct-w',
36
+ mobile: '--g-ct-w'
37
+ }),
34
38
  height: makeStyleResponsive('h', getWidthHeightGlobalSize('height', globalSize)),
35
39
  padding: getPaddingGlobalSize(globalSize)
36
40
  };
37
41
  };
42
+ const makeStyleWithDefault = (name, value, defaultVal)=>{
43
+ return {
44
+ [`--${name}`]: value?.desktop === 'default' ? `var(${defaultVal?.desktop})` : value?.desktop,
45
+ [`--${name}-tablet`]: value?.tablet === 'default' ? `var(${defaultVal?.tablet})` : value?.tablet,
46
+ [`--${name}-mobile`]: value?.mobile === 'default' ? `var(${defaultVal?.mobile})` : value?.mobile
47
+ };
48
+ };
38
49
  const getWidthHeightGlobalSize = (type, globalSize)=>{
39
50
  if (!globalSize) return {};
40
51
  const data = {
@@ -67,4 +78,4 @@ const getPaddingGlobalSize = (globalSize)=>{
67
78
  return Object.assign({}, getCustomPaddingSizeCSSByDevice(globalSize, 'desktop'), getCustomPaddingSizeCSSByDevice(globalSize, 'tablet'), getCustomPaddingSizeCSSByDevice(globalSize, 'mobile'));
68
79
  };
69
80
 
70
- export { composeSize, composeSizeCss, genSizeClass, getPaddingGlobalSize, getWidthHeightGlobalSize, makeGlobalSize };
81
+ export { composeSize, composeSizeCss, genSizeClass, getPaddingGlobalSize, getWidthHeightGlobalSize, makeGlobalSize, makeStyleWithDefault };
package/dist/esm/index.js CHANGED
@@ -52,7 +52,7 @@ import * as tiktokpixel from './helpers/tracking/tiktokpixel.js';
52
52
  export { tiktokpixel };
53
53
  export { RenderIf, composeMemo, dataStringify, props, styles, template } from './helpers/render.js';
54
54
  export { baseAssetURL, isLocalEnv } from './helpers/convert.js';
55
- export { composeSize, composeSizeCss, genSizeClass, getPaddingGlobalSize, getWidthHeightGlobalSize, makeGlobalSize } from './helpers/size.js';
55
+ export { composeSize, composeSizeCss, genSizeClass, getPaddingGlobalSize, getWidthHeightGlobalSize, makeGlobalSize, makeStyleWithDefault } from './helpers/size.js';
56
56
  export { composeShadowCss, getStyleShadow, getStyleShadowState, parseValueWithUnit } from './helpers/shadow.js';
57
57
  export { composeBackgroundCss, getStyleBackgroundByDevice, makeFixedBgAttachment } from './helpers/background.js';
58
58
  export { generateCollectionQueryKey, generateProductQueryKey, generateProductsQueryKey } from './helpers/query.js';
@@ -9521,10 +9521,11 @@ declare const composeSize: (size?: ObjectDevices<SizeProps>) => React.CSSPropert
9521
9521
  declare function genSizeClass(name: string): string;
9522
9522
  declare const composeSizeCss: (spacing?: SizeSetting) => string | undefined;
9523
9523
  declare const makeGlobalSize: (globalSize?: ObjectDevices<SizeSettingGlobal>) => {
9524
- width: Record<"--w" | "--w-tablet" | "--w-mobile", string | number>;
9525
- height: Record<"--h" | "--h-tablet" | "--h-mobile", string | number>;
9524
+ width: Record<ResponsiveKey<"w">, string | number>;
9525
+ height: Record<ResponsiveKey<"h">, string | number>;
9526
9526
  padding: React.CSSProperties;
9527
9527
  };
9528
+ declare const makeStyleWithDefault: <T extends ShortHandProperty, K>(name: T, value?: Partial<Record<NameDevices, K>> | undefined, defaultVal?: Partial<Record<NameDevices, K>> | undefined) => Record<ResponsiveKey<T>, K>;
9528
9529
  declare const getWidthHeightGlobalSize: (type: 'width' | 'height', globalSize?: ObjectDevices<SizeSettingGlobal>) => Partial<Record<NameDevices, string | number>>;
9529
9530
  declare const getPaddingGlobalSize: (globalSize?: ObjectDevices<SizeSettingGlobal>) => React.CSSProperties;
9530
9531
 
@@ -9828,4 +9829,4 @@ type PublishedThemePageSelectFragment = Pick<PublishedThemePage, 'id' | 'name' |
9828
9829
 
9829
9830
  declare const getProductBySlug: (fetcher: FetchFunc, slug?: string) => Promise<ProductSelectFragment>;
9830
9831
 
9831
- export { AddOn, AddonProvider, AddonProviderProps, AlignItemProp, AlignProp, Background, BaseProps, BasePropsWrap, BlockEntity, BoldSubscriptionsWidgetType, Border, BorderStyle, BuilderComponentProvider, BuilderComponentProviderProps, BuilderEntity, BuilderEntityNested, BuilderPreviewProvider, BuilderPreviewProviderProps, BuilderProvider, BuilderProviderProps, BuilderState, Builtin, CartLineProvider, CartLineProviderProps, CollectionDetailFilterDocument, CollectionDetailFilterQueryResponse, CollectionDetailFilterQueryVariables, CollectionDocument, CollectionProvider, CollectionProviderProps, CollectionQueryResponse, CollectionQueryVariables, CollectionSelectFragment, CollectionsDocument, CollectionsQueryResponse, CollectionsQueryVariables, ColorKey, ColorType$1 as ColorType, ColorValueType, Component, ComponentPreset, ComponentSetting, ContainerProp, ControlProp, ControlUI, CornerRadius, CornerRadiusType, CustomComponentConfig, DeepPartial, DynamicCollection, DynamicProduct, ExtractState, FeraReviewsWidgetType, FetchCollectionArgs, FetchFunc, FetchProductParams, FlexDirectionProp, FontName, GlobalStyleConfig, GlobalStyleResponsiveConfig, GlobalSwatchesData, GraphQLConnection, GroupPropType, HSLAColorType, HSLColorType, HexColorType, ImageShape$1 as ImageShape, InitComponentType, InstantJudgeMeReviewsWidgetType, InstantKlaviyoWidgetType, InstantLooxReviewsWidgetType, JudgeMeReviewsWidgetType, KlaviyoWidgetType, LaiProductReviewsWidgetType, LooxReviewsWidgetType, ModalProvider, ModalProviderProps, NameDevices, NestedKeys, ObjectDeviceGlobalType, ObjectDevices, ObjectLayoutValue, OmnisendWidgetType, OptionNormalStyle, OptionSpecialStyle, PageContext, PageType, PageViewUpDocument, PageViewUpMutationResponse, PageViewUpMutationVariables, PickyStoryWidgetType, PreviewPageDocument, PreviewPageQueryResponse, PreviewPageQueryVariables, Primitive, ProductInputAnalytic, ProductListProvider, ProductListProviderProps, ProductProvider, ProductProviderProps, ProductReviewsWidgetType, ProductSelectFragment, ProductsDocument, ProductsQueryResponse, ProductsQueryVariables, PublishedThemePageSelectFragment, PublishedThemePagesDocument, PublishedThemePagesQueryResponse, PublishedThemePagesQueryVariables, RGBAColorType, RGBColorType, Ratio$1 as Ratio, RenderMemo as Render, RenderChildren, RenderIf, Render as RenderLiquid, RenderMode, RenderPreviewMemo as RenderPreview, RequiredCursorEdge, ResponsiveStateProp, RivyoWidgetType, RoundedSize, RyviuWidgetType, SectionData, SectionEntity, SectionProvider, SectionProviderProps, ShadowProps, ShadowStyle, ShadowStyleApplied, ShadowType, ShopProvider, ShopProviderProps, shop as ShopType, SizeProps, SizeSetting, SizeSettingGlobal, SizeType, SpacingType, StampedWidgetType, StateProp, StateSelector, StateType, StoreConfig, StorePropertyDocument, StorePropertyQueryResponse, StorePropertyQueryVariables, SwatchesOptionType, SwatchesOptionValue, TransformProp, TrustooWidgetType, TypographyProps, TypographySetting, TypographySettingV2, TypographyType, TypographyV2Attrs, TypographyV2Props, VariantSelectFragment, VitalsWidgetType, WiserWidgetType, WrapRenderChildren, baseAssetURL, calculateFirstProduct, checkAvailableVariantInStock, cls, composeAdvanceStyle, composeBackgroundCss, composeBorderCss, composeCornerCss, composeGridLayout, composeMemo, composeRadius, composeRadiusResponsive, composeShadowCss, composeSize, composeSizeCss, composeSpacing, composeTextColorCss, composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, convertOldLayout, dataStringify, fetchMedias, fetchVariants, filterToolbarPreview, flattenConnection, fpixel, genSizeClass, genTypoClass, genVariable, generateCollectionQueryKey, generateProductQueryKey, generateProductsQueryKey, getBorderStyle, getCollection, getCornerCSSFromGlobal, getCustomRadius, getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateClassDynamicBtn, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveClassDynamicBtn, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getPaddingGlobalSize, getProduct, getProductBySlug, getRadiusCSSFromGlobal, getRadiusStyleActiveState, getResponsiveStateValue, getResponsiveValue, getResponsiveValueByScreen, getSelectedVariant, getShortName, getSingleColorVariable, getSpacingVariable, getStyleBackgroundByDevice, getStyleShadow, getStyleShadowState, getWidthHeightGlobalSize, globalEvent, gridToArrayRegex, gtag, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, handleConvertClassColorDynamicBtn, isBrowser, isColor, isColumnDirectionExist, isDefined, isEmptyChildren, isLocalEnv, isSafari, loadScript, makeAspectRatio, makeFixedBgAttachment, makeGlobalSize, makeGlobalSizeWidthResponsive, makeHeight, makeLineClamp, makeStyle, makeStyleResponsive, makeStyleResponsiveState, makeStyleState, makeWidth, normalizeBuilderData, optionLayoutStyle, parseSelectedOption, parseValueWithUnit, prefetchQueries, props, removeNullUndefined, splitStyle, styles, template, tiktokpixel, useAddToCart, useAddon, useAddons, useBuilderComponent, useBuilderPreviewStore, useBuilderStore, useCartData, useCartDiscountCodesUpdate, useCartId, useCartLine, useCartLineStore, useCartNoteUpdate, useCartUI, useCheckAvailableVariantInStock, useCheckoutUrl, useCollection, useCollectionQuery, useCollectionStore, useCollectionsQuery, useConnectedShopify, useCreateCart, useCurrency, useCurrentDevice, useCurrentVariant, useCurrentVariantInStock, useEditorMode, useFeaturedImageGlobal, useFormatMoney, useInitialSwatchesOptions, useIsSampleProduct, useIsStorefrontProduct, useIsSyncProduct, useIsomorphicLayoutEffect, useLazyVideo, useLoadScript, useLocale, useMatchMutate, useMobileOnly, useModalStore, useMoney, useMoneyFormat, usePageType, usePluginEnable, usePrevious, useProduct, useProductList, useProductListProducts, useProductListSettings, useProductListStore, useProductListStyles, useProductProperties, useProductQuery, useProductStore, useProductsQuery, useQuantity, useRemoveCartItem, useSection, useSectionStore, useSelectedOption, useShopStore, useStoreFront, useSuspenseFetch, useSwatches, useSwatchesOptions, useUniqProductID, useUpdateCartItem, useVariant, useVariantOutStock, useVariants, validateEmail };
9832
+ export { AddOn, AddonProvider, AddonProviderProps, AlignItemProp, AlignProp, Background, BaseProps, BasePropsWrap, BlockEntity, BoldSubscriptionsWidgetType, Border, BorderStyle, BuilderComponentProvider, BuilderComponentProviderProps, BuilderEntity, BuilderEntityNested, BuilderPreviewProvider, BuilderPreviewProviderProps, BuilderProvider, BuilderProviderProps, BuilderState, Builtin, CartLineProvider, CartLineProviderProps, CollectionDetailFilterDocument, CollectionDetailFilterQueryResponse, CollectionDetailFilterQueryVariables, CollectionDocument, CollectionProvider, CollectionProviderProps, CollectionQueryResponse, CollectionQueryVariables, CollectionSelectFragment, CollectionsDocument, CollectionsQueryResponse, CollectionsQueryVariables, ColorKey, ColorType$1 as ColorType, ColorValueType, Component, ComponentPreset, ComponentSetting, ContainerProp, ControlProp, ControlUI, CornerRadius, CornerRadiusType, CustomComponentConfig, DeepPartial, DynamicCollection, DynamicProduct, ExtractState, FeraReviewsWidgetType, FetchCollectionArgs, FetchFunc, FetchProductParams, FlexDirectionProp, FontName, GlobalStyleConfig, GlobalStyleResponsiveConfig, GlobalSwatchesData, GraphQLConnection, GroupPropType, HSLAColorType, HSLColorType, HexColorType, ImageShape$1 as ImageShape, InitComponentType, InstantJudgeMeReviewsWidgetType, InstantKlaviyoWidgetType, InstantLooxReviewsWidgetType, JudgeMeReviewsWidgetType, KlaviyoWidgetType, LaiProductReviewsWidgetType, LooxReviewsWidgetType, ModalProvider, ModalProviderProps, NameDevices, NestedKeys, ObjectDeviceGlobalType, ObjectDevices, ObjectLayoutValue, OmnisendWidgetType, OptionNormalStyle, OptionSpecialStyle, PageContext, PageType, PageViewUpDocument, PageViewUpMutationResponse, PageViewUpMutationVariables, PickyStoryWidgetType, PreviewPageDocument, PreviewPageQueryResponse, PreviewPageQueryVariables, Primitive, ProductInputAnalytic, ProductListProvider, ProductListProviderProps, ProductProvider, ProductProviderProps, ProductReviewsWidgetType, ProductSelectFragment, ProductsDocument, ProductsQueryResponse, ProductsQueryVariables, PublishedThemePageSelectFragment, PublishedThemePagesDocument, PublishedThemePagesQueryResponse, PublishedThemePagesQueryVariables, RGBAColorType, RGBColorType, Ratio$1 as Ratio, RenderMemo as Render, RenderChildren, RenderIf, Render as RenderLiquid, RenderMode, RenderPreviewMemo as RenderPreview, RequiredCursorEdge, ResponsiveStateProp, RivyoWidgetType, RoundedSize, RyviuWidgetType, SectionData, SectionEntity, SectionProvider, SectionProviderProps, ShadowProps, ShadowStyle, ShadowStyleApplied, ShadowType, ShopProvider, ShopProviderProps, shop as ShopType, SizeProps, SizeSetting, SizeSettingGlobal, SizeType, SpacingType, StampedWidgetType, StateProp, StateSelector, StateType, StoreConfig, StorePropertyDocument, StorePropertyQueryResponse, StorePropertyQueryVariables, SwatchesOptionType, SwatchesOptionValue, TransformProp, TrustooWidgetType, TypographyProps, TypographySetting, TypographySettingV2, TypographyType, TypographyV2Attrs, TypographyV2Props, VariantSelectFragment, VitalsWidgetType, WiserWidgetType, WrapRenderChildren, baseAssetURL, calculateFirstProduct, checkAvailableVariantInStock, cls, composeAdvanceStyle, composeBackgroundCss, composeBorderCss, composeCornerCss, composeGridLayout, composeMemo, composeRadius, composeRadiusResponsive, composeShadowCss, composeSize, composeSizeCss, composeSpacing, composeTextColorCss, composeTypography, composeTypographyAttr, composeTypographyClassName, composeTypographyCss, composeTypographyStyle, composeTypographyV2, composeTypographyV2Css, convertOldLayout, dataStringify, fetchMedias, fetchVariants, filterToolbarPreview, flattenConnection, fpixel, genSizeClass, genTypoClass, genVariable, generateCollectionQueryKey, generateProductQueryKey, generateProductsQueryKey, getBorderStyle, getCollection, getCornerCSSFromGlobal, getCustomRadius, getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateClassDynamicBtn, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveClassDynamicBtn, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getPaddingGlobalSize, getProduct, getProductBySlug, getRadiusCSSFromGlobal, getRadiusStyleActiveState, getResponsiveStateValue, getResponsiveValue, getResponsiveValueByScreen, getSelectedVariant, getShortName, getSingleColorVariable, getSpacingVariable, getStyleBackgroundByDevice, getStyleShadow, getStyleShadowState, getWidthHeightGlobalSize, globalEvent, gridToArrayRegex, gtag, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, handleConvertClassColorDynamicBtn, isBrowser, isColor, isColumnDirectionExist, isDefined, isEmptyChildren, isLocalEnv, isSafari, loadScript, makeAspectRatio, makeFixedBgAttachment, makeGlobalSize, makeGlobalSizeWidthResponsive, makeHeight, makeLineClamp, makeStyle, makeStyleResponsive, makeStyleResponsiveState, makeStyleState, makeStyleWithDefault, makeWidth, normalizeBuilderData, optionLayoutStyle, parseSelectedOption, parseValueWithUnit, prefetchQueries, props, removeNullUndefined, splitStyle, styles, template, tiktokpixel, useAddToCart, useAddon, useAddons, useBuilderComponent, useBuilderPreviewStore, useBuilderStore, useCartData, useCartDiscountCodesUpdate, useCartId, useCartLine, useCartLineStore, useCartNoteUpdate, useCartUI, useCheckAvailableVariantInStock, useCheckoutUrl, useCollection, useCollectionQuery, useCollectionStore, useCollectionsQuery, useConnectedShopify, useCreateCart, useCurrency, useCurrentDevice, useCurrentVariant, useCurrentVariantInStock, useEditorMode, useFeaturedImageGlobal, useFormatMoney, useInitialSwatchesOptions, useIsSampleProduct, useIsStorefrontProduct, useIsSyncProduct, useIsomorphicLayoutEffect, useLazyVideo, useLoadScript, useLocale, useMatchMutate, useMobileOnly, useModalStore, useMoney, useMoneyFormat, usePageType, usePluginEnable, usePrevious, useProduct, useProductList, useProductListProducts, useProductListSettings, useProductListStore, useProductListStyles, useProductProperties, useProductQuery, useProductStore, useProductsQuery, useQuantity, useRemoveCartItem, useSection, useSectionStore, useSelectedOption, useShopStore, useStoreFront, useSuspenseFetch, useSwatches, useSwatchesOptions, useUniqProductID, useUpdateCartItem, useVariant, useVariantOutStock, useVariants, validateEmail };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "1.23.0-staging.37",
3
+ "version": "1.23.0-staging.43",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",