@gem-sdk/components 2.0.0-dev.255 → 2.0.0-dev.258

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 (102) hide show
  1. package/dist/cjs/banner/components/HeroBannerItem.js +2 -2
  2. package/dist/cjs/banner/components/HeroBannerItem.liquid.js +1 -1
  3. package/dist/cjs/builder.js +3 -3
  4. package/dist/cjs/cart/components/CartList.js +2 -2
  5. package/dist/cjs/collection/components/CollectionBanner.js +2 -1
  6. package/dist/cjs/collection/components/CollectionBanner.liquid.js +2 -1
  7. package/dist/cjs/estimate-delivery/components/EstimateDate.liquid.js +1 -1
  8. package/dist/cjs/grid/col/Col.js +29 -0
  9. package/dist/cjs/grid/col/Col.liquid.js +25 -0
  10. package/dist/cjs/grid/col/common/getAttr.js +15 -0
  11. package/dist/cjs/grid/col/common/getClass.js +25 -0
  12. package/dist/cjs/grid/{components/Col.liquid.js → col/common/getStyles.js} +22 -16
  13. package/dist/cjs/grid/next.js +3 -3
  14. package/dist/cjs/grid/{components → row}/Row.js +44 -55
  15. package/dist/cjs/grid/row/Row.liquid.js +122 -0
  16. package/dist/cjs/grid/row/commons/common.js +35 -0
  17. package/dist/cjs/grid/row/commons/getAttr.js +20 -0
  18. package/dist/cjs/grid/row/commons/getClass.js +44 -0
  19. package/dist/cjs/grid/row/commons/getData.js +17 -0
  20. package/dist/cjs/grid/row/commons/getStyle.js +102 -0
  21. package/dist/cjs/grid/{components → row/commons}/helpers.js +4 -4
  22. package/dist/cjs/grid/row/hooks/useRowSetting.js +78 -0
  23. package/dist/cjs/grid/{setting/row → row/setting}/configs/uiV2.js +1 -1
  24. package/dist/cjs/grid/{components → section}/Section.js +1 -1
  25. package/dist/cjs/grid/{components → section}/Section.liquid.js +1 -1
  26. package/dist/cjs/grid/{setting → section/setting}/Section.js +4 -4
  27. package/dist/cjs/grid/setting/index.js +3 -3
  28. package/dist/cjs/index.js +3 -3
  29. package/dist/cjs/index.liquid.js +3 -3
  30. package/dist/cjs/post-purchase/callout-banner/components/CalloutBox.js +1 -1
  31. package/dist/cjs/post-purchase/product/components/ProductOffer.js +3 -2
  32. package/dist/cjs/post-purchase/product/settings/product-quantity/configs/uiV2.js +5 -2
  33. package/dist/cjs/product/components/Product.js +2 -1
  34. package/dist/cjs/product/components/Product.liquid.js +2 -1
  35. package/dist/cjs/product/components/ProductList.js +1 -1
  36. package/dist/cjs/product/components/ProductList.liquid.js +1 -1
  37. package/dist/cjs/product/components/ProductQuickView/ProductQuickView.js +2 -2
  38. package/dist/cjs/sticky/components/Sticky.js +1 -1
  39. package/dist/esm/banner/components/HeroBannerItem.js +2 -2
  40. package/dist/esm/banner/components/HeroBannerItem.liquid.js +1 -1
  41. package/dist/esm/builder.js +3 -3
  42. package/dist/esm/cart/components/CartList.js +2 -2
  43. package/dist/esm/collection/components/CollectionBanner.js +2 -1
  44. package/dist/esm/collection/components/CollectionBanner.liquid.js +2 -1
  45. package/dist/esm/estimate-delivery/components/EstimateDate.liquid.js +1 -1
  46. package/dist/esm/grid/col/Col.js +25 -0
  47. package/dist/esm/grid/col/Col.liquid.js +21 -0
  48. package/dist/esm/grid/col/common/getAttr.js +13 -0
  49. package/dist/esm/grid/col/common/getClass.js +23 -0
  50. package/dist/esm/grid/{components/Col.liquid.js → col/common/getStyles.js} +23 -15
  51. package/dist/esm/grid/next.js +3 -3
  52. package/dist/esm/grid/{components → row}/Row.js +41 -52
  53. package/dist/esm/grid/row/Row.liquid.js +118 -0
  54. package/dist/esm/grid/row/commons/common.js +31 -0
  55. package/dist/esm/grid/row/commons/getAttr.js +18 -0
  56. package/dist/esm/grid/row/commons/getClass.js +42 -0
  57. package/dist/esm/grid/row/commons/getData.js +15 -0
  58. package/dist/esm/grid/row/commons/getStyle.js +100 -0
  59. package/dist/esm/grid/{components → row/commons}/helpers.js +4 -4
  60. package/dist/esm/grid/row/hooks/useRowSetting.js +76 -0
  61. package/dist/esm/grid/{setting/row → row/setting}/configs/uiV2.js +1 -1
  62. package/dist/esm/grid/{components → section}/Section.js +1 -1
  63. package/dist/esm/grid/{components → section}/Section.liquid.js +1 -1
  64. package/dist/esm/grid/{setting → section/setting}/Section.js +4 -4
  65. package/dist/esm/grid/setting/index.js +3 -3
  66. package/dist/esm/index.js +3 -3
  67. package/dist/esm/index.liquid.js +3 -3
  68. package/dist/esm/post-purchase/callout-banner/components/CalloutBox.js +1 -1
  69. package/dist/esm/post-purchase/product/components/ProductOffer.js +3 -2
  70. package/dist/esm/post-purchase/product/settings/product-quantity/configs/uiV2.js +5 -2
  71. package/dist/esm/product/components/Product.js +2 -1
  72. package/dist/esm/product/components/Product.liquid.js +2 -1
  73. package/dist/esm/product/components/ProductList.js +1 -1
  74. package/dist/esm/product/components/ProductList.liquid.js +1 -1
  75. package/dist/esm/product/components/ProductQuickView/ProductQuickView.js +2 -2
  76. package/dist/esm/sticky/components/Sticky.js +1 -1
  77. package/dist/types/index.d.ts +23 -38
  78. package/package.json +2 -2
  79. package/dist/cjs/grid/components/Col.js +0 -44
  80. package/dist/cjs/grid/components/Row.liquid.js +0 -141
  81. package/dist/cjs/grid/hooks/useRowStyles.js +0 -153
  82. package/dist/esm/grid/components/Col.js +0 -40
  83. package/dist/esm/grid/components/Row.liquid.js +0 -137
  84. package/dist/esm/grid/hooks/useRowStyles.js +0 -151
  85. /package/dist/cjs/grid/{setting → col/setting}/Col.js +0 -0
  86. /package/dist/cjs/grid/{hooks → row/commons}/getInnerRadius.js +0 -0
  87. /package/dist/cjs/grid/{setting/row → row/setting}/Row.js +0 -0
  88. /package/dist/cjs/grid/{setting/row → row/setting}/configs/presets.js +0 -0
  89. /package/dist/cjs/grid/{setting/row → row/setting}/configs/settings.js +0 -0
  90. /package/dist/cjs/grid/{setting/row → row/setting}/configs/uiV1.js +0 -0
  91. /package/dist/cjs/grid/{setting/section → section/setting}/configs/settings.js +0 -0
  92. /package/dist/cjs/grid/{setting/section → section/setting}/configs/uiV1.js +0 -0
  93. /package/dist/cjs/grid/{setting/section → section/setting}/configs/uiV2.js +0 -0
  94. /package/dist/esm/grid/{setting → col/setting}/Col.js +0 -0
  95. /package/dist/esm/grid/{hooks → row/commons}/getInnerRadius.js +0 -0
  96. /package/dist/esm/grid/{setting/row → row/setting}/Row.js +0 -0
  97. /package/dist/esm/grid/{setting/row → row/setting}/configs/presets.js +0 -0
  98. /package/dist/esm/grid/{setting/row → row/setting}/configs/settings.js +0 -0
  99. /package/dist/esm/grid/{setting/row → row/setting}/configs/uiV1.js +0 -0
  100. /package/dist/esm/grid/{setting/section → section/setting}/configs/settings.js +0 -0
  101. /package/dist/esm/grid/{setting/section → section/setting}/configs/uiV1.js +0 -0
  102. /package/dist/esm/grid/{setting/section → section/setting}/configs/uiV2.js +0 -0
