@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.
Files changed (206) hide show
  1. package/dist/cjs/components/AddOn.js +7 -7
  2. package/dist/cjs/components/ComponentWrapper.js +14 -8
  3. package/dist/cjs/components/ComponentWrapperPreview.js +55 -46
  4. package/dist/cjs/components/Empty.js +1 -1
  5. package/dist/cjs/components/Render.js +50 -13
  6. package/dist/cjs/components/Render.liquid.js +81 -57
  7. package/dist/cjs/components/RenderBlock.js +41 -8
  8. package/dist/cjs/components/RenderPreview.js +51 -13
  9. package/dist/cjs/components/RenderSection.js +11 -7
  10. package/dist/cjs/components/constant.js +24 -24
  11. package/dist/cjs/contexts/AddonContext.js +25 -14
  12. package/dist/cjs/contexts/BuilderComponent.js +23 -19
  13. package/dist/cjs/contexts/BuilderContext.js +25 -19
  14. package/dist/cjs/contexts/BuilderPreviewContext.js +349 -341
  15. package/dist/cjs/contexts/CartLineContext.js +19 -14
  16. package/dist/cjs/contexts/CollectionContext.js +21 -13
  17. package/dist/cjs/contexts/ProductContext.js +136 -115
  18. package/dist/cjs/contexts/ProductListContext.js +21 -13
  19. package/dist/cjs/contexts/SectionContext.js +41 -37
  20. package/dist/cjs/contexts/ShopContext.js +49 -31
  21. package/dist/cjs/graphql/fragments/analytic.generated.js +1 -1
  22. package/dist/cjs/graphql/fragments/collection-detail.generated.js +1 -1
  23. package/dist/cjs/graphql/fragments/collection-product.generated.js +1 -1
  24. package/dist/cjs/graphql/fragments/custom-code.generated.js +1 -1
  25. package/dist/cjs/graphql/fragments/data-seo.generated.js +1 -1
  26. package/dist/cjs/graphql/fragments/media.generated.js +1 -1
  27. package/dist/cjs/graphql/fragments/product-little.generated.js +1 -1
  28. package/dist/cjs/graphql/fragments/product-option-value.generated.js +1 -1
  29. package/dist/cjs/graphql/fragments/product-option.generated.js +1 -1
  30. package/dist/cjs/graphql/fragments/product.generated.js +1 -1
  31. package/dist/cjs/graphql/fragments/published-custom-section.generated.js +1 -1
  32. package/dist/cjs/graphql/fragments/published-page-section.generated.js +1 -1
  33. package/dist/cjs/graphql/fragments/published-theme-page.generated.js +1 -1
  34. package/dist/cjs/graphql/fragments/published-theme-style.generated.js +1 -1
  35. package/dist/cjs/graphql/fragments/selected-option.generated.js +1 -1
  36. package/dist/cjs/graphql/fragments/variant.generated.js +1 -1
  37. package/dist/cjs/graphql/mutations/page-view-up.generated.js +1 -1
  38. package/dist/cjs/graphql/queries/products.generated.js +1 -1
  39. package/dist/cjs/graphql/queries/store-property.generated.js +1 -1
  40. package/dist/cjs/helpers/GlobalEvent.js +12 -10
  41. package/dist/cjs/helpers/background.js +96 -96
  42. package/dist/cjs/helpers/borders.js +123 -127
  43. package/dist/cjs/helpers/clone-deep.js +1 -1
  44. package/dist/cjs/helpers/cls.js +11 -15
  45. package/dist/cjs/helpers/colors.js +121 -156
  46. package/dist/cjs/helpers/compose-advance-style.js +115 -121
  47. package/dist/cjs/helpers/constant.js +16 -11
  48. package/dist/cjs/helpers/css-variable.js +2 -2
  49. package/dist/cjs/helpers/email.js +3 -3
  50. package/dist/cjs/helpers/flatten-connection.js +4 -5
  51. package/dist/cjs/helpers/get-resonsive-value.js +24 -25
  52. package/dist/cjs/helpers/get-shortname.js +87 -87
  53. package/dist/cjs/helpers/is-browser.js +2 -2
  54. package/dist/cjs/helpers/is-defined.js +2 -2
  55. package/dist/cjs/helpers/is-empty-children.js +2 -2
  56. package/dist/cjs/helpers/layout.js +9 -10
  57. package/dist/cjs/helpers/load-script.js +26 -27
  58. package/dist/cjs/helpers/make-style.js +77 -86
  59. package/dist/cjs/helpers/normalize-builder-data.js +18 -12
  60. package/dist/cjs/helpers/prefetch-queries.js +72 -52
  61. package/dist/cjs/helpers/product.js +25 -29
  62. package/dist/cjs/helpers/queries/get-collection.js +179 -167
  63. package/dist/cjs/helpers/queries/get-product-by-slug.js +103 -94
  64. package/dist/cjs/helpers/queries/get-product.js +121 -106
  65. package/dist/cjs/helpers/queries/get-products.js +137 -125
  66. package/dist/cjs/helpers/radius.js +78 -81
  67. package/dist/cjs/helpers/render.js +56 -56
  68. package/dist/cjs/helpers/shadow.js +38 -38
  69. package/dist/cjs/helpers/size.js +12 -13
  70. package/dist/cjs/helpers/spacing.js +35 -37
  71. package/dist/cjs/helpers/tracking/fpixel.js +21 -22
  72. package/dist/cjs/helpers/tracking/gtag.js +84 -90
  73. package/dist/cjs/helpers/tracking/tiktokpixel.js +12 -12
  74. package/dist/cjs/helpers/typography.js +2 -2
  75. package/dist/cjs/hooks/cart/use-add-to-cart.js +10 -10
  76. package/dist/cjs/hooks/cart/use-cart-data.js +18 -16
  77. package/dist/cjs/hooks/cart/use-cart-discount-codes-update.js +10 -10
  78. package/dist/cjs/hooks/cart/use-cart-note-update.js +10 -10
  79. package/dist/cjs/hooks/cart/use-create-cart.js +12 -12
  80. package/dist/cjs/hooks/cart/use-remove-cart-item.js +10 -10
  81. package/dist/cjs/hooks/cart/use-update-cart-item.js +10 -10
  82. package/dist/cjs/hooks/shop/use-collection-query.js +12 -6
  83. package/dist/cjs/hooks/shop/use-product-query.js +12 -6
  84. package/dist/cjs/hooks/shop/use-products-query.js +14 -6
  85. package/dist/cjs/hooks/shop.js +86 -67
  86. package/dist/cjs/hooks/use-current-device.js +14 -16
  87. package/dist/cjs/hooks/use-lazy-video.js +7 -7
  88. package/dist/cjs/hooks/useCartId.js +35 -27
  89. package/dist/cjs/hooks/useCartLine.js +2 -2
  90. package/dist/cjs/hooks/useCartUI.js +37 -31
  91. package/dist/cjs/hooks/useCollection.js +2 -2
  92. package/dist/cjs/hooks/useFetchHandle.js +6 -6
  93. package/dist/cjs/hooks/useFormatMoney.js +11 -7
  94. package/dist/cjs/hooks/useIsomorphicLayoutEffect.js +1 -1
  95. package/dist/cjs/hooks/useLoadScript.js +22 -20
  96. package/dist/cjs/hooks/useMoney.js +59 -42
  97. package/dist/cjs/hooks/usePrevious.js +12 -10
  98. package/dist/cjs/hooks/useProduct.js +92 -69
  99. package/dist/cjs/hooks/useProductList.js +11 -11
  100. package/dist/cjs/hooks/useSuspenseFetch.js +20 -17
  101. package/dist/cjs/hooks/useSwatchesOptions.js +32 -30
  102. package/dist/cjs/types/global-style.js +9 -2
  103. package/dist/esm/components/AddOn.js +7 -7
  104. package/dist/esm/components/ComponentWrapper.js +14 -8
  105. package/dist/esm/components/ComponentWrapperPreview.js +55 -46
  106. package/dist/esm/components/Empty.js +1 -1
  107. package/dist/esm/components/Render.js +50 -13
  108. package/dist/esm/components/Render.liquid.js +81 -57
  109. package/dist/esm/components/RenderBlock.js +41 -8
  110. package/dist/esm/components/RenderPreview.js +51 -13
  111. package/dist/esm/components/RenderSection.js +11 -7
  112. package/dist/esm/components/constant.js +24 -24
  113. package/dist/esm/contexts/AddonContext.js +26 -15
  114. package/dist/esm/contexts/BuilderComponent.js +24 -20
  115. package/dist/esm/contexts/BuilderContext.js +26 -20
  116. package/dist/esm/contexts/BuilderPreviewContext.js +350 -342
  117. package/dist/esm/contexts/CartLineContext.js +20 -15
  118. package/dist/esm/contexts/CollectionContext.js +22 -14
  119. package/dist/esm/contexts/ProductContext.js +137 -116
  120. package/dist/esm/contexts/ProductListContext.js +22 -14
  121. package/dist/esm/contexts/SectionContext.js +42 -38
  122. package/dist/esm/contexts/ShopContext.js +50 -32
  123. package/dist/esm/graphql/fragments/analytic.generated.js +1 -1
  124. package/dist/esm/graphql/fragments/collection-detail.generated.js +1 -1
  125. package/dist/esm/graphql/fragments/collection-product.generated.js +1 -1
  126. package/dist/esm/graphql/fragments/custom-code.generated.js +1 -1
  127. package/dist/esm/graphql/fragments/data-seo.generated.js +1 -1
  128. package/dist/esm/graphql/fragments/media.generated.js +1 -1
  129. package/dist/esm/graphql/fragments/product-little.generated.js +1 -1
  130. package/dist/esm/graphql/fragments/product-option-value.generated.js +1 -1
  131. package/dist/esm/graphql/fragments/product-option.generated.js +1 -1
  132. package/dist/esm/graphql/fragments/product.generated.js +1 -1
  133. package/dist/esm/graphql/fragments/published-custom-section.generated.js +1 -1
  134. package/dist/esm/graphql/fragments/published-page-section.generated.js +1 -1
  135. package/dist/esm/graphql/fragments/published-theme-page.generated.js +1 -1
  136. package/dist/esm/graphql/fragments/published-theme-style.generated.js +1 -1
  137. package/dist/esm/graphql/fragments/selected-option.generated.js +1 -1
  138. package/dist/esm/graphql/fragments/variant.generated.js +1 -1
  139. package/dist/esm/graphql/mutations/page-view-up.generated.js +1 -1
  140. package/dist/esm/graphql/queries/products.generated.js +1 -1
  141. package/dist/esm/graphql/queries/store-property.generated.js +1 -1
  142. package/dist/esm/helpers/GlobalEvent.js +12 -10
  143. package/dist/esm/helpers/background.js +96 -96
  144. package/dist/esm/helpers/borders.js +123 -127
  145. package/dist/esm/helpers/clone-deep.js +1 -1
  146. package/dist/esm/helpers/cls.js +11 -15
  147. package/dist/esm/helpers/colors.js +121 -156
  148. package/dist/esm/helpers/compose-advance-style.js +115 -121
  149. package/dist/esm/helpers/constant.js +16 -11
  150. package/dist/esm/helpers/css-variable.js +2 -2
  151. package/dist/esm/helpers/email.js +3 -3
  152. package/dist/esm/helpers/flatten-connection.js +4 -5
  153. package/dist/esm/helpers/get-resonsive-value.js +24 -25
  154. package/dist/esm/helpers/get-shortname.js +87 -87
  155. package/dist/esm/helpers/is-browser.js +2 -2
  156. package/dist/esm/helpers/is-defined.js +2 -2
  157. package/dist/esm/helpers/is-empty-children.js +2 -2
  158. package/dist/esm/helpers/layout.js +9 -10
  159. package/dist/esm/helpers/load-script.js +26 -27
  160. package/dist/esm/helpers/make-style.js +77 -86
  161. package/dist/esm/helpers/normalize-builder-data.js +18 -12
  162. package/dist/esm/helpers/prefetch-queries.js +72 -52
  163. package/dist/esm/helpers/product.js +25 -29
  164. package/dist/esm/helpers/queries/get-collection.js +179 -167
  165. package/dist/esm/helpers/queries/get-product-by-slug.js +103 -94
  166. package/dist/esm/helpers/queries/get-product.js +121 -106
  167. package/dist/esm/helpers/queries/get-products.js +137 -125
  168. package/dist/esm/helpers/radius.js +78 -81
  169. package/dist/esm/helpers/render.js +56 -56
  170. package/dist/esm/helpers/shadow.js +38 -38
  171. package/dist/esm/helpers/size.js +12 -13
  172. package/dist/esm/helpers/spacing.js +35 -37
  173. package/dist/esm/helpers/tracking/fpixel.js +21 -22
  174. package/dist/esm/helpers/tracking/gtag.js +84 -90
  175. package/dist/esm/helpers/tracking/tiktokpixel.js +12 -12
  176. package/dist/esm/helpers/typography.js +2 -2
  177. package/dist/esm/hooks/cart/use-add-to-cart.js +10 -10
  178. package/dist/esm/hooks/cart/use-cart-data.js +18 -16
  179. package/dist/esm/hooks/cart/use-cart-discount-codes-update.js +10 -10
  180. package/dist/esm/hooks/cart/use-cart-note-update.js +10 -10
  181. package/dist/esm/hooks/cart/use-create-cart.js +12 -12
  182. package/dist/esm/hooks/cart/use-remove-cart-item.js +10 -10
  183. package/dist/esm/hooks/cart/use-update-cart-item.js +10 -10
  184. package/dist/esm/hooks/shop/use-collection-query.js +12 -6
  185. package/dist/esm/hooks/shop/use-product-query.js +12 -6
  186. package/dist/esm/hooks/shop/use-products-query.js +14 -6
  187. package/dist/esm/hooks/shop.js +86 -67
  188. package/dist/esm/hooks/use-current-device.js +14 -16
  189. package/dist/esm/hooks/use-lazy-video.js +7 -7
  190. package/dist/esm/hooks/useCartId.js +35 -27
  191. package/dist/esm/hooks/useCartLine.js +2 -2
  192. package/dist/esm/hooks/useCartUI.js +37 -31
  193. package/dist/esm/hooks/useCollection.js +2 -2
  194. package/dist/esm/hooks/useFetchHandle.js +6 -6
  195. package/dist/esm/hooks/useFormatMoney.js +11 -7
  196. package/dist/esm/hooks/useIsomorphicLayoutEffect.js +1 -1
  197. package/dist/esm/hooks/useLoadScript.js +22 -20
  198. package/dist/esm/hooks/useMoney.js +59 -42
  199. package/dist/esm/hooks/usePrevious.js +12 -10
  200. package/dist/esm/hooks/useProduct.js +92 -69
  201. package/dist/esm/hooks/useProductList.js +11 -11
  202. package/dist/esm/hooks/useSuspenseFetch.js +20 -17
  203. package/dist/esm/hooks/useSwatchesOptions.js +32 -30
  204. package/dist/esm/types/global-style.js +9 -2
  205. package/dist/types/index.d.ts +24 -2
  206. package/package.json +1 -1
