@gem-sdk/core 2.0.0-dev.1272 → 2.0.0-dev.1283
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/ComponentWrapperPreview.js +1 -1
- package/dist/cjs/helpers/compose-advance-style.js +1 -1
- package/dist/cjs/helpers/typography.js +10 -10
- package/dist/cjs/types/animations.js +1 -1
- package/dist/esm/components/ComponentWrapperPreview.js +1 -1
- package/dist/esm/helpers/compose-advance-style.js +1 -1
- package/dist/esm/helpers/typography.js +10 -10
- package/dist/esm/types/animations.js +1 -1
- package/dist/types/index.d.ts +7 -5
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),react=require("react"),composeAdvanceStyle=require("../helpers/compose-advance-style.js"),useInteraction=require("../hooks/useInteraction.js"),constant=require("./constant.js"),RenderCustomCode=require("./RenderCustomCode.js"),ComponentToolbarPreview=require("./ComponentToolbarPreview.js");require("zustand");var cls=require("../helpers/cls.js");require("swr"),require("../helpers/convert.js"),require("@gem-sdk/adapter-shopify"),require("swr/mutation");var shop=require("../hooks/shop.js");require("swr/infinite"),require("vanilla-lazyload"),require("../hooks/useCartUI.js"),require("../hooks/useStickyStore.js"),require("../types/builder.js"),require("../types/custom.js"),require("../types/animations.js");var ComponentAnimation=require("./ComponentAnimation.js");const ComponentWrapperPreview=({children:e,...t})=>{react.useEffect(()=>{let e=new CustomEvent("editor:component:render",{bubbles:!0,detail:{componentUid:t.uid}});window.dispatchEvent(e)},[t.uid]);let{getAnimationByUid:n}=useInteraction.useInteraction(),o=n(t.uid);o&&(t.advanced={...t.advanced,animation:{desktop:o,tablet:o,mobile:o}});let a=shop.usePageType();if("section"===t.type)return null;let i={};if("Section"===t.tag&&t.isThemeSection&&(i["data-theme-section"]=!0),"Section"===t.tag&&t.isShopifySection&&(i["data-shopify-section"]=!0,i["data-toolbar-wrap"]=!0),t.editorConfigs){let e=t.editorConfigs;e.placeholder?.notAppendBeforeAfter&&(i["data-placeholder-not-append-before-after"]=!0),e.placeholder?.notAppendLeftRight&&(i["data-placeholder-not-append-left-right"]=!0),e.toolbar?.parent&&(i["data-toolbar-parent"]=!0),e.component?.noDelete&&(i["data-component-no-delete"]=!0),e.component?.noDuplicate&&(i["data-component-no-duplicate"]=!0),e.component?.noDragDrop&&(i["data-component-no-drag-drop"]=!0),e.component?.noSetting&&(i["data-component-no-setting"]=!0),e.component?.isThirdParty&&(i["data-component-is-third-party"]=!0),e.toolbar?.hide&&(i["data-toolbar-hide"]=!0),e.slots?.children&&(i["data-slots-children"]=!0),e.toolbar?.hide||(i["data-toolbar-wrap"]=!0)}t?.editorConfigs?.toolbar?.hide||(i["data-toolbar-wrap"]=!0);let s=e=>"GP_FUNNEL_PAGE"===a&&["ProductList","Header"].includes(e),r=composeAdvanceStyle.composeAdvanceStyle(t.advanced,t.tag,a),d=t.advanced,p={...i,"data-uid":t.uid,"data-component-type":"component","data-component-tag":t.tag,"data-component-label":t.label,"data-not-droppable":s(t.tag)?"true":"false"},l=({name:e,visibility:t})=>jsxRuntime.jsxs("div",{className:cls.cls("gp-flex gp-items-center gp-justify-center gp-gap-[8px] gp-bg-[#F4F4F4] gp-p-[16px] gp-border gp-border-[#D6D6D6]",{"gp-opacity-60":!t}),children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M19.1475 5.16194C19.1416 5.1148 19.1197 5.0713 19.0857 5.03911C19.0516 5.00692 19.0076 4.9881 18.9614 4.98597C18.8835 4.98597 17.3469 4.95397 17.3469 4.95397C17.3469 4.95397 16.0588 3.67419 15.9342 3.5311C15.8104 3.40312 15.5619 3.43512 15.4684 3.46711L14.8166 3.67508C14.7361 3.40491 14.6323 3.14259 14.5067 2.89121C14.0566 1.99536 13.3727 1.51544 12.5659 1.51544C12.5044 1.51544 12.4577 1.51544 12.3954 1.53144C12.3642 1.49945 12.3486 1.46745 12.3175 1.45145C11.9608 1.06752 11.5107 0.875552 10.967 0.891549C9.92824 0.923543 8.88772 1.70741 8.03419 3.08318C7.44467 4.05901 6.99453 5.27392 6.8543 6.21776C5.65969 6.6017 4.82087 6.87365 4.79057 6.87365C4.18461 7.06562 4.16903 7.08161 4.09199 7.67351C4.06082 8.12144 2.47754 20.7415 2.47754 20.7415L15.7636 23.1091L21.522 21.6374C21.5064 21.6374 19.1631 5.27392 19.1475 5.16194ZM14.1492 3.89904C13.8062 4.00572 13.4648 4.11772 13.1251 4.23498C13.1251 3.69108 13.0472 2.92321 12.8143 2.28331C13.6064 2.41129 13.9942 3.33914 14.1492 3.89904ZM12.4265 4.44206C11.7279 4.66602 10.9679 4.90598 10.207 5.14594C10.4243 4.29808 10.8277 3.46623 11.3245 2.90632C11.533 2.66965 11.7863 2.47913 12.069 2.34641C12.3806 2.9712 12.4421 3.85105 12.4265 4.44206ZM10.9982 1.61143C11.2466 1.61143 11.4483 1.65942 11.6197 1.7874C11.3127 1.95192 11.0387 2.17444 10.8121 2.44329C10.1455 3.17916 9.63305 4.31408 9.43135 5.4179C8.79423 5.62586 8.17356 5.81783 7.61521 5.9938C7.98744 4.25009 9.39933 1.65942 10.9982 1.61143Z",fill:"#95BF47"}),jsxRuntime.jsx("path",{d:"M18.9647 4.94709C18.8851 4.94709 17.3155 4.91503 17.3155 4.91503C17.3155 4.91503 15.9981 3.63242 15.8716 3.48812C15.8261 3.43951 15.7635 3.41074 15.6973 3.40796V23.1094L21.5828 21.6344L19.1709 5.12345C19.1399 5.01122 19.0444 4.94709 18.9647 4.94709Z",fill:"#5E8E3E"}),jsxRuntime.jsx("path",{d:"M13.0575 8.51577L12.3029 10.8908C12.3029 10.8908 11.4602 10.5663 10.4599 10.6253C8.98595 10.6991 8.98595 11.4809 8.98595 11.6727C9.07404 12.7348 12.39 12.9709 12.5828 15.4631C12.7238 17.4251 11.3545 18.7675 9.35396 18.8708C6.96778 18.9733 5.65137 17.7939 5.65137 17.7939L6.16032 15.9794C6.16032 15.9794 7.49435 16.8203 8.5465 16.7613C9.23162 16.7318 9.4949 16.245 9.45967 15.9204C9.35396 14.5337 6.65165 14.6223 6.47645 12.3365C6.33551 10.4188 7.82712 8.48626 11.1265 8.30924C12.4076 8.23548 13.0575 8.51577 13.0575 8.51577Z",fill:"white"})]}),jsxRuntime.jsx("span",{className:"gp-text-[#212121] gp-text-[14px] gp-leading-[24px] gp-font-medium",children:e})]});return constant.disableWrap.includes(t.tag)&&react.isValidElement(e)?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ComponentAnimation.default,{...t}),jsxRuntime.jsx(RenderCustomCode.default,{uid:t.uid,advanced:d}),jsxRuntime.jsxs(e.type,{className:d?.cssClass,...e.props,style:r,builderAttrs:p,advanced:d,children:[t.isShopifySection?jsxRuntime.jsx(l,{name:t.name??"",visibility:!!t.isShopifyVisibility}):e.props.children,jsxRuntime.jsx(ComponentToolbarPreview.default,{...t})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ComponentAnimation.default,{...t}),jsxRuntime.jsx(RenderCustomCode.default,{uid:t.uid,advanced:d}),jsxRuntime.jsxs("div",{style:constant.excludeApplyStyle.includes(t.tag)?{"--mb":r?.["--mb"],"--mb-tablet":r?.["--mb-tablet"],"--mb-mobile":r?.["--mb-mobile"]}:r,className:`${t.uid} ${t.advanced?.cssClass?t.advanced?.cssClass:""}`,...p,children:[!constant.excludeApplyStyle.includes(t.tag)&&e,react.isValidElement(e)&&constant.excludeApplyStyle.includes(t.tag)&&jsxRuntime.jsx(e.type,{...e.props,style:r,advanced:d}),jsxRuntime.jsx(ComponentToolbarPreview.default,{...t})]})]})};var ComponentWrapperPreview$1=react.memo(ComponentWrapperPreview);exports.default=ComponentWrapperPreview$1;
|
|
2
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),react=require("react"),composeAdvanceStyle=require("../helpers/compose-advance-style.js"),useInteraction=require("../hooks/useInteraction.js"),constant=require("./constant.js"),RenderCustomCode=require("./RenderCustomCode.js"),ComponentToolbarPreview=require("./ComponentToolbarPreview.js");require("zustand");var cls=require("../helpers/cls.js");require("swr"),require("../helpers/convert.js"),require("@gem-sdk/adapter-shopify"),require("swr/mutation");var shop=require("../hooks/shop.js");require("swr/infinite"),require("vanilla-lazyload"),require("../hooks/useCartUI.js"),require("../hooks/useStickyStore.js"),require("../types/builder.js"),require("../types/custom.js"),require("../types/animations.js");var ComponentAnimation=require("./ComponentAnimation.js");const ComponentWrapperPreview=({children:e,...t})=>{react.useEffect(()=>{let e=new CustomEvent("editor:component:render",{bubbles:!0,detail:{componentUid:t.uid}});window.dispatchEvent(e)},[t.uid]);let{getAnimationByUid:n}=useInteraction.useInteraction(),o=n(t.uid);o&&(t.advanced={...t.advanced,animation:{desktop:o,tablet:o,mobile:o}});let a=shop.usePageType();if("section"===t.type)return null;let i={};if("Section"===t.tag&&t.isThemeSection&&(i["data-theme-section"]=!0),"Section"===t.tag&&t.isShopifySection&&(i["data-shopify-section"]=!0,i["data-toolbar-wrap"]=!0),t.editorConfigs){let e=t.editorConfigs;e.placeholder?.notAppendBeforeAfter&&(i["data-placeholder-not-append-before-after"]=!0),e.placeholder?.notAppendLeftRight&&(i["data-placeholder-not-append-left-right"]=!0),e.toolbar?.parent&&(i["data-toolbar-parent"]=!0),e.component?.noDelete&&(i["data-component-no-delete"]=!0),e.component?.noDuplicate&&(i["data-component-no-duplicate"]=!0),e.component?.noDragDrop&&(i["data-component-no-drag-drop"]=!0),e.component?.noSetting&&(i["data-component-no-setting"]=!0),e.component?.isThirdParty&&(i["data-component-is-third-party"]=!0),e.toolbar?.hide&&(i["data-toolbar-hide"]=!0),e.slots?.children&&(i["data-slots-children"]=!0),e.toolbar?.hide||(i["data-toolbar-wrap"]=!0)}t?.editorConfigs?.toolbar?.hide||(i["data-toolbar-wrap"]=!0);let s=e=>"GP_FUNNEL_PAGE"===a&&["ProductList","ProductListV3","Header"].includes(e),r=composeAdvanceStyle.composeAdvanceStyle(t.advanced,t.tag,a),d=t.advanced,p={...i,"data-uid":t.uid,"data-component-type":"component","data-component-tag":t.tag,"data-component-label":t.label,"data-not-droppable":s(t.tag)?"true":"false"},l=({name:e,visibility:t})=>jsxRuntime.jsxs("div",{className:cls.cls("gp-flex gp-items-center gp-justify-center gp-gap-[8px] gp-bg-[#F4F4F4] gp-p-[16px] gp-border gp-border-[#D6D6D6]",{"gp-opacity-60":!t}),children:[jsxRuntime.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M19.1475 5.16194C19.1416 5.1148 19.1197 5.0713 19.0857 5.03911C19.0516 5.00692 19.0076 4.9881 18.9614 4.98597C18.8835 4.98597 17.3469 4.95397 17.3469 4.95397C17.3469 4.95397 16.0588 3.67419 15.9342 3.5311C15.8104 3.40312 15.5619 3.43512 15.4684 3.46711L14.8166 3.67508C14.7361 3.40491 14.6323 3.14259 14.5067 2.89121C14.0566 1.99536 13.3727 1.51544 12.5659 1.51544C12.5044 1.51544 12.4577 1.51544 12.3954 1.53144C12.3642 1.49945 12.3486 1.46745 12.3175 1.45145C11.9608 1.06752 11.5107 0.875552 10.967 0.891549C9.92824 0.923543 8.88772 1.70741 8.03419 3.08318C7.44467 4.05901 6.99453 5.27392 6.8543 6.21776C5.65969 6.6017 4.82087 6.87365 4.79057 6.87365C4.18461 7.06562 4.16903 7.08161 4.09199 7.67351C4.06082 8.12144 2.47754 20.7415 2.47754 20.7415L15.7636 23.1091L21.522 21.6374C21.5064 21.6374 19.1631 5.27392 19.1475 5.16194ZM14.1492 3.89904C13.8062 4.00572 13.4648 4.11772 13.1251 4.23498C13.1251 3.69108 13.0472 2.92321 12.8143 2.28331C13.6064 2.41129 13.9942 3.33914 14.1492 3.89904ZM12.4265 4.44206C11.7279 4.66602 10.9679 4.90598 10.207 5.14594C10.4243 4.29808 10.8277 3.46623 11.3245 2.90632C11.533 2.66965 11.7863 2.47913 12.069 2.34641C12.3806 2.9712 12.4421 3.85105 12.4265 4.44206ZM10.9982 1.61143C11.2466 1.61143 11.4483 1.65942 11.6197 1.7874C11.3127 1.95192 11.0387 2.17444 10.8121 2.44329C10.1455 3.17916 9.63305 4.31408 9.43135 5.4179C8.79423 5.62586 8.17356 5.81783 7.61521 5.9938C7.98744 4.25009 9.39933 1.65942 10.9982 1.61143Z",fill:"#95BF47"}),jsxRuntime.jsx("path",{d:"M18.9647 4.94709C18.8851 4.94709 17.3155 4.91503 17.3155 4.91503C17.3155 4.91503 15.9981 3.63242 15.8716 3.48812C15.8261 3.43951 15.7635 3.41074 15.6973 3.40796V23.1094L21.5828 21.6344L19.1709 5.12345C19.1399 5.01122 19.0444 4.94709 18.9647 4.94709Z",fill:"#5E8E3E"}),jsxRuntime.jsx("path",{d:"M13.0575 8.51577L12.3029 10.8908C12.3029 10.8908 11.4602 10.5663 10.4599 10.6253C8.98595 10.6991 8.98595 11.4809 8.98595 11.6727C9.07404 12.7348 12.39 12.9709 12.5828 15.4631C12.7238 17.4251 11.3545 18.7675 9.35396 18.8708C6.96778 18.9733 5.65137 17.7939 5.65137 17.7939L6.16032 15.9794C6.16032 15.9794 7.49435 16.8203 8.5465 16.7613C9.23162 16.7318 9.4949 16.245 9.45967 15.9204C9.35396 14.5337 6.65165 14.6223 6.47645 12.3365C6.33551 10.4188 7.82712 8.48626 11.1265 8.30924C12.4076 8.23548 13.0575 8.51577 13.0575 8.51577Z",fill:"white"})]}),jsxRuntime.jsx("span",{className:"gp-text-[#212121] gp-text-[14px] gp-leading-[24px] gp-font-medium",children:e})]});return constant.disableWrap.includes(t.tag)&&react.isValidElement(e)?jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ComponentAnimation.default,{...t}),jsxRuntime.jsx(RenderCustomCode.default,{uid:t.uid,advanced:d}),jsxRuntime.jsxs(e.type,{className:d?.cssClass,...e.props,style:r,builderAttrs:p,advanced:d,children:[t.isShopifySection?jsxRuntime.jsx(l,{name:t.name??"",visibility:!!t.isShopifyVisibility}):e.props.children,jsxRuntime.jsx(ComponentToolbarPreview.default,{...t})]})]}):jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx(ComponentAnimation.default,{...t}),jsxRuntime.jsx(RenderCustomCode.default,{uid:t.uid,advanced:d}),jsxRuntime.jsxs("div",{style:constant.excludeApplyStyle.includes(t.tag)?{"--mb":r?.["--mb"],"--mb-tablet":r?.["--mb-tablet"],"--mb-mobile":r?.["--mb-mobile"]}:r,className:`${t.uid} ${t.advanced?.cssClass?t.advanced?.cssClass:""}`,...p,children:[!constant.excludeApplyStyle.includes(t.tag)&&e,react.isValidElement(e)&&constant.excludeApplyStyle.includes(t.tag)&&jsxRuntime.jsx(e.type,{...e.props,style:r,advanced:d}),jsxRuntime.jsx(ComponentToolbarPreview.default,{...t})]})]})};var ComponentWrapperPreview$1=react.memo(ComponentWrapperPreview);exports.default=ComponentWrapperPreview$1;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var borders=require("./borders.js"),colors=require("./colors.js"),constant=require("./constant.js"),makeStyle=require("./make-style.js"),radius=require("./radius.js"),shadow=require("./shadow.js"),device=require("../constants/device.js");const composeSpacing=({source:e,spacing:t,type:o,suffix:r=""})=>{let{top:a,left:s,bottom:n,right:i}=t;a&&(e[`--${o}t${r}`]=a),s&&(e[`--${o}l${r}`]=s),n&&(e[`--${o}b${r}`]=n),i&&(e[`--${o}r${r}`]=i)},composeSpacingV2=({source:e,spacing:t,suffix:o="",tag:r=""})=>{if(t&&t.margin){let{top:a,left:s,bottom:n,right:i}=t.margin;a&&(e[`--mt${o}`]=a),s&&(e[`--ml${o}`]=constant.layoutComponent.includes(r)&&"0px"===s?"auto":s),n&&(e[`--mb${o}`]=n),i&&(e[`--mr${o}`]=constant.layoutComponent.includes(r)&&"0px"===i?"auto":i)}if(t&&t.padding){let{top:r,left:a,bottom:s,right:n}=t.padding;r&&(e[`--pt${o}`]=r),a&&(e[`--pl${o}`]=a),s&&(e[`--pb${o}`]=s),n&&(e[`--pr${o}`]=n)}},getAttrValue=(e,t,o)=>{if(null!=t)switch(e){case"bgc":case"c":return colors.isColor(t.toString())?t:`var(--g-c-${t})`;case"d":if(!t)return"none";if(t&&o&&constant.layoutComponent.includes(o))return"grid";return"block";case"animation":case"hasBoxShadow":case"rounded":case"boxShadow":case"border":return;default:return t}},postPurchasePaddingMapping={loose:"21px",extraLoose:"38px",tight:"9px",extraTight:"5px",base:"14px"},composeAdvanceStyleForPostPurchase=(e,t)=>{if(!e)return{};let o={};return Object.keys(e).forEach(r=>{let a=e[r];if("blockPadding"===r){let e=postPurchasePaddingMapping[a];o["--pb"]=getAttrValue(r,e,t),o["--pt"]=getAttrValue(r,e,t),o["--mb"]="0px",o["--mt"]="0px"}if("inlinePadding"===r){let e=postPurchasePaddingMapping[a];o["--pl"]=getAttrValue(r,e,t),o["--pr"]=getAttrValue(r,e,t)}}),o};function composeAdvanceStyle(e,t,o){if(!e)return{};let r={},a=["hover","normal"];Object.keys(e).forEach(s=>{let n=e[s];if("cssClass"===s||null==n)return;let i=e.hasBoxShadow?e.hasBoxShadow:{};if("object"==typeof n){if(Array.isArray(n))return;Object.keys(n).forEach(o=>{if(device.DEVICES.includes(o)){let e=n[o];if(void 0!==e){"border"===s&&Object.assign(r,borders.handleConvertBorderStyle(n),borders.handleConvertBorderWidth(n),borders.handleConvertBorderColor(n)),"rounded"===s&&Object.assign(r,radius.composeRadius(n,["normal"])),"boxShadow"===s&&Object.assign(r,shadow.getResponsiveStyleShadow(n,"box-shadow",i));let a=getAttrValue(s,e,t);if("desktop"===o)switch(s){case"padding":composeSpacing({source:r,spacing:e,type:"p"});break;case"margin":composeSpacing({source:r,spacing:e,type:"m"});break;case"spacing-setting":composeSpacingV2({source:r,spacing:e,tag:t});break;case"m":case"p":break;default:a&&(r[`--${s}`]=a)}else switch(s){case"padding":composeSpacing({source:r,spacing:e,type:"p",suffix:`-${o}`});break;case"margin":composeSpacing({source:r,spacing:e,type:"m",suffix:`-${o}`});break;case"spacing-setting":composeSpacingV2({source:r,spacing:e,suffix:`-${o}`,tag:t});break;case"m":case"p":break;default:a&&(r[`--${s}-${o}`]=a)}}}else if(a.includes(o))switch(s){case"hasBoxShadow":break;case"boxShadow":Object.assign(r,shadow.getStyleShadowState(n,"box-shadow",i))}else"border"===s&&("none"===n.border&&(n.border="solid",n.color="#121212",n.isCustom=!0,n.width="0px",n.position="all"),Object.assign(r,borders.getBorderStyle(n))),"rounded"===s&&Object.assign(r,radius.getCornerCSSFromGlobal(n)),"hasBoxShadow"===s&&Object.assign(r,shadow.getStyleShadow({value:e.boxShadow,styleAppliedFor:"box-shadow",isEnableShadow:e.hasBoxShadow})),"boxShadow"===s&&Object.assign(r,shadow.getStyleShadow({value:n,styleAppliedFor:"box-shadow",isEnableShadow:e.hasBoxShadow}))})}else{let o=getAttrValue(s,n,t);o&&(r[`--${s}`]=o),"hasBoxShadow"===s&&e.boxShadow&&Object.assign(r,shadow.getStyleShadow({value:e.boxShadow,styleAppliedFor:"box-shadow",isEnableShadow:e.hasBoxShadow}))}if("blockPadding"===s&&"POST_PURCHASE"===o){let e=postPurchasePaddingMapping[n];r["--pb"]=getAttrValue(s,e,t),r["--pt"]=getAttrValue(s,e,t),r["--mb"]="0px",r["--mt"]="0px"}if("inlinePadding"===s&&"POST_PURCHASE"===o){let e=postPurchasePaddingMapping[n];r["--pl"]=getAttrValue(s,e,t),r["--pr"]=getAttrValue(s,e,t)}});let s="POST_PURCHASE"===o?composeAdvanceStyleForPostPurchase(e,t):{};return{...r,...s}}const convertBoxShadowV1ToV2=(e,t,o)=>{let r=["Section","Row","Text","Heading","Image","Button","HeroBanner","ImageComparison","Countdown","Video"],a=["ProductTitle","ProductDescription","ProductPrice","ProductVendor","Product","ProductSku","StockCounter","Sticky","ProductBadge","ProductViewMore","ProductButton","DynamicCheckout","ProductList","ProductQuantity","ProductVariants"],s=["Icon","IconListHoz","Line","IconList","IconListV2","Tabs","Accordion","Marquee","Breadcrumb","EstimateDate"],n=["Newsletter","ContactForm","TextField","FormTextarea","FormEmail","FormDropdown","FormCheckbox","SubmitButton","TextInput"],i=["CollectionTitle","CollectionDescription","CollectionBanner","CollectionToolbar","CollectionPaginator"],c=[...r,...a,...s,...n,...i],d=e;return c.includes(o||"")&&(d={desktop:t.desktop??{},tablet:t.tablet??t.desktop??{},mobile:t.mobile??t.tablet??t.desktop??{}}),d},splitStyle=(e,t={})=>{let o=e.map(e=>makeStyle.makeStyleKey(e)).flat(),r=Object.keys(t).filter(e=>o.includes(e)),a=r.reduce((e,o)=>({...e,[o]:t[o]}),{}),s=Object.keys(t).filter(e=>!r.includes(e)).reduce((e,o)=>({...e,[o]:t[o]}),{});return[a,s]},filterAttrInStyle=(e,t)=>{if(!e||!t)return{};let o={...e};return Object.entries(o).forEach(([e])=>{t.includes(e)||delete o[e]}),o},removeAttrInStyle=(e,t)=>{if(!e||!t)return{};let o={...e};return Object.entries(o).forEach(([e])=>{t.includes(e)&&delete o[e]}),o},getCornerStyle=e=>composeAdvanceStyle({rounded:e?.rounded}),removePaddingYInStyle=e=>{let t=["--pt","--pt-tablet","--pt-mobile","--pb","--pb-tablet","--pb-mobile"];return removeAttrInStyle(e,t)};exports.composeAdvanceStyle=composeAdvanceStyle,exports.composeAdvanceStyleForPostPurchase=composeAdvanceStyleForPostPurchase,exports.convertBoxShadowV1ToV2=convertBoxShadowV1ToV2,exports.filterAttrInStyle=filterAttrInStyle,exports.getCornerStyle=getCornerStyle,exports.removeAttrInStyle=removeAttrInStyle,exports.removePaddingYInStyle=removePaddingYInStyle,exports.splitStyle=splitStyle;
|
|
1
|
+
"use strict";var borders=require("./borders.js"),colors=require("./colors.js"),constant=require("./constant.js"),makeStyle=require("./make-style.js"),radius=require("./radius.js"),shadow=require("./shadow.js"),device=require("../constants/device.js");const composeSpacing=({source:e,spacing:t,type:o,suffix:r=""})=>{let{top:a,left:s,bottom:n,right:i}=t;a&&(e[`--${o}t${r}`]=a),s&&(e[`--${o}l${r}`]=s),n&&(e[`--${o}b${r}`]=n),i&&(e[`--${o}r${r}`]=i)},composeSpacingV2=({source:e,spacing:t,suffix:o="",tag:r=""})=>{if(t&&t.margin){let{top:a,left:s,bottom:n,right:i}=t.margin;a&&(e[`--mt${o}`]=a),s&&(e[`--ml${o}`]=constant.layoutComponent.includes(r)&&"0px"===s?"auto":s),n&&(e[`--mb${o}`]=n),i&&(e[`--mr${o}`]=constant.layoutComponent.includes(r)&&"0px"===i?"auto":i)}if(t&&t.padding){let{top:r,left:a,bottom:s,right:n}=t.padding;r&&(e[`--pt${o}`]=r),a&&(e[`--pl${o}`]=a),s&&(e[`--pb${o}`]=s),n&&(e[`--pr${o}`]=n)}},getAttrValue=(e,t,o)=>{if(null!=t)switch(e){case"bgc":case"c":return colors.isColor(t.toString())?t:`var(--g-c-${t})`;case"d":if(!t)return"none";if(t&&o&&constant.layoutComponent.includes(o))return"grid";return"block";case"animation":case"hasBoxShadow":case"rounded":case"boxShadow":case"border":return;default:return t}},postPurchasePaddingMapping={loose:"21px",extraLoose:"38px",tight:"9px",extraTight:"5px",base:"14px"},composeAdvanceStyleForPostPurchase=(e,t)=>{if(!e)return{};let o={};return Object.keys(e).forEach(r=>{let a=e[r];if("blockPadding"===r){let e=postPurchasePaddingMapping[a];o["--pb"]=getAttrValue(r,e,t),o["--pt"]=getAttrValue(r,e,t),o["--mb"]="0px",o["--mt"]="0px"}if("inlinePadding"===r){let e=postPurchasePaddingMapping[a];o["--pl"]=getAttrValue(r,e,t),o["--pr"]=getAttrValue(r,e,t)}}),o};function composeAdvanceStyle(e,t,o){if(!e)return{};let r={},a=["hover","normal"];Object.keys(e).forEach(s=>{let n=e[s];if("cssClass"===s||null==n)return;let i=e.hasBoxShadow?e.hasBoxShadow:{};if("object"==typeof n){if(Array.isArray(n))return;Object.keys(n).forEach(o=>{if(device.DEVICES.includes(o)){let e=n[o];if(void 0!==e){"border"===s&&Object.assign(r,borders.handleConvertBorderStyle(n),borders.handleConvertBorderWidth(n),borders.handleConvertBorderColor(n)),"rounded"===s&&Object.assign(r,radius.composeRadius(n,["normal"])),"boxShadow"===s&&Object.assign(r,shadow.getResponsiveStyleShadow(n,"box-shadow",i));let a=getAttrValue(s,e,t);if("desktop"===o)switch(s){case"padding":composeSpacing({source:r,spacing:e,type:"p"});break;case"margin":composeSpacing({source:r,spacing:e,type:"m"});break;case"spacing-setting":composeSpacingV2({source:r,spacing:e,tag:t});break;case"m":case"p":break;default:a&&(r[`--${s}`]=a)}else switch(s){case"padding":composeSpacing({source:r,spacing:e,type:"p",suffix:`-${o}`});break;case"margin":composeSpacing({source:r,spacing:e,type:"m",suffix:`-${o}`});break;case"spacing-setting":composeSpacingV2({source:r,spacing:e,suffix:`-${o}`,tag:t});break;case"m":case"p":break;default:a&&(r[`--${s}-${o}`]=a)}}}else if(a.includes(o))switch(s){case"hasBoxShadow":break;case"boxShadow":Object.assign(r,shadow.getStyleShadowState(n,"box-shadow",i))}else"border"===s&&("none"===n.border&&(n.border="solid",n.color="#121212",n.isCustom=!0,n.width="0px",n.position="all"),Object.assign(r,borders.getBorderStyle(n))),"rounded"===s&&Object.assign(r,radius.getCornerCSSFromGlobal(n)),"hasBoxShadow"===s&&Object.assign(r,shadow.getStyleShadow({value:e.boxShadow,styleAppliedFor:"box-shadow",isEnableShadow:e.hasBoxShadow})),"boxShadow"===s&&Object.assign(r,shadow.getStyleShadow({value:n,styleAppliedFor:"box-shadow",isEnableShadow:e.hasBoxShadow}))})}else{let o=getAttrValue(s,n,t);o&&(r[`--${s}`]=o),"hasBoxShadow"===s&&e.boxShadow&&Object.assign(r,shadow.getStyleShadow({value:e.boxShadow,styleAppliedFor:"box-shadow",isEnableShadow:e.hasBoxShadow}))}if("blockPadding"===s&&"POST_PURCHASE"===o){let e=postPurchasePaddingMapping[n];r["--pb"]=getAttrValue(s,e,t),r["--pt"]=getAttrValue(s,e,t),r["--mb"]="0px",r["--mt"]="0px"}if("inlinePadding"===s&&"POST_PURCHASE"===o){let e=postPurchasePaddingMapping[n];r["--pl"]=getAttrValue(s,e,t),r["--pr"]=getAttrValue(s,e,t)}});let s="POST_PURCHASE"===o?composeAdvanceStyleForPostPurchase(e,t):{};return{...r,...s}}const convertBoxShadowV1ToV2=(e,t,o)=>{let r=["Section","Row","Text","Heading","Image","Button","HeroBanner","ImageComparison","Countdown","Video"],a=["ProductTitle","ProductDescription","ProductPrice","ProductVendor","Product","ProductSku","StockCounter","Sticky","ProductBadge","ProductViewMore","ProductButton","DynamicCheckout","ProductList","ProductListV3","ProductQuantity","ProductVariants"],s=["Icon","IconListHoz","Line","IconList","IconListV2","Tabs","Accordion","Marquee","Breadcrumb","EstimateDate"],n=["Newsletter","ContactForm","TextField","FormTextarea","FormEmail","FormDropdown","FormCheckbox","SubmitButton","TextInput"],i=["CollectionTitle","CollectionDescription","CollectionBanner","CollectionToolbar","CollectionPaginator"],c=[...r,...a,...s,...n,...i],d=e;return c.includes(o||"")&&(d={desktop:t.desktop??{},tablet:t.tablet??t.desktop??{},mobile:t.mobile??t.tablet??t.desktop??{}}),d},splitStyle=(e,t={})=>{let o=e.map(e=>makeStyle.makeStyleKey(e)).flat(),r=Object.keys(t).filter(e=>o.includes(e)),a=r.reduce((e,o)=>({...e,[o]:t[o]}),{}),s=Object.keys(t).filter(e=>!r.includes(e)).reduce((e,o)=>({...e,[o]:t[o]}),{});return[a,s]},filterAttrInStyle=(e,t)=>{if(!e||!t)return{};let o={...e};return Object.entries(o).forEach(([e])=>{t.includes(e)||delete o[e]}),o},removeAttrInStyle=(e,t)=>{if(!e||!t)return{};let o={...e};return Object.entries(o).forEach(([e])=>{t.includes(e)&&delete o[e]}),o},getCornerStyle=e=>composeAdvanceStyle({rounded:e?.rounded}),removePaddingYInStyle=e=>{let t=["--pt","--pt-tablet","--pt-mobile","--pb","--pb-tablet","--pb-mobile"];return removeAttrInStyle(e,t)};exports.composeAdvanceStyle=composeAdvanceStyle,exports.composeAdvanceStyleForPostPurchase=composeAdvanceStyleForPostPurchase,exports.convertBoxShadowV1ToV2=convertBoxShadowV1ToV2,exports.filterAttrInStyle=filterAttrInStyle,exports.getCornerStyle=getCornerStyle,exports.removeAttrInStyle=removeAttrInStyle,exports.removePaddingYInStyle=removePaddingYInStyle,exports.splitStyle=splitStyle;
|
|
@@ -5,15 +5,15 @@
|
|
|
5
5
|
${a?`font-weight: ${a};`:""}
|
|
6
6
|
${y?`letter-spacing: ${y};`:""}
|
|
7
7
|
${r?`line-height: ${r};`:""}
|
|
8
|
-
`},composeTypographyV2Css=(e,o)=>{let t=e?.custom,{fontFamily:p,fontSize:s,fontWeight:a,lineHeight:r,letterSpacing:y,textShadow:l,hasShadowText:n}=t??{},i=e?.attrs,c=l&&"none"!==l.type&&!1!==l.enable,{bold:m,italic:g,underline:h,transform:$,color:
|
|
9
|
-
${p?`font-family: ${composeFontFamilyTypographyV2({fontFamily:p,type:e?.type})} ${
|
|
10
|
-
${s?.desktop?`font-size: ${s?.desktop} ${
|
|
11
|
-
${
|
|
12
|
-
${m?`font-weight: bold ${
|
|
13
|
-
${y?`letter-spacing: ${y} ${
|
|
14
|
-
${r?.desktop?`line-height: ${r?.desktop} ${
|
|
15
|
-
${g?`font-style: italic ${
|
|
16
|
-
${h?`text-decoration-line: underline ${
|
|
17
|
-
${$?`text-transform: ${$} ${
|
|
8
|
+
`},composeTypographyV2Css=(e,o)=>{let t=e?.custom,{fontFamily:p,fontSize:s,fontWeight:a,lineHeight:r,letterSpacing:y,textShadow:l,hasShadowText:n}=t??{},i=e?.attrs,c=l&&"none"!==l.type&&!1!==l.enable,{bold:m,italic:g,underline:h,transform:$,color:d}=i??{},f=o?"!important":"";return`
|
|
9
|
+
${p?`font-family: ${composeFontFamilyTypographyV2({fontFamily:p,type:e?.type})} ${f}`:""};
|
|
10
|
+
${s?.desktop?`font-size: ${s?.desktop} ${f}`:""};
|
|
11
|
+
${d?`color: ${colors.getSingleColorVariable(d)} ${f}`:""};
|
|
12
|
+
${m?`font-weight: bold ${f}`:a?`font-weight: ${a} ${f}`:""};
|
|
13
|
+
${y?.desktop?`letter-spacing: ${y?.desktop} ${f}`:""};
|
|
14
|
+
${r?.desktop?`line-height: ${r?.desktop} ${f}`:""};
|
|
15
|
+
${g?`font-style: italic ${f}`:""};
|
|
16
|
+
${h?`text-decoration-line: underline ${f}`:""};
|
|
17
|
+
${$?`text-transform: ${$} ${f}`:""};
|
|
18
18
|
${c&&n?`text-shadow: ${composeTextShadowCss(l||{})}`:"none"};
|
|
19
19
|
`},composeTextShadowCss=e=>{let o="number"==typeof e?.angle?e?.angle:0,t=o*Math.PI/180,p=parseFloat(e?.distance??"0");if(isNaN(p))return"none";let s=Math.round(Math.cos(t)*p*100)/100,a=Math.round(Math.sin(t)*p*100)/100;return`${s}px ${a}px ${e?.blur??"0"} ${e.color}`},composeTextHoverColorCss=(e,o)=>{if(e){let t=o?"!important":"",p=colors.getSingleColorVariable(e.hover);return`${p?`color: ${p} ${t}`:""}`}};function getCustomCSSByDevice(e,o){if(!e||!o)return{};let t="desktop"!==o&&o?`-${o}`:"",{fontFamily:p}=e?.[o]??{};return{[`--size${t}`]:e?.[o]?.fontSize,[`--lh${t}`]:e?.[o]?.lineHeight,[`--fs${t}`]:e?.[o]?.fontStyle,[`--ff${t}`]:composeFontFamilyTypographyV2({fontFamily:p}),[`--weight${t}`]:e?.[o]?.fontWeight,[`--ls${t}`]:e?.[o]?.letterSpacing}}const composeTypography=e=>e?makeStyle.removeNullUndefined({...getCustomCSSByDevice(e,"desktop"),...getCustomCSSByDevice(e,"tablet"),...getCustomCSSByDevice(e,"mobile")}):{},convertPercentToEmLetterSpacing=e=>e?device.DEVICES.reduce((o,t)=>{let p=e[t];return{...o,[t]:p?.includes("%")?`${(.01*parseFloat(p)).toFixed(2)}em`:p}},{}):{},composeTypographyV2=(e,o)=>{if(!e)return{};let t=convertPercentToEmLetterSpacing(e?.letterSpacing);return makeStyle.removeNullUndefined({...makeStyle.makeStyle({fs:o?.italic?void 0:e?.fontStyle,ff:composeFontFamilyTypographyV2(e),weight:o?.bold?void 0:e?.fontWeight}),...makeStyle.makeStyleResponsive("size",e?.fontSize),...makeStyle.makeStyleResponsive("lh",e?.lineHeight),...makeStyle.makeStyleResponsive("ls",t)})},composeFontFamilyTypographyV2=e=>{let{fontFamily:o,isCustom:t,fallbackFontFamily:p,type:s}=e||{};if(!o)return t?p:void 0;if("string"==typeof o)return getFontUsedByTypographyV2({fontFamily:o,fallbackFontFamily:e?.fallbackFontFamily||composeFallbackTypographyStyle(s??"heading")});if("object"==typeof o&&"string"==typeof o?.value){if("theme"===o.type){let e=o?.value.includes("--g-theme-font")?`var(${o?.value})`:o?.value;return`${e}, var(--g-font-body)`}return getFontUsedByTypographyV2({fontFamily:o.value,fallbackFontFamily:e?.fallbackFontFamily||composeFallbackTypographyStyle(s??"heading")})}},getFontUsedByTypographyV2=({fontFamily:e,fallbackFontFamily:o})=>{if(e)return`var(--g-font-${e?.replace(/ /g,"-")}, '${e}'), ${o}`},composeTypographyAttr=e=>e?makeStyle.removeNullUndefined({...makeStyle.makeStyle({fs:e?.italic?"italic":void 0,weight:e?.bold?"bold":void 0,c:colors.getSingleColorVariable(e?.color),tt:e?.transform,tdl:e?.underline?"underline":void 0})}):{},composeTypographyClassName=(e,o)=>e?e?.type&&!isCustomTypo(e.custom)?genTypoClass(e.type):"":o?.type&&genTypoClass(o?.type),composeFallbackTypographyStyle=e=>e.toLocaleLowerCase().includes("heading")?"var(--g-font-heading, heading)":"var(--g-font-body, body)",composeTypographyStyle=(e,o,t)=>{if(e){let o=composeFallbackTypographyStyle(e.type??"heading"),p={...e.custom,fallbackFontFamily:o,isCustom:isCustomTypo(e.custom)};return{...composeTypographyV2(p,e.attrs),...!t&&composeTypographyAttr(e.attrs)}}return{...o?.type?{}:composeTypography(o?.custom)}},isCustomTypo=e=>e&&Object.keys(e).length>1||e&&1===Object.keys(e).length&&!e.fontSize;exports.composeFallbackTypographyStyle=composeFallbackTypographyStyle,exports.composeFontFamilyTypographyV2=composeFontFamilyTypographyV2,exports.composeTextHoverColorCss=composeTextHoverColorCss,exports.composeTypography=composeTypography,exports.composeTypographyAttr=composeTypographyAttr,exports.composeTypographyClassName=composeTypographyClassName,exports.composeTypographyCss=composeTypographyCss,exports.composeTypographyStyle=composeTypographyStyle,exports.composeTypographyV2=composeTypographyV2,exports.composeTypographyV2Css=composeTypographyV2Css,exports.genTypoClass=genTypoClass;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.AnimationType=void 0,function(i){i.Fade="fade",i.Slide="slide",i.Zoom="zoom",i.Shake="shake",i.None="none"}(exports.AnimationType||(exports.AnimationType={})),exports.AnimationSetting=void 0,function(i){i.Loop="loop",i.Scale="scale",i.Delay="delay",i.Easing="easing",i.Speed="speed",i.IsFade="isFade",i.Distance="distance",i.Intensity="intensity",i.Direction="direction",i.ZoomDirection="zoomDirection"}(exports.AnimationSetting||(exports.AnimationSetting={})),exports.AnimationDirectionType=void 0,function(i){i.Left="left",i.Right="right",i.Up="up",i.Down="down"}(exports.AnimationDirectionType||(exports.AnimationDirectionType={})),exports.AnimationTriggerType=void 0,function(i){i.Appear="appear",i.Hover="hover",i.Hidden="hidden",i.AppearByTrigger="appearByTrigger"}(exports.AnimationTriggerType||(exports.AnimationTriggerType={})),exports.AnimationZoomDirectionType=void 0,function(i){i.In="in",i.Out="out"}(exports.AnimationZoomDirectionType||(exports.AnimationZoomDirectionType={})),exports.AnimationEasingType=void 0,function(i){i.Ease="ease",i.EaseIn="ease-in",i.EaseOut="ease-out",i.Linear="linear"}(exports.AnimationEasingType||(exports.AnimationEasingType={}));
|
|
1
|
+
"use strict";exports.AnimationType=void 0,function(i){i.Fade="fade",i.Slide="slide",i.Zoom="zoom",i.Shake="shake",i.None="none"}(exports.AnimationType||(exports.AnimationType={})),exports.AnimationSetting=void 0,function(i){i.Loop="loop",i.Scale="scale",i.Delay="delay",i.Easing="easing",i.Speed="speed",i.IsFade="isFade",i.Distance="distance",i.Intensity="intensity",i.Direction="direction",i.ZoomDirection="zoomDirection",i.TriggerAnimationOption="triggerAnimationOption"}(exports.AnimationSetting||(exports.AnimationSetting={})),exports.AnimationDirectionType=void 0,function(i){i.Left="left",i.Right="right",i.Up="up",i.Down="down"}(exports.AnimationDirectionType||(exports.AnimationDirectionType={})),exports.AnimationTriggerType=void 0,function(i){i.Appear="appear",i.Hover="hover",i.Hidden="hidden",i.AppearByTrigger="appearByTrigger"}(exports.AnimationTriggerType||(exports.AnimationTriggerType={})),exports.AnimationZoomDirectionType=void 0,function(i){i.In="in",i.Out="out"}(exports.AnimationZoomDirectionType||(exports.AnimationZoomDirectionType={})),exports.AnimationEasingType=void 0,function(i){i.Ease="ease",i.EaseIn="ease-in",i.EaseOut="ease-out",i.Linear="linear"}(exports.AnimationEasingType||(exports.AnimationEasingType={}));
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{jsxs as
|
|
2
|
+
import{jsxs as t,Fragment as e,jsx as o}from"react/jsx-runtime";import{memo as a,useEffect as i,isValidElement as n}from"react";import{composeAdvanceStyle as r}from"../helpers/compose-advance-style.js";import{useInteraction as p}from"../hooks/useInteraction.js";import{disableWrap as d,excludeApplyStyle as s}from"./constant.js";import l from"./RenderCustomCode.js";import m from"./ComponentToolbarPreview.js";import"zustand";import{cls as c}from"../helpers/cls.js";import"swr";import"../helpers/convert.js";import"@gem-sdk/adapter-shopify";import"swr/mutation";import{usePageType as C}from"../hooks/shop.js";import"swr/infinite";import"vanilla-lazyload";import"../hooks/useCartUI.js";import"../hooks/useStickyStore.js";import"../types/builder.js";import"../types/custom.js";import"../types/animations.js";import h from"./ComponentAnimation.js";let ComponentWrapperPreview=({children:a,...g})=>{i(()=>{let t=new CustomEvent("editor:component:render",{bubbles:!0,detail:{componentUid:g.uid}});window.dispatchEvent(t)},[g.uid]);let{getAnimationByUid:u}=p(),f=u(g.uid);f&&(g.advanced={...g.advanced,animation:{desktop:f,tablet:f,mobile:f}});let b=C();if("section"===g.type)return null;let v={};if("Section"===g.tag&&g.isThemeSection&&(v["data-theme-section"]=!0),"Section"===g.tag&&g.isShopifySection&&(v["data-shopify-section"]=!0,v["data-toolbar-wrap"]=!0),g.editorConfigs){let t=g.editorConfigs;t.placeholder?.notAppendBeforeAfter&&(v["data-placeholder-not-append-before-after"]=!0),t.placeholder?.notAppendLeftRight&&(v["data-placeholder-not-append-left-right"]=!0),t.toolbar?.parent&&(v["data-toolbar-parent"]=!0),t.component?.noDelete&&(v["data-component-no-delete"]=!0),t.component?.noDuplicate&&(v["data-component-no-duplicate"]=!0),t.component?.noDragDrop&&(v["data-component-no-drag-drop"]=!0),t.component?.noSetting&&(v["data-component-no-setting"]=!0),t.component?.isThirdParty&&(v["data-component-is-third-party"]=!0),t.toolbar?.hide&&(v["data-toolbar-hide"]=!0),t.slots?.children&&(v["data-slots-children"]=!0),t.toolbar?.hide||(v["data-toolbar-wrap"]=!0)}g?.editorConfigs?.toolbar?.hide||(v["data-toolbar-wrap"]=!0);let y=t=>"GP_FUNNEL_PAGE"===b&&["ProductList","ProductListV3","Header"].includes(t),w=r(g.advanced,g.tag,b),j=g.advanced,x={...v,"data-uid":g.uid,"data-component-type":"component","data-component-tag":g.tag,"data-component-label":g.label,"data-not-droppable":y(g.tag)?"true":"false"},L=({name:e,visibility:a})=>t("div",{className:c("gp-flex gp-items-center gp-justify-center gp-gap-[8px] gp-bg-[#F4F4F4] gp-p-[16px] gp-border gp-border-[#D6D6D6]",{"gp-opacity-60":!a}),children:[t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[o("path",{d:"M19.1475 5.16194C19.1416 5.1148 19.1197 5.0713 19.0857 5.03911C19.0516 5.00692 19.0076 4.9881 18.9614 4.98597C18.8835 4.98597 17.3469 4.95397 17.3469 4.95397C17.3469 4.95397 16.0588 3.67419 15.9342 3.5311C15.8104 3.40312 15.5619 3.43512 15.4684 3.46711L14.8166 3.67508C14.7361 3.40491 14.6323 3.14259 14.5067 2.89121C14.0566 1.99536 13.3727 1.51544 12.5659 1.51544C12.5044 1.51544 12.4577 1.51544 12.3954 1.53144C12.3642 1.49945 12.3486 1.46745 12.3175 1.45145C11.9608 1.06752 11.5107 0.875552 10.967 0.891549C9.92824 0.923543 8.88772 1.70741 8.03419 3.08318C7.44467 4.05901 6.99453 5.27392 6.8543 6.21776C5.65969 6.6017 4.82087 6.87365 4.79057 6.87365C4.18461 7.06562 4.16903 7.08161 4.09199 7.67351C4.06082 8.12144 2.47754 20.7415 2.47754 20.7415L15.7636 23.1091L21.522 21.6374C21.5064 21.6374 19.1631 5.27392 19.1475 5.16194ZM14.1492 3.89904C13.8062 4.00572 13.4648 4.11772 13.1251 4.23498C13.1251 3.69108 13.0472 2.92321 12.8143 2.28331C13.6064 2.41129 13.9942 3.33914 14.1492 3.89904ZM12.4265 4.44206C11.7279 4.66602 10.9679 4.90598 10.207 5.14594C10.4243 4.29808 10.8277 3.46623 11.3245 2.90632C11.533 2.66965 11.7863 2.47913 12.069 2.34641C12.3806 2.9712 12.4421 3.85105 12.4265 4.44206ZM10.9982 1.61143C11.2466 1.61143 11.4483 1.65942 11.6197 1.7874C11.3127 1.95192 11.0387 2.17444 10.8121 2.44329C10.1455 3.17916 9.63305 4.31408 9.43135 5.4179C8.79423 5.62586 8.17356 5.81783 7.61521 5.9938C7.98744 4.25009 9.39933 1.65942 10.9982 1.61143Z",fill:"#95BF47"}),o("path",{d:"M18.9647 4.94709C18.8851 4.94709 17.3155 4.91503 17.3155 4.91503C17.3155 4.91503 15.9981 3.63242 15.8716 3.48812C15.8261 3.43951 15.7635 3.41074 15.6973 3.40796V23.1094L21.5828 21.6344L19.1709 5.12345C19.1399 5.01122 19.0444 4.94709 18.9647 4.94709Z",fill:"#5E8E3E"}),o("path",{d:"M13.0575 8.51577L12.3029 10.8908C12.3029 10.8908 11.4602 10.5663 10.4599 10.6253C8.98595 10.6991 8.98595 11.4809 8.98595 11.6727C9.07404 12.7348 12.39 12.9709 12.5828 15.4631C12.7238 17.4251 11.3545 18.7675 9.35396 18.8708C6.96778 18.9733 5.65137 17.7939 5.65137 17.7939L6.16032 15.9794C6.16032 15.9794 7.49435 16.8203 8.5465 16.7613C9.23162 16.7318 9.4949 16.245 9.45967 15.9204C9.35396 14.5337 6.65165 14.6223 6.47645 12.3365C6.33551 10.4188 7.82712 8.48626 11.1265 8.30924C12.4076 8.23548 13.0575 8.51577 13.0575 8.51577Z",fill:"white"})]}),o("span",{className:"gp-text-[#212121] gp-text-[14px] gp-leading-[24px] gp-font-medium",children:e})]});return d.includes(g.tag)&&n(a)?t(e,{children:[o(h,{...g}),o(l,{uid:g.uid,advanced:j}),t(a.type,{className:j?.cssClass,...a.props,style:w,builderAttrs:x,advanced:j,children:[g.isShopifySection?o(L,{name:g.name??"",visibility:!!g.isShopifyVisibility}):a.props.children,o(m,{...g})]})]}):t(e,{children:[o(h,{...g}),o(l,{uid:g.uid,advanced:j}),t("div",{style:s.includes(g.tag)?{"--mb":w?.["--mb"],"--mb-tablet":w?.["--mb-tablet"],"--mb-mobile":w?.["--mb-mobile"]}:w,className:`${g.uid} ${g.advanced?.cssClass?g.advanced?.cssClass:""}`,...x,children:[!s.includes(g.tag)&&a,n(a)&&s.includes(g.tag)&&o(a.type,{...a.props,style:w,advanced:j}),o(m,{...g})]})]})};var ComponentWrapperPreview$1=a(ComponentWrapperPreview);export{ComponentWrapperPreview$1 as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{handleConvertBorderStyle as e,handleConvertBorderWidth as t,handleConvertBorderColor as o,getBorderStyle as a}from"./borders.js";import{isColor as r}from"./colors.js";import{layoutComponent as s}from"./constant.js";import{makeStyleKey as i}from"./make-style.js";import{composeRadius as n,getCornerCSSFromGlobal as c}from"./radius.js";import{getResponsiveStyleShadow as l,getStyleShadowState as d,getStyleShadow as p}from"./shadow.js";import{DEVICES as u}from"../constants/device.js";let composeSpacing=({source:e,spacing:t,type:o,suffix:a=""})=>{let{top:r,left:s,bottom:i,right:n}=t;r&&(e[`--${o}t${a}`]=r),s&&(e[`--${o}l${a}`]=s),i&&(e[`--${o}b${a}`]=i),n&&(e[`--${o}r${a}`]=n)},composeSpacingV2=({source:e,spacing:t,suffix:o="",tag:a=""})=>{if(t&&t.margin){let{top:r,left:i,bottom:n,right:c}=t.margin;r&&(e[`--mt${o}`]=r),i&&(e[`--ml${o}`]=s.includes(a)&&"0px"===i?"auto":i),n&&(e[`--mb${o}`]=n),c&&(e[`--mr${o}`]=s.includes(a)&&"0px"===c?"auto":c)}if(t&&t.padding){let{top:a,left:r,bottom:s,right:i}=t.padding;a&&(e[`--pt${o}`]=a),r&&(e[`--pl${o}`]=r),s&&(e[`--pb${o}`]=s),i&&(e[`--pr${o}`]=i)}},getAttrValue=(e,t,o)=>{if(null!=t)switch(e){case"bgc":case"c":return r(t.toString())?t:`var(--g-c-${t})`;case"d":if(!t)return"none";if(t&&o&&s.includes(o))return"grid";return"block";case"animation":case"hasBoxShadow":case"rounded":case"boxShadow":case"border":return;default:return t}},postPurchasePaddingMapping={loose:"21px",extraLoose:"38px",tight:"9px",extraTight:"5px",base:"14px"},composeAdvanceStyleForPostPurchase=(e,t)=>{if(!e)return{};let o={};return Object.keys(e).forEach(a=>{let r=e[a];if("blockPadding"===a){let e=postPurchasePaddingMapping[r];o["--pb"]=getAttrValue(a,e,t),o["--pt"]=getAttrValue(a,e,t),o["--mb"]="0px",o["--mt"]="0px"}if("inlinePadding"===a){let e=postPurchasePaddingMapping[r];o["--pl"]=getAttrValue(a,e,t),o["--pr"]=getAttrValue(a,e,t)}}),o};function composeAdvanceStyle(r,s,i){if(!r)return{};let b={},g=["hover","normal"];Object.keys(r).forEach(m=>{let h=r[m];if("cssClass"===m||null==h)return;let S=r.hasBoxShadow?r.hasBoxShadow:{};if("object"==typeof h){if(Array.isArray(h))return;Object.keys(h).forEach(i=>{if(u.includes(i)){let a=h[i];if(void 0!==a){"border"===m&&Object.assign(b,e(h),t(h),o(h)),"rounded"===m&&Object.assign(b,n(h,["normal"])),"boxShadow"===m&&Object.assign(b,l(h,"box-shadow",S));let r=getAttrValue(m,a,s);if("desktop"===i)switch(m){case"padding":composeSpacing({source:b,spacing:a,type:"p"});break;case"margin":composeSpacing({source:b,spacing:a,type:"m"});break;case"spacing-setting":composeSpacingV2({source:b,spacing:a,tag:s});break;case"m":case"p":break;default:r&&(b[`--${m}`]=r)}else switch(m){case"padding":composeSpacing({source:b,spacing:a,type:"p",suffix:`-${i}`});break;case"margin":composeSpacing({source:b,spacing:a,type:"m",suffix:`-${i}`});break;case"spacing-setting":composeSpacingV2({source:b,spacing:a,suffix:`-${i}`,tag:s});break;case"m":case"p":break;default:r&&(b[`--${m}-${i}`]=r)}}}else if(g.includes(i))switch(m){case"hasBoxShadow":break;case"boxShadow":Object.assign(b,d(h,"box-shadow",S))}else"border"===m&&("none"===h.border&&(h.border="solid",h.color="#121212",h.isCustom=!0,h.width="0px",h.position="all"),Object.assign(b,a(h))),"rounded"===m&&Object.assign(b,c(h)),"hasBoxShadow"===m&&Object.assign(b,p({value:r.boxShadow,styleAppliedFor:"box-shadow",isEnableShadow:r.hasBoxShadow})),"boxShadow"===m&&Object.assign(b,p({value:h,styleAppliedFor:"box-shadow",isEnableShadow:r.hasBoxShadow}))})}else{let e=getAttrValue(m,h,s);e&&(b[`--${m}`]=e),"hasBoxShadow"===m&&r.boxShadow&&Object.assign(b,p({value:r.boxShadow,styleAppliedFor:"box-shadow",isEnableShadow:r.hasBoxShadow}))}if("blockPadding"===m&&"POST_PURCHASE"===i){let e=postPurchasePaddingMapping[h];b["--pb"]=getAttrValue(m,e,s),b["--pt"]=getAttrValue(m,e,s),b["--mb"]="0px",b["--mt"]="0px"}if("inlinePadding"===m&&"POST_PURCHASE"===i){let e=postPurchasePaddingMapping[h];b["--pl"]=getAttrValue(m,e,s),b["--pr"]=getAttrValue(m,e,s)}});let m="POST_PURCHASE"===i?composeAdvanceStyleForPostPurchase(r,s):{};return{...b,...m}}let convertBoxShadowV1ToV2=(e,t,o)=>{let a=["Section","Row","Text","Heading","Image","Button","HeroBanner","ImageComparison","Countdown","Video"],r=["ProductTitle","ProductDescription","ProductPrice","ProductVendor","Product","ProductSku","StockCounter","Sticky","ProductBadge","ProductViewMore","ProductButton","DynamicCheckout","ProductList","ProductQuantity","ProductVariants"],s=["Icon","IconListHoz","Line","IconList","IconListV2","Tabs","Accordion","Marquee","Breadcrumb","EstimateDate"],i=["Newsletter","ContactForm","TextField","FormTextarea","FormEmail","FormDropdown","FormCheckbox","SubmitButton","TextInput"],n=["CollectionTitle","CollectionDescription","CollectionBanner","CollectionToolbar","CollectionPaginator"],c=[...a,...r,...s,...i,...n],l=e;return c.includes(o||"")&&(l={desktop:t.desktop??{},tablet:t.tablet??t.desktop??{},mobile:t.mobile??t.tablet??t.desktop??{}}),l},splitStyle=(e,t={})=>{let o=e.map(e=>i(e)).flat(),a=Object.keys(t).filter(e=>o.includes(e)),r=a.reduce((e,o)=>({...e,[o]:t[o]}),{}),s=Object.keys(t).filter(e=>!a.includes(e)).reduce((e,o)=>({...e,[o]:t[o]}),{});return[r,s]},filterAttrInStyle=(e,t)=>{if(!e||!t)return{};let o={...e};return Object.entries(o).forEach(([e])=>{t.includes(e)||delete o[e]}),o},removeAttrInStyle=(e,t)=>{if(!e||!t)return{};let o={...e};return Object.entries(o).forEach(([e])=>{t.includes(e)&&delete o[e]}),o},getCornerStyle=e=>composeAdvanceStyle({rounded:e?.rounded}),removePaddingYInStyle=e=>{let t=["--pt","--pt-tablet","--pt-mobile","--pb","--pb-tablet","--pb-mobile"];return removeAttrInStyle(e,t)};export{composeAdvanceStyle,composeAdvanceStyleForPostPurchase,convertBoxShadowV1ToV2,filterAttrInStyle,getCornerStyle,removeAttrInStyle,removePaddingYInStyle,splitStyle};
|
|
1
|
+
import{handleConvertBorderStyle as e,handleConvertBorderWidth as t,handleConvertBorderColor as o,getBorderStyle as a}from"./borders.js";import{isColor as r}from"./colors.js";import{layoutComponent as s}from"./constant.js";import{makeStyleKey as i}from"./make-style.js";import{composeRadius as n,getCornerCSSFromGlobal as c}from"./radius.js";import{getResponsiveStyleShadow as l,getStyleShadowState as d,getStyleShadow as p}from"./shadow.js";import{DEVICES as u}from"../constants/device.js";let composeSpacing=({source:e,spacing:t,type:o,suffix:a=""})=>{let{top:r,left:s,bottom:i,right:n}=t;r&&(e[`--${o}t${a}`]=r),s&&(e[`--${o}l${a}`]=s),i&&(e[`--${o}b${a}`]=i),n&&(e[`--${o}r${a}`]=n)},composeSpacingV2=({source:e,spacing:t,suffix:o="",tag:a=""})=>{if(t&&t.margin){let{top:r,left:i,bottom:n,right:c}=t.margin;r&&(e[`--mt${o}`]=r),i&&(e[`--ml${o}`]=s.includes(a)&&"0px"===i?"auto":i),n&&(e[`--mb${o}`]=n),c&&(e[`--mr${o}`]=s.includes(a)&&"0px"===c?"auto":c)}if(t&&t.padding){let{top:a,left:r,bottom:s,right:i}=t.padding;a&&(e[`--pt${o}`]=a),r&&(e[`--pl${o}`]=r),s&&(e[`--pb${o}`]=s),i&&(e[`--pr${o}`]=i)}},getAttrValue=(e,t,o)=>{if(null!=t)switch(e){case"bgc":case"c":return r(t.toString())?t:`var(--g-c-${t})`;case"d":if(!t)return"none";if(t&&o&&s.includes(o))return"grid";return"block";case"animation":case"hasBoxShadow":case"rounded":case"boxShadow":case"border":return;default:return t}},postPurchasePaddingMapping={loose:"21px",extraLoose:"38px",tight:"9px",extraTight:"5px",base:"14px"},composeAdvanceStyleForPostPurchase=(e,t)=>{if(!e)return{};let o={};return Object.keys(e).forEach(a=>{let r=e[a];if("blockPadding"===a){let e=postPurchasePaddingMapping[r];o["--pb"]=getAttrValue(a,e,t),o["--pt"]=getAttrValue(a,e,t),o["--mb"]="0px",o["--mt"]="0px"}if("inlinePadding"===a){let e=postPurchasePaddingMapping[r];o["--pl"]=getAttrValue(a,e,t),o["--pr"]=getAttrValue(a,e,t)}}),o};function composeAdvanceStyle(r,s,i){if(!r)return{};let b={},g=["hover","normal"];Object.keys(r).forEach(m=>{let h=r[m];if("cssClass"===m||null==h)return;let S=r.hasBoxShadow?r.hasBoxShadow:{};if("object"==typeof h){if(Array.isArray(h))return;Object.keys(h).forEach(i=>{if(u.includes(i)){let a=h[i];if(void 0!==a){"border"===m&&Object.assign(b,e(h),t(h),o(h)),"rounded"===m&&Object.assign(b,n(h,["normal"])),"boxShadow"===m&&Object.assign(b,l(h,"box-shadow",S));let r=getAttrValue(m,a,s);if("desktop"===i)switch(m){case"padding":composeSpacing({source:b,spacing:a,type:"p"});break;case"margin":composeSpacing({source:b,spacing:a,type:"m"});break;case"spacing-setting":composeSpacingV2({source:b,spacing:a,tag:s});break;case"m":case"p":break;default:r&&(b[`--${m}`]=r)}else switch(m){case"padding":composeSpacing({source:b,spacing:a,type:"p",suffix:`-${i}`});break;case"margin":composeSpacing({source:b,spacing:a,type:"m",suffix:`-${i}`});break;case"spacing-setting":composeSpacingV2({source:b,spacing:a,suffix:`-${i}`,tag:s});break;case"m":case"p":break;default:r&&(b[`--${m}-${i}`]=r)}}}else if(g.includes(i))switch(m){case"hasBoxShadow":break;case"boxShadow":Object.assign(b,d(h,"box-shadow",S))}else"border"===m&&("none"===h.border&&(h.border="solid",h.color="#121212",h.isCustom=!0,h.width="0px",h.position="all"),Object.assign(b,a(h))),"rounded"===m&&Object.assign(b,c(h)),"hasBoxShadow"===m&&Object.assign(b,p({value:r.boxShadow,styleAppliedFor:"box-shadow",isEnableShadow:r.hasBoxShadow})),"boxShadow"===m&&Object.assign(b,p({value:h,styleAppliedFor:"box-shadow",isEnableShadow:r.hasBoxShadow}))})}else{let e=getAttrValue(m,h,s);e&&(b[`--${m}`]=e),"hasBoxShadow"===m&&r.boxShadow&&Object.assign(b,p({value:r.boxShadow,styleAppliedFor:"box-shadow",isEnableShadow:r.hasBoxShadow}))}if("blockPadding"===m&&"POST_PURCHASE"===i){let e=postPurchasePaddingMapping[h];b["--pb"]=getAttrValue(m,e,s),b["--pt"]=getAttrValue(m,e,s),b["--mb"]="0px",b["--mt"]="0px"}if("inlinePadding"===m&&"POST_PURCHASE"===i){let e=postPurchasePaddingMapping[h];b["--pl"]=getAttrValue(m,e,s),b["--pr"]=getAttrValue(m,e,s)}});let m="POST_PURCHASE"===i?composeAdvanceStyleForPostPurchase(r,s):{};return{...b,...m}}let convertBoxShadowV1ToV2=(e,t,o)=>{let a=["Section","Row","Text","Heading","Image","Button","HeroBanner","ImageComparison","Countdown","Video"],r=["ProductTitle","ProductDescription","ProductPrice","ProductVendor","Product","ProductSku","StockCounter","Sticky","ProductBadge","ProductViewMore","ProductButton","DynamicCheckout","ProductList","ProductListV3","ProductQuantity","ProductVariants"],s=["Icon","IconListHoz","Line","IconList","IconListV2","Tabs","Accordion","Marquee","Breadcrumb","EstimateDate"],i=["Newsletter","ContactForm","TextField","FormTextarea","FormEmail","FormDropdown","FormCheckbox","SubmitButton","TextInput"],n=["CollectionTitle","CollectionDescription","CollectionBanner","CollectionToolbar","CollectionPaginator"],c=[...a,...r,...s,...i,...n],l=e;return c.includes(o||"")&&(l={desktop:t.desktop??{},tablet:t.tablet??t.desktop??{},mobile:t.mobile??t.tablet??t.desktop??{}}),l},splitStyle=(e,t={})=>{let o=e.map(e=>i(e)).flat(),a=Object.keys(t).filter(e=>o.includes(e)),r=a.reduce((e,o)=>({...e,[o]:t[o]}),{}),s=Object.keys(t).filter(e=>!a.includes(e)).reduce((e,o)=>({...e,[o]:t[o]}),{});return[r,s]},filterAttrInStyle=(e,t)=>{if(!e||!t)return{};let o={...e};return Object.entries(o).forEach(([e])=>{t.includes(e)||delete o[e]}),o},removeAttrInStyle=(e,t)=>{if(!e||!t)return{};let o={...e};return Object.entries(o).forEach(([e])=>{t.includes(e)&&delete o[e]}),o},getCornerStyle=e=>composeAdvanceStyle({rounded:e?.rounded}),removePaddingYInStyle=e=>{let t=["--pt","--pt-tablet","--pt-mobile","--pb","--pb-tablet","--pb-mobile"];return removeAttrInStyle(e,t)};export{composeAdvanceStyle,composeAdvanceStyleForPostPurchase,convertBoxShadowV1ToV2,filterAttrInStyle,getCornerStyle,removeAttrInStyle,removePaddingYInStyle,splitStyle};
|
|
@@ -5,15 +5,15 @@ import{DEVICES as e}from"../constants/device.js";import{getSingleColorVariable a
|
|
|
5
5
|
${s?`font-weight: ${s};`:""}
|
|
6
6
|
${y?`letter-spacing: ${y};`:""}
|
|
7
7
|
${r?`line-height: ${r};`:""}
|
|
8
|
-
`},composeTypographyV2Css=(e,t)=>{let p=e?.custom,{fontFamily:a,fontSize:s,fontWeight:r,lineHeight:y,letterSpacing:l,textShadow:n,hasShadowText:i}=p??{},c=e?.attrs,g=n&&"none"!==n.type&&!1!==n.enable,{bold:m,italic:h,underline:$,transform:f,color:
|
|
9
|
-
${a?`font-family: ${composeFontFamilyTypographyV2({fontFamily:a,type:e?.type})} ${
|
|
10
|
-
${s?.desktop?`font-size: ${s?.desktop} ${
|
|
11
|
-
${
|
|
12
|
-
${m?`font-weight: bold ${
|
|
13
|
-
${l?`letter-spacing: ${l} ${
|
|
14
|
-
${y?.desktop?`line-height: ${y?.desktop} ${
|
|
15
|
-
${h?`font-style: italic ${
|
|
16
|
-
${$?`text-decoration-line: underline ${
|
|
17
|
-
${f?`text-transform: ${f} ${
|
|
8
|
+
`},composeTypographyV2Css=(e,t)=>{let p=e?.custom,{fontFamily:a,fontSize:s,fontWeight:r,lineHeight:y,letterSpacing:l,textShadow:n,hasShadowText:i}=p??{},c=e?.attrs,g=n&&"none"!==n.type&&!1!==n.enable,{bold:m,italic:h,underline:$,transform:f,color:d}=c??{},u=t?"!important":"";return`
|
|
9
|
+
${a?`font-family: ${composeFontFamilyTypographyV2({fontFamily:a,type:e?.type})} ${u}`:""};
|
|
10
|
+
${s?.desktop?`font-size: ${s?.desktop} ${u}`:""};
|
|
11
|
+
${d?`color: ${o(d)} ${u}`:""};
|
|
12
|
+
${m?`font-weight: bold ${u}`:r?`font-weight: ${r} ${u}`:""};
|
|
13
|
+
${l?.desktop?`letter-spacing: ${l?.desktop} ${u}`:""};
|
|
14
|
+
${y?.desktop?`line-height: ${y?.desktop} ${u}`:""};
|
|
15
|
+
${h?`font-style: italic ${u}`:""};
|
|
16
|
+
${$?`text-decoration-line: underline ${u}`:""};
|
|
17
|
+
${f?`text-transform: ${f} ${u}`:""};
|
|
18
18
|
${g&&i?`text-shadow: ${composeTextShadowCss(n||{})}`:"none"};
|
|
19
19
|
`},composeTextShadowCss=e=>{let o="number"==typeof e?.angle?e?.angle:0,t=o*Math.PI/180,p=parseFloat(e?.distance??"0");if(isNaN(p))return"none";let a=Math.round(Math.cos(t)*p*100)/100,s=Math.round(Math.sin(t)*p*100)/100;return`${a}px ${s}px ${e?.blur??"0"} ${e.color}`},composeTextHoverColorCss=(e,t)=>{if(e){let p=t?"!important":"",a=o(e.hover);return`${a?`color: ${a} ${p}`:""}`}};function getCustomCSSByDevice(e,o){if(!e||!o)return{};let t="desktop"!==o&&o?`-${o}`:"",{fontFamily:p}=e?.[o]??{};return{[`--size${t}`]:e?.[o]?.fontSize,[`--lh${t}`]:e?.[o]?.lineHeight,[`--fs${t}`]:e?.[o]?.fontStyle,[`--ff${t}`]:composeFontFamilyTypographyV2({fontFamily:p}),[`--weight${t}`]:e?.[o]?.fontWeight,[`--ls${t}`]:e?.[o]?.letterSpacing}}let composeTypography=e=>e?t({...getCustomCSSByDevice(e,"desktop"),...getCustomCSSByDevice(e,"tablet"),...getCustomCSSByDevice(e,"mobile")}):{},convertPercentToEmLetterSpacing=o=>o?e.reduce((e,t)=>{let p=o[t];return{...e,[t]:p?.includes("%")?`${(.01*parseFloat(p)).toFixed(2)}em`:p}},{}):{},composeTypographyV2=(e,o)=>{if(!e)return{};let s=convertPercentToEmLetterSpacing(e?.letterSpacing);return t({...p({fs:o?.italic?void 0:e?.fontStyle,ff:composeFontFamilyTypographyV2(e),weight:o?.bold?void 0:e?.fontWeight}),...a("size",e?.fontSize),...a("lh",e?.lineHeight),...a("ls",s)})},composeFontFamilyTypographyV2=e=>{let{fontFamily:o,isCustom:t,fallbackFontFamily:p,type:a}=e||{};if(!o)return t?p:void 0;if("string"==typeof o)return getFontUsedByTypographyV2({fontFamily:o,fallbackFontFamily:e?.fallbackFontFamily||composeFallbackTypographyStyle(a??"heading")});if("object"==typeof o&&"string"==typeof o?.value){if("theme"===o.type){let e=o?.value.includes("--g-theme-font")?`var(${o?.value})`:o?.value;return`${e}, var(--g-font-body)`}return getFontUsedByTypographyV2({fontFamily:o.value,fallbackFontFamily:e?.fallbackFontFamily||composeFallbackTypographyStyle(a??"heading")})}},getFontUsedByTypographyV2=({fontFamily:e,fallbackFontFamily:o})=>{if(e)return`var(--g-font-${e?.replace(/ /g,"-")}, '${e}'), ${o}`},composeTypographyAttr=e=>e?t({...p({fs:e?.italic?"italic":void 0,weight:e?.bold?"bold":void 0,c:o(e?.color),tt:e?.transform,tdl:e?.underline?"underline":void 0})}):{},composeTypographyClassName=(e,o)=>e?e?.type&&!isCustomTypo(e.custom)?genTypoClass(e.type):"":o?.type&&genTypoClass(o?.type),composeFallbackTypographyStyle=e=>e.toLocaleLowerCase().includes("heading")?"var(--g-font-heading, heading)":"var(--g-font-body, body)",composeTypographyStyle=(e,o,t)=>{if(e){let o=composeFallbackTypographyStyle(e.type??"heading"),p={...e.custom,fallbackFontFamily:o,isCustom:isCustomTypo(e.custom)};return{...composeTypographyV2(p,e.attrs),...!t&&composeTypographyAttr(e.attrs)}}return{...o?.type?{}:composeTypography(o?.custom)}},isCustomTypo=e=>e&&Object.keys(e).length>1||e&&1===Object.keys(e).length&&!e.fontSize;export{composeFallbackTypographyStyle,composeFontFamilyTypographyV2,composeTextHoverColorCss,composeTypography,composeTypographyAttr,composeTypographyClassName,composeTypographyCss,composeTypographyStyle,composeTypographyV2,composeTypographyV2Css,genTypoClass};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
var AnimationType,AnimationSetting,AnimationDirectionType,AnimationTriggerType,AnimationZoomDirectionType,AnimationEasingType;!function(i){i.Fade="fade",i.Slide="slide",i.Zoom="zoom",i.Shake="shake",i.None="none"}(AnimationType||(AnimationType={})),function(i){i.Loop="loop",i.Scale="scale",i.Delay="delay",i.Easing="easing",i.Speed="speed",i.IsFade="isFade",i.Distance="distance",i.Intensity="intensity",i.Direction="direction",i.ZoomDirection="zoomDirection"}(AnimationSetting||(AnimationSetting={})),function(i){i.Left="left",i.Right="right",i.Up="up",i.Down="down"}(AnimationDirectionType||(AnimationDirectionType={})),function(i){i.Appear="appear",i.Hover="hover",i.Hidden="hidden",i.AppearByTrigger="appearByTrigger"}(AnimationTriggerType||(AnimationTriggerType={})),function(i){i.In="in",i.Out="out"}(AnimationZoomDirectionType||(AnimationZoomDirectionType={})),function(i){i.Ease="ease",i.EaseIn="ease-in",i.EaseOut="ease-out",i.Linear="linear"}(AnimationEasingType||(AnimationEasingType={}));export{AnimationDirectionType,AnimationEasingType,AnimationSetting,AnimationTriggerType,AnimationType,AnimationZoomDirectionType};
|
|
1
|
+
var AnimationType,AnimationSetting,AnimationDirectionType,AnimationTriggerType,AnimationZoomDirectionType,AnimationEasingType;!function(i){i.Fade="fade",i.Slide="slide",i.Zoom="zoom",i.Shake="shake",i.None="none"}(AnimationType||(AnimationType={})),function(i){i.Loop="loop",i.Scale="scale",i.Delay="delay",i.Easing="easing",i.Speed="speed",i.IsFade="isFade",i.Distance="distance",i.Intensity="intensity",i.Direction="direction",i.ZoomDirection="zoomDirection",i.TriggerAnimationOption="triggerAnimationOption"}(AnimationSetting||(AnimationSetting={})),function(i){i.Left="left",i.Right="right",i.Up="up",i.Down="down"}(AnimationDirectionType||(AnimationDirectionType={})),function(i){i.Appear="appear",i.Hover="hover",i.Hidden="hidden",i.AppearByTrigger="appearByTrigger"}(AnimationTriggerType||(AnimationTriggerType={})),function(i){i.In="in",i.Out="out"}(AnimationZoomDirectionType||(AnimationZoomDirectionType={})),function(i){i.Ease="ease",i.EaseIn="ease-in",i.EaseOut="ease-out",i.Linear="linear"}(AnimationEasingType||(AnimationEasingType={}));export{AnimationDirectionType,AnimationEasingType,AnimationSetting,AnimationTriggerType,AnimationType,AnimationZoomDirectionType};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -34478,7 +34478,8 @@ declare enum AnimationSetting {
|
|
|
34478
34478
|
Distance = "distance",
|
|
34479
34479
|
Intensity = "intensity",
|
|
34480
34480
|
Direction = "direction",
|
|
34481
|
-
ZoomDirection = "zoomDirection"
|
|
34481
|
+
ZoomDirection = "zoomDirection",
|
|
34482
|
+
TriggerAnimationOption = "triggerAnimationOption"
|
|
34482
34483
|
}
|
|
34483
34484
|
declare enum AnimationDirectionType {
|
|
34484
34485
|
Left = "left",
|
|
@@ -34513,6 +34514,7 @@ type AnimationBaseSetting = {
|
|
|
34513
34514
|
direction: AnimationDirectionType;
|
|
34514
34515
|
zoomDirection: AnimationZoomDirectionType;
|
|
34515
34516
|
isFade: boolean;
|
|
34517
|
+
triggerAnimationOption: 'once' | 'every-time';
|
|
34516
34518
|
};
|
|
34517
34519
|
/** Represents the animation setting extracted from the animation control */
|
|
34518
34520
|
type AnimationSettingType = {
|
|
@@ -34521,10 +34523,10 @@ type AnimationSettingType = {
|
|
|
34521
34523
|
type ScaleByDirection = {
|
|
34522
34524
|
[key in AnimationZoomDirectionType]: [number | string, number | string];
|
|
34523
34525
|
};
|
|
34524
|
-
type AnimationShakeSettingType = Pick<AnimationSettingType, AnimationSetting.Loop | AnimationSetting.Intensity | AnimationSetting.Speed | AnimationSetting.Delay | AnimationSetting.Easing>;
|
|
34525
|
-
type AnimationZoomSettingType = Pick<AnimationSettingType, AnimationSetting.Scale | AnimationSetting.ZoomDirection | AnimationSetting.Speed | AnimationSetting.Delay | AnimationSetting.Easing | AnimationSetting.IsFade>;
|
|
34526
|
-
type AnimationFadeSettingType = Pick<AnimationSettingType, AnimationSetting.Speed | AnimationSetting.Delay | AnimationSetting.Easing>;
|
|
34527
|
-
type AnimationSlideSettingType = Pick<AnimationSettingType, AnimationSetting.Direction | AnimationSetting.Distance | AnimationSetting.Speed | AnimationSetting.Delay | AnimationSetting.Easing>;
|
|
34526
|
+
type AnimationShakeSettingType = Pick<AnimationSettingType, AnimationSetting.Loop | AnimationSetting.Intensity | AnimationSetting.Speed | AnimationSetting.Delay | AnimationSetting.Easing | AnimationSetting.TriggerAnimationOption>;
|
|
34527
|
+
type AnimationZoomSettingType = Pick<AnimationSettingType, AnimationSetting.Scale | AnimationSetting.ZoomDirection | AnimationSetting.Speed | AnimationSetting.Delay | AnimationSetting.Easing | AnimationSetting.IsFade | AnimationSetting.TriggerAnimationOption>;
|
|
34528
|
+
type AnimationFadeSettingType = Pick<AnimationSettingType, AnimationSetting.Speed | AnimationSetting.Delay | AnimationSetting.Easing | AnimationSetting.TriggerAnimationOption>;
|
|
34529
|
+
type AnimationSlideSettingType = Pick<AnimationSettingType, AnimationSetting.Direction | AnimationSetting.Distance | AnimationSetting.Speed | AnimationSetting.Delay | AnimationSetting.Easing | AnimationSetting.TriggerAnimationOption>;
|
|
34528
34530
|
type SettingByAnimationType = {
|
|
34529
34531
|
[key in AnimationType]: key extends AnimationType.Slide ? AnimationSlideSettingType : key extends AnimationType.Shake ? AnimationShakeSettingType : key extends AnimationType.Zoom ? AnimationZoomSettingType : key extends AnimationType.Fade ? AnimationFadeSettingType : never;
|
|
34530
34532
|
};
|