@gem-sdk/components 23.0.0-dev.19 → 23.0.0-dev.20
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/image/common/attrs.js +1 -1
- package/dist/cjs/image/common/listContext.js +15 -0
- package/dist/cjs/image/common/srcset.js +1 -1
- package/dist/cjs/product/components/product-list/ProductListCarouselLayout.liquid.js +9 -7
- package/dist/cjs/product/components/product-list/ProductListGridLayout.liquid.js +16 -14
- package/dist/cjs/product/components/product-list-v3/ProductListCarouselLayout.liquid.js +11 -9
- package/dist/cjs/product/components/product-list-v3/ProductListGridLayout.liquid.js +16 -14
- package/dist/esm/image/common/attrs.js +1 -1
- package/dist/esm/image/common/listContext.js +15 -0
- package/dist/esm/image/common/srcset.js +1 -1
- package/dist/esm/product/components/product-list/ProductListCarouselLayout.liquid.js +11 -9
- package/dist/esm/product/components/product-list/ProductListGridLayout.liquid.js +18 -16
- package/dist/esm/product/components/product-list-v3/ProductListCarouselLayout.liquid.js +11 -9
- package/dist/esm/product/components/product-list-v3/ProductListGridLayout.liquid.js +18 -16
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("./helpers.js"),t=require("../../constant.js"),
|
|
1
|
+
"use strict";var e=require("./helpers.js"),t=require("./listContext.js"),r=require("../../constant.js"),s=require("@gem-sdk/system"),a=require("./srcset.js");const i=e=>e?{loading:"eager",fetchpriority:"high"}:{loading:"lazy"};exports.getAdaptiveImageAttrs=({styles:t,setting:r,sizeTarget:s,resolvedSrcSet:a})=>{let{alt:i,srcSet:g,priority:l,title:o,qualityType:A,qualityPercent:n}=r??{},_=e.getAspectRatio({styles:t,setting:r});return{pictureClass:"gp-contents",...i&&{alt:i},...o&&{title:o},...g&&{srcSet:g},...a&&{resolvedSrcSet:a},...l&&{priority:l},...s&&{sizeTarget:s},...A&&{qualityType:A},...n&&{qualityPercent:n},...t?.objectFit&&{layout:t.objectFit},aspectRatio:_}},exports.getContainerAttrs=(e,t)=>({...e,...t&&{"data-id":t}}),exports.getImageLiquidAttrs=({pageContext:e})=>({...e&&{pageContext:e}}),exports.getLinkWrapperAttrs=({urlData:e,imageLink:t,title:s,isLiquid:a=!1})=>{let i=a?{...e,...t?.noFollow&&{rel:"nofollow"},title:s}:{setting:e,title:s};return t?.type!=="go-to-sales-page"?t?.link?i:{}:a?{href:r.HREF_TO_SALES_PAGE,target:"_self"}:{setting:{href:r.HREF_TO_SALES_PAGE,target:"_self"}}},exports.getLoadingAttrs=i,exports.getNextImageAttrs=({styles:t,setting:r})=>{let{objectFit:s}=t??{},{vw:a,alt:i,title:g,quality:l,priority:o,isNotLazyload:A,qualityType:n,qualityPercent:_}=r??{},c=e.getAspectRatio({styles:t,setting:r});return{...r?.image,...a&&{vw:a},...i&&{alt:i},...g&&{title:g},...l&&{quality:l},...o&&{priority:o},isNotLazyload:A,setting:{aspectRatio:c,layout:s,qualityType:n,qualityPercent:_}}},exports.getNextImageLiquidAttrs=r=>{let{id:g,src:l=e.NEXT_IMAGE_CONFIG.DEFAULT_SRC,alt:o=e.NEXT_IMAGE_CONFIG.DEFAULT_ALT,title:A,sizes:n,srcset:_,storage:c,baseSrc:E,priority:u,customAttrs:p,width:I=2237,height:L=1678,setting:T,sizeTarget:F,resolvedSrc:y,backupFileKey:G,backupFilePath:N,srcIsLiquidCode:d}=r;return s.createAttr({...p,...g&&{id:g},...o&&{alt:o},...A&&{title:A},width:I,height:L,draggable:"false",...(()=>{if(d)return{src:l,..._&&{srcset:_}};let t=G?e.getNewBackupFileKey(G,l):"",r=e.getImageSrc({src:l,backupFileKey:t,backupFilePath:N,storage:c}),s=a.getImageSrcset({src:r,resolvedSrc:y,sizeTarget:F,qualityType:T?.qualityType,qualityPercent:T?.qualityPercent});return{src:r,...s&&{srcset:s}}})(),...n&&{sizes:n},...E&&{"base-src":E},...d?t.getListAwareLoadingAttrs(u):i(u)})},exports.getNextImageReactAttrs=t=>{let{width:r=e.NEXT_IMAGE_CONFIG.DEFAULT_WIDTH_PROPS,height:a=e.NEXT_IMAGE_CONFIG.DEFAULT_HEIGHT_PROPS,quality:i,priority:g,isNotLazyload:l,pageContext:o,base64:A=e.IMAGE_PLACEHOLDER,alt:n=e.NEXT_IMAGE_CONFIG.DEFAULT_ALT,title:_,src:c=e.NEXT_IMAGE_CONFIG.DEFAULT_SRC}=t,E=!l&&(o?.enableLazyLoadImage??!0)&&!g,u=s.createAttr((()=>{let e={loading:"lazy",placeholder:"blur",...A&&{blurDataURL:A}};return{...E?e:{loading:"eager",fetchpriority:"high"}}})());return{src:c,alt:n,title:_,width:r,height:a,quality:i,...u}};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";var e=require("@gem-sdk/core");const i="gp_list_img_loading",t="gp_list_img_fetchpriority",s={EAGER:"eager",LAZY:"lazy"},a={HIGH:"high",AUTO:"auto"},r={desktop:4,tablet:2,mobile:2},n=i=>e.DEVICES.map(t=>{let s=Number(e.getResponsiveValueByScreen(i,t));return Math.max(1,Math.floor(s||r[t]))});exports.LIST_PRELOAD_ROWS={GRID:2,CAROUSEL:1},exports.getListAwareLoadingAttrs=e=>e?{loading:`{% if ${i} == '${s.LAZY}' %}${s.LAZY}{% else %}${s.EAGER}{% endif %}`,fetchpriority:`{% if ${t} == '${a.AUTO}' %}${a.AUTO}{% else %}${a.HIGH}{% endif %}`}:{loading:s.LAZY},exports.getListImagePriorityLiquid=({slidesToShow:e,rows:r})=>{let g=n(e);return{item:`{%- liquid
|
|
2
|
+
if count <= ${Math.max(...g)*r}
|
|
3
|
+
assign ${i} = '${s.EAGER}'
|
|
4
|
+
else
|
|
5
|
+
assign ${i} = '${s.LAZY}'
|
|
6
|
+
endif
|
|
7
|
+
if count <= ${Math.min(...g)*r}
|
|
8
|
+
assign ${t} = '${a.HIGH}'
|
|
9
|
+
else
|
|
10
|
+
assign ${t} = '${a.AUTO}'
|
|
11
|
+
endif
|
|
12
|
+
-%}`,reset:`{%- liquid
|
|
13
|
+
assign ${i} = nil
|
|
14
|
+
assign ${t} = nil
|
|
15
|
+
-%}`}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var e=require("@gem-sdk/core"),t=require("./helpers.js");const r={mobile:768,tablet:1024,desktop:1440},i={Image:{desktop:
|
|
1
|
+
"use strict";var e=require("@gem-sdk/core"),t=require("./helpers.js");const r={mobile:768,tablet:1024,desktop:1440},i={Image:{desktop:1024,tablet:1024,mobile:768},HeroBanner:{desktop:1920,tablet:1280,mobile:768},ImageComparison:{desktop:1024,tablet:768,mobile:480},ProductFeatureImage:{desktop:1024,tablet:1024,mobile:768},GalleryList:{desktop:256,tablet:256,mobile:128},ArticleImage:{desktop:1024,tablet:768,mobile:480}},s="high",a={high:100,medium:70},o=["GalleryList"],l="original",n=/\s*%\s*$/,p=e=>{if("number"==typeof e)return e;let t=Number.parseFloat(String(e??"").replace(n,""));return Number.isFinite(t)?t:100},u=/^\{\{\s*([\s\S]*?)\s*\}\}$/,d=/\{\{|\{%/,m=e=>!!e&&e.includes("cdn.shopify")&&!t.isCannotResizeImageByQuery(e),c=({qualityType:t,qualityPercent:r})=>{if(!t&&!r)return;let i={};for(let o of e.DEVICES){let n=e.getResponsiveValueByScreen(t,o,s)??s;if("finest"===n){i[o]=l;continue}let u="custom"===n?p(e.getResponsiveValueByScreen(r,o,100)):a[n]??100;i[o]=(u>0?u:100)/100}return i},g=(e,t)=>{let r=e.match(u);return r?`{{ ${r[1]} | append: '?width=${t}' | replace: '?', '&' | replace_first: '&', '?' }}`:`${e}${e.includes("?")?"&":"?"}width=${t}`},b=({sizeTarget:t="Image",qualityType:s,qualityPercent:a})=>{let n=c({qualityType:s,qualityPercent:a}),p=i[t]??i.Image,u=!o.includes(t),d=t=>{let r=e.getResponsiveValueByScreen(n,t,1)??1;return r===l?u?l:p[t]:Math.round(p[t]*r)};return e.DEVICES.map(e=>({device:e,width:d(e),descriptor:r[e]})).sort((e,t)=>e.descriptor-t.descriptor)},S=e=>e.every(e=>e.width===l);exports.ORIGINAL_QUALITY=l,exports.SRCSET_DEVICE_DESCRIPTORS=r,exports.SRCSET_TARGET_WIDTHS=i,exports.appendWidthParam=g,exports.canResizeByShopifyCdn=m,exports.getImageSrcset=({src:t,resolvedSrc:r,sizeTarget:i,qualityType:s,qualityPercent:a})=>{if(!t)return;let o=u.test(t);if(!o&&d.test(t))return;let n=o?e.hasTranslatedLiquid(t)?r:void 0:t;if(!m(n))return;let p=b({sizeTarget:i,qualityType:s,qualityPercent:a});if(!S(p))return p.map(({width:e,descriptor:r})=>{let i=e===l?t:g(t,e);return`${i} ${r}w`}).join(", ")},exports.getQualityMultiplier=c,exports.getSrcsetCandidates=b,exports.isEveryCandidateOriginal=S;
|
|
@@ -1,18 +1,20 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../carousel/components/item/CarouselItem.liquid.js"),
|
|
2
|
-
${
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../image/common/listContext.js"),t=require("../../../carousel/components/item/CarouselItem.liquid.js"),r=require("../../../carousel/components/root/Carousel.liquid.js"),i=require("./ProductListCarouselItem.liquid.js"),o=require("../../../helpers.js"),s=require("./common/classes.js"),d=require("./common/helpers.js"),u=require("./common/styles.js"),l=require("@gem-sdk/core");exports.default=a=>{let{builderProps:c,advanced:n,productSrc:p,productListId:m}=a,{carouselConfigSetting:g,carouselConfigStyle:f}=d.getData(a),{carouselItemStyle:_}=u.getStyle(a),{carouselClass:q}=s.getClass(a),$=e.getListImagePriorityLiquid({slidesToShow:a.setting?.slidesToShow,rows:e.LIST_PRELOAD_ROWS.CAROUSEL});return l.template`
|
|
2
|
+
${r.default({advanced:n,builderProps:{...c},rootAttrs:{"items-repeat":"true"},rootId:`product-list-carousel-${c?.uid}`,rootClass:q,setting:g,styles:f,children:`
|
|
3
3
|
{%- assign count = 0 -%}
|
|
4
4
|
{%- for product in products limit: limit -%}
|
|
5
5
|
{%- if product.id != empty -%}
|
|
6
6
|
{%- assign count = count | plus: 1 -%}
|
|
7
|
+
${$.item}
|
|
7
8
|
{%- assign variant = product.selected_or_first_available_variant -%}
|
|
8
|
-
{%- assign product_form_id = 'product-form-' | append: "${
|
|
9
|
-
${
|
|
10
|
-
${
|
|
9
|
+
{%- assign product_form_id = 'product-form-' | append: "${c?.uid}" | append: product.id -%}
|
|
10
|
+
${t.default({builderProps:{...c},style:_,parentId:`product-list-carousel-${c?.uid} gp-child-item-${c?.uid}`,parentStyle:f,background:g?.background,children:`
|
|
11
|
+
${i.default({...a})}
|
|
11
12
|
`})}
|
|
12
13
|
{%- endif -%}
|
|
13
14
|
{% endfor %}
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
${$.reset}
|
|
16
|
+
{%- if count == 0 and ${m.length} == 0 -%}
|
|
17
|
+
{% if '${p}' == 'RelatedProduct' -%}
|
|
16
18
|
<div>${o.getStaticLocale("ProductList","no_related_products")}</div>
|
|
17
19
|
{% else %}
|
|
18
20
|
<div>${o.getStaticLocale("ProductList","no_products_found")}</div>
|
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./ProductListGridItem.liquid.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../image/common/listContext.js"),t=require("./ProductListGridItem.liquid.js"),i=require("../../../helpers.js"),s=require("@gem-sdk/core"),r=require("./common/classes.js"),o=require("./common/styles.js"),d=require("./common/attrs.js");exports.default=a=>{let{setting:l,builderProps:n,styles:c,productListId:u,productSrc:p}=a,{gridLayoutStyle:m}=o.getStyle(a),{gridLayoutClass:g}=r.getClass(a),{productListAttr:f}=d.getAttr(a),$=e.getListImagePriorityLiquid({slidesToShow:l?.slidesToShow,rows:e.LIST_PRELOAD_ROWS.GRID}),h=()=>s.template`
|
|
2
2
|
{%- assign count = 0 -%}
|
|
3
3
|
{%- for product in products limit: limit -%}
|
|
4
4
|
{%- if product.id != empty -%}
|
|
5
5
|
{%- assign count = count | plus: 1 -%}
|
|
6
|
+
${$.item}
|
|
6
7
|
{%- assign variant = product.selected_or_first_available_variant -%}
|
|
7
|
-
{%- assign product_form_id = 'product-form-' | append: "${
|
|
8
|
-
${
|
|
8
|
+
{%- assign product_form_id = 'product-form-' | append: "${n?.uid}" | append: product.id -%}
|
|
9
|
+
${t.default({...a})}
|
|
9
10
|
{%- endif -%}
|
|
10
11
|
{% endfor %}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
${$.reset}
|
|
13
|
+
{%- if count == 0 and ${u?.length} == 0 -%}
|
|
14
|
+
{% if '${p}' == 'RelatedProduct' -%}
|
|
15
|
+
<div>${i.getStaticLocale("ProductList","no_related_products")}</div>
|
|
14
16
|
{% else %}
|
|
15
|
-
<div>${
|
|
17
|
+
<div>${i.getStaticLocale("ProductList","no_products_found")}</div>
|
|
16
18
|
{%- endif -%}
|
|
17
19
|
{%- endif -%}
|
|
18
|
-
`;return
|
|
20
|
+
`;return s.template`
|
|
19
21
|
<div
|
|
20
|
-
${
|
|
21
|
-
style="${
|
|
22
|
+
${f}
|
|
23
|
+
style="${m}"
|
|
22
24
|
class="${g}"
|
|
23
25
|
>
|
|
24
|
-
${
|
|
26
|
+
${s.RenderIf(l?.sameHeight,s.template`
|
|
25
27
|
<gp-same-height
|
|
26
28
|
class="gp-contents"
|
|
27
29
|
style="visibility: hidden"
|
|
28
30
|
>
|
|
29
|
-
<script gp-data type="application/json">${JSON.stringify({targetUid:
|
|
31
|
+
<script gp-data type="application/json">${JSON.stringify({targetUid:n?.builderData?.childrens?.[0],slidesToShow:l?.slidesToShow,rowGap:c?.horizontalGutter})}
|
|
30
32
|
</script>
|
|
31
|
-
${`${
|
|
33
|
+
${`${h()}`}
|
|
32
34
|
</gp-same-height>
|
|
33
35
|
`)}
|
|
34
|
-
${
|
|
36
|
+
${s.RenderIf(!l?.sameHeight,s.template`${h()}`)}
|
|
35
37
|
</div>
|
|
36
38
|
`};
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../carousel-v3/components/item/CarouselItem.liquid.js"),t=require("../../../carousel-v3/components/root/Carousel.liquid.js"),r=require("./ProductListCarouselItem.liquid.js"),
|
|
2
|
-
${t.default({advanced:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../carousel-v3/components/item/CarouselItem.liquid.js"),t=require("../../../carousel-v3/components/root/Carousel.liquid.js"),r=require("../../../image/common/listContext.js"),i=require("./ProductListCarouselItem.liquid.js"),s=require("../../../helpers.js"),o=require("./common/classes.js"),d=require("./common/helpers.js"),u=require("./common/styles.js"),l=require("@gem-sdk/core");exports.default=a=>{let{builderProps:c,advanced:n,productSrc:p,productListId:m}=a,{carouselConfigSetting:g,carouselConfigStyle:f}=d.getData(a),{carouselItemStyle:_}=u.getStyle(a),{carouselClass:q}=o.getClass(a),$=r.getListImagePriorityLiquid({slidesToShow:a.setting?.slidesToShow,rows:r.LIST_PRELOAD_ROWS.CAROUSEL});return l.template`
|
|
2
|
+
${t.default({advanced:n,builderProps:{...c},rootAttrs:{"items-repeat":"true"},rootId:`product-list-carousel-${c?.uid}`,rootClass:q,setting:g,styles:f,isProductList:!0,children:`
|
|
3
3
|
{%- assign count = 0 -%}
|
|
4
4
|
{%- for product in products limit: limit -%}
|
|
5
5
|
{%- if product.id != empty -%}
|
|
6
6
|
{%- assign count = count | plus: 1 -%}
|
|
7
|
+
${$.item}
|
|
7
8
|
{%- assign variant = product.selected_or_first_available_variant -%}
|
|
8
|
-
{%- assign product_form_id = 'product-form-' | append: "${
|
|
9
|
-
${e.default({builderProps:{...
|
|
10
|
-
${
|
|
9
|
+
{%- assign product_form_id = 'product-form-' | append: "${c?.uid}" | append: product.id -%}
|
|
10
|
+
${e.default({builderProps:{...c},style:_,parentId:`product-list-carousel-${c?.uid} gp-child-item-${c?.uid}`,parentStyle:f,parentSettings:g,background:g?.background,children:`
|
|
11
|
+
${i.default({...a})}
|
|
11
12
|
`})}
|
|
12
13
|
{%- endif -%}
|
|
13
14
|
{% endfor %}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
${$.reset}
|
|
16
|
+
{%- if count == 0 and ${m.length} == 0 -%}
|
|
17
|
+
{% if '${p}' == 'RelatedProduct' -%}
|
|
18
|
+
<div>${s.getStaticLocale("ProductList","no_related_products")}</div>
|
|
17
19
|
{% else %}
|
|
18
|
-
<div>${
|
|
20
|
+
<div>${s.getStaticLocale("ProductList","no_products_found")}</div>
|
|
19
21
|
{%- endif -%}
|
|
20
22
|
{%- endif -%}
|
|
21
23
|
`,carouselType:"product_list"})}
|
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("./ProductListGridItem.liquid.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../image/common/listContext.js"),t=require("./ProductListGridItem.liquid.js"),i=require("../../../helpers.js"),s=require("@gem-sdk/core"),r=require("./common/classes.js"),o=require("./common/styles.js"),d=require("./common/attrs.js");exports.default=a=>{let{setting:l,builderProps:n,styles:c,productListId:u,productSrc:p}=a,{gridLayoutStyle:m}=o.getStyle(a),{gridLayoutClass:g}=r.getClass(a),{productListAttr:f}=d.getAttr(a),$=e.getListImagePriorityLiquid({slidesToShow:l?.slidesToShow,rows:e.LIST_PRELOAD_ROWS.GRID}),h=()=>s.template`
|
|
2
2
|
{%- assign count = 0 -%}
|
|
3
3
|
{%- for product in products limit: limit -%}
|
|
4
4
|
{%- if product.id != empty -%}
|
|
5
5
|
{%- assign count = count | plus: 1 -%}
|
|
6
|
+
${$.item}
|
|
6
7
|
{%- assign variant = product.selected_or_first_available_variant -%}
|
|
7
|
-
{%- assign product_form_id = 'product-form-' | append: "${
|
|
8
|
-
${
|
|
8
|
+
{%- assign product_form_id = 'product-form-' | append: "${n?.uid}" | append: product.id -%}
|
|
9
|
+
${t.default({...a})}
|
|
9
10
|
{%- endif -%}
|
|
10
11
|
{% endfor %}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
${$.reset}
|
|
13
|
+
{%- if count == 0 and ${u?.length} == 0 -%}
|
|
14
|
+
{% if '${p}' == 'RelatedProduct' -%}
|
|
15
|
+
<div>${i.getStaticLocale("ProductList","no_related_products")}</div>
|
|
14
16
|
{% else %}
|
|
15
|
-
<div>${
|
|
17
|
+
<div>${i.getStaticLocale("ProductList","no_products_found")}</div>
|
|
16
18
|
{%- endif -%}
|
|
17
19
|
{%- endif -%}
|
|
18
|
-
`;return
|
|
20
|
+
`;return s.template`
|
|
19
21
|
<div
|
|
20
|
-
${
|
|
21
|
-
style="${
|
|
22
|
+
${f}
|
|
23
|
+
style="${m}"
|
|
22
24
|
class="${g}"
|
|
23
25
|
>
|
|
24
|
-
${
|
|
26
|
+
${s.RenderIf(l?.sameHeight,s.template`
|
|
25
27
|
<gp-same-height
|
|
26
28
|
class="gp-contents"
|
|
27
29
|
style="visibility: hidden"
|
|
28
30
|
>
|
|
29
|
-
<script gp-data type="application/json">${JSON.stringify({targetUid:
|
|
31
|
+
<script gp-data type="application/json">${JSON.stringify({targetUid:n?.builderData?.childrens?.[0],slidesToShow:l?.slidesToShow,rowGap:c?.horizontalGutter})}
|
|
30
32
|
</script>
|
|
31
|
-
${`${
|
|
33
|
+
${`${h()}`}
|
|
32
34
|
</gp-same-height>
|
|
33
35
|
`)}
|
|
34
|
-
${
|
|
36
|
+
${s.RenderIf(!l?.sameHeight,s.template`${h()}`)}
|
|
35
37
|
</div>
|
|
36
38
|
`};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getAspectRatio as t,IMAGE_PLACEHOLDER as e,NEXT_IMAGE_CONFIG as r,getNewBackupFileKey as a,getImageSrc as l}from"./helpers.js";import{
|
|
1
|
+
import{getAspectRatio as t,IMAGE_PLACEHOLDER as e,NEXT_IMAGE_CONFIG as r,getNewBackupFileKey as a,getImageSrc as l}from"./helpers.js";import{getListAwareLoadingAttrs as i}from"./listContext.js";import{HREF_TO_SALES_PAGE as s}from"../../constant.js";import{createAttr as o}from"@gem-sdk/system";import{getImageSrcset as g}from"./srcset.js";let n=(t,e)=>({...t,...e&&{"data-id":e}}),p=({urlData:t,imageLink:e,title:r,isLiquid:a=!1})=>{let l=a?{...t,...e?.noFollow&&{rel:"nofollow"},title:r}:{setting:t,title:r};return e?.type!=="go-to-sales-page"?e?.link?l:{}:a?{href:s,target:"_self"}:{setting:{href:s,target:"_self"}}},u=({pageContext:t})=>({...t&&{pageContext:t}}),m=t=>t?{loading:"eager",fetchpriority:"high"}:{loading:"lazy"},c=({styles:e,setting:r,sizeTarget:a,resolvedSrcSet:l})=>{let{alt:i,srcSet:s,priority:o,title:g,qualityType:n,qualityPercent:p}=r??{},u=t({styles:e,setting:r});return{pictureClass:"gp-contents",...i&&{alt:i},...g&&{title:g},...s&&{srcSet:s},...l&&{resolvedSrcSet:l},...o&&{priority:o},...a&&{sizeTarget:a},...n&&{qualityType:n},...p&&{qualityPercent:p},...e?.objectFit&&{layout:e.objectFit},aspectRatio:u}},A=({styles:e,setting:r})=>{let{objectFit:a}=e??{},{vw:l,alt:i,title:s,quality:o,priority:g,isNotLazyload:n,qualityType:p,qualityPercent:u}=r??{},m=t({styles:e,setting:r});return{...r?.image,...l&&{vw:l},...i&&{alt:i},...s&&{title:s},...o&&{quality:o},...g&&{priority:g},isNotLazyload:n,setting:{aspectRatio:m,layout:a,qualityType:p,qualityPercent:u}}},y=t=>{let{id:e,src:s=r.DEFAULT_SRC,alt:n=r.DEFAULT_ALT,title:p,sizes:u,srcset:c,storage:A,baseSrc:y,priority:L,customAttrs:d,width:f=2237,height:T=1678,setting:h,sizeTarget:F,resolvedSrc:_,backupFileKey:b,backupFilePath:D,srcIsLiquidCode:I}=t;return o({...d,...e&&{id:e},...n&&{alt:n},...p&&{title:p},width:f,height:T,draggable:"false",...(()=>{if(I)return{src:s,...c&&{srcset:c}};let t=b?a(b,s):"",e=l({src:s,backupFileKey:t,backupFilePath:D,storage:A}),r=g({src:e,resolvedSrc:_,sizeTarget:F,qualityType:h?.qualityType,qualityPercent:h?.qualityPercent});return{src:e,...r&&{srcset:r}}})(),...u&&{sizes:u},...y&&{"base-src":y},...I?i(L):m(L)})},L=t=>{let{width:a=r.DEFAULT_WIDTH_PROPS,height:l=r.DEFAULT_HEIGHT_PROPS,quality:i,priority:s,isNotLazyload:g,pageContext:n,base64:p=e,alt:u=r.DEFAULT_ALT,title:m,src:c=r.DEFAULT_SRC}=t,A=!g&&(n?.enableLazyLoadImage??!0)&&!s,y=o((()=>{let t={loading:"lazy",placeholder:"blur",...p&&{blurDataURL:p}};return{...A?t:{loading:"eager",fetchpriority:"high"}}})());return{src:c,alt:u,title:m,width:a,height:l,quality:i,...y}};export{c as getAdaptiveImageAttrs,n as getContainerAttrs,u as getImageLiquidAttrs,p as getLinkWrapperAttrs,m as getLoadingAttrs,A as getNextImageAttrs,y as getNextImageLiquidAttrs,L as getNextImageReactAttrs};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import{DEVICES as i,getResponsiveValueByScreen as e}from"@gem-sdk/core";let t="gp_list_img_loading",s="gp_list_img_fetchpriority",a={EAGER:"eager",LAZY:"lazy"},n={HIGH:"high",AUTO:"auto"},g={desktop:4,tablet:2,mobile:2},l={GRID:2,CAROUSEL:1},r=t=>i.map(i=>{let s=Number(e(t,i));return Math.max(1,Math.floor(s||g[i]))}),$=({slidesToShow:i,rows:e})=>{let g=r(i);return{item:`{%- liquid
|
|
2
|
+
if count <= ${Math.max(...g)*e}
|
|
3
|
+
assign ${t} = '${a.EAGER}'
|
|
4
|
+
else
|
|
5
|
+
assign ${t} = '${a.LAZY}'
|
|
6
|
+
endif
|
|
7
|
+
if count <= ${Math.min(...g)*e}
|
|
8
|
+
assign ${s} = '${n.HIGH}'
|
|
9
|
+
else
|
|
10
|
+
assign ${s} = '${n.AUTO}'
|
|
11
|
+
endif
|
|
12
|
+
-%}`,reset:`{%- liquid
|
|
13
|
+
assign ${t} = nil
|
|
14
|
+
assign ${s} = nil
|
|
15
|
+
-%}`}},o=i=>i?{loading:`{% if ${t} == '${a.LAZY}' %}${a.LAZY}{% else %}${a.EAGER}{% endif %}`,fetchpriority:`{% if ${s} == '${n.AUTO}' %}${n.AUTO}{% else %}${n.HIGH}{% endif %}`}:{loading:a.LAZY};export{l as LIST_PRELOAD_ROWS,o as getListAwareLoadingAttrs,$ as getListImagePriorityLiquid};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{DEVICES as e,hasTranslatedLiquid as t,getResponsiveValueByScreen as r}from"@gem-sdk/core";import{isCannotResizeImageByQuery as i}from"./helpers.js";let l={mobile:768,tablet:1024,desktop:1440},a={Image:{desktop:
|
|
1
|
+
import{DEVICES as e,hasTranslatedLiquid as t,getResponsiveValueByScreen as r}from"@gem-sdk/core";import{isCannotResizeImageByQuery as i}from"./helpers.js";let l={mobile:768,tablet:1024,desktop:1440},a={Image:{desktop:1024,tablet:1024,mobile:768},HeroBanner:{desktop:1920,tablet:1280,mobile:768},ImageComparison:{desktop:1024,tablet:768,mobile:480},ProductFeatureImage:{desktop:1024,tablet:1024,mobile:768},GalleryList:{desktop:256,tablet:256,mobile:128},ArticleImage:{desktop:1024,tablet:768,mobile:480}},o="high",s={high:100,medium:70},n=["GalleryList"],d="original",m=/\s*%\s*$/,p=e=>{if("number"==typeof e)return e;let t=Number.parseFloat(String(e??"").replace(m,""));return Number.isFinite(t)?t:100},u=/^\{\{\s*([\s\S]*?)\s*\}\}$/,c=/\{\{|\{%/,b=e=>!!e&&e.includes("cdn.shopify")&&!i(e),f=({qualityType:t,qualityPercent:i})=>{if(!t&&!i)return;let l={};for(let a of e){let e=r(t,a,o)??o;if("finest"===e){l[a]=d;continue}let n="custom"===e?p(r(i,a,100)):s[e]??100;l[a]=(n>0?n:100)/100}return l},g=(e,t)=>{let r=e.match(u);return r?`{{ ${r[1]} | append: '?width=${t}' | replace: '?', '&' | replace_first: '&', '?' }}`:`${e}${e.includes("?")?"&":"?"}width=${t}`},h=({sizeTarget:t="Image",qualityType:i,qualityPercent:o})=>{let s=f({qualityType:i,qualityPercent:o}),m=a[t]??a.Image,p=!n.includes(t),u=e=>{let t=r(s,e,1)??1;return t===d?p?d:m[e]:Math.round(m[e]*t)};return e.map(e=>({device:e,width:u(e),descriptor:l[e]})).sort((e,t)=>e.descriptor-t.descriptor)},I=e=>e.every(e=>e.width===d),S=({src:e,resolvedSrc:r,sizeTarget:i,qualityType:l,qualityPercent:a})=>{if(!e)return;let o=u.test(e);if(!o&&c.test(e))return;let s=o?t(e)?r:void 0:e;if(!b(s))return;let n=h({sizeTarget:i,qualityType:l,qualityPercent:a});if(!I(n))return n.map(({width:t,descriptor:r})=>{let i=t===d?e:g(e,t);return`${i} ${r}w`}).join(", ")};export{d as ORIGINAL_QUALITY,l as SRCSET_DEVICE_DESCRIPTORS,a as SRCSET_TARGET_WIDTHS,g as appendWidthParam,b as canResizeByShopifyCdn,S as getImageSrcset,f as getQualityMultiplier,h as getSrcsetCandidates,I as isEveryCandidateOriginal};
|
|
@@ -1,22 +1,24 @@
|
|
|
1
|
-
import o from"../../../carousel/components/item/CarouselItem.liquid.js";import
|
|
2
|
-
${
|
|
1
|
+
import{getListImagePriorityLiquid as o,LIST_PRELOAD_ROWS as t}from"../../../image/common/listContext.js";import r from"../../../carousel/components/item/CarouselItem.liquid.js";import e from"../../../carousel/components/root/Carousel.liquid.js";import i from"./ProductListCarouselItem.liquid.js";import{getStaticLocale as s}from"../../../helpers.js";import{getClass as d}from"./common/classes.js";import{getData as u}from"./common/helpers.js";import{getStyle as l}from"./common/styles.js";import{template as m}from"@gem-sdk/core";let n=n=>{let{builderProps:c,advanced:a,productSrc:p,productListId:f}=n,{carouselConfigSetting:$,carouselConfigStyle:g}=u(n),{carouselItemStyle:_}=l(n),{carouselClass:h}=d(n),j=o({slidesToShow:n.setting?.slidesToShow,rows:t.CAROUSEL});return m`
|
|
2
|
+
${e({advanced:a,builderProps:{...c},rootAttrs:{"items-repeat":"true"},rootId:`product-list-carousel-${c?.uid}`,rootClass:h,setting:$,styles:g,children:`
|
|
3
3
|
{%- assign count = 0 -%}
|
|
4
4
|
{%- for product in products limit: limit -%}
|
|
5
5
|
{%- if product.id != empty -%}
|
|
6
6
|
{%- assign count = count | plus: 1 -%}
|
|
7
|
+
${j.item}
|
|
7
8
|
{%- assign variant = product.selected_or_first_available_variant -%}
|
|
8
9
|
{%- assign product_form_id = 'product-form-' | append: "${c?.uid}" | append: product.id -%}
|
|
9
|
-
${
|
|
10
|
-
${
|
|
10
|
+
${r({builderProps:{...c},style:_,parentId:`product-list-carousel-${c?.uid} gp-child-item-${c?.uid}`,parentStyle:g,background:$?.background,children:`
|
|
11
|
+
${i({...n})}
|
|
11
12
|
`})}
|
|
12
13
|
{%- endif -%}
|
|
13
14
|
{% endfor %}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
${j.reset}
|
|
16
|
+
{%- if count == 0 and ${f.length} == 0 -%}
|
|
17
|
+
{% if '${p}' == 'RelatedProduct' -%}
|
|
18
|
+
<div>${s("ProductList","no_related_products")}</div>
|
|
17
19
|
{% else %}
|
|
18
|
-
<div>${
|
|
20
|
+
<div>${s("ProductList","no_products_found")}</div>
|
|
19
21
|
{%- endif -%}
|
|
20
22
|
{%- endif -%}
|
|
21
23
|
`})}
|
|
22
|
-
`};export{
|
|
24
|
+
`};export{n as default};
|
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
import t from"./ProductListGridItem.liquid.js";import{getStaticLocale as
|
|
1
|
+
import{getListImagePriorityLiquid as t,LIST_PRELOAD_ROWS as i}from"../../../image/common/listContext.js";import o from"./ProductListGridItem.liquid.js";import{getStaticLocale as s}from"../../../helpers.js";import{RenderIf as e,template as r}from"@gem-sdk/core";import{getClass as d}from"./common/classes.js";import{getStyle as a}from"./common/styles.js";import{getAttr as n}from"./common/attrs.js";let m=m=>{let{setting:p,builderProps:c,styles:l,productListId:u,productSrc:f}=m,{gridLayoutStyle:g}=a(m),{gridLayoutClass:$}=d(m),{productListAttr:h}=n(m),v=t({slidesToShow:p?.slidesToShow,rows:i.GRID}),_=()=>r`
|
|
2
2
|
{%- assign count = 0 -%}
|
|
3
3
|
{%- for product in products limit: limit -%}
|
|
4
4
|
{%- if product.id != empty -%}
|
|
5
5
|
{%- assign count = count | plus: 1 -%}
|
|
6
|
+
${v.item}
|
|
6
7
|
{%- assign variant = product.selected_or_first_available_variant -%}
|
|
7
|
-
{%- assign product_form_id = 'product-form-' | append: "${
|
|
8
|
-
${
|
|
8
|
+
{%- assign product_form_id = 'product-form-' | append: "${c?.uid}" | append: product.id -%}
|
|
9
|
+
${o({...m})}
|
|
9
10
|
{%- endif -%}
|
|
10
11
|
{% endfor %}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
${v.reset}
|
|
13
|
+
{%- if count == 0 and ${u?.length} == 0 -%}
|
|
14
|
+
{% if '${f}' == 'RelatedProduct' -%}
|
|
15
|
+
<div>${s("ProductList","no_related_products")}</div>
|
|
14
16
|
{% else %}
|
|
15
|
-
<div>${
|
|
17
|
+
<div>${s("ProductList","no_products_found")}</div>
|
|
16
18
|
{%- endif -%}
|
|
17
19
|
{%- endif -%}
|
|
18
|
-
`;return
|
|
20
|
+
`;return r`
|
|
19
21
|
<div
|
|
20
|
-
${
|
|
21
|
-
style="${
|
|
22
|
-
class="${
|
|
22
|
+
${h}
|
|
23
|
+
style="${g}"
|
|
24
|
+
class="${$}"
|
|
23
25
|
>
|
|
24
|
-
${
|
|
26
|
+
${e(p?.sameHeight,r`
|
|
25
27
|
<gp-same-height
|
|
26
28
|
class="gp-contents"
|
|
27
29
|
style="visibility: hidden"
|
|
28
30
|
>
|
|
29
|
-
<script gp-data type="application/json">${JSON.stringify({targetUid:
|
|
31
|
+
<script gp-data type="application/json">${JSON.stringify({targetUid:c?.builderData?.childrens?.[0],slidesToShow:p?.slidesToShow,rowGap:l?.horizontalGutter})}
|
|
30
32
|
</script>
|
|
31
|
-
${`${
|
|
33
|
+
${`${_()}`}
|
|
32
34
|
</gp-same-height>
|
|
33
35
|
`)}
|
|
34
|
-
${
|
|
36
|
+
${e(!p?.sameHeight,r`${_()}`)}
|
|
35
37
|
</div>
|
|
36
|
-
`};export{
|
|
38
|
+
`};export{m as default};
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import o from"../../../carousel-v3/components/item/CarouselItem.liquid.js";import t from"../../../carousel-v3/components/root/Carousel.liquid.js";import r from"./ProductListCarouselItem.liquid.js";import{getStaticLocale as
|
|
2
|
-
${t({advanced:
|
|
1
|
+
import o from"../../../carousel-v3/components/item/CarouselItem.liquid.js";import t from"../../../carousel-v3/components/root/Carousel.liquid.js";import{getListImagePriorityLiquid as r,LIST_PRELOAD_ROWS as e}from"../../../image/common/listContext.js";import s from"./ProductListCarouselItem.liquid.js";import{getStaticLocale as i}from"../../../helpers.js";import{getClass as d}from"./common/classes.js";import{getData as u}from"./common/helpers.js";import{getStyle as l}from"./common/styles.js";import{template as n}from"@gem-sdk/core";let c=c=>{let{builderProps:m,advanced:p,productSrc:a,productListId:f}=c,{carouselConfigSetting:g,carouselConfigStyle:$}=u(c),{carouselItemStyle:_}=l(c),{carouselClass:v}=d(c),h=r({slidesToShow:c.setting?.slidesToShow,rows:e.CAROUSEL});return n`
|
|
2
|
+
${t({advanced:p,builderProps:{...m},rootAttrs:{"items-repeat":"true"},rootId:`product-list-carousel-${m?.uid}`,rootClass:v,setting:g,styles:$,isProductList:!0,children:`
|
|
3
3
|
{%- assign count = 0 -%}
|
|
4
4
|
{%- for product in products limit: limit -%}
|
|
5
5
|
{%- if product.id != empty -%}
|
|
6
6
|
{%- assign count = count | plus: 1 -%}
|
|
7
|
+
${h.item}
|
|
7
8
|
{%- assign variant = product.selected_or_first_available_variant -%}
|
|
8
|
-
{%- assign product_form_id = 'product-form-' | append: "${
|
|
9
|
-
${o({builderProps:{...
|
|
10
|
-
${
|
|
9
|
+
{%- assign product_form_id = 'product-form-' | append: "${m?.uid}" | append: product.id -%}
|
|
10
|
+
${o({builderProps:{...m},style:_,parentId:`product-list-carousel-${m?.uid} gp-child-item-${m?.uid}`,parentStyle:$,parentSettings:g,background:g?.background,children:`
|
|
11
|
+
${s({...c})}
|
|
11
12
|
`})}
|
|
12
13
|
{%- endif -%}
|
|
13
14
|
{% endfor %}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
${h.reset}
|
|
16
|
+
{%- if count == 0 and ${f.length} == 0 -%}
|
|
17
|
+
{% if '${a}' == 'RelatedProduct' -%}
|
|
18
|
+
<div>${i("ProductList","no_related_products")}</div>
|
|
17
19
|
{% else %}
|
|
18
|
-
<div>${
|
|
20
|
+
<div>${i("ProductList","no_products_found")}</div>
|
|
19
21
|
{%- endif -%}
|
|
20
22
|
{%- endif -%}
|
|
21
23
|
`,carouselType:"product_list"})}
|
|
@@ -1,36 +1,38 @@
|
|
|
1
|
-
import t from"./ProductListGridItem.liquid.js";import{getStaticLocale as
|
|
1
|
+
import{getListImagePriorityLiquid as t,LIST_PRELOAD_ROWS as i}from"../../../image/common/listContext.js";import o from"./ProductListGridItem.liquid.js";import{getStaticLocale as s}from"../../../helpers.js";import{RenderIf as e,template as r}from"@gem-sdk/core";import{getClass as d}from"./common/classes.js";import{getStyle as a}from"./common/styles.js";import{getAttr as n}from"./common/attrs.js";let m=m=>{let{setting:p,builderProps:c,styles:l,productListId:u,productSrc:f}=m,{gridLayoutStyle:g}=a(m),{gridLayoutClass:$}=d(m),{productListAttr:h}=n(m),v=t({slidesToShow:p?.slidesToShow,rows:i.GRID}),_=()=>r`
|
|
2
2
|
{%- assign count = 0 -%}
|
|
3
3
|
{%- for product in products limit: limit -%}
|
|
4
4
|
{%- if product.id != empty -%}
|
|
5
5
|
{%- assign count = count | plus: 1 -%}
|
|
6
|
+
${v.item}
|
|
6
7
|
{%- assign variant = product.selected_or_first_available_variant -%}
|
|
7
|
-
{%- assign product_form_id = 'product-form-' | append: "${
|
|
8
|
-
${
|
|
8
|
+
{%- assign product_form_id = 'product-form-' | append: "${c?.uid}" | append: product.id -%}
|
|
9
|
+
${o({...m})}
|
|
9
10
|
{%- endif -%}
|
|
10
11
|
{% endfor %}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
${v.reset}
|
|
13
|
+
{%- if count == 0 and ${u?.length} == 0 -%}
|
|
14
|
+
{% if '${f}' == 'RelatedProduct' -%}
|
|
15
|
+
<div>${s("ProductList","no_related_products")}</div>
|
|
14
16
|
{% else %}
|
|
15
|
-
<div>${
|
|
17
|
+
<div>${s("ProductList","no_products_found")}</div>
|
|
16
18
|
{%- endif -%}
|
|
17
19
|
{%- endif -%}
|
|
18
|
-
`;return
|
|
20
|
+
`;return r`
|
|
19
21
|
<div
|
|
20
|
-
${
|
|
21
|
-
style="${
|
|
22
|
-
class="${
|
|
22
|
+
${h}
|
|
23
|
+
style="${g}"
|
|
24
|
+
class="${$}"
|
|
23
25
|
>
|
|
24
|
-
${
|
|
26
|
+
${e(p?.sameHeight,r`
|
|
25
27
|
<gp-same-height
|
|
26
28
|
class="gp-contents"
|
|
27
29
|
style="visibility: hidden"
|
|
28
30
|
>
|
|
29
|
-
<script gp-data type="application/json">${JSON.stringify({targetUid:
|
|
31
|
+
<script gp-data type="application/json">${JSON.stringify({targetUid:c?.builderData?.childrens?.[0],slidesToShow:p?.slidesToShow,rowGap:l?.horizontalGutter})}
|
|
30
32
|
</script>
|
|
31
|
-
${`${
|
|
33
|
+
${`${_()}`}
|
|
32
34
|
</gp-same-height>
|
|
33
35
|
`)}
|
|
34
|
-
${
|
|
36
|
+
${e(!p?.sameHeight,r`${_()}`)}
|
|
35
37
|
</div>
|
|
36
|
-
`};export{
|
|
38
|
+
`};export{m as default};
|