@@ -1,153 +0,0 @@
1
- 'use client';
2
- 'use strict';
3
-
4
- var core = require('@gem-sdk/core');
5
- var React = require('react');
6
- var useInView = require('../../intersection-observer/useInView.js');
7
- var helpers = require('../components/helpers.js');
8
- var getInnerRadius = require('./getInnerRadius.js');
9
-
10
- const useRowStyles = (rowProps)=>{
11
- const { className, children, setting, builderAttrs, builderProps, styles, style, advanced, maxWidthWithEmptyChildren, isNotFullWidth, ...otherProps } = rowProps;
12
- const { isSection, lazy, layout, horizontalAlign, verticalAlign, responsive, inlineAlignment, blockAlignment } = setting ?? {};
13
- const { width, columnGap, fullWidth, background, verticalGutter, verticalGutterMobile } = styles ?? {};
14
- const innerRadius = getInnerRadius.getInnerRadiusExcludeBorder(advanced?.border, advanced?.rounded);
15
- const radiusStyleInner = core.composeRadius(innerRadius);
16
- const mode = core.useEditorMode();
17
- const childHasChildren = React.useMemo(()=>{
18
- return builderProps?.builderData?.childrens?.length;
19
- }, [
20
- builderProps
21
- ]);
22
- const currentDevice = core.useCurrentDevice();
23
- const bgVideoAspectRatioStyle = {
24
- ...core.makeStyleResponsive('aspect', {
25
- desktop: '16/9'
26
- })
27
- };
28
- const isRowEmpty = React.useMemo(()=>{
29
- return core.isEmptyChildren(children) || !childHasChildren;
30
- }, [
31
- childHasChildren,
32
- children
33
- ]);
34
- const [cacheHeightOutViewport, setCacheHeightOutViewport] = React.useState(500);
35
- const bgVideo = React.useMemo(()=>{
36
- return core.getValueByDevice(background, currentDevice);
37
- }, [
38
- background,
39
- currentDevice
40
- ]);
41
- const [ref, inView] = useInView.useInView({
42
- initialInView: !lazy,
43
- triggerOnce: true,
44
- skip: !isSection,
45
- onChange: (inView, node)=>{
46
- if (mode == 'edit' && !inView && node) {
47
- const computedStyle = getComputedStyle(node);
48
- let height = node?.getBoundingClientRect().height;
49
- height -= parseFloat(computedStyle.paddingTop) + parseFloat(computedStyle.paddingBottom);
50
- setCacheHeightOutViewport(height ?? 500);
51
- }
52
- }
53
- });
54
- const sizeStyles = helpers.createStyleObject(width, fullWidth);
55
- const pageType = core.usePageType();
56
- const [wrapStyle, restStyle] = core.splitStyle([
57
- 'pos',
58
- 'top',
59
- 'left',
60
- 'bottom',
61
- 'right',
62
- 'z'
63
- ], style);
64
- const [radiusStyle] = core.splitStyle([
65
- 'bblr',
66
- 'bbrr',
67
- 'btlr',
68
- 'btrr'
69
- ], style);
70
- const getGlobalStyles = ()=>{
71
- return {
72
- ...isSection ? restStyle : style,
73
- ...core.makeStyleResponsive('cg', verticalGutter),
74
- ...core.makeStyleResponsive('rg', verticalGutterMobile),
75
- ...layout ? core.composeGridLayout(layout) : core.makeStyleResponsive('gtc', responsive),
76
- ...core.makeStyleResponsive('w', sizeStyles.content)
77
- };
78
- };
79
- const getPostPurchaseStyle = ()=>{
80
- return pageType === 'POST_PURCHASE' ? {
81
- '--mb': '0px',
82
- '--mt': '0px',
83
- ...core.makeStyleResponsive('cg', columnGap),
84
- ...core.makeStyle({
85
- pc: inlineAlignment
86
- })
87
- } : {};
88
- };
89
- const getRowNormalStyle = (options)=>{
90
- return {
91
- ...core.getStyleBackgroundByDevice(background, options),
92
- ...core.getGradientBgrStyleByDevice(background, {
93
- desktop: true,
94
- tablet: true,
95
- mobile: true
96
- }),
97
- ...core.makeStyleResponsive('pc', horizontalAlign)
98
- };
99
- };
100
- const getWidthForEmptyChildren = ()=>{
101
- const isCustomizeWidth = maxWidthWithEmptyChildren && isRowEmpty && mode === 'edit';
102
- if (!isCustomizeWidth) return {};
103
- const display = core.getResponsiveValue(layout, 'display');
104
- const displayByDevice = display[currentDevice];
105
- return {
106
- width: displayByDevice === 'fit' ? 'fit-content' : '400px'
107
- };
108
- };
109
- const getMarginByWidth = ()=>{
110
- const isCustomizeMargin = isNotFullWidth && !isRowEmpty;
111
- if (!isCustomizeMargin) return {};
112
- return {
113
- marginLeft: '0px',
114
- marginRight: '0px'
115
- };
116
- };
117
- const getStyles = ()=>{
118
- return {
119
- ...getGlobalStyles(),
120
- ...getPostPurchaseStyle(),
121
- ...getRowNormalStyle(),
122
- ...getWidthForEmptyChildren(),
123
- ...getMarginByWidth()
124
- };
125
- };
126
- const getVerticalAlign = ()=>{
127
- if (pageType === 'POST_PURCHASE') {
128
- return {
129
- desktop: blockAlignment,
130
- tablet: blockAlignment,
131
- mobile: blockAlignment
132
- };
133
- }
134
- return verticalAlign;
135
- };
136
- return {
137
- inView,
138
- wrapStyle,
139
- radiusStyle,
140
- radiusStyleInner,
141
- pageType,
142
- sizeStyles,
143
- otherProps,
144
- cacheHeightOutViewport,
145
- bgVideoAspectRatioStyle,
146
- bgVideo,
147
- ref,
148
- getVerticalAlign,
149
- getStyles
150
- };
151
- };
152
-
153
- exports.useRowStyles = useRowStyles;
@@ -1,40 +0,0 @@
1
- 'use client';
2
- import { jsx } from 'react/jsx-runtime';
3
- import { usePageType, makeStyleResponsive, cls, isEmptyChildren } from '@gem-sdk/core';
4
- import ChildrenDroppable from './ChildrenDroppable.js';
5
- import { useMemo } from 'react';
6
-
7
- const Column = ({ children, className, style, builderAttrs, builderProps, advanced, setting, styles, justifyContent, order, ...props })=>{
8
- const pageType = usePageType();
9
- const orderRender = useMemo(()=>{
10
- const od = order ?? styles?.order;
11
- if (pageType === 'POST_PURCHASE') {
12
- return {
13
- desktop: od?.desktop,
14
- tablet: od?.desktop,
15
- mobile: od?.desktop
16
- };
17
- }
18
- return od;
19
- }, [
20
- order,
21
- pageType,
22
- styles?.order
23
- ]);
24
- return /*#__PURE__*/ jsx("div", {
25
- ...props,
26
- ...builderAttrs,
27
- style: {
28
- ...makeStyleResponsive('cg', styles?.gap),
29
- ...makeStyleResponsive('rg', styles?.gap),
30
- ...makeStyleResponsive('ai', styles?.alignItem),
31
- ...makeStyleResponsive('jc', justifyContent ?? styles?.justifyContent),
32
- ...makeStyleResponsive('o', orderRender)
33
- },
34
- className: cls(className, builderProps?.uid, 'gp-relative gp-flex gp-flex-col', styles?.fullWidth ? 'gp-w-full' : ''),
35
- "data-same-height-display-contents": !!setting?.allowSameHeight,
36
- children: isEmptyChildren(children) ? /*#__PURE__*/ jsx(ChildrenDroppable, {}) : children
37
- });
38
- };
39
-
40
- export { Column as default };
@@ -1,137 +0,0 @@
1
- import { splitStyle, template, dataStringify, makeStyleResponsive, composeGridLayout, getStyleBackgroundByDevice, getGradientBgrStyleByDevice, cls, WrapRenderChildren, RenderChildren, RenderIf, isLocalEnv, baseAssetURL, getValueByDevice } from '@gem-sdk/core';
2
- import { createStyleObject } from './helpers.js';
3
- import { getSettingPreloadData } from '../../helpers.js';
4
- import { getResponsiveSetting } from '../../banner/components/common/common.js';
5
- import HTML5Embed from '../../video/components/HTML5Embed.liquid.js';
6
-
7
- const Row = ({ className, children, setting, builderAttrs, builderProps, styles, style, rawChildren, advanced, ...props })=>{
8
- const { isSection, horizontalAlign, verticalAlign, order, layout, responsive } = setting ?? {};
9
- const { fullWidth, width, verticalGutter, verticalGutterMobile, background } = styles ?? {};
10
- const backgroundResponsive = getResponsiveSetting(background || {});
11
- const DEVICES = [
12
- 'desktop',
13
- 'tablet',
14
- 'mobile'
15
- ];
16
- const checkHasBackgroundVideo = ()=>{
17
- return DEVICES.some((item)=>{
18
- const bg = getValueByDevice(background, item);
19
- if (bg) return bg.videoType === 'html5' && bg.videoHtml5 || bg.videoType === 'youtube' && bg.video;
20
- return false;
21
- });
22
- };
23
- const styleObject = createStyleObject(width, fullWidth);
24
- const [wrapStyle, restStyle] = splitStyle([
25
- 'pos',
26
- 'top',
27
- 'left',
28
- 'bottom',
29
- 'right',
30
- 'z'
31
- ], style);
32
- const [radiusStyle] = splitStyle([
33
- 'bblr',
34
- 'bbrr',
35
- 'btlr',
36
- 'btrr'
37
- ], style);
38
- const renderComponentScript = ()=>{
39
- if (!checkHasBackgroundVideo()) return;
40
- return template`
41
- ${RenderIf(isLocalEnv, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="{{ 'gp-row.js' | asset_url }}" defer="defer"></script>`, `<script ${getSettingPreloadData('class="gps-link" delay', 'src')}="${baseAssetURL}/assets-v2/gp-row.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}" defer="defer"></script>`)}
42
- `;
43
- };
44
- const embed = ()=>{
45
- const videoType = backgroundResponsive.desktop?.videoType;
46
- const videoTypeTablet = backgroundResponsive.tablet?.videoType;
47
- const videoTypeMobile = backgroundResponsive.mobile?.videoType;
48
- if (videoType == 'html5' || videoTypeTablet == 'html5' || videoTypeMobile == 'html5') {
49
- return HTML5Embed({
50
- uid: builderProps?.uid,
51
- muted: true,
52
- loop: backgroundResponsive.desktop?.loop,
53
- controls: false,
54
- autoplay: true,
55
- src: '',
56
- title: 'Video',
57
- className: 'gp-relative',
58
- style: {
59
- transform: 'translateY(-50%)',
60
- top: '50%'
61
- }
62
- });
63
- }
64
- return;
65
- };
66
- const element = template`
67
- <gp-row
68
- gp-data='${dataStringify({
69
- background: background,
70
- uid: builderProps?.uid
71
- }).replaceAll("'", '&#039;')}'
72
- ${{
73
- ...props,
74
- id: builderProps?.uid,
75
- 'data-id': builderProps?.uid
76
- }}
77
- style="${{
78
- ...isSection ? restStyle : style,
79
- ...makeStyleResponsive('cg', verticalGutter),
80
- ...makeStyleResponsive('rg', verticalGutterMobile),
81
- ...makeStyleResponsive('pc', horizontalAlign),
82
- ...layout ? composeGridLayout(layout) : makeStyleResponsive('gtc', responsive),
83
- ...makeStyleResponsive('w', styleObject.content),
84
- ...getStyleBackgroundByDevice(background, {
85
- liquid: true
86
- }),
87
- ...getGradientBgrStyleByDevice(background, {
88
- desktop: true,
89
- tablet: true,
90
- mobile: true
91
- })
92
- }}"
93
- class="${cls(className, builderProps?.uid, advanced?.cssClass, 'gp-relative gp-mx-auto gp-mb-0 gp-grid gp-max-w-full gp-transition-colors gp-duration-200 gp-ease-in-out [&_*]:gp-max-w-full')}"
94
- >
95
- <div class="gp-bg-video gp-absolute gp-overflow-hidden gp-w-full gp-h-full top-0 left-0" style="${{
96
- ...radiusStyle
97
- }}">
98
- ${embed()}
99
-
100
- </div>
101
- ${WrapRenderChildren({
102
- uid: builderProps?.uid || '',
103
- customProps: rawChildren?.[0].customProps
104
- }, rawChildren?.map((child)=>{
105
- if (child) {
106
- return RenderChildren({
107
- ...child,
108
- order,
109
- layout,
110
- justifyContent: verticalAlign
111
- });
112
- }
113
- }))}
114
- ${renderComponentScript()}
115
- </gp-row>
116
- `;
117
- const elementTag = isSection ? 'section' : 'div';
118
- return template`
119
- ${RenderIf(!!styles?.preloadBgImage, `${RenderIf(!!background?.desktop?.image?.src, `<link rel="preload" href="${background?.desktop?.image?.src}" as="image" />`)}${RenderIf(!!background?.tablet?.image?.src, `<link rel="preload" href="${background?.tablet?.image?.src}" as="image" />`)}${RenderIf(!!background?.mobile?.image?.src, `<link rel="preload" href="${background?.mobile?.image?.src}" as="image" />`)}`)}
120
- ${template`
121
- ${RenderIf(!!isSection, `{% assign locationOrigin = request.origin | append: routes.root_url | split: '/' | join: '/' %}`)}
122
- <${elementTag}
123
- class="gp-max-w-full ${isSection ? getSettingPreloadData('gps-lazy') : ''}"
124
- data-same-height-display-contents="${!!setting?.allowSameHeight}"
125
- style="${{
126
- ...wrapStyle,
127
- ...makeStyleResponsive('pl', styleObject.padding),
128
- ...makeStyleResponsive('pr', styleObject.padding)
129
- }}"
130
- >
131
- ${element}
132
- </${elementTag}>
133
- `}
134
- `;
135
- };
136
-
137
- export { Row as default };
@@ -1,151 +0,0 @@
1
- 'use client';
2
- import { composeRadius, useEditorMode, useCurrentDevice, makeStyleResponsive, isEmptyChildren, getValueByDevice, usePageType, splitStyle, composeGridLayout, makeStyle, getStyleBackgroundByDevice, getGradientBgrStyleByDevice, getResponsiveValue } from '@gem-sdk/core';
3
- import { useMemo, useState } from 'react';
4
- import { useInView } from '../../intersection-observer/useInView.js';
5
- import { createStyleObject } from '../components/helpers.js';
6
- import { getInnerRadiusExcludeBorder } from './getInnerRadius.js';
7
-
8
- const useRowStyles = (rowProps)=>{
9
- const { className, children, setting, builderAttrs, builderProps, styles, style, advanced, maxWidthWithEmptyChildren, isNotFullWidth, ...otherProps } = rowProps;
10
- const { isSection, lazy, layout, horizontalAlign, verticalAlign, responsive, inlineAlignment, blockAlignment } = setting ?? {};
11
- const { width, columnGap, fullWidth, background, verticalGutter, verticalGutterMobile } = styles ?? {};
12
- const innerRadius = getInnerRadiusExcludeBorder(advanced?.border, advanced?.rounded);
13
- const radiusStyleInner = composeRadius(innerRadius);
14
- const mode = useEditorMode();
15
- const childHasChildren = useMemo(()=>{
16
- return builderProps?.builderData?.childrens?.length;
17
- }, [
18
- builderProps
19
- ]);
20
- const currentDevice = useCurrentDevice();
21
- const bgVideoAspectRatioStyle = {
22
- ...makeStyleResponsive('aspect', {
23
- desktop: '16/9'
24
- })
25
- };
26
- const isRowEmpty = useMemo(()=>{
27
- return isEmptyChildren(children) || !childHasChildren;
28
- }, [
29
- childHasChildren,
30
- children
31
- ]);
32
- const [cacheHeightOutViewport, setCacheHeightOutViewport] = useState(500);
33
- const bgVideo = useMemo(()=>{
34
- return getValueByDevice(background, currentDevice);
35
- }, [
36
- background,
37
- currentDevice
38
- ]);
39
- const [ref, inView] = useInView({
40
- initialInView: !lazy,
41
- triggerOnce: true,
42
- skip: !isSection,
43
- onChange: (inView, node)=>{
44
- if (mode == 'edit' && !inView && node) {
45
- const computedStyle = getComputedStyle(node);
46
- let height = node?.getBoundingClientRect().height;
47
- height -= parseFloat(computedStyle.paddingTop) + parseFloat(computedStyle.paddingBottom);
48
- setCacheHeightOutViewport(height ?? 500);
49
- }
50
- }
51
- });
52
- const sizeStyles = createStyleObject(width, fullWidth);
53
- const pageType = usePageType();
54
- const [wrapStyle, restStyle] = splitStyle([
55
- 'pos',
56
- 'top',
57
- 'left',
58
- 'bottom',
59
- 'right',
60
- 'z'
61
- ], style);
62
- const [radiusStyle] = splitStyle([
63
- 'bblr',
64
- 'bbrr',
65
- 'btlr',
66
- 'btrr'
67
- ], style);
68
- const getGlobalStyles = ()=>{
69
- return {
70
- ...isSection ? restStyle : style,
71
- ...makeStyleResponsive('cg', verticalGutter),
72
- ...makeStyleResponsive('rg', verticalGutterMobile),
73
- ...layout ? composeGridLayout(layout) : makeStyleResponsive('gtc', responsive),
74
- ...makeStyleResponsive('w', sizeStyles.content)
75
- };
76
- };
77
- const getPostPurchaseStyle = ()=>{
78
- return pageType === 'POST_PURCHASE' ? {
79
- '--mb': '0px',
80
- '--mt': '0px',
81
- ...makeStyleResponsive('cg', columnGap),
82
- ...makeStyle({
83
- pc: inlineAlignment
84
- })
85
- } : {};
86
- };
87
- const getRowNormalStyle = (options)=>{
88
- return {
89
- ...getStyleBackgroundByDevice(background, options),
90
- ...getGradientBgrStyleByDevice(background, {
91
- desktop: true,
92
- tablet: true,
93
- mobile: true
94
- }),
95
- ...makeStyleResponsive('pc', horizontalAlign)
96
- };
97
- };
98
- const getWidthForEmptyChildren = ()=>{
99
- const isCustomizeWidth = maxWidthWithEmptyChildren && isRowEmpty && mode === 'edit';
100
- if (!isCustomizeWidth) return {};
101
- const display = getResponsiveValue(layout, 'display');
102
- const displayByDevice = display[currentDevice];
103
- return {
104
- width: displayByDevice === 'fit' ? 'fit-content' : '400px'
105
- };
106
- };
107
- const getMarginByWidth = ()=>{
108
- const isCustomizeMargin = isNotFullWidth && !isRowEmpty;
109
- if (!isCustomizeMargin) return {};
110
- return {
111
- marginLeft: '0px',
112
- marginRight: '0px'
113
- };
114
- };
115
- const getStyles = ()=>{
116
- return {
117
- ...getGlobalStyles(),
118
- ...getPostPurchaseStyle(),
119
- ...getRowNormalStyle(),
120
- ...getWidthForEmptyChildren(),
121
- ...getMarginByWidth()
122
- };
123
- };
124
- const getVerticalAlign = ()=>{
125
- if (pageType === 'POST_PURCHASE') {
126
- return {
127
- desktop: blockAlignment,
128
- tablet: blockAlignment,
129
- mobile: blockAlignment
130
- };
131
- }
132
- return verticalAlign;
133
- };
134
- return {
135
- inView,
136
- wrapStyle,
137
- radiusStyle,
138
- radiusStyleInner,
139
- pageType,
140
- sizeStyles,
141
- otherProps,
142
- cacheHeightOutViewport,
143
- bgVideoAspectRatioStyle,
144
- bgVideo,
145
- ref,
146
- getVerticalAlign,
147
- getStyles
148
- };
149
- };
150
-
151
- export { useRowStyles };
File without changes
File without changes