@gem-sdk/core 1.5.41 → 1.5.44

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.
@@ -3,6 +3,13 @@
3
3
  var colors = require('./colors.js');
4
4
  var makeStyle = require('./make-style.js');
5
5
 
6
+ const getBorderStyle = (value)=>{
7
+ return makeStyle.makeStyle({
8
+ 'b': value?.border,
9
+ 'bc': value?.color,
10
+ 'bw': value?.width
11
+ });
12
+ };
6
13
  const handleConvertBorderStyle = (value)=>{
7
14
  if (!value) return undefined;
8
15
  if ('desktop' in value || 'tablet' in value || 'mobile' in value) {
@@ -128,6 +135,7 @@ const handleConvertClassColor = (value)=>{
128
135
  return colors.getGlobalColorStateClass('border', newVal);
129
136
  };
130
137
 
138
+ exports.getBorderStyle = getBorderStyle;
131
139
  exports.handleConvertBorderColor = handleConvertBorderColor;
132
140
  exports.handleConvertBorderStyle = handleConvertBorderStyle;
133
141
  exports.handleConvertBorderWidth = handleConvertBorderWidth;
@@ -114,6 +114,13 @@ function composeAdvanceStyle(data, tag) {
114
114
  Object.assign(styles, shadow.getStyleShadowState(value, 'box-shadow', hasBoxShadow));
115
115
  break;
116
116
  }
117
+ } else {
118
+ if (attr === 'border') {
119
+ Object.assign(styles, borders.getBorderStyle(value));
120
+ }
121
+ if (attr === 'rounded') {
122
+ Object.assign(styles, radius.getCornerCSSFromGlobal(value));
123
+ }
117
124
  }
118
125
  });
