@gem-sdk/components 2.0.0-dev.693 → 2.0.0-dev.695

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 (176) hide show
  1. package/dist/cjs/builder.js +6 -12
  2. package/dist/cjs/index.js +32 -34
  3. package/dist/cjs/index.liquid.js +10 -16
  4. package/dist/cjs/next.js +1 -3
  5. package/dist/cjs/product/components/ProductImagesV2/common/common.js +2 -1
  6. package/dist/cjs/product/index.js +4 -6
  7. package/dist/cjs/product/next.js +0 -4
  8. package/dist/cjs/setting.js +76 -78
  9. package/dist/esm/builder.js +0 -6
  10. package/dist/esm/index.js +0 -1
  11. package/dist/esm/index.liquid.js +0 -3
  12. package/dist/esm/next.js +1 -3
  13. package/dist/esm/product/components/ProductImagesV2/common/common.js +2 -1
  14. package/dist/esm/product/index.js +24 -26
  15. package/dist/esm/product/next.js +0 -4
  16. package/dist/esm/setting.js +0 -2
  17. package/dist/types/index.d.ts +116 -551
  18. package/package.json +4 -4
  19. package/dist/cjs/product/components/ProductImagesV3/common/common.js +0 -360
  20. package/dist/cjs/product/components/ProductImagesV3/common/getAttr.js +0 -192
  21. package/dist/cjs/product/components/ProductImagesV3/common/getBorderActiveCss.js +0 -26
  22. package/dist/cjs/product/components/ProductImagesV3/common/getClasses.js +0 -94
  23. package/dist/cjs/product/components/ProductImagesV3/common/getStyle.js +0 -303
  24. package/dist/cjs/product/components/ProductImagesV3/common/hoverAction.js +0 -95
  25. package/dist/cjs/product/components/ProductImagesV3/common/productFeaturedImage.js +0 -59
  26. package/dist/cjs/product/components/ProductImagesV3/common/productGallery.js +0 -266
  27. package/dist/cjs/product/components/ProductImagesV3/components/child/MediaIcon.js +0 -63
  28. package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeatureVideo.js +0 -36
  29. package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeaturedImageCarousel.js +0 -109
  30. package/dist/cjs/product/components/ProductImagesV3/components/child/ProductFeaturedImageOnly.js +0 -139
  31. package/dist/cjs/product/components/ProductImagesV3/components/child/ProductGalleryGrid.js +0 -100
  32. package/dist/cjs/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.js +0 -77
  33. package/dist/cjs/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.liquid.js +0 -300
  34. package/dist/cjs/product/components/ProductImagesV3/components/feature-only/OnlyFeatureImage.js +0 -44
  35. package/dist/cjs/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.js +0 -83
  36. package/dist/cjs/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.liquid.js +0 -182
  37. package/dist/cjs/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.js +0 -30
  38. package/dist/cjs/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.liquid.js +0 -239
  39. package/dist/cjs/product/components/ProductImagesV3/components/lightbox/ButtonOpenLightBox.js +0 -28
  40. package/dist/cjs/product/components/ProductImagesV3/components/lightbox/ProductImagesLightBox.js +0 -144
  41. package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesAttr.js +0 -14
  42. package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesClassName.js +0 -54
  43. package/dist/cjs/product/components/ProductImagesV3/composables/getProductImagesStyles.js +0 -53
  44. package/dist/cjs/product/components/ProductImagesV3/hooks/useFeatureImageWithGallery.js +0 -55
  45. package/dist/cjs/product/components/ProductImagesV3/hooks/useFilterImagesByVariant.js +0 -41
  46. package/dist/cjs/product/components/ProductImagesV3/hooks/useGalleryCarousel.js +0 -134
  47. package/dist/cjs/product/components/ProductImagesV3/hooks/useProductFeaturedImageCarousel.js +0 -203
  48. package/dist/cjs/product/components/ProductImagesV3/hooks/useProductGalleryGrid.js +0 -87
  49. package/dist/cjs/product/components/ProductImagesV3/index.js +0 -291
  50. package/dist/cjs/product/components/ProductImagesV3/index.liquid.js +0 -153
  51. package/dist/cjs/product/setting/product-image-v3/ProductFeatureImage.js +0 -252
  52. package/dist/cjs/product/setting/product-image-v3/ProductGalleryImage.js +0 -251
  53. package/dist/cjs/product/setting/product-image-v3/ProductImages.js +0 -74
  54. package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/ProductFeatureImage.js +0 -388
  55. package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/ProductGalleryImage.js +0 -519
  56. package/dist/cjs/product/setting/product-image-v3/configs/setting-v2/index.js +0 -337
  57. package/dist/cjs/product/setting/product-image-v3/configs/ui/FeatureNavigation.js +0 -118
  58. package/dist/cjs/product/setting/product-image-v3/configs/ui/ImageListNavigation.js +0 -119
  59. package/dist/cjs/product/setting/product-image-v3/configs/uiV1.js +0 -237
  60. package/dist/cjs/product/setting/product-image-v3/configs/uiV2.js +0 -491
  61. package/dist/cjs/swiper-carousel/arrow/Arrow.js +0 -52
  62. package/dist/cjs/swiper-carousel/arrow/Arrow.liquid.js +0 -46
  63. package/dist/cjs/swiper-carousel/arrow/common/common.js +0 -119
  64. package/dist/cjs/swiper-carousel/arrow/common/getClass.js +0 -50
  65. package/dist/cjs/swiper-carousel/arrow/common/getStyle.js +0 -84
  66. package/dist/cjs/swiper-carousel/carousel-item/SwiperItem.js +0 -34
  67. package/dist/cjs/swiper-carousel/carousel-item/SwiperItem.liquid.js +0 -38
  68. package/dist/cjs/swiper-carousel/carousel-item/common/getClass.js +0 -29
  69. package/dist/cjs/swiper-carousel/carousel-item/common/getStyle.js +0 -79
  70. package/dist/cjs/swiper-carousel/carousel-item/hook/useCarouseItem.js +0 -22
  71. package/dist/cjs/swiper-carousel/components/common/carousel.js +0 -98
  72. package/dist/cjs/swiper-carousel/components/const/index.js +0 -5
  73. package/dist/cjs/swiper-carousel/components/hooks/useTrackPreviewPause.js +0 -34
  74. package/dist/cjs/swiper-carousel/components/plugins/AnimationPlugin.js +0 -42
  75. package/dist/cjs/swiper-carousel/components/plugins/AutoPlayPlugin.js +0 -105
  76. package/dist/cjs/swiper-carousel/components/plugins/FixSliderMoveBackwards.js +0 -15
  77. package/dist/cjs/swiper-carousel/components/plugins/MutationPlugin.js +0 -45
  78. package/dist/cjs/swiper-carousel/dots/Dots.js +0 -51
  79. package/dist/cjs/swiper-carousel/dots/Dots.liquid.js +0 -26
  80. package/dist/cjs/swiper-carousel/dots/common/common.js +0 -28
  81. package/dist/cjs/swiper-carousel/dots/common/getClass.js +0 -40
  82. package/dist/cjs/swiper-carousel/dots/common/getStyle.js +0 -33
  83. package/dist/cjs/swiper-carousel/dots/hook/useDotsSetting.js +0 -21
  84. package/dist/cjs/swiper-carousel/index.js +0 -17
  85. package/dist/cjs/swiper-carousel/next.js +0 -22
  86. package/dist/cjs/swiper-carousel/root/Swiper.js +0 -128
  87. package/dist/cjs/swiper-carousel/root/Swiper.liquid.js +0 -104
  88. package/dist/cjs/swiper-carousel/root/common/getAttr.js +0 -25
  89. package/dist/cjs/swiper-carousel/root/common/getClass.js +0 -135
  90. package/dist/cjs/swiper-carousel/root/common/getData.js +0 -56
  91. package/dist/cjs/swiper-carousel/root/common/getStyle.js +0 -66
  92. package/dist/cjs/swiper-carousel/root/hook/useCarousel.js +0 -482
  93. package/dist/cjs/swiper-carousel/setting/Swiper.js +0 -42
  94. package/dist/cjs/swiper-carousel/setting/SwiperItem.js +0 -40
  95. package/dist/cjs/swiper-carousel/setting/configs/presets.js +0 -87
  96. package/dist/cjs/swiper-carousel/setting/configs/settingV2.js +0 -822
  97. package/dist/cjs/swiper-carousel/setting/configs/uiV2.js +0 -718
  98. package/dist/esm/product/components/ProductImagesV3/common/common.js +0 -344
  99. package/dist/esm/product/components/ProductImagesV3/common/getAttr.js +0 -189
  100. package/dist/esm/product/components/ProductImagesV3/common/getBorderActiveCss.js +0 -24
  101. package/dist/esm/product/components/ProductImagesV3/common/getClasses.js +0 -83
  102. package/dist/esm/product/components/ProductImagesV3/common/getStyle.js +0 -292
  103. package/dist/esm/product/components/ProductImagesV3/common/hoverAction.js +0 -92
  104. package/dist/esm/product/components/ProductImagesV3/common/productFeaturedImage.js +0 -53
  105. package/dist/esm/product/components/ProductImagesV3/common/productGallery.js +0 -251
  106. package/dist/esm/product/components/ProductImagesV3/components/child/MediaIcon.js +0 -59
  107. package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeatureVideo.js +0 -32
  108. package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeaturedImageCarousel.js +0 -105
  109. package/dist/esm/product/components/ProductImagesV3/components/child/ProductFeaturedImageOnly.js +0 -135
  110. package/dist/esm/product/components/ProductImagesV3/components/child/ProductGalleryGrid.js +0 -96
  111. package/dist/esm/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.js +0 -73
  112. package/dist/esm/product/components/ProductImagesV3/components/feature-gallery/FeatureImageWithGallery.liquid.js +0 -296
  113. package/dist/esm/product/components/ProductImagesV3/components/feature-only/OnlyFeatureImage.js +0 -40
  114. package/dist/esm/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.js +0 -79
  115. package/dist/esm/product/components/ProductImagesV3/components/gallery-carousel/GalleryCarousel.liquid.js +0 -178
  116. package/dist/esm/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.js +0 -26
  117. package/dist/esm/product/components/ProductImagesV3/components/gallery-grid/GalleryGrid.liquid.js +0 -235
  118. package/dist/esm/product/components/ProductImagesV3/components/lightbox/ButtonOpenLightBox.js +0 -24
  119. package/dist/esm/product/components/ProductImagesV3/components/lightbox/ProductImagesLightBox.js +0 -140
  120. package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesAttr.js +0 -12
  121. package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesClassName.js +0 -52
  122. package/dist/esm/product/components/ProductImagesV3/composables/getProductImagesStyles.js +0 -51
  123. package/dist/esm/product/components/ProductImagesV3/hooks/useFeatureImageWithGallery.js +0 -53
  124. package/dist/esm/product/components/ProductImagesV3/hooks/useFilterImagesByVariant.js +0 -39
  125. package/dist/esm/product/components/ProductImagesV3/hooks/useGalleryCarousel.js +0 -132
  126. package/dist/esm/product/components/ProductImagesV3/hooks/useProductFeaturedImageCarousel.js +0 -201
  127. package/dist/esm/product/components/ProductImagesV3/hooks/useProductGalleryGrid.js +0 -85
  128. package/dist/esm/product/components/ProductImagesV3/index.js +0 -287
  129. package/dist/esm/product/components/ProductImagesV3/index.liquid.js +0 -149
  130. package/dist/esm/product/setting/product-image-v3/ProductFeatureImage.js +0 -248
  131. package/dist/esm/product/setting/product-image-v3/ProductGalleryImage.js +0 -248
  132. package/dist/esm/product/setting/product-image-v3/ProductImages.js +0 -70
  133. package/dist/esm/product/setting/product-image-v3/configs/setting-v2/ProductFeatureImage.js +0 -384
  134. package/dist/esm/product/setting/product-image-v3/configs/setting-v2/ProductGalleryImage.js +0 -516
  135. package/dist/esm/product/setting/product-image-v3/configs/setting-v2/index.js +0 -335
  136. package/dist/esm/product/setting/product-image-v3/configs/ui/FeatureNavigation.js +0 -116
  137. package/dist/esm/product/setting/product-image-v3/configs/ui/ImageListNavigation.js +0 -117
  138. package/dist/esm/product/setting/product-image-v3/configs/uiV1.js +0 -235
  139. package/dist/esm/product/setting/product-image-v3/configs/uiV2.js +0 -489
  140. package/dist/esm/swiper-carousel/arrow/Arrow.js +0 -48
  141. package/dist/esm/swiper-carousel/arrow/Arrow.liquid.js +0 -42
  142. package/dist/esm/swiper-carousel/arrow/common/common.js +0 -111
  143. package/dist/esm/swiper-carousel/arrow/common/getClass.js +0 -48
  144. package/dist/esm/swiper-carousel/arrow/common/getStyle.js +0 -82
  145. package/dist/esm/swiper-carousel/carousel-item/SwiperItem.js +0 -30
  146. package/dist/esm/swiper-carousel/carousel-item/SwiperItem.liquid.js +0 -34
  147. package/dist/esm/swiper-carousel/carousel-item/common/getClass.js +0 -27
  148. package/dist/esm/swiper-carousel/carousel-item/common/getStyle.js +0 -77
  149. package/dist/esm/swiper-carousel/carousel-item/hook/useCarouseItem.js +0 -20
  150. package/dist/esm/swiper-carousel/components/common/carousel.js +0 -93
  151. package/dist/esm/swiper-carousel/components/const/index.js +0 -3
  152. package/dist/esm/swiper-carousel/components/hooks/useTrackPreviewPause.js +0 -30
  153. package/dist/esm/swiper-carousel/components/plugins/AnimationPlugin.js +0 -35
  154. package/dist/esm/swiper-carousel/components/plugins/AutoPlayPlugin.js +0 -103
  155. package/dist/esm/swiper-carousel/components/plugins/FixSliderMoveBackwards.js +0 -13
  156. package/dist/esm/swiper-carousel/components/plugins/MutationPlugin.js +0 -43
  157. package/dist/esm/swiper-carousel/dots/Dots.js +0 -47
  158. package/dist/esm/swiper-carousel/dots/Dots.liquid.js +0 -22
  159. package/dist/esm/swiper-carousel/dots/common/common.js +0 -26
  160. package/dist/esm/swiper-carousel/dots/common/getClass.js +0 -38
  161. package/dist/esm/swiper-carousel/dots/common/getStyle.js +0 -31
  162. package/dist/esm/swiper-carousel/dots/hook/useDotsSetting.js +0 -19
  163. package/dist/esm/swiper-carousel/index.js +0 -15
  164. package/dist/esm/swiper-carousel/next.js +0 -18
  165. package/dist/esm/swiper-carousel/root/Swiper.js +0 -124
  166. package/dist/esm/swiper-carousel/root/Swiper.liquid.js +0 -100
  167. package/dist/esm/swiper-carousel/root/common/getAttr.js +0 -23
  168. package/dist/esm/swiper-carousel/root/common/getClass.js +0 -133
  169. package/dist/esm/swiper-carousel/root/common/getData.js +0 -54
  170. package/dist/esm/swiper-carousel/root/common/getStyle.js +0 -64
  171. package/dist/esm/swiper-carousel/root/hook/useCarousel.js +0 -480
  172. package/dist/esm/swiper-carousel/setting/Swiper.js +0 -38
  173. package/dist/esm/swiper-carousel/setting/SwiperItem.js +0 -36
  174. package/dist/esm/swiper-carousel/setting/configs/presets.js +0 -85
  175. package/dist/esm/swiper-carousel/setting/configs/settingV2.js +0 -818
  176. package/dist/esm/swiper-carousel/setting/configs/uiV2.js +0 -713
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-dev.693",
3
+ "version": "2.0.0-dev.695",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -25,9 +25,9 @@
25
25
  "scan-all-text": "rollup -c ./scripts/rollup.config.settings.mjs && node ./scripts/scan-all-text && node ./scripts/scan-all-text"
