@gem-sdk/pages 2.0.0-dev.1278 → 2.0.0-dev.1296

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";var core=require("@gem-sdk/core"),merge=require("deepmerge");const baseDevices={tablet:"1024px",mobile:"767px"},flattenObject=(e,t)=>Object.keys(e).reduce((r,n)=>{let o=t?`${t}-`:"";return"object"==typeof e[n]&&null!==e[n]&&Object.keys(e[n]).length>0?Object.assign(r,flattenObject(e[n],o+n)):r[o+n]=e[n],r},{}),mapObject=e=>Object.entries(e??{}).reduce((e,[t,r])=>({...e,[core.getShortName(t)]:"object"==typeof r?mapObject(r):r}),{}),getValueByDevice=(e,t)=>{let r={typography:Object.fromEntries(Object.entries(e?.typography??{}).map(([e,r])=>{let n={...r?.[t]};return n?(n.fontFamily&&(n.fontFamily=`var(--g-font-${n.fontFamily}, ${n.fontFamily})`),[e,n]):[e,void 0]})),spacing:Object.fromEntries(Object.entries(e?.spacing??{}).map(([e,r])=>[e,r?.[t]])),container:Object.fromEntries(Object.entries(e?.container??{}).map(([e,r])=>[e,r?.[t]])),font:Object.fromEntries(Object.entries(e?.font??{}).map(([e,t])=>[e,t?.family])),theme:{font:Object.fromEntries(Object.entries(e?.theme?.font??{}).map(([e,t])=>[e,t?.family]))}};return r},quoteFontName=e=>["sans-serif"].includes(e)?e:`'${e}'`,genCSSVariable=e=>Object.entries(mapObject(flattenObject(e))).map(([e,t])=>{if(void 0!==t)return["font-heading","font-body","theme-font-heading","theme-font-body"].includes(e)?`--g-${e}: ${quoteFontName(t)}`:`--g-${e}:${t}`}).filter(e=>void 0!==e).join(";"),genCSS=(e,t)=>{if(!e)return"";let r={};try{if(r="string"==typeof e?JSON.parse(e):e,t){let e=getValueByDevice(r,"desktop"),t=getValueByDevice(r,"mobile"),n=merge(e,t);n.color=r.color,n.radius=r.radius;let o=genCSSVariable(n);return`:root{${o}}`}return core.DEVICES.map(e=>{let t=getValueByDevice(r,e);"desktop"===e&&(t.color=r.color,t.radius=r.radius);let n=genCSSVariable(t);return"desktop"===e?`:root{${n}}`:`@media (max-width: ${baseDevices[e]}) {:root{${n}}}`}).join("\n")}catch{return""}};exports.genCSS=genCSS;
1
+ "use strict";var core=require("@gem-sdk/core"),merge=require("deepmerge");const baseDevices={tablet:"1024px",mobile:"767px"},flattenObject=(e,t)=>Object.keys(e).reduce((r,n)=>{let o=t?`${t}-`:"";return"object"==typeof e[n]&&null!==e[n]&&Object.keys(e[n]).length>0?Object.assign(r,flattenObject(e[n],o+n)):r[o+n]=e[n],r},{}),mapObject=e=>Object.entries(e??{}).reduce((e,[t,r])=>({...e,[core.getShortName(t)]:"object"==typeof r?mapObject(r):r}),{}),getValueByDevice=(e,t)=>{let r={typography:Object.fromEntries(Object.entries(e?.typography??{}).map(([e,r])=>{let n={...r?.[t]};return n?(n.fontFamily&&(n.fontFamily=`var(--g-font-${n.fontFamily}, ${n.fontFamily})`),[e,n]):[e,void 0]})),spacing:Object.fromEntries(Object.entries(e?.spacing??{}).map(([e,r])=>[e,r?.[t]])),container:Object.fromEntries(Object.entries(e?.container??{}).map(([e,r])=>[e,r?.[t]])),font:Object.fromEntries(Object.entries(e?.font??{}).map(([e,t])=>[e,t?.family])),theme:{font:Object.fromEntries(Object.entries(e?.theme?.font??{}).map(([e,t])=>[e,t?.family]))}};return r},quoteFontName=e=>["sans-serif"].includes(e)?e:`'${e}'`,convertLetterSpacingToEm=e=>"string"==typeof e&&e.includes("%")?`${(.01*parseFloat(e)).toFixed(2)}em`:e,genCSSVariable=e=>Object.entries(mapObject(flattenObject(e))).map(([e,t])=>{if(void 0!==t){if(["font-heading","font-body","theme-font-heading","theme-font-body"].includes(e))return`--g-${e}: ${quoteFontName(t)}`;if(e.includes("-ls")){let r=convertLetterSpacingToEm(t);return`--g-${e}:${r}`}return`--g-${e}:${t}`}}).filter(e=>void 0!==e).join(";"),genCSS=(e,t)=>{if(!e)return"";let r={};try{if(r="string"==typeof e?JSON.parse(e):e,t){let e=getValueByDevice(r,"desktop"),t=getValueByDevice(r,"mobile"),n=merge(e,t);n.color=r.color,n.radius=r.radius;let o=genCSSVariable(n);return`:root{${o}}`}return core.DEVICES.map(e=>{let t=getValueByDevice(r,e);"desktop"===e&&(t.color=r.color,t.radius=r.radius);let n=genCSSVariable(t);return"desktop"===e?`:root{${n}}`:`@media (max-width: ${baseDevices[e]}) {:root{${n}}}`}).join("\n")}catch{return""}};exports.genCSS=genCSS;
@@ -1 +1 @@
1
- "use strict";const EXCLUDED_FONT_FAMILIES=["sans-serif"],getFontsFromDataBuilder=t=>{let e=[];for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)){let r=t[o],n=r.styles,i=r.settings;getFontFromGroupSetting(e,n),getFontFromGroupSetting(e,i)}return e},getFontFromGroupSetting=(t,e)=>{let o=["normal","hover","focus","active","disabled","price","compareAtPrice"];for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let n=e[r];if(!n)continue;for(let e of(getFontValue(t,n),o))n[e]&&getFontValue(t,n[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 r=o?.value;if(EXCLUDED_FONT_FAMILIES.includes(r))return;let n=e.custom?.fontVariants;if(n?.length||(n=[e.custom?.fontWeight]),o&&n?.length){let i=n.map(t=>"regular"===t?"400":t),s=e.custom?.fontWeight&&i.includes(e.custom?.fontWeight)?e.custom?.fontWeight:i[0];if(s){let n=uniqueArray([s,...e?.attrs?.isAlwaysLoadBold?["700"]:[]]),l=t.find(t=>t.family==r&&t.variants.includes(s));if(!l){let e=t.find(t=>t.family==r);e?e.variants.push(s):("700"!==s&&i.includes("700")&&n.push("700"),t.push({family:r||"",variants:n,subsets:[],type:o.type}))}}}};exports.getFontFromGroupSetting=getFontFromGroupSetting,exports.getFontsFromDataBuilder=getFontsFromDataBuilder;
1
+ "use strict";const EXCLUDED_FONT_FAMILIES=["sans-serif"],getFontsFromDataBuilder=t=>{let e=[];for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)){let r=t[o],n=r.styles,i=r.settings;getFontFromGroupSetting(e,n),getFontFromGroupSetting(e,i)}return e},getFontFromGroupSetting=(t,e)=>{let o=["normal","hover","focus","active","disabled","price","compareAtPrice"];for(let r in e)if(Object.prototype.hasOwnProperty.call(e,r)){let n=e[r];if(!n)continue;for(let e of(getFontValue(t,n),o))n[e]&&getFontValue(t,n[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 r=o?.value;if(EXCLUDED_FONT_FAMILIES.includes(r))return;let n=e.custom?.fontVariants;if(n?.length||(n=[e.custom?.fontWeight]),o&&n?.length){let i=n.map(t=>"regular"===t?"400":t),l=e.custom?.fontWeight&&i.includes(e.custom?.fontWeight)?e.custom?.fontWeight:i[0];if(l){let n=uniqueArray([l,...e?.attrs?.isAlwaysLoadBold?["700"]:[],...e?.attrs?.loadFontStyles?.includes("bold")?["700"]:[]]);if(e?.attrs?.loadFontStyles?.includes("italic")){let t=n.map(t=>{if("string"==typeof t&&/^\d+$/.test(t))return`${t}i`});n.push(...t)}let s=t.find(t=>t.family==r&&t.variants.includes(l));if(!s){let e=t.find(t=>t.family==r);e?e.variants.push(l):("700"!==l&&i.includes("700")&&n.push("700"),t.push({family:r||"",variants:n,subsets:[],type:o.type}))}}}};exports.getFontFromGroupSetting=getFontFromGroupSetting,exports.getFontsFromDataBuilder=getFontsFromDataBuilder;
@@ -1 +1 @@
1
- import{DEVICES as e,getShortName as t}from"@gem-sdk/core";import r from"deepmerge";let baseDevices={tablet:"1024px",mobile:"767px"},flattenObject=(e,t)=>Object.keys(e).reduce((r,o)=>{let n=t?`${t}-`:"";return"object"==typeof e[o]&&null!==e[o]&&Object.keys(e[o]).length>0?Object.assign(r,flattenObject(e[o],n+o)):r[n+o]=e[o],r},{}),mapObject=e=>Object.entries(e??{}).reduce((e,[r,o])=>({...e,[t(r)]:"object"==typeof o?mapObject(o):o}),{}),getValueByDevice=(e,t)=>{let r={typography:Object.fromEntries(Object.entries(e?.typography??{}).map(([e,r])=>{let o={...r?.[t]};return o?(o.fontFamily&&(o.fontFamily=`var(--g-font-${o.fontFamily}, ${o.fontFamily})`),[e,o]):[e,void 0]})),spacing:Object.fromEntries(Object.entries(e?.spacing??{}).map(([e,r])=>[e,r?.[t]])),container:Object.fromEntries(Object.entries(e?.container??{}).map(([e,r])=>[e,r?.[t]])),font:Object.fromEntries(Object.entries(e?.font??{}).map(([e,t])=>[e,t?.family])),theme:{font:Object.fromEntries(Object.entries(e?.theme?.font??{}).map(([e,t])=>[e,t?.family]))}};return r},quoteFontName=e=>["sans-serif"].includes(e)?e:`'${e}'`,genCSSVariable=e=>Object.entries(mapObject(flattenObject(e))).map(([e,t])=>{if(void 0!==t)return["font-heading","font-body","theme-font-heading","theme-font-body"].includes(e)?`--g-${e}: ${quoteFontName(t)}`:`--g-${e}:${t}`}).filter(e=>void 0!==e).join(";"),genCSS=(t,o)=>{if(!t)return"";let n={};try{if(n="string"==typeof t?JSON.parse(t):t,o){let e=getValueByDevice(n,"desktop"),t=getValueByDevice(n,"mobile"),o=r(e,t);o.color=n.color,o.radius=n.radius;let i=genCSSVariable(o);return`:root{${i}}`}return e.map(e=>{let t=getValueByDevice(n,e);"desktop"===e&&(t.color=n.color,t.radius=n.radius);let r=genCSSVariable(t);return"desktop"===e?`:root{${r}}`:`@media (max-width: ${baseDevices[e]}) {:root{${r}}}`}).join("\n")}catch{return""}};export{genCSS};
1
+ import{DEVICES as e,getShortName as t}from"@gem-sdk/core";import r from"deepmerge";let baseDevices={tablet:"1024px",mobile:"767px"},flattenObject=(e,t)=>Object.keys(e).reduce((r,n)=>{let o=t?`${t}-`:"";return"object"==typeof e[n]&&null!==e[n]&&Object.keys(e[n]).length>0?Object.assign(r,flattenObject(e[n],o+n)):r[o+n]=e[n],r},{}),mapObject=e=>Object.entries(e??{}).reduce((e,[r,n])=>({...e,[t(r)]:"object"==typeof n?mapObject(n):n}),{}),getValueByDevice=(e,t)=>{let r={typography:Object.fromEntries(Object.entries(e?.typography??{}).map(([e,r])=>{let n={...r?.[t]};return n?(n.fontFamily&&(n.fontFamily=`var(--g-font-${n.fontFamily}, ${n.fontFamily})`),[e,n]):[e,void 0]})),spacing:Object.fromEntries(Object.entries(e?.spacing??{}).map(([e,r])=>[e,r?.[t]])),container:Object.fromEntries(Object.entries(e?.container??{}).map(([e,r])=>[e,r?.[t]])),font:Object.fromEntries(Object.entries(e?.font??{}).map(([e,t])=>[e,t?.family])),theme:{font:Object.fromEntries(Object.entries(e?.theme?.font??{}).map(([e,t])=>[e,t?.family]))}};return r},quoteFontName=e=>["sans-serif"].includes(e)?e:`'${e}'`,convertLetterSpacingToEm=e=>"string"==typeof e&&e.includes("%")?`${(.01*parseFloat(e)).toFixed(2)}em`:e,genCSSVariable=e=>Object.entries(mapObject(flattenObject(e))).map(([e,t])=>{if(void 0!==t){if(["font-heading","font-body","theme-font-heading","theme-font-body"].includes(e))return`--g-${e}: ${quoteFontName(t)}`;if(e.includes("-ls")){let r=convertLetterSpacingToEm(t);return`--g-${e}:${r}`}return`--g-${e}:${t}`}}).filter(e=>void 0!==e).join(";"),genCSS=(t,n)=>{if(!t)return"";let o={};try{if(o="string"==typeof t?JSON.parse(t):t,n){let e=getValueByDevice(o,"desktop"),t=getValueByDevice(o,"mobile"),n=r(e,t);n.color=o.color,n.radius=o.radius;let i=genCSSVariable(n);return`:root{${i}}`}return e.map(e=>{let t=getValueByDevice(o,e);"desktop"===e&&(t.color=o.color,t.radius=o.radius);let r=genCSSVariable(t);return"desktop"===e?`:root{${r}}`:`@media (max-width: ${baseDevices[e]}) {:root{${r}}}`}).join("\n")}catch{return""}};export{genCSS};
@@ -1 +1 @@
1
- let EXCLUDED_FONT_FAMILIES=["sans-serif"],getFontsFromDataBuilder=t=>{let e=[];for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)){let n=t[o],r=n.styles,i=n.settings;getFontFromGroupSetting(e,r),getFontFromGroupSetting(e,i)}return e},getFontFromGroupSetting=(t,e)=>{let o=["normal","hover","focus","active","disabled","price","compareAtPrice"];for(let n in e)if(Object.prototype.hasOwnProperty.call(e,n)){let r=e[n];if(!r)continue;for(let e of(getFontValue(t,r),o))r[e]&&getFontValue(t,r[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 n=o?.value;if(EXCLUDED_FONT_FAMILIES.includes(n))return;let r=e.custom?.fontVariants;if(r?.length||(r=[e.custom?.fontWeight]),o&&r?.length){let i=r.map(t=>"regular"===t?"400":t),l=e.custom?.fontWeight&&i.includes(e.custom?.fontWeight)?e.custom?.fontWeight:i[0];if(l){let r=uniqueArray([l,...e?.attrs?.isAlwaysLoadBold?["700"]:[]]),a=t.find(t=>t.family==n&&t.variants.includes(l));if(!a){let e=t.find(t=>t.family==n);e?e.variants.push(l):("700"!==l&&i.includes("700")&&r.push("700"),t.push({family:n||"",variants:r,subsets:[],type:o.type}))}}}};export{getFontFromGroupSetting,getFontsFromDataBuilder};
1
+ let EXCLUDED_FONT_FAMILIES=["sans-serif"],getFontsFromDataBuilder=t=>{let e=[];for(let o in t)if(Object.prototype.hasOwnProperty.call(t,o)){let i=t[o],l=i.styles,n=i.settings;getFontFromGroupSetting(e,l),getFontFromGroupSetting(e,n)}return e},getFontFromGroupSetting=(t,e)=>{let o=["normal","hover","focus","active","disabled","price","compareAtPrice"];for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i)){let l=e[i];if(!l)continue;for(let e of(getFontValue(t,l),o))l[e]&&getFontValue(t,l[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 i=o?.value;if(EXCLUDED_FONT_FAMILIES.includes(i))return;let l=e.custom?.fontVariants;if(l?.length||(l=[e.custom?.fontWeight]),o&&l?.length){let n=l.map(t=>"regular"===t?"400":t),r=e.custom?.fontWeight&&n.includes(e.custom?.fontWeight)?e.custom?.fontWeight:n[0];if(r){let l=uniqueArray([r,...e?.attrs?.isAlwaysLoadBold?["700"]:[],...e?.attrs?.loadFontStyles?.includes("bold")?["700"]:[]]);if(e?.attrs?.loadFontStyles?.includes("italic")){let t=l.map(t=>{if("string"==typeof t&&/^\d+$/.test(t))return`${t}i`});l.push(...t)}let s=t.find(t=>t.family==i&&t.variants.includes(r));if(!s){let e=t.find(t=>t.family==i);e?e.variants.push(r):("700"!==r&&n.includes("700")&&l.push("700"),t.push({family:i||"",variants:l,subsets:[],type:o.type}))}}}};export{getFontFromGroupSetting,getFontsFromDataBuilder};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/pages",
3
- "version": "2.0.0-dev.1278",
3
+ "version": "2.0.0-dev.1296",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -26,7 +26,7 @@
26
26
  "next": "14.2.20"
27
27
  },
28
28
  "devDependencies": {
29
- "@gem-sdk/core": "2.0.0-dev.1277",
29
+ "@gem-sdk/core": "2.0.0-dev.1295",
30
30
  "@gem-sdk/plugin-cookie-bar": "2.0.0-dev.1260",
31
31
  "@gem-sdk/plugin-quick-view": "2.0.0-dev.1260",
32
32
  "@gem-sdk/plugin-sticky-add-to-cart": "2.0.0-dev.1260"