@@ -1,28 +1,27 @@
1
- const getResponsiveValue = (input, k) => {
2
- if (!k)
3
- return {};
4
- return {
5
- desktop: input?.desktop?.[k],
6
- tablet: input?.tablet?.[k],
7
- mobile: input?.mobile?.[k],
8
- };
9
- };
10
- const getResponsiveStateValue = (k, input) => {
11
- return {
12
- desktop: input?.desktop?.[k],
13
- tablet: input?.tablet?.[k],
14
- mobile: input?.mobile?.[k],
15
- };
16
- };
17
- const getResponsiveValueByScreen = (value, breakpoint, defaultValue) => {
18
- switch (breakpoint) {
19
- case 'tablet':
20
- return value?.tablet ?? value?.desktop ?? defaultValue;
21
- case 'mobile':
22
- return value?.mobile ?? value?.tablet ?? value?.desktop ?? defaultValue;
23
- default:
24
- return value?.desktop ?? defaultValue;
25
- }
1
+ const getResponsiveValue = (input, k)=>{
2
+ if (!k) return {};
3
+ return {
4
+ desktop: input?.desktop?.[k],
5
+ tablet: input?.tablet?.[k],
6
+ mobile: input?.mobile?.[k]
7
+ };
8
+ };
9
+ const getResponsiveStateValue = (k, input)=>{
10
+ return {
11
+ desktop: input?.desktop?.[k],
12
+ tablet: input?.tablet?.[k],
13
+ mobile: input?.mobile?.[k]
14
+ };
15
+ };
16
+ const getResponsiveValueByScreen = (value, breakpoint, defaultValue)=>{
17
+ switch(breakpoint){
18
+ case 'tablet':
19
+ return value?.tablet ?? value?.desktop ?? defaultValue;
20
+ case 'mobile':
21
+ return value?.mobile ?? value?.tablet ?? value?.desktop ?? defaultValue;
22
+ default:
23
+ return value?.desktop ?? defaultValue;
24
+ }
26
25
  };
27
26
 
28
27
  export { getResponsiveStateValue, getResponsiveValue, getResponsiveValueByScreen };
@@ -1,90 +1,90 @@
1
- const globalSortNameMapping = {
2
- 'typography-heading-1-fontFamily': 'h1-ff',
3
- 'typography-heading-1-fontSize': 'h1-size',
4
- 'typography-heading-1-fontWeight': 'h1-weight',
5
- 'typography-heading-1-lineHeight': 'h1-lh',
6
- 'typography-heading-1-letterSpacing': 'h1-ls',
7
- 'typography-heading-1-fontStyle': 'h1-fs',
8
- 'typography-heading-2-fontFamily': 'h2-ff',
9
- 'typography-heading-2-fontSize': 'h2-size',
10
- 'typography-heading-2-fontWeight': 'h2-weight',
11
- 'typography-heading-2-lineHeight': 'h2-lh',
12
- 'typography-heading-2-letterSpacing': 'h2-ls',
13
- 'typography-heading-2-fontStyle': 'h2-fs',
14
- 'typography-heading-3-fontFamily': 'h3-ff',
15
- 'typography-heading-3-fontSize': 'h3-size',
16
- 'typography-heading-3-fontWeight': 'h3-weight',
17
- 'typography-heading-3-lineHeight': 'h3-lh',
18
- 'typography-heading-3-letterSpacing': 'h3-ls',
19
- 'typography-heading-3-fontStyle': 'h3-fs',
20
- 'typography-subheading-1-fontFamily': 'sh1-ff',
21
- 'typography-subheading-1-fontSize': 'sh1-size',
22
- 'typography-subheading-1-fontWeight': 'sh1-weight',
23
- 'typography-subheading-1-lineHeight': 'sh1-lh',
24
- 'typography-subheading-1-letterSpacing': 'sh1-ls',
25
- 'typography-subheading-1-fontStyle': 'sh1-fs',
26
- 'typography-subheading-2-fontFamily': 'sh2-ff',
27
- 'typography-subheading-2-fontSize': 'sh2-size',
28
- 'typography-subheading-2-fontWeight': 'sh2-weight',
29
- 'typography-subheading-2-lineHeight': 'sh2-lh',
30
- 'typography-subheading-2-letterSpacing': 'sh2-ls',
31
- 'typography-subheading-2-fontStyle': 'sh2-fs',
32
- 'typography-subheading-3-fontFamily': 'sh3-ff',
33
- 'typography-subheading-3-fontSize': 'sh3-size',
34
- 'typography-subheading-3-fontWeight': 'sh3-weight',
35
- 'typography-subheading-3-lineHeight': 'sh3-lh',
36
- 'typography-subheading-3-letterSpacing': 'sh3-ls',
37
- 'typography-subheading-3-fontStyle': 'sh3-fs',
38
- 'typography-paragraph-1-fontFamily': 'p1-ff',
39
- 'typography-paragraph-1-fontSize': 'p1-size',
40
- 'typography-paragraph-1-fontWeight': 'p1-weight',
41
- 'typography-paragraph-1-lineHeight': 'p1-lh',
42
- 'typography-paragraph-1-letterSpacing': 'p1-ls',
43
- 'typography-paragraph-1-fontStyle': 'p1-fs',
44
- 'typography-paragraph-2-fontFamily': 'p2-ff',
45
- 'typography-paragraph-2-fontSize': 'p2-size',
46
- 'typography-paragraph-2-fontWeight': 'p2-weight',
47
- 'typography-paragraph-2-lineHeight': 'p2-lh',
48
- 'typography-paragraph-2-letterSpacing': 'p2-ls',
49
- 'typography-paragraph-2-fontStyle': 'p2-fs',
50
- 'typography-paragraph-3-fontFamily': 'p3-ff',
51
- 'typography-paragraph-3-fontSize': 'p3-size',
52
- 'typography-paragraph-3-fontWeight': 'p3-weight',
53
- 'typography-paragraph-3-lineHeight': 'p3-lh',
54
- 'typography-paragraph-3-letterSpacing': 'p3-ls',
55
- 'typography-paragraph-3-fontStyle': 'p3-fs',
56
- 'color-brand': 'c-brand',
57
- 'color-highlight': 'c-highlight',
58
- 'color-text-1': 'c-text-1',
59
- 'color-text-2': 'c-text-2',
60
- 'color-text-3': 'c-text-3',
61
- 'color-bg-1': 'c-bg-1',
62
- 'color-bg-2': 'c-bg-2',
63
- 'color-bg-3': 'c-bg-3',
64
- 'color-line-1': 'c-line-1',
65
- 'color-line-2': 'c-line-2',
66
- 'color-line-3': 'c-line-3',
67
- 'color-success': 'c-success',
68
- 'color-info': 'c-info',
69
- 'color-warning': 'c-warning',
70
- 'color-error': 'c-error',
71
- 'spacing-xxs': 's-xxs',
72
- 'spacing-xs': 's-xs',
73
- 'spacing-s': 's-s',
74
- 'spacing-m': 's-m',
75
- 'spacing-l': 's-l',
76
- 'spacing-xl': 's-xl',
77
- 'spacing-2xl': 's-2xl',
78
- 'spacing-3xl': 's-3xl',
79
- 'spacing-4xl': 's-4xl',
80
- 'spacing-5xl': 's-5xl',
81
- 'container-width': 'ct-w',
82
- 'container-padding': 'ct-p',
83
- 'text-shadow': 'ts',
84
- 'box-shadow': 'shadow',
85
- };
86
- function getShortName(name) {
87
- return globalSortNameMapping[name] || name;
1
+ const globalSortNameMapping = {
2
+ 'typography-heading-1-fontFamily': 'h1-ff',
3
+ 'typography-heading-1-fontSize': 'h1-size',
4
+ 'typography-heading-1-fontWeight': 'h1-weight',
5
+ 'typography-heading-1-lineHeight': 'h1-lh',
6
+ 'typography-heading-1-letterSpacing': 'h1-ls',
7
+ 'typography-heading-1-fontStyle': 'h1-fs',
8
+ 'typography-heading-2-fontFamily': 'h2-ff',
9
+ 'typography-heading-2-fontSize': 'h2-size',
10
+ 'typography-heading-2-fontWeight': 'h2-weight',
11
+ 'typography-heading-2-lineHeight': 'h2-lh',
12
+ 'typography-heading-2-letterSpacing': 'h2-ls',
13
+ 'typography-heading-2-fontStyle': 'h2-fs',
14
+ 'typography-heading-3-fontFamily': 'h3-ff',
15
+ 'typography-heading-3-fontSize': 'h3-size',
16
+ 'typography-heading-3-fontWeight': 'h3-weight',
17
+ 'typography-heading-3-lineHeight': 'h3-lh',
18
+ 'typography-heading-3-letterSpacing': 'h3-ls',
19
+ 'typography-heading-3-fontStyle': 'h3-fs',
20
+ 'typography-subheading-1-fontFamily': 'sh1-ff',
21
+ 'typography-subheading-1-fontSize': 'sh1-size',
22
+ 'typography-subheading-1-fontWeight': 'sh1-weight',
23
+ 'typography-subheading-1-lineHeight': 'sh1-lh',
24
+ 'typography-subheading-1-letterSpacing': 'sh1-ls',
25
+ 'typography-subheading-1-fontStyle': 'sh1-fs',
26
+ 'typography-subheading-2-fontFamily': 'sh2-ff',
27
+ 'typography-subheading-2-fontSize': 'sh2-size',
28
+ 'typography-subheading-2-fontWeight': 'sh2-weight',
29
+ 'typography-subheading-2-lineHeight': 'sh2-lh',
30
+ 'typography-subheading-2-letterSpacing': 'sh2-ls',
31
+ 'typography-subheading-2-fontStyle': 'sh2-fs',
32
+ 'typography-subheading-3-fontFamily': 'sh3-ff',
33
+ 'typography-subheading-3-fontSize': 'sh3-size',
34
+ 'typography-subheading-3-fontWeight': 'sh3-weight',
35
+ 'typography-subheading-3-lineHeight': 'sh3-lh',
36
+ 'typography-subheading-3-letterSpacing': 'sh3-ls',
37
+ 'typography-subheading-3-fontStyle': 'sh3-fs',
38
+ 'typography-paragraph-1-fontFamily': 'p1-ff',
39
+ 'typography-paragraph-1-fontSize': 'p1-size',
40
+ 'typography-paragraph-1-fontWeight': 'p1-weight',
41
+ 'typography-paragraph-1-lineHeight': 'p1-lh',
42
+ 'typography-paragraph-1-letterSpacing': 'p1-ls',
43
+ 'typography-paragraph-1-fontStyle': 'p1-fs',
44
+ 'typography-paragraph-2-fontFamily': 'p2-ff',
45
+ 'typography-paragraph-2-fontSize': 'p2-size',
46
+ 'typography-paragraph-2-fontWeight': 'p2-weight',
47
+ 'typography-paragraph-2-lineHeight': 'p2-lh',
48
+ 'typography-paragraph-2-letterSpacing': 'p2-ls',
49
+ 'typography-paragraph-2-fontStyle': 'p2-fs',
50
+ 'typography-paragraph-3-fontFamily': 'p3-ff',
51
+ 'typography-paragraph-3-fontSize': 'p3-size',
52
+ 'typography-paragraph-3-fontWeight': 'p3-weight',
53
+ 'typography-paragraph-3-lineHeight': 'p3-lh',
54
+ 'typography-paragraph-3-letterSpacing': 'p3-ls',
55
+ 'typography-paragraph-3-fontStyle': 'p3-fs',
56
+ 'color-brand': 'c-brand',
57
+ 'color-highlight': 'c-highlight',
58
+ 'color-text-1': 'c-text-1',
59
+ 'color-text-2': 'c-text-2',
60
+ 'color-text-3': 'c-text-3',
61
+ 'color-bg-1': 'c-bg-1',
62
+ 'color-bg-2': 'c-bg-2',
63
+ 'color-bg-3': 'c-bg-3',
64
+ 'color-line-1': 'c-line-1',
65
+ 'color-line-2': 'c-line-2',
66
+ 'color-line-3': 'c-line-3',
67
+ 'color-success': 'c-success',
68
+ 'color-info': 'c-info',
69
+ 'color-warning': 'c-warning',
70
+ 'color-error': 'c-error',
71
+ 'spacing-xxs': 's-xxs',
72
+ 'spacing-xs': 's-xs',
73
+ 'spacing-s': 's-s',
74
+ 'spacing-m': 's-m',
75
+ 'spacing-l': 's-l',
76
+ 'spacing-xl': 's-xl',
77
+ 'spacing-2xl': 's-2xl',
78
+ 'spacing-3xl': 's-3xl',
79
+ 'spacing-4xl': 's-4xl',
80
+ 'spacing-5xl': 's-5xl',
81
+ 'container-width': 'ct-w',
82
+ 'container-padding': 'ct-p',
83
+ 'text-shadow': 'ts',
84
+ 'box-shadow': 'shadow'
85
+ };
86
+ function getShortName(name) {
87
+ return globalSortNameMapping[name] || name;
88
88
  }
89
89
 
90
90
  export { getShortName };
@@ -1,5 +1,5 @@
1
- function isBrowser() {
2
- return typeof window !== 'undefined';
1
+ function isBrowser() {
2
+ return typeof window !== 'undefined';
3
3
  }
4
4
 
5
5
  export { isBrowser as default };
@@ -1,5 +1,5 @@
1
- function isDefined(argument) {
2
- return argument !== undefined;
1
+ function isDefined(argument) {
2
+ return argument !== undefined;
3
3
  }
4
4
 
5
5
  export { isDefined };
@@ -1,7 +1,7 @@
1
1
  import { Children } from 'react';
2
2
 
3
- const isEmptyChildren = (children) => {
4
- return Children.count(children) < 1 || !children;
3
+ const isEmptyChildren = (children)=>{
4
+ return Children.count(children) < 1 || !children;
5
5
  };
6
6
 
7
7
  export { isEmptyChildren as default, isEmptyChildren };
@@ -1,15 +1,14 @@
1
1
  import { devicesMapping } from './constant.js';
2
2
 
3
- const optionLayoutStyle = (column) => {
4
- if (!column)
5
- return {};
6
- const style = {};
7
- for (const [key, value] of Object.entries(column)) {
8
- Object.assign(style, {
9
- [`--gtc${devicesMapping?.[key]}`]: `repeat(${parseFloat(value + '') || 1}, minmax(0, 1fr))`,
10
- });
11
- }
12
- return style;
3
+ const optionLayoutStyle = (column)=>{
4
+ if (!column) return {};
5
+ const style = {};
6
+ for (const [key, value] of Object.entries(column)){
7
+ Object.assign(style, {
8
+ [`--gtc${devicesMapping?.[key]}`]: `repeat(${parseFloat(value + '') || 1}, minmax(0, 1fr))`
9
+ });
10
+ }
11
+ return style;
13
12
  };
14
13
 
15
14
  export { optionLayoutStyle };
@@ -1,30 +1,29 @@
1
- const SCRIPTS_LOADED = {};
2
- function loadScript(src, options) {
3
- const isScriptLoaded = SCRIPTS_LOADED[src];
4
- if (isScriptLoaded) {
5
- return isScriptLoaded;
6
- }
7
- const promise = new Promise((resolve, reject) => {
8
- const script = document.createElement('script');
9
- if (options?.module) {
10
- script.type = 'module';
11
- }
12
- script.src = src;
13
- script.onload = () => {
14
- resolve(true);
15
- };
16
- script.onerror = () => {
17
- reject(false);
18
- };
19
- if (options?.in === 'head') {
20
- document.head.appendChild(script);
21
- }
22
- else {
23
- document.body.appendChild(script);
24
- }
25
- });
26
- SCRIPTS_LOADED[src] = promise;
27
- return promise;
1
+ const SCRIPTS_LOADED = {};
2
+ function loadScript(src, options) {
3
+ const isScriptLoaded = SCRIPTS_LOADED[src];
4
+ if (isScriptLoaded) {
5
+ return isScriptLoaded;
6
+ }
7
+ const promise = new Promise((resolve, reject)=>{
8
+ const script = document.createElement('script');
9
+ if (options?.module) {
10
+ script.type = 'module';
11
+ }
12
+ script.src = src;
13
+ script.onload = ()=>{
14
+ resolve(true);
15
+ };
16
+ script.onerror = ()=>{
17
+ reject(false);
18
+ };
19
+ if (options?.in === 'head') {
20
+ document.head.appendChild(script);
21
+ } else {
22
+ document.body.appendChild(script);
23
+ }
24
+ });
25
+ SCRIPTS_LOADED[src] = promise;
26
+ return promise;
28
27
  }
29
28
 
30
29
  export { loadScript };
@@ -1,91 +1,82 @@
1
1
  import { getResponsiveValueByScreen } from './get-resonsive-value.js';
2
2
 
3
- const makeStyle = (style) => {
4
- return Object.fromEntries(Object.entries(style).map(([key, value]) => [`--${key}`, value]));
5
- };
6
- const makeStyleState = (name, value) => {
7
- if (!value)
8
- return {};
9
- return {
10
- [`--${name}`]: value?.normal,
11
- [`--hvr-${name}`]: value?.hover,
12
- [`--focus-${name}`]: value?.focus,
13
- };
14
- };
15
- const makeStyleResponsiveState = (name, value) => {
16
- if (!value)
17
- return {};
18
- return {
19
- [`--${name}`]: value?.desktop?.normal,
20
- [`--hvr-${name}`]: value?.desktop?.hover,
21
- [`--focus-${name}`]: value?.desktop?.focus,
22
- [`--${name}-tablet`]: value?.tablet?.normal,
23
- [`--hvr-${name}-tablet`]: value?.tablet?.hover,
24
- [`--focus-${name}-tablet`]: value?.tablet?.focus,
25
- [`--${name}-mobile`]: value?.mobile?.normal,
26
- [`--hvr-${name}-mobile`]: value?.mobile?.hover,
27
- [`--focus-${name}-mobile`]: value?.mobile?.focus,
28
- };
29
- };
30
- const makeStyleResponsive = (name, value) => {
31
- return {
32
- [`--${name}`]: value?.desktop,
33
- [`--${name}-tablet`]: value?.tablet,
34
- [`--${name}-mobile`]: value?.mobile,
35
- };
36
- };
37
- const makeWidth = (widthValue, fullWidthValue) => {
38
- const getVal = (deviceValue, widthValue, fullWidthValue) => {
39
- const widthVal = widthValue?.[deviceValue];
40
- const fullWidthVal = fullWidthValue?.[deviceValue];
41
- if (fullWidthVal) {
42
- return '100%';
43
- }
44
- else if (fullWidthVal === false) {
45
- return widthVal ?? widthVal;
46
- }
47
- else {
48
- return widthVal;
49
- }
50
- };
51
- return {
52
- desktop: getVal('desktop', widthValue, fullWidthValue),
53
- tablet: getVal('tablet', widthValue, fullWidthValue),
54
- mobile: getVal('mobile', widthValue, fullWidthValue),
55
- };
56
- };
57
- const makeHeight = (heighValue, autoHeight) => {
58
- const getVal = (deviceValue, heighValue, autoHeight) => {
59
- const heightVal = heighValue?.[deviceValue];
60
- const isAuto = autoHeight?.[deviceValue];
61
- if (isAuto) {
62
- return 'auto';
63
- }
64
- else if (isAuto === false) {
65
- return heightVal ?? heightVal;
66
- }
67
- else {
68
- return heightVal;
69
- }
70
- };
71
- return {
72
- desktop: getVal('desktop', heighValue, autoHeight),
73
- tablet: getVal('tablet', heighValue, autoHeight),
74
- mobile: getVal('mobile', heighValue, autoHeight),
75
- };
76
- };
77
- const makeAspectRatio = (aspectRatio, aspectWidth, aspectHeight) => {
78
- return {
79
- desktop: aspectRatio?.desktop === 'custom'
80
- ? `${getResponsiveValueByScreen(aspectWidth, 'desktop')}/${getResponsiveValueByScreen(aspectHeight, 'desktop')}`
81
- : aspectRatio?.desktop,
82
- tablet: aspectRatio?.tablet === 'custom'
83
- ? `${getResponsiveValueByScreen(aspectWidth, 'tablet')}/${getResponsiveValueByScreen(aspectHeight, 'tablet')}`
84
- : aspectRatio?.tablet,
85
- mobile: aspectRatio?.mobile === 'custom'
86
- ? `${getResponsiveValueByScreen(aspectWidth, 'mobile')}/${getResponsiveValueByScreen(aspectHeight, 'mobile')}`
87
- : aspectRatio?.mobile,
88
- };
3
+ const makeStyle = (style)=>{
4
+ return Object.fromEntries(Object.entries(style).map(([key, value])=>[
5
+ `--${key}`,
6
+ value
7
+ ]));
8
+ };
9
+ const makeStyleState = (name, value)=>{
10
+ if (!value) return {};
11
+ return {
12
+ [`--${name}`]: value?.normal,
13
+ [`--hvr-${name}`]: value?.hover,
14
+ [`--focus-${name}`]: value?.focus
15
+ };
16
+ };
17
+ const makeStyleResponsiveState = (name, value)=>{
18
+ if (!value) return {};
19
+ return {
20
+ [`--${name}`]: value?.desktop?.normal,
21
+ [`--hvr-${name}`]: value?.desktop?.hover,
22
+ [`--focus-${name}`]: value?.desktop?.focus,
23
+ [`--${name}-tablet`]: value?.tablet?.normal,
24
+ [`--hvr-${name}-tablet`]: value?.tablet?.hover,
25
+ [`--focus-${name}-tablet`]: value?.tablet?.focus,
26
+ [`--${name}-mobile`]: value?.mobile?.normal,
27
+ [`--hvr-${name}-mobile`]: value?.mobile?.hover,
28
+ [`--focus-${name}-mobile`]: value?.mobile?.focus
29
+ };
30
+ };
31
+ const makeStyleResponsive = (name, value)=>{
32
+ return {
33
+ [`--${name}`]: value?.desktop,
34
+ [`--${name}-tablet`]: value?.tablet,
35
+ [`--${name}-mobile`]: value?.mobile
36
+ };
37
+ };
38
+ const makeWidth = (widthValue, fullWidthValue)=>{
39
+ const getVal = (deviceValue, widthValue, fullWidthValue)=>{
40
+ const widthVal = widthValue?.[deviceValue];
41
+ const fullWidthVal = fullWidthValue?.[deviceValue];
42
+ if (fullWidthVal) {
43
+ return '100%';
44
+ } else if (fullWidthVal === false) {
45
+ return widthVal ?? widthVal;
46
+ } else {
47
+ return widthVal;
48
+ }
49
+ };
50
+ return {
51
+ desktop: getVal('desktop', widthValue, fullWidthValue),
52
+ tablet: getVal('tablet', widthValue, fullWidthValue),
53
+ mobile: getVal('mobile', widthValue, fullWidthValue)
54
+ };
55
+ };
56
+ const makeHeight = (heighValue, autoHeight)=>{
57
+ const getVal = (deviceValue, heighValue, autoHeight)=>{
58
+ const heightVal = heighValue?.[deviceValue];
59
+ const isAuto = autoHeight?.[deviceValue];
60
+ if (isAuto) {
61
+ return 'auto';
62
+ } else if (isAuto === false) {
63
+ return heightVal ?? heightVal;
64
+ } else {
65
+ return heightVal;
66
+ }
67
+ };
68
+ return {
69
+ desktop: getVal('desktop', heighValue, autoHeight),
70
+ tablet: getVal('tablet', heighValue, autoHeight),
71
+ mobile: getVal('mobile', heighValue, autoHeight)
72
+ };
73
+ };
74
+ const makeAspectRatio = (aspectRatio, aspectWidth, aspectHeight)=>{
75
+ return {
76
+ desktop: aspectRatio?.desktop === 'custom' ? `${getResponsiveValueByScreen(aspectWidth, 'desktop')}/${getResponsiveValueByScreen(aspectHeight, 'desktop')}` : aspectRatio?.desktop,
77
+ tablet: aspectRatio?.tablet === 'custom' ? `${getResponsiveValueByScreen(aspectWidth, 'tablet')}/${getResponsiveValueByScreen(aspectHeight, 'tablet')}` : aspectRatio?.tablet,
78
+ mobile: aspectRatio?.mobile === 'custom' ? `${getResponsiveValueByScreen(aspectWidth, 'mobile')}/${getResponsiveValueByScreen(aspectHeight, 'mobile')}` : aspectRatio?.mobile
79
+ };
89
80
  };
90
81
 
91
82
  export { makeAspectRatio, makeHeight, makeStyle, makeStyleResponsive, makeStyleResponsiveState, makeStyleState, makeWidth };
@@ -1,15 +1,21 @@
1
- function normalizeBuilderData(data) {
2
- const result = {};
3
- function compose(data, res = {}) {
4
- const childrens = data.childrens;
5
- const items = childrens?.map((child) => child.uid) ?? [];
6
- res[data.uid] = { ...data, childrens: items, type: 'component' };
7
- if (childrens) {
8
- childrens.map((child) => compose(child, res));
9
- }
10
- }
11
- compose(data, result);
12
- return { ...result };
1
+ function normalizeBuilderData(data) {
2
+ const result = {};
3
+ function compose(data, res = {}) {
4
+ const childrens = data.childrens;
5
+ const items = childrens?.map((child)=>child.uid) ?? [];
6
+ res[data.uid] = {
7
+ ...data,
8
+ childrens: items,
9
+ type: 'component'
10
+ };
11
+ if (childrens) {
12
+ childrens.map((child)=>compose(child, res));
13
+ }
14
+ }
15
+ compose(data, result);
16
+ return {
17
+ ...result
18
+ };
13
19
  }
14
20
 
15
21
  export { normalizeBuilderData };