26
26
  },
27
27
  "devDependencies": {
28
- "@gem-sdk/core": "2.0.0-dev.693",
29
- "@gem-sdk/styles": "2.0.0-dev.661",
30
- "@gem-sdk/system": "2.0.0-dev.661",
28
+ "@gem-sdk/core": "2.0.0-dev.695",
29
+ "@gem-sdk/styles": "2.0.0-dev.695",
30
+ "@gem-sdk/system": "2.0.0-dev.695",
31
31
  "@types/react-transition-group": "^4.4.5",
32
32
  "xlsx": "^0.18.5"
33
33
  },
@@ -1,360 +0,0 @@
1
- 'use strict';
2
-
3
- var core = require('@gem-sdk/core');
4
-
5
- const getTypeWidthDevice = (typeWithDevice)=>{
6
- const desktopType = typeWithDevice?.desktop;
7
- const tabletType = typeWithDevice?.tablet === undefined ? desktopType : typeWithDevice?.tablet;
8
- const mobileType = typeWithDevice?.mobile === undefined ? tabletType : typeWithDevice?.mobile;
9
- return {
10
- desktop: desktopType,
11
- tablet: tabletType,
12
- mobile: mobileType
13
- };
14
- };
15
- const convertUnitToNumber = (value, defaultValue)=>{
16
- if (!value) {
17
- return defaultValue;
18
- }
19
- if (typeof value === 'number') {
20
- return value;
21
- }
22
- const data = value.replaceAll('px', '').replaceAll('%', '').replaceAll('rem', '').replaceAll('em', '');
23
- return !isNaN(Number(data)) ? Number(data) : defaultValue;
24
- };
25
- const convertSpacing = (spacing)=>{
26
- if (!spacing) {
27
- return {
28
- desktop: 5
29
- };
30
- }
31
- return {
32
- desktop: convertUnitToNumber(spacing.desktop, 5),
33
- tablet: convertUnitToNumber(spacing.tablet, 5),
34
- mobile: convertUnitToNumber(spacing.mobile, 5)
35
- };
36
- };
37
- const getDisplayStyle = (fnCondition, defaultValue)=>{
38
- let result = {};
39
- const devices = [
40
- 'desktop',
41
- 'mobile',
42
- 'tablet'
43
- ];
44
- devices.forEach((device)=>{
45
- result = {
46
- ...result,
47
- [`--d${device === 'desktop' ? '' : `-${device}`}`]: `${fnCondition(device) ? 'none' : defaultValue}`
48
- };
49
- });
50
- return result;
51
- };
52
- const checkAddOverFlowClass = (style)=>{
53
- const radius = style?.['--radius'];
54
- const bblr = style?.['--bblr'] || '0px';
55
- const bbrr = style?.['--bbrr'] || '0px';
56
- const btlr = style?.['--btlr'] || '0px';
57
- const btrr = style?.['--btrr'] || '0px';
58
- return radius && !radius.toString().includes('none') && radius.toString() !== '0' || bblr !== '0px' || bbrr !== '0px' || btlr !== '0px' || btrr !== '0px';
59
- };
60
- const getAspectRatio = (shape)=>{
61
- let result = {};
62
- const DEVICES = [
63
- 'desktop',
64
- 'mobile',
65
- 'tablet'
66
- ];
67
- DEVICES.forEach((device)=>{
68
- const shapeValue = core.getResponsiveValueByScreen(shape, device)?.shapeValue;
69
- if (shapeValue) {
70
- result = {
71
- ...result,
72
- [device]: shapeValue
73
- };
74
- } else {
75
- const shapeConfig = core.getResponsiveValueByScreen(shape, device)?.shape;
76
- switch(shapeConfig){
77
- case 'square':
78
- result = {
79
- ...result,
80
- [device]: '1/1'
81
- };
82
- break;
83
- case 'vertical':
84
- result = {
85
- ...result,
86
- [device]: '3/4'
87
- };
88
- break;
89
- case 'horizontal':
90
- result = {
91
- ...result,
92
- [device]: '4/3'
93
- };
94
- break;
95
- case 'original':
96
- result = {
97
- ...result,
98
- [device]: ''
99
- };
100
- break;
101
- }
102
- }
103
- });
104
- return core.makeAspectRatio(result);
105
- };
106
- const getStyleGridLayout = (settings)=>{
107
- const DEVICES = [
108
- 'desktop',
109
- 'tablet',
110
- 'mobile'
111
- ];
112
- let result = {
113
- [`--gtc`]: 'minmax(0, 12fr)',
114
- [`--gtc-tablet`]: 'minmax(0, 12fr)',
115
- [`--gtc-mobile`]: 'minmax(0, 12fr)'
116
- };
117
- if (!settings.isHiddenGalleryImages) {
118
- let hasHorizontalLayout = false;
119
- DEVICES.forEach((device)=>{
120
- const positionDevice = core.getResponsiveValueByScreen(settings.position, device);
121
- const ratioLayoutDevice = core.getResponsiveValueByScreen(settings.ratioLayout, device);
122
- const ratioLayoutRightDevice = core.getResponsiveValueByScreen(settings.ratioLayoutRight, device);
123
- const key = device === 'desktop' ? '--gtc' : `--gtc-${device}`;
124
- const rowKey = device === 'desktop' ? '--gtr' : `--gtr-${device}`;
125
- const ratioLayout = positionDevice === 'left' ? ratioLayoutDevice : ratioLayoutRightDevice;
126
- const isHorizontalLayout = [
127
- 'left',
128
- 'right'
129
- ].includes(positionDevice || '');
130
- if (isHorizontalLayout && ratioLayout) {
131
- hasHorizontalLayout = true;
132
- result = {
133
- ...result,
134
- [key]: `minmax(0, ${ratioLayout[0]}fr) minmax(0, ${ratioLayout[1]}fr)`
135
- };
136
- Object.assign(result, {
137
- [rowKey]: 'fit-content(0)'
138
- });
139
- } else if (hasHorizontalLayout) {
140
- Object.assign(result, {
141
- [rowKey]: 'unset'
142
- });
143
- }
144
- });
145
- }
146
- return result;
147
- };
148
- const getStyleGridOrderForFeature = (settings)=>{
149
- let result = {
150
- [`--o`]: '0',
151
- [`--o-tablet`]: '0',
152
- [`--o-mobile`]: '0'
153
- };
154
- const DEVICES = [
155
- 'desktop',
156
- 'mobile',
157
- 'tablet'
158
- ];
159
- DEVICES.forEach((device)=>{
160
- const positionDevice = core.getResponsiveValueByScreen(settings.position, device);
161
- const key = device === 'desktop' ? '--o' : `--o-${device}`;
162
- result = {
163
- ...result,
164
- [key]: positionDevice === 'left' ? `1` : '0'
165
- };
166
- });
167
- return result;
168
- };
169
- const getStyleGridOrderForGallery = (settings)=>{
170
- let result = {
171
- [`--o`]: '1',
172
- [`--o-tablet`]: '1',
173
- [`--o-mobile`]: '1'
174
- };
175
- const DEVICES = [
176
- 'desktop',
177
- 'mobile',
178
- 'tablet'
179
- ];
180
- DEVICES.forEach((device)=>{
181
- const positionDevice = core.getResponsiveValueByScreen(settings.position, device);
182
- const key = device === 'desktop' ? '--o' : `--o-${device}`;
183
- result = {
184
- ...result,
185
- [key]: positionDevice === 'left' ? `0` : '1'
186
- };
187
- });
188
- return result;
189
- };
190
- const getSrcImage = (liquidSrc)=>{
191
- return `{{${liquidSrc} | img_url: '480x480'}} 480w, {{${liquidSrc} | img_url: '768x768'}} 768w,{{${liquidSrc} | img_url: '1024x1024'}} 1024w,{{${liquidSrc} | img_url: '1440x1440'}} 1440w`;
192
- };
193
- const convertSpacingForIndisdeLayout = (spacing)=>{
194
- const spacingVal = parseInt(spacing) ? `${parseInt(spacing) * 2}px` : `${spacing} * 2`;
195
- return spacingVal;
196
- };
197
- const getStyleInsideLayout = (position, shape, spacing)=>{
198
- const DEVICES = [
199
- 'desktop',
200
- 'mobile',
201
- 'tablet'
202
- ];
203
- let posResponsive = {};
204
- let width = {};
205
- let bottom = {};
206
- let top = {};
207
- let right = {};
208
- let left = {};
209
- DEVICES.forEach((device)=>{
210
- const positionDevice = core.getResponsiveValueByScreen(position, device);
211
- let widthDevice = core.getResponsiveValueByScreen(shape, device)?.width;
212
- const spacingDevice = core.getResponsiveValueByScreen(spacing, device);
213
- posResponsive = {
214
- ...posResponsive,
215
- [device]: [
216
- 'inside-bottom',
217
- 'inside-left',
218
- 'inside-right'
219
- ].includes(positionDevice) ? 'absolute' : 'static'
220
- };
221
- if ([
222
- 'inside-bottom'
223
- ].includes(positionDevice)) {
224
- const spacingVal = convertSpacingForIndisdeLayout(spacingDevice);
225
- widthDevice = `calc(100% - ${spacingVal})`;
226
- }
227
- if ([
228
- 'bottom-center',
229
- 'two-col',
230
- 'one-col'
231
- ].includes(positionDevice)) {
232
- widthDevice = '100%';
233
- }
234
- bottom = {
235
- ...bottom,
236
- [device]: positionDevice === 'inside-bottom' ? `${spacingDevice}` : 'auto'
237
- };
238
- top = {
239
- ...top,
240
- [device]: [
241
- 'inside-left',
242
- 'inside-right'
243
- ].includes(positionDevice) ? `${spacingDevice}` : 'auto'
244
- };
245
- left = {
246
- ...left,
247
- [device]: [
248
- 'inside-bottom',
249
- 'inside-left'
250
- ].includes(positionDevice) ? `${spacingDevice}` : 'auto'
251
- };
252
- right = {
253
- ...right,
254
- [device]: positionDevice === 'inside-right' ? `${spacingDevice}` : 'auto'
255
- };
256
- width = {
257
- ...width,
258
- [device]: widthDevice
259
- };
260
- });
261
- return {
262
- ...core.makeStyleResponsive('pos', posResponsive),
263
- ...core.makeStyleResponsive('w', core.removeNullUndefined(width)),
264
- ...core.makeStyleResponsive('bottom', core.removeNullUndefined(bottom)),
265
- ...core.makeStyleResponsive('top', core.removeNullUndefined(top)),
266
- ...core.makeStyleResponsive('left', core.removeNullUndefined(left)),
267
- ...core.makeStyleResponsive('right', core.removeNullUndefined(right))
268
- };
269
- };
270
- const getConditionRenderGalleryImages = (position)=>{
271
- const DEVICES = [
272
- 'desktop',
273
- 'mobile',
274
- 'tablet'
275
- ];
276
- let isOnlyFeatureAllDevices = true;
277
- let isRenderGalleryGrid = false;
278
- DEVICES.forEach((device)=>{
279
- const positionDevice = core.getResponsiveValueByScreen(position, device);
280
- if (positionDevice && positionDevice !== 'only-feature') isOnlyFeatureAllDevices = false;
281
- if ([
282
- 'two-col',
283
- 'one-col'
284
- ].includes(positionDevice)) {
285
- isRenderGalleryGrid = true;
286
- }
287
- });
288
- return {
289
- isOnlyFeatureAllDevices,
290
- isRenderGalleryGrid
291
- };
292
- };
293
- const setDefaultWhenUndefineSetting = (props)=>{
294
- return {
295
- ...props,
296
- setting: {
297
- ...props.setting
298
- }
299
- };
300
- };
301
- const getValueFromValueContainUnit = (value)=>{
302
- const result = value.match(/\d+/g);
303
- return result ? result[0] : value;
304
- };
305
- const getPaddingBottomByShapeSetting = (shapeSetting)=>{
306
- const aspectRatio = getAspectRatio(shapeSetting);
307
- let result = {
308
- desktop: 'auto',
309
- mobile: 'auto',
310
- tablet: 'auto'
311
- };
312
- const DEVICES = [
313
- 'desktop',
314
- 'mobile',
315
- 'tablet'
316
- ];
317
- DEVICES.forEach((device)=>{
318
- const shapeByDevice = core.getResponsiveValueByScreen(shapeSetting, device);
319
- const height = shapeByDevice?.height;
320
- const width = shapeByDevice?.width || '';
321
- const heightNotUnit = getValueFromValueContainUnit(height || '');
322
- const widthNotUnit = width.match(/px/g) ? getValueFromValueContainUnit(width) : width;
323
- if (height && width && !isNaN(Number(heightNotUnit)) && !isNaN(Number(widthNotUnit))) {
324
- result = {
325
- ...result,
326
- [device]: `${Number(heightNotUnit) / Number(widthNotUnit) * 100}%`
327
- };
328
- return;
329
- }
330
- if (height && !isNaN(Number(heightNotUnit))) {
331
- result = {
332
- ...result,
333
- [device]: height
334
- };
335
- return;
336
- }
337
- const value = aspectRatio?.[device] !== 'auto' && !!aspectRatio?.[device] ? aspectRatio?.[device]?.split('').reverse().join('') : '{%if media.height%} {{media.height}} / {{media.width}} {%else%} 100 / 100 {%endif%}';
338
- result = {
339
- ...result,
340
- [device]: `calc((${value})*100%)`
341
- };
342
- });
343
- return result;
344
- };
345
-
346
- exports.checkAddOverFlowClass = checkAddOverFlowClass;
347
- exports.convertSpacing = convertSpacing;
348
- exports.convertSpacingForIndisdeLayout = convertSpacingForIndisdeLayout;
349
- exports.convertUnitToNumber = convertUnitToNumber;
350
- exports.getAspectRatio = getAspectRatio;
351
- exports.getConditionRenderGalleryImages = getConditionRenderGalleryImages;
352
- exports.getDisplayStyle = getDisplayStyle;
353
- exports.getPaddingBottomByShapeSetting = getPaddingBottomByShapeSetting;
354
- exports.getSrcImage = getSrcImage;
355
- exports.getStyleGridLayout = getStyleGridLayout;
356
- exports.getStyleGridOrderForFeature = getStyleGridOrderForFeature;
357
- exports.getStyleGridOrderForGallery = getStyleGridOrderForGallery;
358
- exports.getStyleInsideLayout = getStyleInsideLayout;
359
- exports.getTypeWidthDevice = getTypeWidthDevice;
360
- exports.setDefaultWhenUndefineSetting = setDefaultWhenUndefineSetting;
@@ -1,192 +0,0 @@
1
- 'use strict';
2
-
3
- var core = require('@gem-sdk/core');
4
- var productGallery = require('./productGallery.js');
5
- var productFeaturedImage = require('./productFeaturedImage.js');
6
-
7
- const DEVICES = [
8
- 'desktop',
9
- 'mobile',
10
- 'tablet'
11
- ];
12
- const getGalleryCarouselSettingAttr = (setting)=>{
13
- const shapeByLayout = productGallery.getShapeByLayout({
14
- shape: setting.shape,
15
- shapeForBottom: setting.shapeForBottom,
16
- shapeFor1Col: setting.shapeFor1Col,
17
- shapeFor2Col: setting.shapeFor2Col,
18
- shapeForFtOnly: setting.shapeForFtOnly,
19
- shapeForInsideBottom: setting.shapeForInsideBottom,
20
- shapeForInside: setting.shapeForInside
21
- }, setting.position);
22
- const slidePerShow = productGallery.getSliderPerShowConfig(shapeByLayout, setting.position);
23
- const controlOverContent = {
24
- desktop: core.getResponsiveValueByScreen(setting.navigationPosition, 'desktop') === 'inside',
25
- tablet: core.getResponsiveValueByScreen(setting.navigationPosition, 'tablet') === 'inside',
26
- mobile: core.getResponsiveValueByScreen(setting.navigationPosition, 'mobile') === 'inside'
27
- };
28
- const mappingNavigationEnable = DEVICES.reduce((acc, device)=>{
29
- if (setting.navigationPosition?.[device]) {
30
- acc[device] = setting.navigationPosition[device] !== 'none';
31
- }
32
- return acc;
33
- }, {});
34
- return {
35
- ...setting?.loop && {
36
- loop: setting.loop
37
- },
38
- itemNumber: slidePerShow,
39
- dot: productGallery.getAllowDotConfig(),
40
- dotStyle: productGallery.getDotStyleConfig(),
41
- controlOverContent: controlOverContent,
42
- ...setting?.dragToScroll && {
43
- enableDrag: {
44
- desktop: setting.dragToScroll,
45
- tablet: setting.dragToScroll,
46
- mobile: setting.dragToScroll
47
- }
48
- },
49
- vertical: productGallery.getCarouselVerticalConfigByPosition(setting.position),
50
- ...setting?.arrowIcon && {
51
- arrowCustom: setting.arrowIcon
52
- },
53
- ...{
54
- arrowIconSize: setting.arrowIconSize || {
55
- desktop: 24
56
- }
57
- },
58
- ...setting?.arrowIconColor && {
59
- arrowCustomColor: setting.arrowIconColor
60
- },
61
- ...setting?.arrowNavColor && {
62
- arrowBackgroundColor: setting.arrowNavColor
63
- },
64
- ...setting?.arrowNavBorder && {
65
- arrowBorder: {
66
- desktop: setting.arrowNavBorder
67
- }
68
- },
69
- ...setting?.arrowNavRadius && {
70
- roundedArrow: {
71
- desktop: setting.arrowNavRadius
72
- }
73
- },
74
- ...setting?.arrowNavShadow && {
75
- arrowShadow: {
76
- desktop: setting.arrowNavShadow
77
- }
78
- },
79
- sneakPeakType: {
80
- desktop: 'center'
81
- },
82
- arrowGapToEachSide: '16',
83
- navigationStyle: setting.navigationPosition,
84
- navigationEnable: mappingNavigationEnable,
85
- arrowButtonSize: {
86
- desktop: {
87
- width: undefined,
88
- height: undefined
89
- }
90
- },
91
- animationMode: setting?.ftAnimationMode,
92
- enableAction: {
93
- desktop: true
94
- }
95
- };
96
- };
97
- const getFeaturedCarouselSettingAttr = (setting)=>{
98
- const controlOverContent = {
99
- desktop: core.getResponsiveValueByScreen(setting.ftNavigationPosition, 'desktop') === 'inside',
100
- tablet: core.getResponsiveValueByScreen(setting.ftNavigationPosition, 'tablet') === 'inside',
101
- mobile: core.getResponsiveValueByScreen(setting.ftNavigationPosition, 'mobile') === 'inside'
102
- };
103
- const mappingNavigationEnable = DEVICES.reduce((acc, device)=>{
104
- if (setting.ftNavigationPosition?.[device]) {
105
- acc[device] = setting.ftNavigationPosition[device] !== 'none';
106
- }
107
- return acc;
108
- }, {});
109
- return {
110
- ...setting?.ftLoop && {
111
- loop: setting.ftLoop
112
- },
113
- itemNumber: {
114
- desktop: 1
115
- },
116
- dot: productGallery.getAllowDotConfig(),
117
- dotStyle: productFeaturedImage.getDotStyleForOnlyFeaturedImage({
118
- position: setting.position,
119
- dotStyle: setting.ftDotStyle
120
- }),
121
- dotSize: setting.ftDotSize ?? {
122
- desktop: 12
123
- },
124
- dotGapToCarousel: setting.ftDotGapToCarousel ?? {
125
- desktop: 16
126
- },
127
- dotColor: setting.ftDotColor ?? {
128
- desktop: 'bg-1'
129
- },
130
- dotActiveColor: setting.ftDotActiveColor ?? {
131
- desktop: 'line-3'
132
- },
133
- controlOverContent: controlOverContent,
134
- ...setting?.ftDragToScroll && {
135
- enableDrag: {
136
- desktop: setting.ftDragToScroll,
137
- tablet: setting.ftDragToScroll,
138
- mobile: setting.ftDragToScroll
139
- }
140
- },
141
- ...setting?.ftArrowIcon && {
142
- arrowCustom: setting.ftArrowIcon
143
- },
144
- ...{
145
- arrowIconSize: setting.ftArrowIconSize || {
146
- desktop: 24
147
- }
148
- },
149
- ...setting?.ftArrowIconColor && {
150
- arrowCustomColor: setting.ftArrowIconColor
151
- },
152
- ...setting?.ftArrowNavColor && {
153
- arrowBackgroundColor: setting.ftArrowNavColor
154
- },
155
- ...setting?.ftArrowNavBorder && {
156
- arrowBorder: {
157
- desktop: setting.ftArrowNavBorder
158
- }
159
- },
160
- ...setting?.ftArrowNavRadius && {
161
- roundedArrow: {
162
- desktop: setting.ftArrowNavRadius
163
- }
164
- },
165
- ...setting?.ftArrowNavShadow && {
166
- arrowShadow: {
167
- desktop: setting.ftArrowNavShadow
168
- }
169
- },
170
- sneakPeakType: {
171
- desktop: 'center'
172
- },
173
- arrowGapToEachSide: '16',
174
- animationMode: setting?.ftAnimationMode,
175
- ...setting?.ftNavigationPosition && {
176
- navigationStyle: setting.ftNavigationPosition
177
- },
178
- navigationEnable: mappingNavigationEnable,
179
- arrowButtonSize: {
180
- desktop: {
181
- width: undefined,
182
- height: undefined
183
- }
184
- },
185
- enableAction: {
186
- desktop: true
187
- }
188
- };
189
- };
190
-
191
- exports.getFeaturedCarouselSettingAttr = getFeaturedCarouselSettingAttr;
192
- exports.getGalleryCarouselSettingAttr = getGalleryCarouselSettingAttr;
@@ -1,26 +0,0 @@
1
- 'use strict';
2
-
3
- var core = require('@gem-sdk/core');
4
-
5
- const getBorderActiveCss = ({ settings, uid, type })=>{
6
- // const suffix = type === 'Liquid' ? '-{{product.id}}' : '';
7
- const selector = type === 'Liquid' ? `.gem-slider-item-${uid}-{{product.id}}.gp-gallery-image-item::after, .gem-slider-item-gp-gallery-${uid}-{{product.id}}.gp-gallery-image-item::after` : `.gem-slider-item-active.gem-slider-item-${uid}.gp-gallery-image-item::after`;
8
- return `
9
- ${selector} {
10
- content: "";
11
- height: 100%;
12
- width: 100%;
13
- position: absolute;
14
- z-index: 999;
15
- top: 0;
16
- left: 0;
17
- ${core.composeBorderCss(settings?.borderActive)}
18
- ${core.composeCornerCss(settings?.corner)}
19
- }
20
- .gem-slider-item-${uid}-{{product.id}}.gp-gallery-image-item[data-outline=active]:after, .gem-slider-item-gp-gallery-${uid}-{{product.id}}.gp-gallery-image-item[data-outline=active]:after {
21
- pointer-events: none;
22
- }
23
- `;
24
- };
25
-
26
- exports.getBorderActiveCss = getBorderActiveCss;
@@ -1,94 +0,0 @@
1
- 'use strict';
2
-
3
- var core = require('@gem-sdk/core');
4
-
5
- function composeClasses(classList) {
6
- return classList.split(' ').reduce((acc, item)=>{
7
- acc[item] = true;
8
- return acc;
9
- }, {});
10
- }
11
- const getWrapperClasses = ({ extraClass, isAddOverFlowClass = false })=>{
12
- let classList = 'gp-relative gp-w-full';
13
- if (extraClass) classList += ` ${extraClass}`;
14
- if (isAddOverFlowClass) classList += ` gp-overflow-hidden`;
15
- return composeClasses(classList);
16
- };
17
- const getGalleryWrapperClasses = ({ extraClass })=>{
18
- let classList = 'gallery-wrapper gp-product-images-gallery gp-flex gp-overflow-hidden gp-max-w-full gp-max-h-full data-[only-image=true]:gp-hidden';
19
- if (extraClass) classList += ` ${extraClass}`;
20
- return composeClasses(classList);
21
- };
22
- const getGalleryGridWrapperClasses = ({ extraClass })=>{
23
- let classList = 'product-feature-image grid-gallery gp-flex !gp-h-fit gp-w-full gp-flex-wrap scrollbar-track:gp-rounded-2xl scrollbar-thumb:gp-rounded-2xl scrollbar-thumb:gp-bg-gray-400';
24
- if (extraClass) classList += ` ${extraClass}`;
25
- return composeClasses(classList);
26
- };
27
- const getFtImageWithGalleryClasses = ({ extraClass })=>{
28
- let classList = 'gp-flex !gp-h-fit gp-relative gp-overflow-hidden';
29
- if (extraClass) classList += ` ${extraClass}`;
30
- return composeClasses(classList);
31
- };
32
- const getImageGalleryWrapperClasses = ({ extraClass })=>{
33
- let classList = 'gp-flex gp-h-fit gp-max-w-full';
34
- if (extraClass) classList += ` ${extraClass}`;
35
- return composeClasses(classList);
36
- };
37
- const getFeaturedImageCarouselClasses = ({ extraClass })=>{
38
- let classList = '`gp-flex-1 gp-w-full gp-feature-image-carousel';
39
- if (extraClass) classList += ` ${extraClass}`;
40
- return composeClasses(classList);
41
- };
42
- const getFeaturedImageClasses = ({ setting, extraClass })=>{
43
- let classList = extraClass ?? '';
44
- const devices = [
45
- 'desktop',
46
- 'tablet',
47
- 'mobile'
48
- ];
49
- devices.forEach((device)=>{
50
- const navigation = core.getResponsiveValueByScreen(setting?.ftNavigationPosition, device);
51
- const suffix = device !== 'desktop' ? `${device}:` : '';
52
- navigation === 'outside' ? classList += ` ${suffix}gp-px-[16px]` : classList += ` ${suffix}gp-px-0`;
53
- });
54
- return composeClasses(classList);
55
- };
56
- const getFeaturedImageGalleryClasses = ({ settings, extraClass })=>{
57
- let classList = extraClass ?? 'gp-flex-1 gp-w-full carousel-gallery';
58
- const devices = [
59
- 'desktop',
60
- 'tablet',
61
- 'mobile'
62
- ];
63
- devices.forEach((device)=>{
64
- const navigation = core.getResponsiveValueByScreen(settings?.navigationPosition, device);
65
- const type = core.getResponsiveValueByScreen(settings?.type, device);
66
- const position = core.getResponsiveValueByScreen(settings?.position, device);
67
- const suffix = device !== 'desktop' ? `${device}:` : '';
68
- navigation === 'outside' && type === 'slider' && [
69
- 'bottom-center'
70
- ].includes(position || '') ? classList += ` ${suffix}gp-px-[16px]` : classList += ` ${suffix}gp-px-0`;
71
- });
72
- return composeClasses(classList);
73
- };
74
- const getGalleryItemClasses = ({ extraClass })=>{
75
- let classList = `gp-image-item gp-flex gp-items-center gp-justify-center gp-group gp-relative gp-overflow-hidden gp-cursor-pointer data-[outline=deactive]:after:!gp-border-transparent data-[outline=deactive]:after:!gp-border-transparent`;
76
- if (extraClass) classList += ` ${extraClass}`;
77
- return composeClasses(classList);
78
- };
79
- const getFeaturedCarouselItemClasses = ({ extraClass })=>{
80
- let classList = `gp-group gp-z-0 gp-flex !gp-min-w-full !gp-max-w-full gp-w-full gp-relative gp-items-start gp-justify-center gp-overflow-hidden gp-outline-1 -gp-outline-offset-1 gp-image-item gp-ft-image-item data-[outline=active]:gp-outline`;
81
- if (extraClass) classList += ` ${extraClass}`;
82
- return composeClasses(classList);
83
- };
84
-
85
- exports.getFeaturedCarouselItemClasses = getFeaturedCarouselItemClasses;
86
- exports.getFeaturedImageCarouselClasses = getFeaturedImageCarouselClasses;
87
- exports.getFeaturedImageClasses = getFeaturedImageClasses;
88
- exports.getFeaturedImageGalleryClasses = getFeaturedImageGalleryClasses;
89
- exports.getFtImageWithGalleryClasses = getFtImageWithGalleryClasses;
90
- exports.getGalleryGridWrapperClasses = getGalleryGridWrapperClasses;
91
- exports.getGalleryItemClasses = getGalleryItemClasses;
92
- exports.getGalleryWrapperClasses = getGalleryWrapperClasses;
93
- exports.getImageGalleryWrapperClasses = getImageGalleryWrapperClasses;
94
- exports.getWrapperClasses = getWrapperClasses;