@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
|
|
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=(
|
|
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.
|
|
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.
|
|
32
|
-
"@gem-sdk/styles": "17.0.0-dev.
|
|
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": {
|