@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
@@ -1,292 +0,0 @@
1
- import { makeStyleResponsive, makeHeight, getHeightByShapeGlobalSize, makeWidth, composeRadius, getResponsiveValueByScreen, makeStyleWithDefault, getWidthByShapeGlobalSize } from '@gem-sdk/core';
2
- import { getStyleGridLayout, getStyleGridOrderForFeature, getStyleGridOrderForGallery, getStyleInsideLayout, convertSpacing, getDisplayStyle, convertSpacingForIndisdeLayout } from './common.js';
3
- import { getShapeByLayout, sizeSettingDefaultForNewLayout, getSettingWidthForGridItem, getSettingMinWidthForCarouselItem, getSettingWidthForCarouselItem, checkDisplayGalleryByWidth } from './productGallery.js';
4
-
5
- const DEVICES = [
6
- 'desktop',
7
- 'mobile',
8
- 'tablet'
9
- ];
10
- function filterTruthyStyles(styles) {
11
- return Object.fromEntries(Object.entries(styles || {}).filter(([, value])=>!!value));
12
- }
13
- const getWrapContainerStyle = (settings, isOnlyOneImage)=>{
14
- const gridLayout = getStyleGridLayout({
15
- position: settings.position,
16
- ratioLayout: settings.ratioLayout,
17
- ratioLayoutRight: settings.ratioLayoutRight,
18
- isHiddenGalleryImages: !!isOnlyOneImage
19
- });
20
- const layoutOneImage = {
21
- '--gtc': 'minmax(0, 12fr)'
22
- };
23
- const composeStyles = {
24
- ...isOnlyOneImage ? layoutOneImage : gridLayout,
25
- ...makeStyleResponsive('gg', settings?.spacing)
26
- };
27
- return filterTruthyStyles(composeStyles);
28
- };
29
- const getFeatureImageStyle = (settings, { enableOrder, enableDisplay })=>{
30
- const getStyleFeaturedImageDisplay = ()=>{
31
- return getDisplayStyle((device)=>![
32
- 'bottom-center',
33
- 'left',
34
- 'right',
35
- 'only-feature',
36
- 'inside-bottom',
37
- 'inside-left',
38
- 'inside-right'
39
- ].includes(getResponsiveValueByScreen(settings?.position, device) || ''), 'flex');
40
- };
41
- const featureImageOrder = getStyleGridOrderForFeature({
42
- position: settings?.position
43
- });
44
- const composeStyles = {
45
- ...makeStyleResponsive('jc', settings?.align),
46
- ...enableOrder && {
47
- ...featureImageOrder
48
- },
49
- ...enableDisplay && {
50
- ...getStyleFeaturedImageDisplay()
51
- }
52
- };
53
- return filterTruthyStyles(composeStyles);
54
- };
55
- const getGalleryImageStyle = (settings, featureImageHeight)=>{
56
- const galleryImageOrder = getStyleGridOrderForGallery({
57
- position: settings.position
58
- });
59
- const getHeightForGallery = ()=>{
60
- let result = {};
61
- const ftImageHeight = featureImageHeight ?? 0;
62
- DEVICES.forEach((device)=>{
63
- const position = getResponsiveValueByScreen(settings?.position, device);
64
- const isHorizontalLayout = [
65
- 'left',
66
- 'right'
67
- ].includes(position);
68
- const spacingByDevice = getResponsiveValueByScreen(settings?.spacing, device);
69
- const isHorizontalInsideLayout = [
70
- 'inside-left',
71
- 'inside-right'
72
- ].includes(position);
73
- const spacingValue = convertSpacingForIndisdeLayout(spacingByDevice);
74
- const heightInside = `calc(${ftImageHeight}px - ${spacingValue})`;
75
- result = {
76
- ...result,
77
- [device]: isHorizontalLayout ? ftImageHeight + 'px' : isHorizontalInsideLayout ? heightInside : 'auto'
78
- };
79
- });
80
- return result;
81
- };
82
- const shapeByLayout = getShapeByLayout({
83
- shape: settings.shape,
84
- shapeForBottom: settings.shapeForBottom,
85
- shapeFor1Col: settings.shapeFor1Col,
86
- shapeFor2Col: settings.shapeFor2Col,
87
- shapeForFtOnly: settings.shapeForFtOnly,
88
- shapeForInsideBottom: settings.shapeForInsideBottom ?? sizeSettingDefaultForNewLayout,
89
- shapeForInside: settings.shapeForInside ?? sizeSettingDefaultForNewLayout
90
- }, settings.position);
91
- const styleInsideLayout = getStyleInsideLayout(settings.position, shapeByLayout, settings?.spacing);
92
- const composeStyles = {
93
- ...makeStyleResponsive('h', makeHeight(getHeightForGallery())),
94
- ...makeStyleResponsive('jc', settings?.align),
95
- ...galleryImageOrder,
96
- ...styleInsideLayout
97
- };
98
- return filterTruthyStyles(composeStyles);
99
- };
100
- const getGalleryGridStyle = (setting, wrapperStyle)=>{
101
- const shapeByLayout = getShapeByLayout({
102
- shape: setting.shape,
103
- shapeForBottom: setting.shapeForBottom,
104
- shapeFor1Col: setting.shapeFor1Col,
105
- shapeFor2Col: setting.shapeFor2Col,
106
- shapeForFtOnly: setting.shapeForFtOnly,
107
- shapeForInsideBottom: setting.shapeForInsideBottom,
108
- shapeForInside: setting.shapeForInside
109
- }, setting.position);
110
- const getGridDisplay = ()=>{
111
- const isDisplayGrid = (type, position, device)=>{
112
- const layout = getResponsiveValueByScreen(position, device);
113
- const typeDevice = getResponsiveValueByScreen(type, device);
114
- const isDisplayTypeGrid = typeDevice !== 'slider' && (layout === 'bottom-center' || layout === 'inside-bottom');
115
- const isDisplayByLayout = [
116
- 'one-col',
117
- 'two-col'
118
- ].includes(layout || '');
119
- return isDisplayTypeGrid || isDisplayByLayout;
120
- };
121
- const isDisplayByWidth = checkDisplayGalleryByWidth({
122
- shapeByLayout
123
- });
124
- const isDisplay = {
125
- desktop: isDisplayByWidth.desktop && isDisplayGrid(setting.type, setting.position, 'desktop'),
126
- tablet: isDisplayByWidth.tablet && isDisplayGrid(setting.type, setting.position, 'tablet'),
127
- mobile: isDisplayByWidth.mobile && isDisplayGrid(setting.type, setting.position, 'mobile')
128
- };
129
- return getDisplayStyle((device)=>!isDisplay[device], 'flex');
130
- };
131
- const composeStyles = {
132
- ...getGridDisplay(),
133
- ...makeStyleResponsive('cg', setting?.itemSpacing),
134
- ...makeStyleResponsive('rg', setting?.itemSpacing),
135
- ...makeStyleResponsive('jc', setting?.align),
136
- ...wrapperStyle
137
- };
138
- return filterTruthyStyles(composeStyles);
139
- };
140
- const getGalleryGridItemStyle = (setting)=>{
141
- const shapeByLayout = getShapeByLayout({
142
- shape: setting.shape,
143
- shapeForBottom: setting.shapeForBottom,
144
- shapeFor1Col: setting.shapeFor1Col,
145
- shapeFor2Col: setting.shapeFor2Col,
146
- shapeForFtOnly: setting.shapeForFtOnly,
147
- shapeForInsideBottom: setting.shapeForInsideBottom,
148
- shapeForInside: setting.shapeForInside
149
- }, setting.position);
150
- const getHeightByLayoutForItem = getHeightByShapeGlobalSize(shapeByLayout);
151
- const getWidthByLayoutForItem = getSettingWidthForGridItem({
152
- shapeByLayout,
153
- itemSpacing: setting.itemSpacing
154
- });
155
- const composeStyles = {
156
- 'max-width': '100%',
157
- 'outline-color': 'var(--g-c-brand, brand)',
158
- ...makeStyleResponsive('h', makeHeight(getHeightByLayoutForItem)),
159
- ...makeStyleResponsive('w', makeWidth(getWidthByLayoutForItem)),
160
- ...composeRadius({
161
- normal: setting.corner
162
- })
163
- };
164
- return filterTruthyStyles(composeStyles);
165
- };
166
- const getFeatureImageCarouselItemStyle = (setting)=>{
167
- const imageHeightResponsive = getHeightByShapeGlobalSize(setting.ftShape);
168
- const composeStyles = {
169
- 'max-width': '100%',
170
- 'outline-color': 'var(--g-c-brand, brand)',
171
- ...composeRadius({
172
- normal: setting?.ftCorner
173
- }),
174
- ...makeStyleResponsive('h', makeHeight(imageHeightResponsive)),
175
- 'min-width': '100%'
176
- };
177
- return filterTruthyStyles(composeStyles);
178
- };
179
- const getGalleryCarouselStyle = (setting)=>{
180
- const shapeByLayout = getShapeByLayout({
181
- shape: setting.shape,
182
- shapeForBottom: setting.shapeForBottom,
183
- shapeFor1Col: setting.shapeFor1Col,
184
- shapeFor2Col: setting.shapeFor2Col,
185
- shapeForFtOnly: setting.shapeForFtOnly,
186
- shapeForInsideBottom: setting.shapeForInsideBottom,
187
- shapeForInside: setting.shapeForInside
188
- }, setting.position);
189
- const getWidthByLayoutForCarouselByDevice = (device)=>{
190
- const layout = getResponsiveValueByScreen(setting?.position, device);
191
- const isLayoutBottom = layout === 'bottom-center' || layout === 'inside-bottom';
192
- const isInsideLayout = layout === 'inside-left' || layout === 'inside-right';
193
- const shapeSetting = getResponsiveValueByScreen(shapeByLayout, device);
194
- return isLayoutBottom || isInsideLayout || !shapeSetting?.width ? '100%' : shapeSetting.width;
195
- };
196
- const composeStyles = {
197
- spacing: convertSpacing(setting?.itemSpacing),
198
- sizeSetting: {
199
- desktop: {
200
- width: getWidthByLayoutForCarouselByDevice('desktop'),
201
- height: '100%'
202
- },
203
- tablet: {
204
- width: getWidthByLayoutForCarouselByDevice('tablet'),
205
- height: '100%'
206
- },
207
- mobile: {
208
- width: getWidthByLayoutForCarouselByDevice('mobile'),
209
- height: '100%'
210
- }
211
- }
212
- };
213
- return filterTruthyStyles(composeStyles);
214
- };
215
- const getGalleryCarouselItemStyle = (setting)=>{
216
- const shapeByLayout = getShapeByLayout({
217
- shape: setting.shape,
218
- shapeForBottom: setting.shapeForBottom,
219
- shapeFor1Col: setting.shapeFor1Col,
220
- shapeFor2Col: setting.shapeFor2Col,
221
- shapeForFtOnly: setting.shapeForFtOnly,
222
- shapeForInsideBottom: setting.shapeForInsideBottom,
223
- shapeForInside: setting.shapeForInside
224
- }, setting.position);
225
- const styleMinWidthForItem = makeStyleResponsive('minw', makeWidth(getSettingMinWidthForCarouselItem({
226
- shapeByLayout,
227
- position: setting.position,
228
- spacing: setting.itemSpacing
229
- })));
230
- const styleWidthForItem = makeStyleResponsive('w', makeWidth(getSettingWidthForCarouselItem({
231
- shapeByLayout,
232
- position: setting.position
233
- })));
234
- const styleHeightForItem = makeStyleResponsive('h', makeHeight(getHeightByShapeGlobalSize(shapeByLayout)));
235
- const composeStyles = {
236
- 'max-width': '100%',
237
- 'outline-color': 'var(--g-c-brand, brand)',
238
- ...styleMinWidthForItem,
239
- ...styleWidthForItem,
240
- ...styleHeightForItem,
241
- ...composeRadius({
242
- normal: setting.corner
243
- })
244
- };
245
- return filterTruthyStyles(composeStyles);
246
- };
247
- const getFeaturedImageCarouselStyle = (setting)=>{
248
- const imageWidthResponsiveByDevice = (device)=>{
249
- const shapeSetting = getResponsiveValueByScreen(setting.ftShape, device);
250
- return shapeSetting?.width ?? '100%';
251
- };
252
- const composeStyles = {
253
- playSpeed: setting?.ftAnimationSpeed,
254
- sizeSetting: {
255
- desktop: {
256
- width: imageWidthResponsiveByDevice('desktop'),
257
- height: 'auto'
258
- },
259
- tablet: {
260
- width: imageWidthResponsiveByDevice('tablet'),
261
- height: 'auto'
262
- },
263
- mobile: {
264
- width: imageWidthResponsiveByDevice('mobile'),
265
- height: 'auto'
266
- }
267
- },
268
- align: {
269
- desktop: getResponsiveValueByScreen(setting?.align, 'desktop'),
270
- tablet: getResponsiveValueByScreen(setting?.align, 'tablet'),
271
- mobile: getResponsiveValueByScreen(setting?.align, 'mobile')
272
- }
273
- };
274
- return filterTruthyStyles(composeStyles);
275
- };
276
- const getFeaturedImageOnlyOneImageStyle = ({ setting, options })=>{
277
- const imageHeightResponsive = getHeightByShapeGlobalSize(setting?.ftShape);
278
- const composeStyles = {
279
- ...makeStyleWithDefault('w', getWidthByShapeGlobalSize(setting?.ftShape, false, true), {
280
- desktop: '--g-ct-w',
281
- tablet: '--g-ct-w',
282
- mobile: '--g-ct-w'
283
- }),
284
- ...options?.enableRadius && composeRadius({
285
- normal: setting?.ftCorner
286
- }),
287
- ...options?.enableHeight && makeStyleResponsive('h', makeHeight(imageHeightResponsive))
288
- };
289
- return filterTruthyStyles(composeStyles);
290
- };
291
-
292
- export { getFeatureImageCarouselItemStyle, getFeatureImageStyle, getFeaturedImageCarouselStyle, getFeaturedImageOnlyOneImageStyle, getGalleryCarouselItemStyle, getGalleryCarouselStyle, getGalleryGridItemStyle, getGalleryGridStyle, getGalleryImageStyle, getWrapContainerStyle };
@@ -1,92 +0,0 @@
1
- import { convertUnitToNumber } from './common.js';
2
-
3
- const handleMouseMove = (event, setting)=>{
4
- const isEnableRoomEffect = setting?.hoverEffect === 'zoom' && setting?.zoomType === 'default';
5
- const isEnableGlassEffect = setting?.hoverEffect === 'zoom' && setting?.zoomType === 'glasses';
6
- const isEnableShowOtherImage = setting?.hoverEffect === 'other';
7
- const isEnableHoverEffect = setting?.hoverEffect !== 'none';
8
- if (!isEnableHoverEffect) return;
9
- const featureImageDom = event.currentTarget.querySelector('img');
10
- const featureImageHoverDom = event.currentTarget.querySelector('img.hover-image');
11
- const zoomLens = event.currentTarget.querySelector('.room-len');
12
- const imagePosition = featureImageDom?.getBoundingClientRect();
13
- const slideWidth = featureImageDom?.clientWidth || 0;
14
- const slideHeight = featureImageDom?.clientHeight || 0;
15
- const zoom = convertUnitToNumber(setting?.zoom, 0);
16
- const zoomValue = !zoom || zoom < 100 ? 1 : zoom / 100 || 1;
17
- const zoomSize = (slideWidth || 1) * (setting?.hoverEffect === 'other' ? 1 : zoomValue);
18
- const zoomSizeHeight = (slideHeight || 1) * (setting?.hoverEffect === 'other' ? 1 : zoomValue);
19
- const imageOffsetX = event.clientX - imagePosition?.x;
20
- const imageOffsetY = event.clientY - imagePosition?.y;
21
- isEnableShowOtherImage && displayOtherImage({
22
- featureImageHoverDom
23
- });
24
- isEnableRoomEffect && event.clientX >= imagePosition?.x && event.clientX <= imagePosition.right && event.clientY >= imagePosition?.y && event.clientY <= imagePosition.bottom && displayZoomImage({
25
- featureImageDom,
26
- featureImageHoverDom,
27
- zoomSize,
28
- zoomSizeHeight,
29
- slideWidth,
30
- imageOffsetX,
31
- imageOffsetY,
32
- isEnableShowOtherImage
33
- });
34
- isEnableGlassEffect && displayZoomLen({
35
- zoomLens,
36
- zoomSize,
37
- zoomValue,
38
- imagePosition,
39
- slideWidth,
40
- slideHeight,
41
- imageOffsetX,
42
- imageOffsetY
43
- });
44
- };
45
- const displayOtherImage = ({ featureImageHoverDom })=>{
46
- if (!featureImageHoverDom) return;
47
- featureImageHoverDom.style.opacity = '1';
48
- featureImageHoverDom.style.top = '0px';
49
- featureImageHoverDom.style.left = '0px';
50
- featureImageHoverDom.style.width = '100%';
51
- };
52
- const displayZoomLen = ({ zoomLens, zoomSize, zoomValue, slideWidth, slideHeight, imageOffsetX, imageOffsetY })=>{
53
- if (!zoomLens) return;
54
- zoomLens.style.opacity = '1';
55
- const w = zoomLens.offsetWidth / 2;
56
- const h = zoomLens.offsetHeight / 2;
57
- const imageHeight = slideHeight || 1;
58
- if (imageOffsetX > slideWidth - w / zoomValue) {
59
- imageOffsetX = slideWidth - w / zoomValue;
60
- }
61
- if (imageOffsetX < w / zoomValue) {
62
- imageOffsetX = w / zoomValue;
63
- }
64
- if (imageOffsetY > imageHeight - h / zoomValue) {
65
- imageOffsetY = imageHeight - h / zoomValue;
66
- }
67
- if (imageOffsetY < h / zoomValue) {
68
- imageOffsetY = h / zoomValue;
69
- }
70
- zoomLens.style.top = imageOffsetY - h + 'px';
71
- zoomLens.style.left = imageOffsetX - w + 'px';
72
- zoomLens.style.backgroundSize = zoomSize + 'px ' + imageHeight * zoomValue + 'px';
73
- zoomLens.style.backgroundPosition = `-${imageOffsetX * zoomValue - w}px -${imageOffsetY * zoomValue - h}px`;
74
- };
75
- const displayZoomImage = ({ featureImageDom, featureImageHoverDom, zoomSize, zoomSizeHeight, slideWidth, imageOffsetX, imageOffsetY, isEnableShowOtherImage = false })=>{
76
- if (!featureImageHoverDom) return;
77
- featureImageHoverDom.style.width = `${zoomSize}px`;
78
- if (!isEnableShowOtherImage) featureImageHoverDom.style.height = `${zoomSizeHeight}px`;
79
- featureImageHoverDom.style.opacity = '1';
80
- const x = imageOffsetX / featureImageDom?.offsetWidth;
81
- const y = imageOffsetY / featureImageDom?.offsetHeight;
82
- featureImageHoverDom.style.top = (featureImageDom?.offsetHeight - featureImageHoverDom.offsetHeight) * y + 'px';
83
- featureImageHoverDom.style.left = (slideWidth - zoomSize) * x + 'px';
84
- };
85
- const handleMouseOut = (event)=>{
86
- const featureImageHoverDom = event.currentTarget.querySelector('img.hover-image');
87
- const zoomLens = event.currentTarget.querySelector('.room-len');
88
- featureImageHoverDom && (featureImageHoverDom.style.opacity = '0');
89
- zoomLens && (zoomLens.style.opacity = '0');
90
- };
91
-
92
- export { handleMouseMove, handleMouseOut };
@@ -1,53 +0,0 @@
1
- import { getResponsiveValueByScreen } from '@gem-sdk/core';
2
-
3
- const devices = [
4
- 'desktop',
5
- 'tablet',
6
- 'mobile'
7
- ];
8
- const isFeatureMedia = (contentType)=>{
9
- if (!contentType) return false;
10
- return [
11
- 'EXTERNAL_VIDEO',
12
- 'MODEL_3D',
13
- 'VIDEO'
14
- ].includes(contentType);
15
- };
16
- const getZoomLenClass = ()=>{
17
- return `!gp-flex gp-absolute gp-opacity-0 gp-h-[150px] gp-w-[150px] gp-cursor-none gp-rounded-full gp-bg-no-repeat gp-shadow-glasses gp-bg-white gp-pointer-events-none`;
18
- };
19
- const getZoomImageClass = ()=>{
20
- return `gp-absolute gp-left-0 gp-top-0 gp-opacity-0 gp-transition-opacity gp-bg-white gp-pointer-events-none`;
21
- };
22
- const getDotStyleForOnlyFeaturedImage = (setting)=>{
23
- let result = {};
24
- devices.forEach((device)=>{
25
- const position = getResponsiveValueByScreen(setting.position, device);
26
- const dotStyle = getResponsiveValueByScreen(setting.dotStyle, device);
27
- result = {
28
- ...result,
29
- [device]: position === 'only-feature' ? dotStyle : 'none'
30
- };
31
- });
32
- return result;
33
- };
34
- const checkRenderFeaturedCarousel = (setting)=>{
35
- const devices = [
36
- 'desktop',
37
- 'mobile',
38
- 'tablet'
39
- ];
40
- let isShow = false;
41
- devices.forEach((device)=>{
42
- const show = checkShowCarousel(setting, device);
43
- if (checkShowCarousel(setting, device)) {
44
- isShow = show;
45
- }
46
- });
47
- return isShow;
48
- };
49
- const checkShowCarousel = (setting, device)=>{
50
- return getResponsiveValueByScreen(setting.position, device) !== 'only-feature' || getResponsiveValueByScreen(setting.ftNavigationPosition, device) !== 'none' || getResponsiveValueByScreen(setting.ftDotStyle, device) !== 'none' || getResponsiveValueByScreen(setting.ftLoop, device) === true || setting.ftDragToScroll === true;
51
- };
52
-
53
- export { checkRenderFeaturedCarousel, getDotStyleForOnlyFeaturedImage, getZoomImageClass, getZoomLenClass, isFeatureMedia };
@@ -1,251 +0,0 @@
1
- import { getResponsiveValueByScreen, cls } from '@gem-sdk/core';
2
- import { getDisplayStyle } from './common.js';
3
- import { convertUnitToNumber } from '../../ProductImages/common/productFeaturedImage.js';
4
-
5
- const getZoomDisplay = (largeViewInPopup)=>{
6
- return getDisplayStyle((device)=>!getResponsiveValueByScreen(largeViewInPopup, device), 'flex');
7
- };
8
- const HORIZONTAL_LAYOUT = [
9
- 'right',
10
- 'left',
11
- 'inside-left',
12
- 'inside-right'
13
- ];
14
- const sizeSettingDefaultForNewLayout = {
15
- desktop: {
16
- shape: 'square',
17
- shapeValue: '1/1',
18
- width: '20%',
19
- height: undefined,
20
- shapeLinked: true
21
- }
22
- };
23
- const getCarouselVerticalConfigByPosition = (position)=>{
24
- const devices = [
25
- 'desktop',
26
- 'mobile',
27
- 'tablet'
28
- ];
29
- let result = {};
30
- devices.forEach((device)=>{
31
- const positionDevice = getResponsiveValueByScreen(position, device);
32
- const isHorizontalLayout = HORIZONTAL_LAYOUT.includes(positionDevice);
33
- if (isHorizontalLayout) result = {
34
- ...result,
35
- [device]: true
36
- };
37
- else result = {
38
- ...result,
39
- [device]: false
40
- };
41
- });
42
- return result;
43
- };
44
- const getMinHeightByPosition = (position, navigationPosition)=>{
45
- const devices = [
46
- 'desktop',
47
- 'mobile',
48
- 'tablet'
49
- ];
50
- const vertical = getCarouselVerticalConfigByPosition(position);
51
- const result = {};
52
- devices.forEach((device)=>{
53
- const navigationStyle = getResponsiveValueByScreen(navigationPosition, device);
54
- const deviceType = device === 'desktop' ? '' : `${device}:`;
55
- result[`${deviceType}!gp-min-h-0`] = !!vertical[device] && navigationStyle === 'outside';
56
- result[`${deviceType}!gp-min-h-full`] = !(vertical[device] && navigationStyle === 'outside');
57
- });
58
- return cls({
59
- ...result
60
- });
61
- };
62
- const getEditorMinHeightClass = (device, position, navigationPosition)=>{
63
- const vertical = getCarouselVerticalConfigByPosition(position);
64
- const navigationStyle = getResponsiveValueByScreen(navigationPosition, device);
65
- return vertical[device] && navigationStyle === 'outside' ? '!gp-min-h-0' : '!gp-min-h-full';
66
- };
67
- const getAllowDotConfig = ()=>{
68
- return {
69
- desktop: false,
70
- tablet: false,
71
- mobile: false
72
- };
73
- };
74
- const getDotStyleConfig = ()=>{
75
- return {
76
- desktop: 'none',
77
- tablet: 'none',
78
- mobile: 'none'
79
- };
80
- };
81
- const getSettingWidthForGridItem = (setting)=>{
82
- let result = {};
83
- const DEVICES = [
84
- 'desktop',
85
- 'mobile',
86
- 'tablet'
87
- ];
88
- DEVICES.forEach((device)=>{
89
- const widthDevice = getResponsiveValueByScreen(setting.shapeByLayout, device)?.width;
90
- const itemSpacingDevice = getResponsiveValueByScreen(setting.itemSpacing, device);
91
- let itemPerLine = 0;
92
- if (widthDevice?.includes('%')) {
93
- itemPerLine = 100 / parseInt(widthDevice);
94
- }
95
- result = {
96
- ...result,
97
- [device]: itemPerLine ? `calc(${widthDevice} - ${itemSpacingDevice} * ${itemPerLine - 1} / ${itemPerLine})` : widthDevice
98
- };
99
- });
100
- return result;
101
- };
102
- const getSettingWidthForCarouselItem = (setting)=>{
103
- let result = {};
104
- const DEVICES = [
105
- 'desktop',
106
- 'mobile',
107
- 'tablet'
108
- ];
109
- DEVICES.forEach((device)=>{
110
- const layout = getResponsiveValueByScreen(setting.position, device);
111
- const isLayoutBottom = layout === 'bottom-center';
112
- const itemWidth = getResponsiveValueByScreen(setting.shapeByLayout, device)?.width;
113
- result = {
114
- ...result,
115
- [device]: isLayoutBottom && itemWidth?.includes('px') ? itemWidth : '100%'
116
- };
117
- });
118
- return result;
119
- };
120
- const getSettingMinWidthForCarouselItem = (setting)=>{
121
- let result = {};
122
- const DEVICES = [
123
- 'desktop',
124
- 'mobile',
125
- 'tablet'
126
- ];
127
- DEVICES.forEach((device)=>{
128
- const layout = getResponsiveValueByScreen(setting.position, device);
129
- const spacing = convertUnitToNumber(getResponsiveValueByScreen(setting.spacing, device), 5);
130
- const isLayoutBottom = layout === 'bottom-center' || layout === 'inside-bottom';
131
- const itemWidth = getResponsiveValueByScreen(setting.shapeByLayout, device)?.width;
132
- let value = '100%';
133
- if (isLayoutBottom) {
134
- const itemsPerSlide = 100 / convertUnitToNumber(itemWidth, 20);
135
- value = itemWidth?.includes('px') ? itemWidth : itemWidth?.includes('%') ? `calc(${itemWidth} - ${(itemsPerSlide - 1) * spacing / itemsPerSlide}px)` : '100%';
136
- }
137
- result = {
138
- ...result,
139
- [device]: value
140
- };
141
- });
142
- return result;
143
- };
144
- const checkDisplayGalleryByWidth = (setting)=>{
145
- let result = {
146
- desktop: true,
147
- tablet: true,
148
- mobile: true
149
- };
150
- const DEVICES = [
151
- 'desktop',
152
- 'mobile',
153
- 'tablet'
154
- ];
155
- DEVICES.forEach((device)=>{
156
- const itemWidth = getResponsiveValueByScreen(setting.shapeByLayout, device)?.width ?? '100%';
157
- const isDisplay = parseInt(itemWidth) !== 0;
158
- result = {
159
- ...result,
160
- [device]: isDisplay
161
- };
162
- });
163
- return result;
164
- };
165
- const getSliderPerShowConfig = (shapeByLayout, position)=>{
166
- let result = {
167
- desktop: 'auto',
168
- tablet: 'auto',
169
- mobile: 'auto'
170
- };
171
- const DEVICES = [
172
- 'desktop',
173
- 'mobile',
174
- 'tablet'
175
- ];
176
- DEVICES.forEach((device)=>{
177
- const layout = getResponsiveValueByScreen(position, device);
178
- const isLayoutBottom = layout === 'bottom-center' || layout === 'inside-bottom';
179
- const itemWidth = getResponsiveValueByScreen(shapeByLayout, device)?.width;
180
- let itemPerShow = 'auto';
181
- if (itemWidth?.includes('%')) {
182
- itemPerShow = parseInt(itemWidth) < 100 ? 100 / parseInt(itemWidth) : 'auto';
183
- }
184
- result = {
185
- ...result,
186
- [device]: isLayoutBottom ? itemPerShow : 'auto'
187
- };
188
- });
189
- return result;
190
- };
191
- const getShapeByLayout = (setting, position)=>{
192
- let shapeByLayout = {};
193
- const DEVICES = [
194
- 'desktop',
195
- 'mobile',
196
- 'tablet'
197
- ];
198
- DEVICES.forEach((device)=>{
199
- const layout = getResponsiveValueByScreen(position, device);
200
- switch(layout){
201
- case 'bottom-center':
202
- case 'bottom-left':
203
- shapeByLayout = {
204
- ...shapeByLayout,
205
- [device]: getResponsiveValueByScreen(setting.shapeForBottom, device)
206
- };
207
- break;
208
- case 'inside-bottom':
209
- shapeByLayout = {
210
- ...shapeByLayout,
211
- [device]: getResponsiveValueByScreen(setting.shapeForInsideBottom ?? sizeSettingDefaultForNewLayout, device)
212
- };
213
- break;
214
- case 'left':
215
- case 'right':
216
- shapeByLayout = {
217
- ...shapeByLayout,
218
- [device]: getResponsiveValueByScreen(setting.shape, device)
219
- };
220
- break;
221
- case 'inside-left':
222
- case 'inside-right':
223
- shapeByLayout = {
224
- ...shapeByLayout,
225
- [device]: getResponsiveValueByScreen(setting.shapeForInside ?? sizeSettingDefaultForNewLayout, device)
226
- };
227
- break;
228
- case 'only-feature':
229
- shapeByLayout = {
230
- ...shapeByLayout,
231
- [device]: getResponsiveValueByScreen(setting.shapeForFtOnly, device)
232
- };
233
- break;
234
- case 'one-col':
235
- shapeByLayout = {
236
- ...shapeByLayout,
237
- [device]: getResponsiveValueByScreen(setting.shapeFor1Col, device)
238
- };
239
- break;
240
- case 'two-col':
241
- shapeByLayout = {
242
- ...shapeByLayout,
243
- [device]: getResponsiveValueByScreen(setting.shapeFor2Col, device)
244
- };
245
- break;
246
- }
247
- });
248
- return shapeByLayout;
249
- };
250
-
251
- export { HORIZONTAL_LAYOUT, checkDisplayGalleryByWidth, getAllowDotConfig, getCarouselVerticalConfigByPosition, getDotStyleConfig, getEditorMinHeightClass, getMinHeightByPosition, getSettingMinWidthForCarouselItem, getSettingWidthForCarouselItem, getSettingWidthForGridItem, getShapeByLayout, getSliderPerShowConfig, getZoomDisplay, sizeSettingDefaultForNewLayout };