@gem-sdk/core 2.0.0-dev.1207 → 2.0.0-dev.1215
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.
|
@@ -16,4 +16,4 @@
|
|
|
16
16
|
${h?`text-decoration-line: underline ${T}`:""};
|
|
17
17
|
${$?`text-transform: ${$} ${T}`:""};
|
|
18
18
|
${m&&n?`text-shadow: ${composeTextShadowCss(r||{})}`:"none"};
|
|
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")}):{},composeTypographyV2=(e,o)=>e?makeStyle.removeNullUndefined({...makeStyle.makeStyle({fs:o?.italic?void 0:e?.fontStyle,ff:composeFontFamilyTypographyV2(e),weight:o?.bold?void 0:e?.fontWeight
|
|
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")}):{},composeTypographyV2=(e,o)=>e?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",e?.letterSpacing)}):{},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,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
"use strict";var useSWR=require("swr"),getCollection=require("../../helpers/queries/get-collection.js"),shop=require("../shop.js"),useFetchHandle=require("../useFetchHandle.js"),query=require("../../helpers/query.js");const useCollectionQuery=(e,r)=>{let
|
|
2
|
+
"use strict";var useSWR=require("swr"),getCollection=require("../../helpers/queries/get-collection.js"),shop=require("../shop.js"),useFetchHandle=require("../useFetchHandle.js"),query=require("../../helpers/query.js"),PageContext=require("../../contexts/PageContext.js"),createStoreFrontFetcher=require("../../helpers/create-store-front-fetcher.js"),react=require("react");const useCollectionQuery=(e,r)=>{let t=useFetchHandle.useFetchHandle(),o=PageContext.usePageStore(e=>e.publicStoreFrontData),s=react.useMemo(()=>createStoreFrontFetcher.hasPublicStoreFrontData(o)?createStoreFrontFetcher.createStoreFrontFetcher(o):t,[o]),u=shop.useIsSampleProduct(),c=shop.useIsStorefrontProduct();return useSWR(e?query.generateCollectionQueryKey({...e,isSample:u,isStorefront:c}):null,([,e])=>getCollection.getCollection(s,e),r)};exports.useCollectionQuery=useCollectionQuery;
|
|
@@ -16,4 +16,4 @@ import{getSingleColorVariable as o}from"./colors.js";import{removeNullUndefined
|
|
|
16
16
|
${$?`text-decoration-line: underline ${d}`:""};
|
|
17
17
|
${f?`text-transform: ${f} ${d}`:""};
|
|
18
18
|
${c&&i?`text-shadow: ${composeTextShadowCss(n||{})}`:"none"};
|
|
19
|
-
`},composeTextShadowCss=o=>{let e="number"==typeof o?.angle?o?.angle:0,t=e*Math.PI/180,p=parseFloat(o?.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 ${o?.blur??"0"} ${o.color}`},composeTextHoverColorCss=(e,t)=>{if(e){let p=t?"!important":"",a=o(e.hover);return`${a?`color: ${a} ${p}`:""}`}};function getCustomCSSByDevice(o,e){if(!o||!e)return{};let t="desktop"!==e&&e?`-${e}`:"",{fontFamily:p}=o?.[e]??{};return{[`--size${t}`]:o?.[e]?.fontSize,[`--lh${t}`]:o?.[e]?.lineHeight,[`--fs${t}`]:o?.[e]?.fontStyle,[`--ff${t}`]:composeFontFamilyTypographyV2({fontFamily:p}),[`--weight${t}`]:o?.[e]?.fontWeight,[`--ls${t}`]:o?.[e]?.letterSpacing}}let composeTypography=o=>o?e({...getCustomCSSByDevice(o,"desktop"),...getCustomCSSByDevice(o,"tablet"),...getCustomCSSByDevice(o,"mobile")}):{},composeTypographyV2=(o,a)=>o?e({...t({fs:a?.italic?void 0:o?.fontStyle,ff:composeFontFamilyTypographyV2(o),weight:a?.bold?void 0:o?.fontWeight
|
|
19
|
+
`},composeTextShadowCss=o=>{let e="number"==typeof o?.angle?o?.angle:0,t=e*Math.PI/180,p=parseFloat(o?.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 ${o?.blur??"0"} ${o.color}`},composeTextHoverColorCss=(e,t)=>{if(e){let p=t?"!important":"",a=o(e.hover);return`${a?`color: ${a} ${p}`:""}`}};function getCustomCSSByDevice(o,e){if(!o||!e)return{};let t="desktop"!==e&&e?`-${e}`:"",{fontFamily:p}=o?.[e]??{};return{[`--size${t}`]:o?.[e]?.fontSize,[`--lh${t}`]:o?.[e]?.lineHeight,[`--fs${t}`]:o?.[e]?.fontStyle,[`--ff${t}`]:composeFontFamilyTypographyV2({fontFamily:p}),[`--weight${t}`]:o?.[e]?.fontWeight,[`--ls${t}`]:o?.[e]?.letterSpacing}}let composeTypography=o=>o?e({...getCustomCSSByDevice(o,"desktop"),...getCustomCSSByDevice(o,"tablet"),...getCustomCSSByDevice(o,"mobile")}):{},composeTypographyV2=(o,a)=>o?e({...t({fs:a?.italic?void 0:o?.fontStyle,ff:composeFontFamilyTypographyV2(o),weight:a?.bold?void 0:o?.fontWeight}),...p("size",o?.fontSize),...p("lh",o?.lineHeight),...p("ls",o?.letterSpacing)}):{},composeFontFamilyTypographyV2=o=>{let{fontFamily:e,isCustom:t,fallbackFontFamily:p,type:a}=o||{};if(!e)return t?p:void 0;if("string"==typeof e)return getFontUsedByTypographyV2({fontFamily:e,fallbackFontFamily:o?.fallbackFontFamily||composeFallbackTypographyStyle(a??"heading")});if("object"==typeof e&&"string"==typeof e?.value){if("theme"===e.type){let o=e?.value.includes("--g-theme-font")?`var(${e?.value})`:e?.value;return`${o}, var(--g-font-body)`}return getFontUsedByTypographyV2({fontFamily:e.value,fallbackFontFamily:o?.fallbackFontFamily||composeFallbackTypographyStyle(a??"heading")})}},getFontUsedByTypographyV2=({fontFamily:o,fallbackFontFamily:e})=>{if(o)return`var(--g-font-${o?.replace(/ /g,"-")}, '${o}'), ${e}`},composeTypographyAttr=p=>p?e({...t({fs:p?.italic?"italic":void 0,weight:p?.bold?"bold":void 0,c:o(p?.color),tt:p?.transform,tdl:p?.underline?"underline":void 0})}):{},composeTypographyClassName=(o,e)=>o?o?.type&&!isCustomTypo(o.custom)?genTypoClass(o.type):"":e?.type&&genTypoClass(e?.type),composeFallbackTypographyStyle=o=>o.toLocaleLowerCase().includes("heading")?"var(--g-font-heading, heading)":"var(--g-font-body, body)",composeTypographyStyle=(o,e,t)=>{if(o){let e=composeFallbackTypographyStyle(o.type??"heading"),p={...o.custom,fallbackFontFamily:e,isCustom:isCustomTypo(o.custom)};return{...composeTypographyV2(p,o.attrs),...!t&&composeTypographyAttr(o.attrs)}}return{...e?.type?{}:composeTypography(e?.custom)}},isCustomTypo=o=>o&&Object.keys(o).length>1||o&&1===Object.keys(o).length&&!o.fontSize;export{composeFallbackTypographyStyle,composeFontFamilyTypographyV2,composeTextHoverColorCss,composeTypography,composeTypographyAttr,composeTypographyClassName,composeTypographyCss,composeTypographyStyle,composeTypographyV2,composeTypographyV2Css,genTypoClass};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import e from"swr";import{getCollection as r}from"../../helpers/queries/get-collection.js";import{useIsSampleProduct as o,useIsStorefrontProduct as t}from"../shop.js";import{useFetchHandle as
|
|
2
|
+
import e from"swr";import{getCollection as r}from"../../helpers/queries/get-collection.js";import{useIsSampleProduct as o,useIsStorefrontProduct as t}from"../shop.js";import{useFetchHandle as s}from"../useFetchHandle.js";import{generateCollectionQueryKey as m}from"../../helpers/query.js";import{usePageStore as l}from"../../contexts/PageContext.js";import{hasPublicStoreFrontData as p,createStoreFrontFetcher as i}from"../../helpers/create-store-front-fetcher.js";import{useMemo as c}from"react";let useCollectionQuery=(f,n)=>{let u=s(),a=l(e=>e.publicStoreFrontData),h=c(()=>p(a)?i(a):u,[a]),j=o(),x=t();return e(f?m({...f,isSample:j,isStorefront:x}):null,([,e])=>r(h,e),n)};export{useCollectionQuery};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -34287,9 +34287,10 @@ type TypographyProps = {
|
|
|
34287
34287
|
hasShadowText?: boolean;
|
|
34288
34288
|
isCustom?: boolean;
|
|
34289
34289
|
};
|
|
34290
|
-
type TypographyV2Props = Omit<TypographyProps, 'fontSize' | 'lineHeight'> & {
|
|
34290
|
+
type TypographyV2Props = Omit<TypographyProps, 'fontSize' | 'lineHeight' | 'letterSpacing'> & {
|
|
34291
34291
|
fontSize?: ObjectDevices<string>;
|
|
34292
34292
|
lineHeight?: ObjectDevices<string>;
|
|
34293
|
+
letterSpacing?: ObjectDevices<string>;
|
|
34293
34294
|
};
|
|
34294
34295
|
type TypographyV2Attrs = {
|
|
34295
34296
|
bold?: boolean;
|