119
126
  } else {
@@ -1,7 +1,18 @@
1
1
  'use strict';
2
2
 
3
3
  var constant = require('./constant.js');
4
+ var makeStyle = require('./make-style.js');
4
5
 
6
+ const getCornerCSSFromGlobal = (corner)=>{
7
+ if (!corner.radiusType) return {};
8
+ return makeStyle.makeStyle({
9
+ 'bblr': corner.bblr,
10
+ 'bbrr': corner.bbrr,
11
+ 'btlr': corner.btlr,
12
+ 'btrr': corner.btrr,
13
+ 'radius': `var(--g-radius-${corner.radiusType})`
14
+ });
15
+ };
5
16
  const getRadiusCSSFromGlobal = (state, key, device)=>{
6
17
  if (!key || !state) return {};
7
18
  const suffix = device && device !== 'desktop' ? constant.devicesMapping?.[device] : '';
@@ -83,6 +94,7 @@ const getRadiusStyleActiveState = (radiusValue)=>{
83
94
  };
84
95
 
85
96
  exports.composeRadius = composeRadius;
97
+ exports.getCornerCSSFromGlobal = getCornerCSSFromGlobal;
86
98
  exports.getCustomRadius = getCustomRadius;
87
99
  exports.getRadiusCSSFromGlobal = getRadiusCSSFromGlobal;
88
100
  exports.getRadiusStyleActiveState = getRadiusStyleActiveState;
package/dist/cjs/index.js CHANGED
@@ -166,6 +166,7 @@ exports.getSingleColorVariable = colors.getSingleColorVariable;
166
166
  exports.isColor = colors.isColor;
167
167
  exports.genTypoClass = typography.genTypoClass;
168
168
  exports.composeRadius = radius.composeRadius;
169
+ exports.getCornerCSSFromGlobal = radius.getCornerCSSFromGlobal;
169
170
  exports.getCustomRadius = radius.getCustomRadius;
170
171
  exports.getRadiusCSSFromGlobal = radius.getRadiusCSSFromGlobal;
171
172
  exports.getRadiusStyleActiveState = radius.getRadiusStyleActiveState;
@@ -1,6 +1,13 @@
1
1
  import { getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStateResponsiveClass, getGlobalColorStateClass } from './colors.js';
2
- import { makeStyleResponsiveState, makeStyleState } from './make-style.js';
2
+ import { makeStyleResponsiveState, makeStyleState, makeStyle } from './make-style.js';
3
3
 
4
+ const getBorderStyle = (value)=>{
5
+ return makeStyle({
6
+ 'b': value?.border,
7
+ 'bc': value?.color,
8
+ 'bw': value?.width
9
+ });
10
+ };
4
11
  const handleConvertBorderStyle = (value)=>{
5
12
  if (!value) return undefined;
6
13
  if ('desktop' in value || 'tablet' in value || 'mobile' in value) {
@@ -126,4 +133,4 @@ const handleConvertClassColor = (value)=>{
126
133
  return getGlobalColorStateClass('border', newVal);
127
134
  };
128
135
 
129
- export { handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor };
136
+ export { getBorderStyle, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor };
@@ -1,7 +1,7 @@
1
- import { handleConvertBorderStyle, handleConvertBorderWidth, handleConvertBorderColor } from './borders.js';
1
+ import { handleConvertBorderStyle, handleConvertBorderWidth, handleConvertBorderColor, getBorderStyle } from './borders.js';
2
2
  import { isColor } from './colors.js';
3
3
  import { layoutComponent } from './constant.js';
4
- import { composeRadius } from './radius.js';
4
+ import { composeRadius, getCornerCSSFromGlobal } from './radius.js';
5
5
  import { getStyleShadowState } from './shadow.js';
6
6
 
7
7
  const composeSpacing = ({ source , spacing , type , suffix ='' })=>{
@@ -112,6 +112,13 @@ function composeAdvanceStyle(data, tag) {
112
112
  Object.assign(styles, getStyleShadowState(value, 'box-shadow', hasBoxShadow));
113
113
  break;
114
114
  }
115
+ } else {
116
+ if (attr === 'border') {
117
+ Object.assign(styles, getBorderStyle(value));
118
+ }
119
+ if (attr === 'rounded') {
120
+ Object.assign(styles, getCornerCSSFromGlobal(value));
121
+ }
115
122
  }
116
123
  });
117
124
  } else {
@@ -1,5 +1,16 @@
1
1
  import { devicesMapping, stateMapping } from './constant.js';
2
+ import { makeStyle } from './make-style.js';
2
3
 
4
+ const getCornerCSSFromGlobal = (corner)=>{
5
+ if (!corner.radiusType) return {};
6
+ return makeStyle({
7
+ 'bblr': corner.bblr,
8
+ 'bbrr': corner.bbrr,
9
+ 'btlr': corner.btlr,
10
+ 'btrr': corner.btrr,
11
+ 'radius': `var(--g-radius-${corner.radiusType})`
12
+ });
13
+ };
3
14
  const getRadiusCSSFromGlobal = (state, key, device)=>{
4
15
  if (!key || !state) return {};
5
16
  const suffix = device && device !== 'desktop' ? devicesMapping?.[device] : '';
@@ -80,4 +91,4 @@ const getRadiusStyleActiveState = (radiusValue)=>{
80
91
  return getRadiusCSSFromGlobal('normal', radiusValue?.active?.radiusType);
81
92
  };
82
93
 
83
- export { composeRadius, getCustomRadius, getRadiusCSSFromGlobal, getRadiusStyleActiveState };
94
+ export { composeRadius, getCornerCSSFromGlobal, getCustomRadius, getRadiusCSSFromGlobal, getRadiusStyleActiveState };
package/dist/esm/index.js CHANGED
@@ -42,7 +42,7 @@ export { genVariable } from './helpers/css-variable.js';
42
42
  export { isDefined } from './helpers/is-defined.js';
43
43
  export { getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getSingleColorVariable, isColor } from './helpers/colors.js';
44
44
  export { genTypoClass } from './helpers/typography.js';
45
- export { composeRadius, getCustomRadius, getRadiusCSSFromGlobal, getRadiusStyleActiveState } from './helpers/radius.js';
45
+ export { composeRadius, getCornerCSSFromGlobal, getCustomRadius, getRadiusCSSFromGlobal, getRadiusStyleActiveState } from './helpers/radius.js';
46
46
  export { getSelectedVariant, parseSelectedOption } from './helpers/product.js';
47
47
  import * as fpixel from './helpers/tracking/fpixel.js';
48
48
  export { fpixel };
@@ -399,6 +399,7 @@ type RangeControlType<T> = SharedControlType<T> & {
399
399
  readonly?: boolean;
400
400
  units?: string[];
401
401
  disableOnChange?: boolean;
402
+ ignoreUnit?: boolean;
402
403
  };
403
404
 
404
405
  type Option$2<T> = {
@@ -548,6 +549,7 @@ type TypographyControlType<T> = SharedControlType<T> & {
548
549
 
549
550
  type PickLinkControlType<T> = SharedControlType<T> & {
550
551
  type: 'pick-link';
552
+ pickLinkLabel?: string;
551
553
  };
552
554
 
553
555
  type BehaviorStateControlType<T> = {
@@ -760,7 +762,13 @@ type LayoutSegmentControlType<T> = {
760
762
  [K in keyof T]-?: Mapped<K, T[K]>;
761
763
  }[keyof T];
762
764
 
763
- type ControlProp<T> = AngleControlType<T> | CheckboxControlType<T> | ColorPickerControlType<T> | GroupControlType<T> | IconControlType<T> | InputFixContentControlType<T> | InputNumberControlType<T> | InputUnitControlType<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> | 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> | CustomCodeEditor | LayoutSegmentControlType<T>;
765
+ type InputSpacing<T> = SharedControlType<T> & {
766
+ type: 'spacingInput';
767
+ placeholder?: string;
768
+ readonly?: boolean;
769
+ };
770
+
771
+ type ControlProp<T> = AngleControlType<T> | CheckboxControlType<T> | ColorPickerControlType<T> | GroupControlType<T> | IconControlType<T> | InputFixContentControlType<T> | InputNumberControlType<T> | InputUnitControlType<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> | 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> | CustomCodeEditor | LayoutSegmentControlType<T> | InputSpacing<T>;
764
772
  type Setting<P extends BaseProps> = {
765
773
  id: 'setting';
766
774
  note?: string;
@@ -7308,6 +7316,7 @@ declare const getGlobalColorStyle: (data?: ColorValueType) => React.CSSPropertie
7308
7316
  type TypographyClass = `g-${TypographyType}`;
7309
7317
  declare const genTypoClass: (name: TypographyType) => TypographyClass;
7310
7318
 
7319
+ declare const getCornerCSSFromGlobal: (corner: CornerRadius) => React.CSSProperties;
7311
7320
  declare const getRadiusCSSFromGlobal: (state: StateType, key?: RoundedSize, device?: NameDevices) => React.CSSProperties;
7312
7321
  declare const getCustomRadius: (state: StateType, radius?: CornerRadius, device?: NameDevices) => React.CSSProperties;
7313
7322
  declare const composeRadius: (value?: StateProp<CornerRadius> | ResponsiveStateProp<CornerRadius>) => React.CSSProperties;
@@ -7601,4 +7610,4 @@ declare const fetchMedias: (fetcher: FetchFunc, { id, isSample }: FetchParams) =
7601
7610
 
7602
7611
  declare const getProductBySlug: (fetcher: FetchFunc, slug?: string) => Promise<ProductSelectFragment>;
7603
7612
 
7604
- export { AddOn, AddonProvider, AddonProviderProps, AlignItemProp, AlignProp, Background, BaseProps, BasePropsWrap, BlockEntity, Border, BuilderComponentProvider, BuilderComponentProviderProps, BuilderEntity, BuilderEntityNested, BuilderPreviewProvider, BuilderPreviewProviderProps, BuilderProvider, BuilderProviderProps, BuilderState, Builtin, CartLineProvider, CartLineProviderProps, CollectionDetailFilterDocument, CollectionDetailFilterQueryResponse, CollectionDetailFilterQueryVariables, CollectionDocument, CollectionProvider, CollectionProviderProps, CollectionQueryResponse, CollectionQueryVariables, ColorKey, ColorType$1 as ColorType, ColorValueType, Component, ComponentSetting, ContainerProp, ControlProp, ControlUI, CornerRadius, CornerRadiusType, CustomComponentConfig, DeepPartial, ExtractState, FetchFunc, FlexDirectionProp, FontName, GlobalStyleConfig, GlobalStyleResponsiveConfig, GlobalSwatchesData, GraphQLConnection, GroupPropType, HSLAColorType, HSLColorType, HexColorType, InitComponentType, JudgeMeReviewsWidgetType, KlaviyoWidgetType, LooxReviewsWidgetType, NameDevices, NestedKeys, ObjectDeviceGlobalType, ObjectDevices, OptionNormalStyle, OptionSpecialStyle, PageViewUpDocument, PageViewUpMutationResponse, PageViewUpMutationVariables, PreviewPageDocument, PreviewPageQueryResponse, PreviewPageQueryVariables, Primitive, ProductInputAnalytic, ProductListProvider, ProductListProviderProps, ProductProvider, ProductProviderProps, ProductSelectFragment, ProductsDocument, ProductsQueryResponse, ProductsQueryVariables, PublishedThemePageSelectFragment, PublishedThemePagesDocument, PublishedThemePagesQueryResponse, PublishedThemePagesQueryVariables, RGBAColorType, RGBColorType, RenderMemo as Render, RenderIf, Render as RenderLiquid, RenderMode, RenderPreviewMemo as RenderPreview, RequiredCursorEdge, ResponsiveStateProp, RoundedSize, SectionData, SectionEntity, SectionProvider, SectionProviderProps, ShadowProps, ShadowStyle, ShadowStyleApplied, ShadowType, ShopProvider, ShopProviderProps, shop as ShopType, SizeProps, SizeSetting, SizeType, SpacingType, StateProp, StateSelector, StateType, StoreConfig, StorePropertyDocument, StorePropertyQueryResponse, StorePropertyQueryVariables, SwatchesOptionType, SwatchesOptionValue, TransformProp, TypographyProps, TypographySetting, TypographyType, VariantSelectFragment, calculateFirstProduct, cls, composeAdvanceStyle, composeRadius, composeSize, composeSpacing, fetchMedias, fetchVariants, flattenConnection, fpixel, genTypoClass, genVariable, getCollection, getCustomRadius, getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getProduct, getProductBySlug, getRadiusCSSFromGlobal, getRadiusStyleActiveState, getResponsiveStateValue, getResponsiveValue, getResponsiveValueByScreen, getSelectedVariant, getShortName, getSingleColorVariable, getSpacingVariable, getStyleBackgroundByDevice, getStyleShadow, getStyleShadowState, globalEvent, gtag, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, isBrowser, isColor, isDefined, isEmptyChildren, isLocalEnv, loadScript, makeAspectRatio, makeHeight, makeStyle, makeStyleResponsive, makeStyleResponsiveState, makeStyleState, makeWidth, normalizeBuilderData, optionLayoutStyle, parseSelectedOption, prefetchQueries, props, styles, template, tiktokpixel, useAddToCart, useAddon, useAddons, useBuilderComponent, useBuilderPreviewStore, useBuilderStore, useCartData, useCartDiscountCodesUpdate, useCartId, useCartLine, useCartLineStore, useCartNoteUpdate, useCartUI, useCheckoutUrl, useCollection, useCollectionQuery, useCollectionStore, useConnectedShopify, useCreateCart, useCurrency, useCurrentDevice, useCurrentVariant, useCurrentVariantInStock, useEditorMode, useFeaturedImageGlobal, useFormatMoney, useIsSampleProduct, useIsomorphicLayoutEffect, useLazyVideo, useLoadScript, useLocale, useMatchMutate, useMobileOnly, useMoney, 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 };
7613
+ export { AddOn, AddonProvider, AddonProviderProps, AlignItemProp, AlignProp, Background, BaseProps, BasePropsWrap, BlockEntity, Border, BuilderComponentProvider, BuilderComponentProviderProps, BuilderEntity, BuilderEntityNested, BuilderPreviewProvider, BuilderPreviewProviderProps, BuilderProvider, BuilderProviderProps, BuilderState, Builtin, CartLineProvider, CartLineProviderProps, CollectionDetailFilterDocument, CollectionDetailFilterQueryResponse, CollectionDetailFilterQueryVariables, CollectionDocument, CollectionProvider, CollectionProviderProps, CollectionQueryResponse, CollectionQueryVariables, ColorKey, ColorType$1 as ColorType, ColorValueType, Component, ComponentSetting, ContainerProp, ControlProp, ControlUI, CornerRadius, CornerRadiusType, CustomComponentConfig, DeepPartial, ExtractState, FetchFunc, FlexDirectionProp, FontName, GlobalStyleConfig, GlobalStyleResponsiveConfig, GlobalSwatchesData, GraphQLConnection, GroupPropType, HSLAColorType, HSLColorType, HexColorType, InitComponentType, JudgeMeReviewsWidgetType, KlaviyoWidgetType, LooxReviewsWidgetType, NameDevices, NestedKeys, ObjectDeviceGlobalType, ObjectDevices, OptionNormalStyle, OptionSpecialStyle, PageViewUpDocument, PageViewUpMutationResponse, PageViewUpMutationVariables, PreviewPageDocument, PreviewPageQueryResponse, PreviewPageQueryVariables, Primitive, ProductInputAnalytic, ProductListProvider, ProductListProviderProps, ProductProvider, ProductProviderProps, ProductSelectFragment, ProductsDocument, ProductsQueryResponse, ProductsQueryVariables, PublishedThemePageSelectFragment, PublishedThemePagesDocument, PublishedThemePagesQueryResponse, PublishedThemePagesQueryVariables, RGBAColorType, RGBColorType, RenderMemo as Render, RenderIf, Render as RenderLiquid, RenderMode, RenderPreviewMemo as RenderPreview, RequiredCursorEdge, ResponsiveStateProp, RoundedSize, SectionData, SectionEntity, SectionProvider, SectionProviderProps, ShadowProps, ShadowStyle, ShadowStyleApplied, ShadowType, ShopProvider, ShopProviderProps, shop as ShopType, SizeProps, SizeSetting, SizeType, SpacingType, StateProp, StateSelector, StateType, StoreConfig, StorePropertyDocument, StorePropertyQueryResponse, StorePropertyQueryVariables, SwatchesOptionType, SwatchesOptionValue, TransformProp, TypographyProps, TypographySetting, TypographyType, VariantSelectFragment, calculateFirstProduct, cls, composeAdvanceStyle, composeRadius, composeSize, composeSpacing, fetchMedias, fetchVariants, flattenConnection, fpixel, genTypoClass, genVariable, getCollection, getCornerCSSFromGlobal, getCustomRadius, getGlobalColorCSSProp, getGlobalColorClass, getGlobalColorResponsiveClass, getGlobalColorResponsiveStyle, getGlobalColorStateClass, getGlobalColorStateResponsiveClass, getGlobalColorStateResponsiveStyle, getGlobalColorStateStyle, getGlobalColorStyle, getProduct, getProductBySlug, getRadiusCSSFromGlobal, getRadiusStyleActiveState, getResponsiveStateValue, getResponsiveValue, getResponsiveValueByScreen, getSelectedVariant, getShortName, getSingleColorVariable, getSpacingVariable, getStyleBackgroundByDevice, getStyleShadow, getStyleShadowState, globalEvent, gtag, handleConvertBorderColor, handleConvertBorderStyle, handleConvertBorderWidth, handleConvertClassColor, isBrowser, isColor, isDefined, isEmptyChildren, isLocalEnv, loadScript, makeAspectRatio, makeHeight, makeStyle, makeStyleResponsive, makeStyleResponsiveState, makeStyleState, makeWidth, normalizeBuilderData, optionLayoutStyle, parseSelectedOption, prefetchQueries, props, styles, template, tiktokpixel, useAddToCart, useAddon, useAddons, useBuilderComponent, useBuilderPreviewStore, useBuilderStore, useCartData, useCartDiscountCodesUpdate, useCartId, useCartLine, useCartLineStore, useCartNoteUpdate, useCartUI, useCheckoutUrl, useCollection, useCollectionQuery, useCollectionStore, useConnectedShopify, useCreateCart, useCurrency, useCurrentDevice, useCurrentVariant, useCurrentVariantInStock, useEditorMode, useFeaturedImageGlobal, useFormatMoney, useIsSampleProduct, useIsomorphicLayoutEffect, useLazyVideo, useLoadScript, useLocale, useMatchMutate, useMobileOnly, useMoney, 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.5.41",
3
+ "version": "1.5.44",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",