@gem-sdk/pages 8.0.0-dev.26 → 8.0.0-dev.30

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.
@@ -1 +1 @@
1
- "use strict";const EXCLUDED_FONT_FAMILIES=["sans-serif"],getFallbackFontFamilyFromGlobalStyle=(t,e)=>{if(e&&t?.type&&!t?.custom?.fontFamily){let o=e[t.type];o&&(t.custom||(t.custom={}),t.custom.fontFamily={value:o.family,type:o.type})}},getFontsFromDataBuilder=(t,e)=>{let o=[];for(let l in t)if(Object.prototype.hasOwnProperty.call(t,l)){let a=t[l],i=a.styles,n=a.settings;getFontFromGroupSetting(o,i,e),getFontFromGroupSetting(o,n,e)}return o},getFontFromGroupSetting=(t,e,o)=>{let l=["normal","hover","focus","active","disabled","price","compareAtPrice"];for(let a in e)if(Object.prototype.hasOwnProperty.call(e,a)){let i=e[a];if(!i)continue;for(let e of(getFallbackFontFamilyFromGlobalStyle(i,o),getFontValue(t,i),l))i[e]&&(getFallbackFontFamilyFromGlobalStyle(i[e],o),getFontValue(t,i[e]))}},uniqueArray=t=>Array.from(new Set(t)),getFontValue=(t,e)=>{let o=e.custom?.fontFamily;"string"==typeof o&&(o={value:e.custom?.fontFamily||"",type:"google"});let l=o?.value;if(EXCLUDED_FONT_FAMILIES.includes(l))return;let a=e.custom?.fontVariants;if(a?.length||(a=[e.custom?.fontWeight]),o&&a?.length){let i=a.map(t=>"regular"===t?"400":t),n=e.custom?.fontWeight&&i.includes(e.custom?.fontWeight)?e.custom?.fontWeight:i[0];if(n){let a=uniqueArray([n,...e?.attrs?.isAlwaysLoadBold?["700"]:[],...e?.attrs?.loadFontStyles?.includes("bold")?["700"]:[]]);if(e?.attrs?.loadFontStyles?.includes("italic")){let t=a.map(t=>"string"==typeof t&&/^\d+$/.test(t)?`${t}i`:null).filter(t=>null!==t);a.push(...t)}let r=t.find(t=>t.family==l&&a.every(e=>t.variants.includes(e)));if(!r){let e=t.find(t=>t.family==l);e?a.forEach(t=>{e.variants.includes(t)||e.variants.push(t)}):("700"!==n&&i.includes("700")&&a.push("700"),t.push({family:l||"",variants:uniqueArray(a),subsets:[],type:o.type}))}}}};exports.getFontFromGroupSetting=getFontFromGroupSetting,exports.getFontsFromDataBuilder=getFontsFromDataBuilder;
1
+ "use strict";const EXCLUDED_FONT_FAMILIES=["sans-serif"],getFallbackFontFamilyFromGlobalStyle=(t,e)=>{if(e&&t?.type&&!t?.custom?.fontFamily){let l=e[t.type];if(l){let e=JSON.parse(JSON.stringify(t));return e.custom||(e.custom={}),e.custom.fontFamily={value:l.family,type:l.type},e}}return t},getFontsFromDataBuilder=(t,e)=>{let l=[];for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)){let i=t[o],n=i.styles,r=i.settings;getFontFromGroupSetting(l,n,e),getFontFromGroupSetting(l,r,e)}return l},getFontFromGroupSetting=(t,e,l)=>{let o=["normal","hover","focus","active","disabled","price","compareAtPrice"];for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)){let n=e[i];if(!n)continue;let r=l?getFallbackFontFamilyFromGlobalStyle(n,l):n;for(let e of(getFontValue(t,r),o)){if(!n[e])continue;let o=l?getFallbackFontFamilyFromGlobalStyle(n[e],l):n[e];getFontValue(t,o)}}},uniqueArray=t=>Array.from(new Set(t)),getFontValue=(t,e)=>{let l=e.custom?.fontFamily;"string"==typeof l&&(l={value:e.custom?.fontFamily||"",type:"google"});let o=l?.value;if(EXCLUDED_FONT_FAMILIES.includes(o))return;let i=e.custom?.fontVariants;if(i?.length||(i=[e.custom?.fontWeight]),l&&i?.length){let n=i.map(t=>"regular"===t?"400":t),r=e.custom?.fontWeight&&n.includes(e.custom?.fontWeight)?e.custom?.fontWeight:n[0];if(r){let i=uniqueArray([r,...e?.attrs?.isAlwaysLoadBold?["700"]:[],...e?.attrs?.loadFontStyles?.includes("bold")?["700"]:[]]);if(e?.attrs?.loadFontStyles?.includes("italic")){let t=i.map(t=>"string"==typeof t&&/^\d+$/.test(t)?`${t}i`:null).filter(t=>null!==t);i.push(...t)}let a=t.find(t=>t.family==o&&i.every(e=>t.variants.includes(e)));if(!a){let e=t.find(t=>t.family==o);e?i.forEach(t=>{e.variants.includes(t)||e.variants.push(t)}):("700"!==r&&n.includes("700")&&i.push("700"),t.push({family:o||"",variants:uniqueArray(i),subsets:[],type:l.type}))}}}};exports.getFontFromGroupSetting=getFontFromGroupSetting,exports.getFontsFromDataBuilder=getFontsFromDataBuilder;
@@ -1 +1 @@
1
- let EXCLUDED_FONT_FAMILIES=["sans-serif"],getFallbackFontFamilyFromGlobalStyle=(t,e)=>{if(e&&t?.type&&!t?.custom?.fontFamily){let l=e[t.type];l&&(t.custom||(t.custom={}),t.custom.fontFamily={value:l.family,type:l.type})}},getFontsFromDataBuilder=(t,e)=>{let l=[];for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)){let a=t[o],i=a.styles,n=a.settings;getFontFromGroupSetting(l,i,e),getFontFromGroupSetting(l,n,e)}return l},getFontFromGroupSetting=(t,e,l)=>{let o=["normal","hover","focus","active","disabled","price","compareAtPrice"];for(let a in e)if(Object.prototype.hasOwnProperty.call(e,a)){let i=e[a];if(!i)continue;for(let e of(getFallbackFontFamilyFromGlobalStyle(i,l),getFontValue(t,i),o))i[e]&&(getFallbackFontFamilyFromGlobalStyle(i[e],l),getFontValue(t,i[e]))}},uniqueArray=t=>Array.from(new Set(t)),getFontValue=(t,e)=>{let l=e.custom?.fontFamily;"string"==typeof l&&(l={value:e.custom?.fontFamily||"",type:"google"});let o=l?.value;if(EXCLUDED_FONT_FAMILIES.includes(o))return;let a=e.custom?.fontVariants;if(a?.length||(a=[e.custom?.fontWeight]),l&&a?.length){let i=a.map(t=>"regular"===t?"400":t),n=e.custom?.fontWeight&&i.includes(e.custom?.fontWeight)?e.custom?.fontWeight:i[0];if(n){let a=uniqueArray([n,...e?.attrs?.isAlwaysLoadBold?["700"]:[],...e?.attrs?.loadFontStyles?.includes("bold")?["700"]:[]]);if(e?.attrs?.loadFontStyles?.includes("italic")){let t=a.map(t=>"string"==typeof t&&/^\d+$/.test(t)?`${t}i`:null).filter(t=>null!==t);a.push(...t)}let r=t.find(t=>t.family==o&&a.every(e=>t.variants.includes(e)));if(!r){let e=t.find(t=>t.family==o);e?a.forEach(t=>{e.variants.includes(t)||e.variants.push(t)}):("700"!==n&&i.includes("700")&&a.push("700"),t.push({family:o||"",variants:uniqueArray(a),subsets:[],type:l.type}))}}}};export{getFontFromGroupSetting,getFontsFromDataBuilder};
1
+ let EXCLUDED_FONT_FAMILIES=["sans-serif"],getFallbackFontFamilyFromGlobalStyle=(t,e)=>{if(e&&t?.type&&!t?.custom?.fontFamily){let l=e[t.type];if(l){let e=JSON.parse(JSON.stringify(t));return e.custom||(e.custom={}),e.custom.fontFamily={value:l.family,type:l.type},e}}return t},getFontsFromDataBuilder=(t,e)=>{let l=[];for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)){let i=t[o],n=i.styles,a=i.settings;getFontFromGroupSetting(l,n,e),getFontFromGroupSetting(l,a,e)}return l},getFontFromGroupSetting=(t,e,l)=>{let o=["normal","hover","focus","active","disabled","price","compareAtPrice"];for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)){let n=e[i];if(!n)continue;let a=l?getFallbackFontFamilyFromGlobalStyle(n,l):n;for(let e of(getFontValue(t,a),o)){if(!n[e])continue;let o=l?getFallbackFontFamilyFromGlobalStyle(n[e],l):n[e];getFontValue(t,o)}}},uniqueArray=t=>Array.from(new Set(t)),getFontValue=(t,e)=>{let l=e.custom?.fontFamily;"string"==typeof l&&(l={value:e.custom?.fontFamily||"",type:"google"});let o=l?.value;if(EXCLUDED_FONT_FAMILIES.includes(o))return;let i=e.custom?.fontVariants;if(i?.length||(i=[e.custom?.fontWeight]),l&&i?.length){let n=i.map(t=>"regular"===t?"400":t),a=e.custom?.fontWeight&&n.includes(e.custom?.fontWeight)?e.custom?.fontWeight:n[0];if(a){let i=uniqueArray([a,...e?.attrs?.isAlwaysLoadBold?["700"]:[],...e?.attrs?.loadFontStyles?.includes("bold")?["700"]:[]]);if(e?.attrs?.loadFontStyles?.includes("italic")){let t=i.map(t=>"string"==typeof t&&/^\d+$/.test(t)?`${t}i`:null).filter(t=>null!==t);i.push(...t)}let r=t.find(t=>t.family==o&&i.every(e=>t.variants.includes(e)));if(!r){let e=t.find(t=>t.family==o);e?i.forEach(t=>{e.variants.includes(t)||e.variants.push(t)}):("700"!==a&&n.includes("700")&&i.push("700"),t.push({family:o||"",variants:uniqueArray(i),subsets:[],type:l.type}))}}}};export{getFontFromGroupSetting,getFontsFromDataBuilder};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/pages",
3
- "version": "8.0.0-dev.26",
3
+ "version": "8.0.0-dev.30",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",