@gem-sdk/core 17.0.0-dev.106 → 17.0.0-dev.111
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")
|
|
1
|
+
"use strict";var e=require("./get-resonsive-value.js");const t=e=>Object.entries(e).reduce((e,[t,o])=>null==o?e:{...e,[t]:o},{}),o=(e,t,o)=>o?`${t?.[e]}${o}`:t?.[e]==="default"?"1200px":t?.[e],l=(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(a=>{let i=e.getResponsiveValueByScreen(t,a);"none"!==i&&(s={...s,[a]:"custom"!==i?i:`${e.getResponsiveValueByScreen(o,"desktop")}/${e.getResponsiveValueByScreen(l,"desktop")}`})}),s},exports.makeGlobalSizeHeightResponsive=e=>({"--h":e?.desktop?.height,"--h-tablet":e?.tablet?.height,"--h-mobile":e?.mobile?.height}),exports.makeGlobalSizeWidthResponsive=e=>({"--w":e?.desktop?.width,"--w-tablet":e?.tablet?.width,"--w-mobile":e?.mobile?.width}),exports.makeHeight=(e,t)=>{let o=(e,t,o)=>{let l=t?.[e],s=o?.[e];return s?"auto":!1===s?l??l:l};return{desktop:o("desktop",e,t),tablet:o("tablet",e,t),mobile:o("mobile",e,t)}},exports.makeLineClamp=(t,o)=>{let l=(t,o,l)=>{let s=e.getResponsiveValueByScreen(o,t),a=e.getResponsiveValueByScreen(l,t);return 0===s?"0":a||void 0===a?s:"unset"};return{desktop:l("desktop",t,o),tablet:l("tablet",t,o),mobile:l("mobile",t,o)}},exports.makeStyle=e=>t(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,t,o)=>({[`--${e}`]:o?`${t?.desktop}${o}`:t?.desktop,[`--${e}-tablet`]:o?`${t?.tablet}${o}`:t?.tablet,[`--${e}-mobile`]:o?`${t?.mobile}${o}`:t?.mobile}),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)=>({"--w":o("desktop",e,t),"--w-tablet":o("tablet",e,t),"--w-mobile":o("mobile",e,t)}),exports.makeStyleResponsiveWidthWithoutAuto=(e,t)=>({"--w":l("desktop",e,t),"--w-tablet":l("tablet",e,t),"--w-mobile":l("mobile",e,t)}),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),a=l?.[t]===void 0?l?.desktop:l?.[t];return a?"100%":!1===a?s??s:s||"auto"};return{desktop:l("desktop",t,o),tablet:l("tablet",t,o),mobile:l("mobile",t,o)}},exports.removeNullUndefined=t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{getResponsiveValueByScreen as e}from"./get-resonsive-value.js";
|
|
1
|
+
import{getResponsiveValueByScreen as e}from"./get-resonsive-value.js";let t=e=>Object.entries(e).reduce((e,[t,o])=>null==o?e:{...e,[t]:o},{}),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}`),l=e=>t(Object.fromEntries(Object.entries(e).map(([e,t])=>[`--${e}`,t]))),a=(e,t)=>t?{[`--${e}`]:t?.normal,[`--hvr-${e}`]:t?.hover,[`--focus-${e}`]:t?.focus}:{},b=(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}:{},i=(e,t,o)=>({[`--${e}`]:o?`${t?.desktop}${o}`:t?.desktop,[`--${e}-tablet`]:o?`${t?.tablet}${o}`:t?.tablet,[`--${e}-mobile`]:o?`${t?.mobile}${o}`:t?.mobile}),s=(t,o,l)=>({[`--${t}`]:l?`${e(o,"desktop")}${l}`:e(o,"desktop"),[`--${t}-tablet`]:l?`${e(o,"tablet")}${l}`:e(o,"tablet"),[`--${t}-mobile`]:l?`${e(o,"mobile")}${l}`:e(o,"mobile")}),m=(t,o)=>{let l=(t,o,l)=>{let a=e(o,t),b=l?.[t]===void 0?l?.desktop:l?.[t];return b?"100%":!1===b?a??a:a||"auto"};return{desktop:l("desktop",t,o),tablet:l("tablet",t,o),mobile:l("mobile",t,o)}},r=e=>({"--w":e?.desktop?.width,"--w-tablet":e?.tablet?.width,"--w-mobile":e?.mobile?.width}),$=e=>({"--h":e?.desktop?.height,"--h-tablet":e?.tablet?.height,"--h-mobile":e?.mobile?.height}),d=(e,t)=>{let o=(e,t,o)=>{let l=t?.[e],a=o?.[e];return a?"auto":!1===a?l??l:l};return{desktop:o("desktop",e,t),tablet:o("tablet",e,t),mobile:o("mobile",e,t)}},p=(t,o,l)=>{let a={};return["desktop","mobile","tablet"].forEach(b=>{let i=e(t,b);"none"!==i&&(a={...a,[b]:"custom"!==i?i:`${e(o,"desktop")}/${e(l,"desktop")}`})}),a},u=(t,o)=>{let l=(t,o,l)=>{let a=e(o,t),b=e(l,t);return 0===a?"0":b||void 0===b?a:"unset"};return{desktop:l("desktop",t,o),tablet:l("tablet",t,o),mobile:l("mobile",t,o)}},k=(e,t,o)=>o?`${t?.[e]}${o}`:t?.[e]==="default"?"1200px":t?.[e],n=(e,t)=>({"--w":k("desktop",e,t),"--w-tablet":k("tablet",e,t),"--w-mobile":k("mobile",e,t)}),h=(e,t,o)=>{if(o)return`${t?.[e]}${o}`;switch(t?.[e]){case"default":return"1200px";case"Auto":return"100%";default:return t?.[e]}},v=(e,t)=>({"--w":h("desktop",e,t),"--w-tablet":h("tablet",e,t),"--w-mobile":h("mobile",e,t)});export{p as makeAspectRatio,$ as makeGlobalSizeHeightResponsive,r as makeGlobalSizeWidthResponsive,d as makeHeight,u as makeLineClamp,l as makeStyle,o as makeStyleKey,i as makeStyleResponsive,s as makeStyleResponsiveByScreen,b as makeStyleResponsiveState,n as makeStyleResponsiveWidth,v as makeStyleResponsiveWidthWithoutAuto,a as makeStyleState,m as makeWidth,t as removeNullUndefined};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -44139,8 +44139,16 @@ declare const makeStyleResponsiveState: <T extends ShortHandProperty, K>(name: T
|
|
|
44139
44139
|
declare const makeStyleResponsive: <T extends ShortHandProperty, K>(name: T, value?: ObjectDevices<K>, unit?: string) => Record<ResponsiveKey<T>, K>;
|
|
44140
44140
|
declare const makeStyleResponsiveByScreen: <T extends ShortHandProperty, K>(name: T, value?: ObjectDevices<K>, unit?: string) => Record<ResponsiveKey<T>, K>;
|
|
44141
44141
|
declare const makeWidth: (widthValue?: ObjectDevices<string | number>, fullWidthValue?: ObjectDevices<boolean>) => ObjectDevices<string | number>;
|
|
44142
|
-
declare const makeGlobalSizeWidthResponsive: (globalSize?: ObjectDevices<SizeSettingGlobal>) =>
|
|
44143
|
-
|
|
44142
|
+
declare const makeGlobalSizeWidthResponsive: (globalSize?: ObjectDevices<SizeSettingGlobal>) => {
|
|
44143
|
+
'--w': string | undefined;
|
|
44144
|
+
'--w-tablet': string | undefined;
|
|
44145
|
+
'--w-mobile': string | undefined;
|
|
44146
|
+
};
|
|
44147
|
+
declare const makeGlobalSizeHeightResponsive: (globalSize?: ObjectDevices<SizeSettingGlobal>) => {
|
|
44148
|
+
'--h': string | undefined;
|
|
44149
|
+
'--h-tablet': string | undefined;
|
|
44150
|
+
'--h-mobile': string | undefined;
|
|
44151
|
+
};
|
|
44144
44152
|
declare const makeHeight: (heighValue?: ObjectDevices<string | number>, autoHeight?: ObjectDevices<boolean>) => ObjectDevices<string | number | undefined>;
|
|
44145
44153
|
declare const makeAspectRatio: (aspectRatio?: ObjectDevices<string>, aspectWidth?: ObjectDevices<string | number>, aspectHeight?: ObjectDevices<string | number>) => ObjectDevices<string>;
|
|
44146
44154
|
declare const makeLineClamp: (lineClampValue?: ObjectDevices<number>, hasLineClampValue?: ObjectDevices<boolean>) => ObjectDevices<string | number | undefined>;
|
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.111",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@gem-sdk/adapter-shopify": "17.0.0-dev.93",
|
|
32
|
-
"@gem-sdk/styles": "17.0.0-dev.
|
|
32
|
+
"@gem-sdk/styles": "17.0.0-dev.108",
|
|
33
33
|
"@types/classnames": "^2.3.1"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";exports.isSafeValue=t=>null!=t&&!("string"==typeof t&&""===t.trim());
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
let e=e=>null!=e&&!("string"==typeof e&&""===e.trim());export{e as isSafeValue};
|