@gem-sdk/core 1.5.17 → 1.5.22
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.
- package/dist/cjs/components/AddOn.js +7 -7
- package/dist/cjs/components/ComponentWrapper.js +14 -8
- package/dist/cjs/components/ComponentWrapperPreview.js +55 -46
- package/dist/cjs/components/Empty.js +1 -1
- package/dist/cjs/components/Render.js +50 -13
- package/dist/cjs/components/Render.liquid.js +81 -57
- package/dist/cjs/components/RenderBlock.js +41 -8
- package/dist/cjs/components/RenderPreview.js +51 -13
- package/dist/cjs/components/RenderSection.js +11 -7
- package/dist/cjs/components/constant.js +24 -24
- package/dist/cjs/contexts/AddonContext.js +25 -14
- package/dist/cjs/contexts/BuilderComponent.js +23 -19
- package/dist/cjs/contexts/BuilderContext.js +25 -19
- package/dist/cjs/contexts/BuilderPreviewContext.js +349 -341
- package/dist/cjs/contexts/CartLineContext.js +19 -14
- package/dist/cjs/contexts/CollectionContext.js +21 -13
- package/dist/cjs/contexts/ProductContext.js +136 -115
- package/dist/cjs/contexts/ProductListContext.js +21 -13
- package/dist/cjs/contexts/SectionContext.js +41 -37
- package/dist/cjs/contexts/ShopContext.js +49 -31
- package/dist/cjs/graphql/fragments/analytic.generated.js +1 -1
- package/dist/cjs/graphql/fragments/collection-detail.generated.js +1 -1
- package/dist/cjs/graphql/fragments/collection-product.generated.js +1 -1
- package/dist/cjs/graphql/fragments/custom-code.generated.js +1 -1
- package/dist/cjs/graphql/fragments/data-seo.generated.js +1 -1
- package/dist/cjs/graphql/fragments/media.generated.js +1 -1
- package/dist/cjs/graphql/fragments/product-little.generated.js +1 -1
- package/dist/cjs/graphql/fragments/product-option-value.generated.js +1 -1
- package/dist/cjs/graphql/fragments/product-option.generated.js +1 -1
- package/dist/cjs/graphql/fragments/product.generated.js +1 -1
- package/dist/cjs/graphql/fragments/published-custom-section.generated.js +1 -1
- package/dist/cjs/graphql/fragments/published-page-section.generated.js +1 -1
- package/dist/cjs/graphql/fragments/published-theme-page.generated.js +1 -1
- package/dist/cjs/graphql/fragments/published-theme-style.generated.js +1 -1
- package/dist/cjs/graphql/fragments/selected-option.generated.js +1 -1
- package/dist/cjs/graphql/fragments/variant.generated.js +1 -1
- package/dist/cjs/graphql/mutations/page-view-up.generated.js +1 -1
- package/dist/cjs/graphql/queries/products.generated.js +1 -1
- package/dist/cjs/graphql/queries/store-property.generated.js +1 -1
- package/dist/cjs/helpers/GlobalEvent.js +12 -10
- package/dist/cjs/helpers/background.js +96 -96
- package/dist/cjs/helpers/borders.js +123 -127
- package/dist/cjs/helpers/clone-deep.js +1 -1
- package/dist/cjs/helpers/cls.js +11 -15
- package/dist/cjs/helpers/colors.js +121 -156
- package/dist/cjs/helpers/compose-advance-style.js +115 -121
- package/dist/cjs/helpers/constant.js +16 -11
- package/dist/cjs/helpers/css-variable.js +2 -2
- package/dist/cjs/helpers/email.js +3 -3
- package/dist/cjs/helpers/flatten-connection.js +4 -5
- package/dist/cjs/helpers/get-resonsive-value.js +24 -25
- package/dist/cjs/helpers/get-shortname.js +87 -87
- package/dist/cjs/helpers/is-browser.js +2 -2
- package/dist/cjs/helpers/is-defined.js +2 -2
- package/dist/cjs/helpers/is-empty-children.js +2 -2
- package/dist/cjs/helpers/layout.js +9 -10
- package/dist/cjs/helpers/load-script.js +26 -27
- package/dist/cjs/helpers/make-style.js +77 -86
- package/dist/cjs/helpers/normalize-builder-data.js +18 -12
- package/dist/cjs/helpers/prefetch-queries.js +72 -52
- package/dist/cjs/helpers/product.js +25 -29
- package/dist/cjs/helpers/queries/get-collection.js +179 -167
- package/dist/cjs/helpers/queries/get-product-by-slug.js +103 -94
- package/dist/cjs/helpers/queries/get-product.js +121 -106
- package/dist/cjs/helpers/queries/get-products.js +137 -125
- package/dist/cjs/helpers/radius.js +78 -81
- package/dist/cjs/helpers/render.js +56 -56
- package/dist/cjs/helpers/shadow.js +38 -38
- package/dist/cjs/helpers/size.js +12 -13
- package/dist/cjs/helpers/spacing.js +35 -37
- package/dist/cjs/helpers/tracking/fpixel.js +21 -22
- package/dist/cjs/helpers/tracking/gtag.js +84 -90
- package/dist/cjs/helpers/tracking/tiktokpixel.js +12 -12
- package/dist/cjs/helpers/typography.js +2 -2
- package/dist/cjs/hooks/cart/use-add-to-cart.js +10 -10
- package/dist/cjs/hooks/cart/use-cart-data.js +18 -16
- package/dist/cjs/hooks/cart/use-cart-discount-codes-update.js +10 -10
- package/dist/cjs/hooks/cart/use-cart-note-update.js +10 -10
- package/dist/cjs/hooks/cart/use-create-cart.js +12 -12
- package/dist/cjs/hooks/cart/use-remove-cart-item.js +10 -10
- package/dist/cjs/hooks/cart/use-update-cart-item.js +10 -10
- package/dist/cjs/hooks/shop/use-collection-query.js +12 -6
- package/dist/cjs/hooks/shop/use-product-query.js +12 -6
- package/dist/cjs/hooks/shop/use-products-query.js +14 -6
- package/dist/cjs/hooks/shop.js +86 -67
- package/dist/cjs/hooks/use-current-device.js +14 -16
- package/dist/cjs/hooks/use-lazy-video.js +7 -7
- package/dist/cjs/hooks/useCartId.js +35 -27
- package/dist/cjs/hooks/useCartLine.js +2 -2
- package/dist/cjs/hooks/useCartUI.js +37 -31
- package/dist/cjs/hooks/useCollection.js +2 -2
- package/dist/cjs/hooks/useFetchHandle.js +6 -6
- package/dist/cjs/hooks/useFormatMoney.js +11 -7
- package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +1 -1
- package/dist/cjs/hooks/useLoadScript.js +22 -20
- package/dist/cjs/hooks/useMoney.js +59 -42
- package/dist/cjs/hooks/usePrevious.js +12 -10
- package/dist/cjs/hooks/useProduct.js +92 -69
- package/dist/cjs/hooks/useProductList.js +11 -11
- package/dist/cjs/hooks/useSuspenseFetch.js +20 -17
- package/dist/cjs/hooks/useSwatchesOptions.js +32 -30
- package/dist/cjs/types/global-style.js +9 -2
- package/dist/esm/components/AddOn.js +7 -7
- package/dist/esm/components/ComponentWrapper.js +14 -8
- package/dist/esm/components/ComponentWrapperPreview.js +55 -46
- package/dist/esm/components/Empty.js +1 -1
- package/dist/esm/components/Render.js +50 -13
- package/dist/esm/components/Render.liquid.js +81 -57
- package/dist/esm/components/RenderBlock.js +41 -8
- package/dist/esm/components/RenderPreview.js +51 -13
- package/dist/esm/components/RenderSection.js +11 -7
- package/dist/esm/components/constant.js +24 -24
- package/dist/esm/contexts/AddonContext.js +26 -15
- package/dist/esm/contexts/BuilderComponent.js +24 -20
- package/dist/esm/contexts/BuilderContext.js +26 -20
- package/dist/esm/contexts/BuilderPreviewContext.js +350 -342
- package/dist/esm/contexts/CartLineContext.js +20 -15
- package/dist/esm/contexts/CollectionContext.js +22 -14
- package/dist/esm/contexts/ProductContext.js +137 -116
- package/dist/esm/contexts/ProductListContext.js +22 -14
- package/dist/esm/contexts/SectionContext.js +42 -38
- package/dist/esm/contexts/ShopContext.js +50 -32
- package/dist/esm/graphql/fragments/analytic.generated.js +1 -1
- package/dist/esm/graphql/fragments/collection-detail.generated.js +1 -1
- package/dist/esm/graphql/fragments/collection-product.generated.js +1 -1
- package/dist/esm/graphql/fragments/custom-code.generated.js +1 -1
- package/dist/esm/graphql/fragments/data-seo.generated.js +1 -1
- package/dist/esm/graphql/fragments/media.generated.js +1 -1
- package/dist/esm/graphql/fragments/product-little.generated.js +1 -1
- package/dist/esm/graphql/fragments/product-option-value.generated.js +1 -1
- package/dist/esm/graphql/fragments/product-option.generated.js +1 -1
- package/dist/esm/graphql/fragments/product.generated.js +1 -1
- package/dist/esm/graphql/fragments/published-custom-section.generated.js +1 -1
- package/dist/esm/graphql/fragments/published-page-section.generated.js +1 -1
- package/dist/esm/graphql/fragments/published-theme-page.generated.js +1 -1
- package/dist/esm/graphql/fragments/published-theme-style.generated.js +1 -1
- package/dist/esm/graphql/fragments/selected-option.generated.js +1 -1
- package/dist/esm/graphql/fragments/variant.generated.js +1 -1
- package/dist/esm/graphql/mutations/page-view-up.generated.js +1 -1
- package/dist/esm/graphql/queries/products.generated.js +1 -1
- package/dist/esm/graphql/queries/store-property.generated.js +1 -1
- package/dist/esm/helpers/GlobalEvent.js +12 -10
- package/dist/esm/helpers/background.js +96 -96
- package/dist/esm/helpers/borders.js +123 -127
- package/dist/esm/helpers/clone-deep.js +1 -1
- package/dist/esm/helpers/cls.js +11 -15
- package/dist/esm/helpers/colors.js +121 -156
- package/dist/esm/helpers/compose-advance-style.js +115 -121
- package/dist/esm/helpers/constant.js +16 -11
- package/dist/esm/helpers/css-variable.js +2 -2
- package/dist/esm/helpers/email.js +3 -3
- package/dist/esm/helpers/flatten-connection.js +4 -5
- package/dist/esm/helpers/get-resonsive-value.js +24 -25
- package/dist/esm/helpers/get-shortname.js +87 -87
- package/dist/esm/helpers/is-browser.js +2 -2
- package/dist/esm/helpers/is-defined.js +2 -2
- package/dist/esm/helpers/is-empty-children.js +2 -2
- package/dist/esm/helpers/layout.js +9 -10
- package/dist/esm/helpers/load-script.js +26 -27
- package/dist/esm/helpers/make-style.js +77 -86
- package/dist/esm/helpers/normalize-builder-data.js +18 -12
- package/dist/esm/helpers/prefetch-queries.js +72 -52
- package/dist/esm/helpers/product.js +25 -29
- package/dist/esm/helpers/queries/get-collection.js +179 -167
- package/dist/esm/helpers/queries/get-product-by-slug.js +103 -94
- package/dist/esm/helpers/queries/get-product.js +121 -106
- package/dist/esm/helpers/queries/get-products.js +137 -125
- package/dist/esm/helpers/radius.js +78 -81
- package/dist/esm/helpers/render.js +56 -56
- package/dist/esm/helpers/shadow.js +38 -38
- package/dist/esm/helpers/size.js +12 -13
- package/dist/esm/helpers/spacing.js +35 -37
- package/dist/esm/helpers/tracking/fpixel.js +21 -22
- package/dist/esm/helpers/tracking/gtag.js +84 -90
- package/dist/esm/helpers/tracking/tiktokpixel.js +12 -12
- package/dist/esm/helpers/typography.js +2 -2
- package/dist/esm/hooks/cart/use-add-to-cart.js +10 -10
- package/dist/esm/hooks/cart/use-cart-data.js +18 -16
- package/dist/esm/hooks/cart/use-cart-discount-codes-update.js +10 -10
- package/dist/esm/hooks/cart/use-cart-note-update.js +10 -10
- package/dist/esm/hooks/cart/use-create-cart.js +12 -12
- package/dist/esm/hooks/cart/use-remove-cart-item.js +10 -10
- package/dist/esm/hooks/cart/use-update-cart-item.js +10 -10
- package/dist/esm/hooks/shop/use-collection-query.js +12 -6
- package/dist/esm/hooks/shop/use-product-query.js +12 -6
- package/dist/esm/hooks/shop/use-products-query.js +14 -6
- package/dist/esm/hooks/shop.js +86 -67
- package/dist/esm/hooks/use-current-device.js +14 -16
- package/dist/esm/hooks/use-lazy-video.js +7 -7
- package/dist/esm/hooks/useCartId.js +35 -27
- package/dist/esm/hooks/useCartLine.js +2 -2
- package/dist/esm/hooks/useCartUI.js +37 -31
- package/dist/esm/hooks/useCollection.js +2 -2
- package/dist/esm/hooks/useFetchHandle.js +6 -6
- package/dist/esm/hooks/useFormatMoney.js +11 -7
- package/dist/esm/hooks/useIsomorphicLayoutEffect.js +1 -1
- package/dist/esm/hooks/useLoadScript.js +22 -20
- package/dist/esm/hooks/useMoney.js +59 -42
- package/dist/esm/hooks/usePrevious.js +12 -10
- package/dist/esm/hooks/useProduct.js +92 -69
- package/dist/esm/hooks/useProductList.js +11 -11
- package/dist/esm/hooks/useSuspenseFetch.js +20 -17
- package/dist/esm/hooks/useSwatchesOptions.js +32 -30
- package/dist/esm/types/global-style.js +9 -2
- package/dist/types/index.d.ts +24 -2
- package/package.json +1 -1
|
@@ -1,30 +1,29 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const getResponsiveValue = (input, k)
|
|
4
|
-
if (!k)
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}
|
|
3
|
+
const getResponsiveValue = (input, k)=>{
|
|
4
|
+
if (!k) return {};
|
|
5
|
+
return {
|
|
6
|
+
desktop: input?.desktop?.[k],
|
|
7
|
+
tablet: input?.tablet?.[k],
|
|
8
|
+
mobile: input?.mobile?.[k]
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
const getResponsiveStateValue = (k, input)=>{
|
|
12
|
+
return {
|
|
13
|
+
desktop: input?.desktop?.[k],
|
|
14
|
+
tablet: input?.tablet?.[k],
|
|
15
|
+
mobile: input?.mobile?.[k]
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
const getResponsiveValueByScreen = (value, breakpoint, defaultValue)=>{
|
|
19
|
+
switch(breakpoint){
|
|
20
|
+
case 'tablet':
|
|
21
|
+
return value?.tablet ?? value?.desktop ?? defaultValue;
|
|
22
|
+
case 'mobile':
|
|
23
|
+
return value?.mobile ?? value?.tablet ?? value?.desktop ?? defaultValue;
|
|
24
|
+
default:
|
|
25
|
+
return value?.desktop ?? defaultValue;
|
|
26
|
+
}
|
|
28
27
|
};
|
|
29
28
|
|
|
30
29
|
exports.getResponsiveStateValue = getResponsiveStateValue;
|
|
@@ -1,92 +1,92 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const globalSortNameMapping = {
|
|
4
|
-
'typography-heading-1-fontFamily': 'h1-ff',
|
|
5
|
-
'typography-heading-1-fontSize': 'h1-size',
|
|
6
|
-
'typography-heading-1-fontWeight': 'h1-weight',
|
|
7
|
-
'typography-heading-1-lineHeight': 'h1-lh',
|
|
8
|
-
'typography-heading-1-letterSpacing': 'h1-ls',
|
|
9
|
-
'typography-heading-1-fontStyle': 'h1-fs',
|
|
10
|
-
'typography-heading-2-fontFamily': 'h2-ff',
|
|
11
|
-
'typography-heading-2-fontSize': 'h2-size',
|
|
12
|
-
'typography-heading-2-fontWeight': 'h2-weight',
|
|
13
|
-
'typography-heading-2-lineHeight': 'h2-lh',
|
|
14
|
-
'typography-heading-2-letterSpacing': 'h2-ls',
|
|
15
|
-
'typography-heading-2-fontStyle': 'h2-fs',
|
|
16
|
-
'typography-heading-3-fontFamily': 'h3-ff',
|
|
17
|
-
'typography-heading-3-fontSize': 'h3-size',
|
|
18
|
-
'typography-heading-3-fontWeight': 'h3-weight',
|
|
19
|
-
'typography-heading-3-lineHeight': 'h3-lh',
|
|
20
|
-
'typography-heading-3-letterSpacing': 'h3-ls',
|
|
21
|
-
'typography-heading-3-fontStyle': 'h3-fs',
|
|
22
|
-
'typography-subheading-1-fontFamily': 'sh1-ff',
|
|
23
|
-
'typography-subheading-1-fontSize': 'sh1-size',
|
|
24
|
-
'typography-subheading-1-fontWeight': 'sh1-weight',
|
|
25
|
-
'typography-subheading-1-lineHeight': 'sh1-lh',
|
|
26
|
-
'typography-subheading-1-letterSpacing': 'sh1-ls',
|
|
27
|
-
'typography-subheading-1-fontStyle': 'sh1-fs',
|
|
28
|
-
'typography-subheading-2-fontFamily': 'sh2-ff',
|
|
29
|
-
'typography-subheading-2-fontSize': 'sh2-size',
|
|
30
|
-
'typography-subheading-2-fontWeight': 'sh2-weight',
|
|
31
|
-
'typography-subheading-2-lineHeight': 'sh2-lh',
|
|
32
|
-
'typography-subheading-2-letterSpacing': 'sh2-ls',
|
|
33
|
-
'typography-subheading-2-fontStyle': 'sh2-fs',
|
|
34
|
-
'typography-subheading-3-fontFamily': 'sh3-ff',
|
|
35
|
-
'typography-subheading-3-fontSize': 'sh3-size',
|
|
36
|
-
'typography-subheading-3-fontWeight': 'sh3-weight',
|
|
37
|
-
'typography-subheading-3-lineHeight': 'sh3-lh',
|
|
38
|
-
'typography-subheading-3-letterSpacing': 'sh3-ls',
|
|
39
|
-
'typography-subheading-3-fontStyle': 'sh3-fs',
|
|
40
|
-
'typography-paragraph-1-fontFamily': 'p1-ff',
|
|
41
|
-
'typography-paragraph-1-fontSize': 'p1-size',
|
|
42
|
-
'typography-paragraph-1-fontWeight': 'p1-weight',
|
|
43
|
-
'typography-paragraph-1-lineHeight': 'p1-lh',
|
|
44
|
-
'typography-paragraph-1-letterSpacing': 'p1-ls',
|
|
45
|
-
'typography-paragraph-1-fontStyle': 'p1-fs',
|
|
46
|
-
'typography-paragraph-2-fontFamily': 'p2-ff',
|
|
47
|
-
'typography-paragraph-2-fontSize': 'p2-size',
|
|
48
|
-
'typography-paragraph-2-fontWeight': 'p2-weight',
|
|
49
|
-
'typography-paragraph-2-lineHeight': 'p2-lh',
|
|
50
|
-
'typography-paragraph-2-letterSpacing': 'p2-ls',
|
|
51
|
-
'typography-paragraph-2-fontStyle': 'p2-fs',
|
|
52
|
-
'typography-paragraph-3-fontFamily': 'p3-ff',
|
|
53
|
-
'typography-paragraph-3-fontSize': 'p3-size',
|
|
54
|
-
'typography-paragraph-3-fontWeight': 'p3-weight',
|
|
55
|
-
'typography-paragraph-3-lineHeight': 'p3-lh',
|
|
56
|
-
'typography-paragraph-3-letterSpacing': 'p3-ls',
|
|
57
|
-
'typography-paragraph-3-fontStyle': 'p3-fs',
|
|
58
|
-
'color-brand': 'c-brand',
|
|
59
|
-
'color-highlight': 'c-highlight',
|
|
60
|
-
'color-text-1': 'c-text-1',
|
|
61
|
-
'color-text-2': 'c-text-2',
|
|
62
|
-
'color-text-3': 'c-text-3',
|
|
63
|
-
'color-bg-1': 'c-bg-1',
|
|
64
|
-
'color-bg-2': 'c-bg-2',
|
|
65
|
-
'color-bg-3': 'c-bg-3',
|
|
66
|
-
'color-line-1': 'c-line-1',
|
|
67
|
-
'color-line-2': 'c-line-2',
|
|
68
|
-
'color-line-3': 'c-line-3',
|
|
69
|
-
'color-success': 'c-success',
|
|
70
|
-
'color-info': 'c-info',
|
|
71
|
-
'color-warning': 'c-warning',
|
|
72
|
-
'color-error': 'c-error',
|
|
73
|
-
'spacing-xxs': 's-xxs',
|
|
74
|
-
'spacing-xs': 's-xs',
|
|
75
|
-
'spacing-s': 's-s',
|
|
76
|
-
'spacing-m': 's-m',
|
|
77
|
-
'spacing-l': 's-l',
|
|
78
|
-
'spacing-xl': 's-xl',
|
|
79
|
-
'spacing-2xl': 's-2xl',
|
|
80
|
-
'spacing-3xl': 's-3xl',
|
|
81
|
-
'spacing-4xl': 's-4xl',
|
|
82
|
-
'spacing-5xl': 's-5xl',
|
|
83
|
-
'container-width': 'ct-w',
|
|
84
|
-
'container-padding': 'ct-p',
|
|
85
|
-
'text-shadow': 'ts',
|
|
86
|
-
'box-shadow': 'shadow'
|
|
87
|
-
};
|
|
88
|
-
function getShortName(name) {
|
|
89
|
-
return globalSortNameMapping[name] || name;
|
|
3
|
+
const globalSortNameMapping = {
|
|
4
|
+
'typography-heading-1-fontFamily': 'h1-ff',
|
|
5
|
+
'typography-heading-1-fontSize': 'h1-size',
|
|
6
|
+
'typography-heading-1-fontWeight': 'h1-weight',
|
|
7
|
+
'typography-heading-1-lineHeight': 'h1-lh',
|
|
8
|
+
'typography-heading-1-letterSpacing': 'h1-ls',
|
|
9
|
+
'typography-heading-1-fontStyle': 'h1-fs',
|
|
10
|
+
'typography-heading-2-fontFamily': 'h2-ff',
|
|
11
|
+
'typography-heading-2-fontSize': 'h2-size',
|
|
12
|
+
'typography-heading-2-fontWeight': 'h2-weight',
|
|
13
|
+
'typography-heading-2-lineHeight': 'h2-lh',
|
|
14
|
+
'typography-heading-2-letterSpacing': 'h2-ls',
|
|
15
|
+
'typography-heading-2-fontStyle': 'h2-fs',
|
|
16
|
+
'typography-heading-3-fontFamily': 'h3-ff',
|
|
17
|
+
'typography-heading-3-fontSize': 'h3-size',
|
|
18
|
+
'typography-heading-3-fontWeight': 'h3-weight',
|
|
19
|
+
'typography-heading-3-lineHeight': 'h3-lh',
|
|
20
|
+
'typography-heading-3-letterSpacing': 'h3-ls',
|
|
21
|
+
'typography-heading-3-fontStyle': 'h3-fs',
|
|
22
|
+
'typography-subheading-1-fontFamily': 'sh1-ff',
|
|
23
|
+
'typography-subheading-1-fontSize': 'sh1-size',
|
|
24
|
+
'typography-subheading-1-fontWeight': 'sh1-weight',
|
|
25
|
+
'typography-subheading-1-lineHeight': 'sh1-lh',
|
|
26
|
+
'typography-subheading-1-letterSpacing': 'sh1-ls',
|
|
27
|
+
'typography-subheading-1-fontStyle': 'sh1-fs',
|
|
28
|
+
'typography-subheading-2-fontFamily': 'sh2-ff',
|
|
29
|
+
'typography-subheading-2-fontSize': 'sh2-size',
|
|
30
|
+
'typography-subheading-2-fontWeight': 'sh2-weight',
|
|
31
|
+
'typography-subheading-2-lineHeight': 'sh2-lh',
|
|
32
|
+
'typography-subheading-2-letterSpacing': 'sh2-ls',
|
|
33
|
+
'typography-subheading-2-fontStyle': 'sh2-fs',
|
|
34
|
+
'typography-subheading-3-fontFamily': 'sh3-ff',
|
|
35
|
+
'typography-subheading-3-fontSize': 'sh3-size',
|
|
36
|
+
'typography-subheading-3-fontWeight': 'sh3-weight',
|
|
37
|
+
'typography-subheading-3-lineHeight': 'sh3-lh',
|
|
38
|
+
'typography-subheading-3-letterSpacing': 'sh3-ls',
|
|
39
|
+
'typography-subheading-3-fontStyle': 'sh3-fs',
|
|
40
|
+
'typography-paragraph-1-fontFamily': 'p1-ff',
|
|
41
|
+
'typography-paragraph-1-fontSize': 'p1-size',
|
|
42
|
+
'typography-paragraph-1-fontWeight': 'p1-weight',
|
|
43
|
+
'typography-paragraph-1-lineHeight': 'p1-lh',
|
|
44
|
+
'typography-paragraph-1-letterSpacing': 'p1-ls',
|
|
45
|
+
'typography-paragraph-1-fontStyle': 'p1-fs',
|
|
46
|
+
'typography-paragraph-2-fontFamily': 'p2-ff',
|
|
47
|
+
'typography-paragraph-2-fontSize': 'p2-size',
|
|
48
|
+
'typography-paragraph-2-fontWeight': 'p2-weight',
|
|
49
|
+
'typography-paragraph-2-lineHeight': 'p2-lh',
|
|
50
|
+
'typography-paragraph-2-letterSpacing': 'p2-ls',
|
|
51
|
+
'typography-paragraph-2-fontStyle': 'p2-fs',
|
|
52
|
+
'typography-paragraph-3-fontFamily': 'p3-ff',
|
|
53
|
+
'typography-paragraph-3-fontSize': 'p3-size',
|
|
54
|
+
'typography-paragraph-3-fontWeight': 'p3-weight',
|
|
55
|
+
'typography-paragraph-3-lineHeight': 'p3-lh',
|
|
56
|
+
'typography-paragraph-3-letterSpacing': 'p3-ls',
|
|
57
|
+
'typography-paragraph-3-fontStyle': 'p3-fs',
|
|
58
|
+
'color-brand': 'c-brand',
|
|
59
|
+
'color-highlight': 'c-highlight',
|
|
60
|
+
'color-text-1': 'c-text-1',
|
|
61
|
+
'color-text-2': 'c-text-2',
|
|
62
|
+
'color-text-3': 'c-text-3',
|
|
63
|
+
'color-bg-1': 'c-bg-1',
|
|
64
|
+
'color-bg-2': 'c-bg-2',
|
|
65
|
+
'color-bg-3': 'c-bg-3',
|
|
66
|
+
'color-line-1': 'c-line-1',
|
|
67
|
+
'color-line-2': 'c-line-2',
|
|
68
|
+
'color-line-3': 'c-line-3',
|
|
69
|
+
'color-success': 'c-success',
|
|
70
|
+
'color-info': 'c-info',
|
|
71
|
+
'color-warning': 'c-warning',
|
|
72
|
+
'color-error': 'c-error',
|
|
73
|
+
'spacing-xxs': 's-xxs',
|
|
74
|
+
'spacing-xs': 's-xs',
|
|
75
|
+
'spacing-s': 's-s',
|
|
76
|
+
'spacing-m': 's-m',
|
|
77
|
+
'spacing-l': 's-l',
|
|
78
|
+
'spacing-xl': 's-xl',
|
|
79
|
+
'spacing-2xl': 's-2xl',
|
|
80
|
+
'spacing-3xl': 's-3xl',
|
|
81
|
+
'spacing-4xl': 's-4xl',
|
|
82
|
+
'spacing-5xl': 's-5xl',
|
|
83
|
+
'container-width': 'ct-w',
|
|
84
|
+
'container-padding': 'ct-p',
|
|
85
|
+
'text-shadow': 'ts',
|
|
86
|
+
'box-shadow': 'shadow'
|
|
87
|
+
};
|
|
88
|
+
function getShortName(name) {
|
|
89
|
+
return globalSortNameMapping[name] || name;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
exports.getShortName = getShortName;
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var react = require('react');
|
|
6
6
|
|
|
7
|
-
const isEmptyChildren = (children)
|
|
8
|
-
return react.Children.count(children) < 1 || !children;
|
|
7
|
+
const isEmptyChildren = (children)=>{
|
|
8
|
+
return react.Children.count(children) < 1 || !children;
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
exports.default = isEmptyChildren;
|
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
var constant = require('./constant.js');
|
|
4
4
|
|
|
5
|
-
const optionLayoutStyle = (column)
|
|
6
|
-
if (!column)
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
return style;
|
|
5
|
+
const optionLayoutStyle = (column)=>{
|
|
6
|
+
if (!column) return {};
|
|
7
|
+
const style = {};
|
|
8
|
+
for (const [key, value] of Object.entries(column)){
|
|
9
|
+
Object.assign(style, {
|
|
10
|
+
[`--gtc${constant.devicesMapping?.[key]}`]: `repeat(${parseFloat(value + '') || 1}, minmax(0, 1fr))`
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
return style;
|
|
15
14
|
};
|
|
16
15
|
|
|
17
16
|
exports.optionLayoutStyle = optionLayoutStyle;
|
|
@@ -1,32 +1,31 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const SCRIPTS_LOADED = {};
|
|
4
|
-
function loadScript(src, options) {
|
|
5
|
-
const isScriptLoaded = SCRIPTS_LOADED[src];
|
|
6
|
-
if (isScriptLoaded) {
|
|
7
|
-
return isScriptLoaded;
|
|
8
|
-
}
|
|
9
|
-
const promise = new Promise((resolve, reject)
|
|
10
|
-
const script = document.createElement('script');
|
|
11
|
-
if (options?.module) {
|
|
12
|
-
script.type = 'module';
|
|
13
|
-
}
|
|
14
|
-
script.src = src;
|
|
15
|
-
script.onload = ()
|
|
16
|
-
resolve(true);
|
|
17
|
-
};
|
|
18
|
-
script.onerror = ()
|
|
19
|
-
reject(false);
|
|
20
|
-
};
|
|
21
|
-
if (options?.in === 'head') {
|
|
22
|
-
document.head.appendChild(script);
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
return promise;
|
|
3
|
+
const SCRIPTS_LOADED = {};
|
|
4
|
+
function loadScript(src, options) {
|
|
5
|
+
const isScriptLoaded = SCRIPTS_LOADED[src];
|
|
6
|
+
if (isScriptLoaded) {
|
|
7
|
+
return isScriptLoaded;
|
|
8
|
+
}
|
|
9
|
+
const promise = new Promise((resolve, reject)=>{
|
|
10
|
+
const script = document.createElement('script');
|
|
11
|
+
if (options?.module) {
|
|
12
|
+
script.type = 'module';
|
|
13
|
+
}
|
|
14
|
+
script.src = src;
|
|
15
|
+
script.onload = ()=>{
|
|
16
|
+
resolve(true);
|
|
17
|
+
};
|
|
18
|
+
script.onerror = ()=>{
|
|
19
|
+
reject(false);
|
|
20
|
+
};
|
|
21
|
+
if (options?.in === 'head') {
|
|
22
|
+
document.head.appendChild(script);
|
|
23
|
+
} else {
|
|
24
|
+
document.body.appendChild(script);
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
SCRIPTS_LOADED[src] = promise;
|
|
28
|
+
return promise;
|
|
30
29
|
}
|
|
31
30
|
|
|
32
31
|
exports.loadScript = loadScript;
|
|
@@ -2,92 +2,83 @@
|
|
|
2
2
|
|
|
3
3
|
var getResonsiveValue = require('./get-resonsive-value.js');
|
|
4
4
|
|
|
5
|
-
const makeStyle = (style)
|
|
6
|
-
return Object.fromEntries(Object.entries(style).map(([key, value])
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
[
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
|
|
22
|
-
[
|
|
23
|
-
[`--
|
|
24
|
-
[
|
|
25
|
-
[
|
|
26
|
-
[`--
|
|
27
|
-
[
|
|
28
|
-
[
|
|
29
|
-
[`--
|
|
30
|
-
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
[`--${name}
|
|
36
|
-
[`--${name}-
|
|
37
|
-
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
else if (fullWidthVal === false) {
|
|
47
|
-
return widthVal ?? widthVal;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
else
|
|
67
|
-
return heightVal
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
? `${getResonsiveValue.getResponsiveValueByScreen(aspectWidth, 'desktop')}/${getResonsiveValue.getResponsiveValueByScreen(aspectHeight, 'desktop')}`
|
|
83
|
-
: aspectRatio?.desktop,
|
|
84
|
-
tablet: aspectRatio?.tablet === 'custom'
|
|
85
|
-
? `${getResonsiveValue.getResponsiveValueByScreen(aspectWidth, 'tablet')}/${getResonsiveValue.getResponsiveValueByScreen(aspectHeight, 'tablet')}`
|
|
86
|
-
: aspectRatio?.tablet,
|
|
87
|
-
mobile: aspectRatio?.mobile === 'custom'
|
|
88
|
-
? `${getResonsiveValue.getResponsiveValueByScreen(aspectWidth, 'mobile')}/${getResonsiveValue.getResponsiveValueByScreen(aspectHeight, 'mobile')}`
|
|
89
|
-
: aspectRatio?.mobile,
|
|
90
|
-
};
|
|
5
|
+
const makeStyle = (style)=>{
|
|
6
|
+
return Object.fromEntries(Object.entries(style).map(([key, value])=>[
|
|
7
|
+
`--${key}`,
|
|
8
|
+
value
|
|
9
|
+
]));
|
|
10
|
+
};
|
|
11
|
+
const makeStyleState = (name, value)=>{
|
|
12
|
+
if (!value) return {};
|
|
13
|
+
return {
|
|
14
|
+
[`--${name}`]: value?.normal,
|
|
15
|
+
[`--hvr-${name}`]: value?.hover,
|
|
16
|
+
[`--focus-${name}`]: value?.focus
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
const makeStyleResponsiveState = (name, value)=>{
|
|
20
|
+
if (!value) return {};
|
|
21
|
+
return {
|
|
22
|
+
[`--${name}`]: value?.desktop?.normal,
|
|
23
|
+
[`--hvr-${name}`]: value?.desktop?.hover,
|
|
24
|
+
[`--focus-${name}`]: value?.desktop?.focus,
|
|
25
|
+
[`--${name}-tablet`]: value?.tablet?.normal,
|
|
26
|
+
[`--hvr-${name}-tablet`]: value?.tablet?.hover,
|
|
27
|
+
[`--focus-${name}-tablet`]: value?.tablet?.focus,
|
|
28
|
+
[`--${name}-mobile`]: value?.mobile?.normal,
|
|
29
|
+
[`--hvr-${name}-mobile`]: value?.mobile?.hover,
|
|
30
|
+
[`--focus-${name}-mobile`]: value?.mobile?.focus
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
const makeStyleResponsive = (name, value)=>{
|
|
34
|
+
return {
|
|
35
|
+
[`--${name}`]: value?.desktop,
|
|
36
|
+
[`--${name}-tablet`]: value?.tablet,
|
|
37
|
+
[`--${name}-mobile`]: value?.mobile
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
const makeWidth = (widthValue, fullWidthValue)=>{
|
|
41
|
+
const getVal = (deviceValue, widthValue, fullWidthValue)=>{
|
|
42
|
+
const widthVal = widthValue?.[deviceValue];
|
|
43
|
+
const fullWidthVal = fullWidthValue?.[deviceValue];
|
|
44
|
+
if (fullWidthVal) {
|
|
45
|
+
return '100%';
|
|
46
|
+
} else if (fullWidthVal === false) {
|
|
47
|
+
return widthVal ?? widthVal;
|
|
48
|
+
} else {
|
|
49
|
+
return widthVal;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
return {
|
|
53
|
+
desktop: getVal('desktop', widthValue, fullWidthValue),
|
|
54
|
+
tablet: getVal('tablet', widthValue, fullWidthValue),
|
|
55
|
+
mobile: getVal('mobile', widthValue, fullWidthValue)
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
const makeHeight = (heighValue, autoHeight)=>{
|
|
59
|
+
const getVal = (deviceValue, heighValue, autoHeight)=>{
|
|
60
|
+
const heightVal = heighValue?.[deviceValue];
|
|
61
|
+
const isAuto = autoHeight?.[deviceValue];
|
|
62
|
+
if (isAuto) {
|
|
63
|
+
return 'auto';
|
|
64
|
+
} else if (isAuto === false) {
|
|
65
|
+
return heightVal ?? heightVal;
|
|
66
|
+
} else {
|
|
67
|
+
return heightVal;
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
return {
|
|
71
|
+
desktop: getVal('desktop', heighValue, autoHeight),
|
|
72
|
+
tablet: getVal('tablet', heighValue, autoHeight),
|
|
73
|
+
mobile: getVal('mobile', heighValue, autoHeight)
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
const makeAspectRatio = (aspectRatio, aspectWidth, aspectHeight)=>{
|
|
77
|
+
return {
|
|
78
|
+
desktop: aspectRatio?.desktop === 'custom' ? `${getResonsiveValue.getResponsiveValueByScreen(aspectWidth, 'desktop')}/${getResonsiveValue.getResponsiveValueByScreen(aspectHeight, 'desktop')}` : aspectRatio?.desktop,
|
|
79
|
+
tablet: aspectRatio?.tablet === 'custom' ? `${getResonsiveValue.getResponsiveValueByScreen(aspectWidth, 'tablet')}/${getResonsiveValue.getResponsiveValueByScreen(aspectHeight, 'tablet')}` : aspectRatio?.tablet,
|
|
80
|
+
mobile: aspectRatio?.mobile === 'custom' ? `${getResonsiveValue.getResponsiveValueByScreen(aspectWidth, 'mobile')}/${getResonsiveValue.getResponsiveValueByScreen(aspectHeight, 'mobile')}` : aspectRatio?.mobile
|
|
81
|
+
};
|
|
91
82
|
};
|
|
92
83
|
|
|
93
84
|
exports.makeAspectRatio = makeAspectRatio;
|
|
@@ -1,17 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
function normalizeBuilderData(data) {
|
|
4
|
-
const result = {};
|
|
5
|
-
function compose(data, res = {}) {
|
|
6
|
-
const childrens = data.childrens;
|
|
7
|
-
const items = childrens?.map((child)
|
|
8
|
-
res[data.uid] = {
|
|
9
|
-
|
|
10
|
-
childrens
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
function normalizeBuilderData(data) {
|
|
4
|
+
const result = {};
|
|
5
|
+
function compose(data, res = {}) {
|
|
6
|
+
const childrens = data.childrens;
|
|
7
|
+
const items = childrens?.map((child)=>child.uid) ?? [];
|
|
8
|
+
res[data.uid] = {
|
|
9
|
+
...data,
|
|
10
|
+
childrens: items,
|
|
11
|
+
type: 'component'
|
|
12
|
+
};
|
|
13
|
+
if (childrens) {
|
|
14
|
+
childrens.map((child)=>compose(child, res));
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
compose(data, result);
|
|
18
|
+
return {
|
|
19
|
+
...result
|
|
20
|
+
};
|
|
15
21
|
}
|
|
16
22
|
|
|
17
23
|
exports.normalizeBuilderData = normalizeBuilderData;
|