@gem-sdk/core 17.0.0-dev.35 → 17.0.0-dev.38

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 e=require("./get-resonsive-value.js"),t=require("./builder.js");const o=e=>Object.entries(e).reduce((e,[t,o])=>null==o?e:{...e,[t]:o},{}),l=(e,t,o)=>o?`${t?.[e]}${o}`:t?.[e]==="default"?"1200px":t?.[e],s=(e,t,o)=>{if(o)return`${t?.[e]}${o}`;switch(t?.[e]){case"default":return"1200px";case"Auto":return"100%";default:return t?.[e]}};exports.makeAspectRatio=(t,o,l)=>{let s={};return["desktop","mobile","tablet"].forEach(r=>{let a=e.getResponsiveValueByScreen(t,r);"none"!==a&&(s={...s,[r]:"custom"!==a?a:`${e.getResponsiveValueByScreen(o,"desktop")}/${e.getResponsiveValueByScreen(l,"desktop")}`})}),s},exports.makeGlobalSizeHeightResponsive=e=>{let t=e?.desktop?.height,o=e?.tablet?.height,l=e?.mobile?.height,s={};return t&&(s["--h"]=t),o&&o!==t&&(s["--h-tablet"]=o),l&&l!==o&&(s["--h-mobile"]=l),s},exports.makeGlobalSizeWidthResponsive=e=>{let t=e?.desktop?.width,o=e?.tablet?.width,l=e?.mobile?.width,s={};return t&&(s["--w"]=t),o&&o!==t&&(s["--w-tablet"]=o),l&&l!==o&&(s["--w-mobile"]=l),s},exports.makeHeight=(e,t)=>{let o=(e,t,o)=>{let l=t?.[e],s=o?.[e];return s?"auto":!1===s?l??l:l},l=o("desktop",e,t),s=o("tablet",e,t),r=o("mobile",e,t),a={};return l&&(a.desktop=l),s&&s!==l&&(a.tablet=s),r&&r!==s&&(a.mobile=r),a},exports.makeLineClamp=(t,o)=>{let l=(t,o,l)=>{let s=e.getResponsiveValueByScreen(o,t),r=e.getResponsiveValueByScreen(l,t);return 0===s?"0":r||void 0===r?s:"unset"},s=l("desktop",t,o),r=l("tablet",t,o),a=l("mobile",t,o),i={};return s&&(i.desktop=s),r&&r!==s&&(i.tablet=r),a&&a!==r&&(i.mobile=a),i},exports.makeStyle=e=>o(Object.fromEntries(Object.entries(e).map(([e,t])=>[`--${e}`,t]))),exports.makeStyleKey=e=>[e,`hvr-${e}`,`focus-${e}`,`${e}-tablet`,`hvr-${e}-tablet`,`focus-${e}-tablet`,`${e}-mobile`,`hvr-${e}-mobile`,`focus-${e}-mobile`].map(e=>`--${e}`),exports.makeStyleResponsive=(e,o,l)=>{let s=l&&t.isSafeValue(o?.desktop)?`${o?.desktop}${l}`:o?.desktop,r=l&&t.isSafeValue(o?.tablet)?`${o?.tablet}${l}`:o?.tablet,a=l&&t.isSafeValue(o?.mobile)?`${o?.mobile}${l}`:o?.mobile,i={};return s&&(i[`--${e}`]=s),r&&r!==s&&(i[`--${e}-tablet`]=r),a&&a!==r&&(i[`--${e}-mobile`]=a),i},exports.makeStyleResponsiveByScreen=(t,o,l)=>({[`--${t}`]:l?`${e.getResponsiveValueByScreen(o,"desktop")}${l}`:e.getResponsiveValueByScreen(o,"desktop"),[`--${t}-tablet`]:l?`${e.getResponsiveValueByScreen(o,"tablet")}${l}`:e.getResponsiveValueByScreen(o,"tablet"),[`--${t}-mobile`]:l?`${e.getResponsiveValueByScreen(o,"mobile")}${l}`:e.getResponsiveValueByScreen(o,"mobile")}),exports.makeStyleResponsiveState=(e,t)=>t?{[`--${e}`]:t?.desktop?.normal,[`--hvr-${e}`]:t?.desktop?.hover,[`--focus-${e}`]:t?.desktop?.focus,[`--${e}-tablet`]:t?.tablet?.normal,[`--hvr-${e}-tablet`]:t?.tablet?.hover,[`--focus-${e}-tablet`]:t?.tablet?.focus,[`--${e}-mobile`]:t?.mobile?.normal,[`--hvr-${e}-mobile`]:t?.mobile?.hover,[`--focus-${e}-mobile`]:t?.mobile?.focus}:{},exports.makeStyleResponsiveWidth=(e,t)=>{let o=l("desktop",e,t),s=l("tablet",e,t),r=l("mobile",e,t),a={};return o&&(a["--w"]=o),s&&s!==o&&(a["--w-tablet"]=s),r&&r!==s&&(a["--w-mobile"]=r),a},exports.makeStyleResponsiveWidthWithoutAuto=(e,t)=>{let o=s("desktop",e,t),l=s("tablet",e,t),r=s("mobile",e,t),a={};return o&&(a["--w"]=o),l&&l!==o&&(a["--w-tablet"]=l),r&&r!==l&&(a["--w-mobile"]=r),a},exports.makeStyleState=(e,t)=>t?{[`--${e}`]:t?.normal,[`--hvr-${e}`]:t?.hover,[`--focus-${e}`]:t?.focus}:{},exports.makeWidth=(t,o)=>{let l=(t,o,l)=>{let s=e.getResponsiveValueByScreen(o,t),r=l?.[t]===void 0?l?.desktop:l?.[t];return r?"100%":!1===r?s??s:s||"auto"},s=l("desktop",t,o),r=l("tablet",t,o),a=l("mobile",t,o),i={};return s&&(i.desktop=s),r&&r!==s&&(i.tablet=r),a&&a!==r&&(i.mobile=a),i},exports.removeNullUndefined=o;
1
+ "use strict";var e=require("./get-resonsive-value.js"),t=require("./builder.js");const l=e=>Object.entries(e).reduce((e,[t,l])=>null==l?e:{...e,[t]:l},{}),a=(e,t,l)=>l?`${t?.[e]}${l}`:t?.[e]==="default"?"1200px":t?.[e],s=(e,t,l)=>{if(l)return`${t?.[e]}${l}`;switch(t?.[e]){case"default":return"1200px";case"Auto":return"100%";default:return t?.[e]}};exports.makeAspectRatio=(t,l,a)=>{let s={};return["desktop","mobile","tablet"].forEach(o=>{let i=e.getResponsiveValueByScreen(t,o);"none"!==i&&(s={...s,[o]:"custom"!==i?i:`${e.getResponsiveValueByScreen(l,"desktop")}/${e.getResponsiveValueByScreen(a,"desktop")}`})}),s},exports.makeGlobalSizeHeightResponsive=e=>{let l=e?.desktop?.height,a=e?.tablet?.height,s=e?.mobile?.height,o={};return t.isSafeValue(l)&&(o["--h"]=l),t.isSafeValue(a)&&a!==l&&(o["--h-tablet"]=a),t.isSafeValue(s)&&s!==a&&(o["--h-mobile"]=s),o},exports.makeGlobalSizeWidthResponsive=e=>{let l=e?.desktop?.width,a=e?.tablet?.width,s=e?.mobile?.width,o={};return t.isSafeValue(l)&&(o["--w"]=l),t.isSafeValue(a)&&a!==l&&(o["--w-tablet"]=a),t.isSafeValue(s)&&s!==a&&(o["--w-mobile"]=s),o},exports.makeHeight=(e,l)=>{let a=(e,t,l)=>{let a=t?.[e],s=l?.[e];return s?"auto":!1===s?a??a:a},s=a("desktop",e,l),o=a("tablet",e,l),i=a("mobile",e,l),r={};return t.isSafeValue(s)&&(r.desktop=s),t.isSafeValue(o)&&o!==s&&(r.tablet=o),t.isSafeValue(i)&&i!==o&&(r.mobile=i),r},exports.makeLineClamp=(l,a)=>{let s=(t,l,a)=>{let s=e.getResponsiveValueByScreen(l,t),o=e.getResponsiveValueByScreen(a,t);return 0===s?"0":o||void 0===o?s:"unset"},o=s("desktop",l,a),i=s("tablet",l,a),r=s("mobile",l,a),u={};return t.isSafeValue(o)&&(u.desktop=o),t.isSafeValue(i)&&i!==o&&(u.tablet=i),t.isSafeValue(r)&&r!==i&&(u.mobile=r),u},exports.makeStyle=e=>l(Object.fromEntries(Object.entries(e).map(([e,t])=>[`--${e}`,t]))),exports.makeStyleKey=e=>[e,`hvr-${e}`,`focus-${e}`,`${e}-tablet`,`hvr-${e}-tablet`,`focus-${e}-tablet`,`${e}-mobile`,`hvr-${e}-mobile`,`focus-${e}-mobile`].map(e=>`--${e}`),exports.makeStyleResponsive=(e,l,a)=>{let s=a&&t.isSafeValue(l?.desktop)?`${l?.desktop}${a}`:l?.desktop,o=a&&t.isSafeValue(l?.tablet)?`${l?.tablet}${a}`:l?.tablet,i=a&&t.isSafeValue(l?.mobile)?`${l?.mobile}${a}`:l?.mobile,r={};return s&&(r[`--${e}`]=s),o&&o!==s&&(r[`--${e}-tablet`]=o),i&&i!==o&&(r[`--${e}-mobile`]=i),r},exports.makeStyleResponsiveByScreen=(t,l,a)=>({[`--${t}`]:a?`${e.getResponsiveValueByScreen(l,"desktop")}${a}`:e.getResponsiveValueByScreen(l,"desktop"),[`--${t}-tablet`]:a?`${e.getResponsiveValueByScreen(l,"tablet")}${a}`:e.getResponsiveValueByScreen(l,"tablet"),[`--${t}-mobile`]:a?`${e.getResponsiveValueByScreen(l,"mobile")}${a}`:e.getResponsiveValueByScreen(l,"mobile")}),exports.makeStyleResponsiveState=(e,t)=>t?{[`--${e}`]:t?.desktop?.normal,[`--hvr-${e}`]:t?.desktop?.hover,[`--focus-${e}`]:t?.desktop?.focus,[`--${e}-tablet`]:t?.tablet?.normal,[`--hvr-${e}-tablet`]:t?.tablet?.hover,[`--focus-${e}-tablet`]:t?.tablet?.focus,[`--${e}-mobile`]:t?.mobile?.normal,[`--hvr-${e}-mobile`]:t?.mobile?.hover,[`--focus-${e}-mobile`]:t?.mobile?.focus}:{},exports.makeStyleResponsiveWidth=(e,l)=>{let s=a("desktop",e,l),o=a("tablet",e,l),i=a("mobile",e,l),r={};return t.isSafeValue(s)&&(r["--w"]=s),t.isSafeValue(o)&&o!==s&&(r["--w-tablet"]=o),t.isSafeValue(i)&&i!==o&&(r["--w-mobile"]=i),r},exports.makeStyleResponsiveWidthWithoutAuto=(e,l)=>{let a=s("desktop",e,l),o=s("tablet",e,l),i=s("mobile",e,l),r={};return t.isSafeValue(a)&&(r["--w"]=a),t.isSafeValue(o)&&o!==a&&(r["--w-tablet"]=o),t.isSafeValue(i)&&i!==o&&(r["--w-mobile"]=i),r},exports.makeStyleState=(e,t)=>t?{[`--${e}`]:t?.normal,[`--hvr-${e}`]:t?.hover,[`--focus-${e}`]:t?.focus}:{},exports.makeWidth=(l,a)=>{let s=(t,l,a)=>{let s=e.getResponsiveValueByScreen(l,t),o=a?.[t]===void 0?a?.desktop:a?.[t];return o?"100%":!1===o?s??s:s||"auto"},o=s("desktop",l,a),i=s("tablet",l,a),r=s("mobile",l,a),u={};return t.isSafeValue(o)&&(u.desktop=o),t.isSafeValue(i)&&i!==o&&(u.tablet=i),t.isSafeValue(r)&&r!==i&&(u.mobile=r),u},exports.removeNullUndefined=l;
@@ -1 +1 @@
1
- import{getResponsiveValueByScreen as e}from"./get-resonsive-value.js";import{isSafeValue as t}from"./builder.js";let l=e=>Object.entries(e).reduce((e,[t,l])=>null==l?e:{...e,[t]:l},{}),o=e=>[e,`hvr-${e}`,`focus-${e}`,`${e}-tablet`,`hvr-${e}-tablet`,`focus-${e}-tablet`,`${e}-mobile`,`hvr-${e}-mobile`,`focus-${e}-mobile`].map(e=>`--${e}`),b=e=>l(Object.fromEntries(Object.entries(e).map(([e,t])=>[`--${e}`,t]))),i=(e,t)=>t?{[`--${e}`]:t?.normal,[`--hvr-${e}`]:t?.hover,[`--focus-${e}`]:t?.focus}:{},a=(e,t)=>t?{[`--${e}`]:t?.desktop?.normal,[`--hvr-${e}`]:t?.desktop?.hover,[`--focus-${e}`]:t?.desktop?.focus,[`--${e}-tablet`]:t?.tablet?.normal,[`--hvr-${e}-tablet`]:t?.tablet?.hover,[`--focus-${e}-tablet`]:t?.tablet?.focus,[`--${e}-mobile`]:t?.mobile?.normal,[`--hvr-${e}-mobile`]:t?.mobile?.hover,[`--focus-${e}-mobile`]:t?.mobile?.focus}:{},r=(e,l,o)=>{let b=o&&t(l?.desktop)?`${l?.desktop}${o}`:l?.desktop,i=o&&t(l?.tablet)?`${l?.tablet}${o}`:l?.tablet,a=o&&t(l?.mobile)?`${l?.mobile}${o}`:l?.mobile,r={};return b&&(r[`--${e}`]=b),i&&i!==b&&(r[`--${e}-tablet`]=i),a&&a!==i&&(r[`--${e}-mobile`]=a),r},s=(t,l,o)=>({[`--${t}`]:o?`${e(l,"desktop")}${o}`:e(l,"desktop"),[`--${t}-tablet`]:o?`${e(l,"tablet")}${o}`:e(l,"tablet"),[`--${t}-mobile`]:o?`${e(l,"mobile")}${o}`:e(l,"mobile")}),m=(t,l)=>{let o=(t,l,o)=>{let b=e(l,t),i=o?.[t]===void 0?o?.desktop:o?.[t];return i?"100%":!1===i?b??b:b||"auto"},b=o("desktop",t,l),i=o("tablet",t,l),a=o("mobile",t,l),r={};return b&&(r.desktop=b),i&&i!==b&&(r.tablet=i),a&&a!==i&&(r.mobile=a),r},$=e=>{let t=e?.desktop?.width,l=e?.tablet?.width,o=e?.mobile?.width,b={};return t&&(b["--w"]=t),l&&l!==t&&(b["--w-tablet"]=l),o&&o!==l&&(b["--w-mobile"]=o),b},u=e=>{let t=e?.desktop?.height,l=e?.tablet?.height,o=e?.mobile?.height,b={};return t&&(b["--h"]=t),l&&l!==t&&(b["--h-tablet"]=l),o&&o!==l&&(b["--h-mobile"]=o),b},n=(e,t)=>{let l=(e,t,l)=>{let o=t?.[e],b=l?.[e];return b?"auto":!1===b?o??o:o},o=l("desktop",e,t),b=l("tablet",e,t),i=l("mobile",e,t),a={};return o&&(a.desktop=o),b&&b!==o&&(a.tablet=b),i&&i!==b&&(a.mobile=i),a},d=(t,l,o)=>{let b={};return["desktop","mobile","tablet"].forEach(i=>{let a=e(t,i);"none"!==a&&(b={...b,[i]:"custom"!==a?a:`${e(l,"desktop")}/${e(o,"desktop")}`})}),b},p=(t,l)=>{let o=(t,l,o)=>{let b=e(l,t),i=e(o,t);return 0===b?"0":i||void 0===i?b:"unset"},b=o("desktop",t,l),i=o("tablet",t,l),a=o("mobile",t,l),r={};return b&&(r.desktop=b),i&&i!==b&&(r.tablet=i),a&&a!==i&&(r.mobile=a),r},k=(e,t,l)=>l?`${t?.[e]}${l}`:t?.[e]==="default"?"1200px":t?.[e],h=(e,t)=>{let l=k("desktop",e,t),o=k("tablet",e,t),b=k("mobile",e,t),i={};return l&&(i["--w"]=l),o&&o!==l&&(i["--w-tablet"]=o),b&&b!==o&&(i["--w-mobile"]=b),i},v=(e,t,l)=>{if(l)return`${t?.[e]}${l}`;switch(t?.[e]){case"default":return"1200px";case"Auto":return"100%";default:return t?.[e]}},c=(e,t)=>{let l=v("desktop",e,t),o=v("tablet",e,t),b=v("mobile",e,t),i={};return l&&(i["--w"]=l),o&&o!==l&&(i["--w-tablet"]=o),b&&b!==o&&(i["--w-mobile"]=b),i};export{d as makeAspectRatio,u as makeGlobalSizeHeightResponsive,$ as makeGlobalSizeWidthResponsive,n as makeHeight,p as makeLineClamp,b as makeStyle,o as makeStyleKey,r as makeStyleResponsive,s as makeStyleResponsiveByScreen,a as makeStyleResponsiveState,h as makeStyleResponsiveWidth,c as makeStyleResponsiveWidthWithoutAuto,i as makeStyleState,m as makeWidth,l as removeNullUndefined};
1
+ import{getResponsiveValueByScreen as e}from"./get-resonsive-value.js";import{isSafeValue as t}from"./builder.js";let l=e=>Object.entries(e).reduce((e,[t,l])=>null==l?e:{...e,[t]:l},{}),o=e=>[e,`hvr-${e}`,`focus-${e}`,`${e}-tablet`,`hvr-${e}-tablet`,`focus-${e}-tablet`,`${e}-mobile`,`hvr-${e}-mobile`,`focus-${e}-mobile`].map(e=>`--${e}`),b=e=>l(Object.fromEntries(Object.entries(e).map(([e,t])=>[`--${e}`,t]))),i=(e,t)=>t?{[`--${e}`]:t?.normal,[`--hvr-${e}`]:t?.hover,[`--focus-${e}`]:t?.focus}:{},a=(e,t)=>t?{[`--${e}`]:t?.desktop?.normal,[`--hvr-${e}`]:t?.desktop?.hover,[`--focus-${e}`]:t?.desktop?.focus,[`--${e}-tablet`]:t?.tablet?.normal,[`--hvr-${e}-tablet`]:t?.tablet?.hover,[`--focus-${e}-tablet`]:t?.tablet?.focus,[`--${e}-mobile`]:t?.mobile?.normal,[`--hvr-${e}-mobile`]:t?.mobile?.hover,[`--focus-${e}-mobile`]:t?.mobile?.focus}:{},r=(e,l,o)=>{let b=o&&t(l?.desktop)?`${l?.desktop}${o}`:l?.desktop,i=o&&t(l?.tablet)?`${l?.tablet}${o}`:l?.tablet,a=o&&t(l?.mobile)?`${l?.mobile}${o}`:l?.mobile,r={};return b&&(r[`--${e}`]=b),i&&i!==b&&(r[`--${e}-tablet`]=i),a&&a!==i&&(r[`--${e}-mobile`]=a),r},s=(t,l,o)=>({[`--${t}`]:o?`${e(l,"desktop")}${o}`:e(l,"desktop"),[`--${t}-tablet`]:o?`${e(l,"tablet")}${o}`:e(l,"tablet"),[`--${t}-mobile`]:o?`${e(l,"mobile")}${o}`:e(l,"mobile")}),m=(l,o)=>{let b=(t,l,o)=>{let b=e(l,t),i=o?.[t]===void 0?o?.desktop:o?.[t];return i?"100%":!1===i?b??b:b||"auto"},i=b("desktop",l,o),a=b("tablet",l,o),r=b("mobile",l,o),s={};return t(i)&&(s.desktop=i),t(a)&&a!==i&&(s.tablet=a),t(r)&&r!==a&&(s.mobile=r),s},$=e=>{let l=e?.desktop?.width,o=e?.tablet?.width,b=e?.mobile?.width,i={};return t(l)&&(i["--w"]=l),t(o)&&o!==l&&(i["--w-tablet"]=o),t(b)&&b!==o&&(i["--w-mobile"]=b),i},u=e=>{let l=e?.desktop?.height,o=e?.tablet?.height,b=e?.mobile?.height,i={};return t(l)&&(i["--h"]=l),t(o)&&o!==l&&(i["--h-tablet"]=o),t(b)&&b!==o&&(i["--h-mobile"]=b),i},n=(e,l)=>{let o=(e,t,l)=>{let o=t?.[e],b=l?.[e];return b?"auto":!1===b?o??o:o},b=o("desktop",e,l),i=o("tablet",e,l),a=o("mobile",e,l),r={};return t(b)&&(r.desktop=b),t(i)&&i!==b&&(r.tablet=i),t(a)&&a!==i&&(r.mobile=a),r},d=(t,l,o)=>{let b={};return["desktop","mobile","tablet"].forEach(i=>{let a=e(t,i);"none"!==a&&(b={...b,[i]:"custom"!==a?a:`${e(l,"desktop")}/${e(o,"desktop")}`})}),b},p=(l,o)=>{let b=(t,l,o)=>{let b=e(l,t),i=e(o,t);return 0===b?"0":i||void 0===i?b:"unset"},i=b("desktop",l,o),a=b("tablet",l,o),r=b("mobile",l,o),s={};return t(i)&&(s.desktop=i),t(a)&&a!==i&&(s.tablet=a),t(r)&&r!==a&&(s.mobile=r),s},k=(e,t,l)=>l?`${t?.[e]}${l}`:t?.[e]==="default"?"1200px":t?.[e],h=(e,l)=>{let o=k("desktop",e,l),b=k("tablet",e,l),i=k("mobile",e,l),a={};return t(o)&&(a["--w"]=o),t(b)&&b!==o&&(a["--w-tablet"]=b),t(i)&&i!==b&&(a["--w-mobile"]=i),a},v=(e,t,l)=>{if(l)return`${t?.[e]}${l}`;switch(t?.[e]){case"default":return"1200px";case"Auto":return"100%";default:return t?.[e]}},c=(e,l)=>{let o=v("desktop",e,l),b=v("tablet",e,l),i=v("mobile",e,l),a={};return t(o)&&(a["--w"]=o),t(b)&&b!==o&&(a["--w-tablet"]=b),t(i)&&i!==b&&(a["--w-mobile"]=i),a};export{d as makeAspectRatio,u as makeGlobalSizeHeightResponsive,$ as makeGlobalSizeWidthResponsive,n as makeHeight,p as makeLineClamp,b as makeStyle,o as makeStyleKey,r as makeStyleResponsive,s as makeStyleResponsiveByScreen,a as makeStyleResponsiveState,h as makeStyleResponsiveWidth,c as makeStyleResponsiveWidthWithoutAuto,i as makeStyleState,m as makeWidth,l as removeNullUndefined};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "17.0.0-dev.35",
3
+ "version": "17.0.0-dev.38",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -28,8 +28,8 @@
28
28
  "type-check": "yarn tsc --noEmit"
29
29
  },
30
30
  "devDependencies": {
31
- "@gem-sdk/adapter-shopify": "17.0.0-dev.9",
32
- "@gem-sdk/styles": "17.0.0-dev.30",
31
+ "@gem-sdk/adapter-shopify": "17.0.0-dev.38",
32
+ "@gem-sdk/styles": "17.0.0-dev.38",
33
33
  "@types/classnames": "^2.3.1"
34
34
  },
35
35
  "dependencies": {