@gem-sdk/core 2.0.0-staging.982 → 2.0.0-staging.987
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,5 +1,5 @@
|
|
|
1
|
-
"use strict";var constant=require("./constant.js"),makeStyle=require("./make-style.js");const getCornerCSSFromGlobal=e=>e?.radiusType?["custom","circle"].includes(e?.radiusType)?makeStyle.makeStyle({bblr:e.bblr,bbrr:e.bbrr,btlr:e.btlr,btrr:e.btrr}):makeStyle.makeStyle({radius:`var(--g-radius-${e?.radiusType})`}):{},getRadiusCSSFromGlobal=(e,s,t)=>{if(!s||!e)return{};let
|
|
2
|
-
${
|
|
1
|
+
"use strict";var constant=require("./constant.js"),makeStyle=require("./make-style.js");const getCornerCSSFromGlobal=e=>e?.radiusType?["custom","circle"].includes(e?.radiusType)?makeStyle.makeStyle({bblr:e.bblr,bbrr:e.bbrr,btlr:e.btlr,btrr:e.btrr}):makeStyle.makeStyle({radius:`var(--g-radius-${e?.radiusType})`}):{},getRadiusCSSFromGlobal=(e,s,t)=>{if(!s||!e)return{};let r=t&&"desktop"!==t?constant.devicesMapping?.[t]:"",a=constant.stateMapping?.[e];return{[`-${a}-radius${r}`]:`var(--g-radius-${s})`}},getCustomRadius=(e,s,t)=>{let r=["custom","pill","rounded","single","none","circle","square"];if(!s||!e||!r.includes(s?.radiusType??""))return{};let a=t&&"desktop"!==t?constant.devicesMapping?.[t]:"",o=constant.stateMapping?.[e];return{[`-${o}-bblr${a}`]:s.bblr,[`-${o}-bbrr${a}`]:s.bbrr,[`-${o}-btlr${a}`]:s.btlr,[`-${o}-btrr${a}`]:s.btrr}},composeRadius=e=>e?"desktop"in e||"tablet"in e||"mobile"in e?composeRadiusResponsiveState(e):composeRadiusState(e):{},composeRadiusResponsive=e=>{let s={};return Object.assign(s,getCustomRadius("normal",e?.desktop,"desktop")),Object.assign(s,getCustomRadius("normal",e?.tablet,"tablet")),Object.assign(s,getCustomRadius("normal",e?.mobile,"mobile")),s},composeRadiusState=(e,s)=>{let t={},r=["normal","hover","focus","active"];for(let a of r){let r=e?.[a]||e?.normal;if(r)switch(r.radiusType){case"medium":case"large":case"small":Object.assign(t,getRadiusCSSFromGlobal(a,r.radiusType,s));break;default:Object.assign(t,getCustomRadius(a,r,s))}}return t},composeRadiusResponsiveState=e=>{let s={};return Object.assign(s,composeRadiusState(e?.desktop,"desktop")),Object.assign(s,composeRadiusState(e?.tablet,"tablet")),Object.assign(s,composeRadiusState(e?.mobile,"mobile")),s},getRadiusStyleActiveState=e=>{let s=["circle","square","rounded","none","custom"],t=e?.active||e?.normal;return s.includes(t?.radiusType||"")?getCustomRadius("normal",t):getRadiusCSSFromGlobal("normal",t?.radiusType)},composeCornerCss=(e,s=!1)=>{let t;if(!e)return"";let{radiusType:r,bblr:a,bbrr:o,btlr:i,btrr:u}=e,l=s?" !important":"";switch(r){case"medium":case"large":case"small":t=`border-radius: var(--g-radius-${r});`;break;case"circle":case"square":case"none":case"rounded":case"custom":t=`
|
|
2
|
+
${a?`border-bottom-left-radius: ${a}${l};`:""}
|
|
3
3
|
${o?`border-bottom-right-radius: ${o}${l};`:""}
|
|
4
4
|
${i?`border-top-left-radius: ${i}${l};`:""}
|
|
5
5
|
${u?`border-top-right-radius: ${u}${l};`:""}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{devicesMapping as e,stateMapping as s}from"./constant.js";import{makeStyle as
|
|
2
|
-
${
|
|
1
|
+
import{devicesMapping as e,stateMapping as s}from"./constant.js";import{makeStyle as t}from"./make-style.js";let getCornerCSSFromGlobal=e=>e?.radiusType?["custom","circle"].includes(e?.radiusType)?t({bblr:e.bblr,bbrr:e.bbrr,btlr:e.btlr,btrr:e.btrr}):t({radius:`var(--g-radius-${e?.radiusType})`}):{},getRadiusCSSFromGlobal=(t,r,a)=>{if(!r||!t)return{};let o=a&&"desktop"!==a?e?.[a]:"",i=s?.[t];return{[`-${i}-radius${o}`]:`var(--g-radius-${r})`}},getCustomRadius=(t,r,a)=>{let o=["custom","pill","rounded","single","none","circle","square"];if(!r||!t||!o.includes(r?.radiusType??""))return{};let i=a&&"desktop"!==a?e?.[a]:"",u=s?.[t];return{[`-${u}-bblr${i}`]:r.bblr,[`-${u}-bbrr${i}`]:r.bbrr,[`-${u}-btlr${i}`]:r.btlr,[`-${u}-btrr${i}`]:r.btrr}},composeRadius=e=>e?"desktop"in e||"tablet"in e||"mobile"in e?composeRadiusResponsiveState(e):composeRadiusState(e):{},composeRadiusResponsive=e=>{let s={};return Object.assign(s,getCustomRadius("normal",e?.desktop,"desktop")),Object.assign(s,getCustomRadius("normal",e?.tablet,"tablet")),Object.assign(s,getCustomRadius("normal",e?.mobile,"mobile")),s},composeRadiusState=(e,s)=>{let t={},r=["normal","hover","focus","active"];for(let a of r){let r=e?.[a]||e?.normal;if(r)switch(r.radiusType){case"medium":case"large":case"small":Object.assign(t,getRadiusCSSFromGlobal(a,r.radiusType,s));break;default:Object.assign(t,getCustomRadius(a,r,s))}}return t},composeRadiusResponsiveState=e=>{let s={};return Object.assign(s,composeRadiusState(e?.desktop,"desktop")),Object.assign(s,composeRadiusState(e?.tablet,"tablet")),Object.assign(s,composeRadiusState(e?.mobile,"mobile")),s},getRadiusStyleActiveState=e=>{let s=["circle","square","rounded","none","custom"],t=e?.active||e?.normal;return s.includes(t?.radiusType||"")?getCustomRadius("normal",t):getRadiusCSSFromGlobal("normal",t?.radiusType)},composeCornerCss=(e,s=!1)=>{let t;if(!e)return"";let{radiusType:r,bblr:a,bbrr:o,btlr:i,btrr:u}=e,l=s?" !important":"";switch(r){case"medium":case"large":case"small":t=`border-radius: var(--g-radius-${r});`;break;case"circle":case"square":case"none":case"rounded":case"custom":t=`
|
|
2
|
+
${a?`border-bottom-left-radius: ${a}${l};`:""}
|
|
3
3
|
${o?`border-bottom-right-radius: ${o}${l};`:""}
|
|
4
4
|
${i?`border-top-left-radius: ${i}${l};`:""}
|
|
5
5
|
${u?`border-top-right-radius: ${u}${l};`:""}
|
|
6
|
-
`}return
|
|
6
|
+
`}return t};export{composeCornerCss,composeRadius,composeRadiusResponsive,getCornerCSSFromGlobal,getCustomRadius,getRadiusCSSFromGlobal,getRadiusStyleActiveState};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gem-sdk/core",
|
|
3
|
-
"version": "2.0.0-staging.
|
|
3
|
+
"version": "2.0.0-staging.987",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@gem-sdk/adapter-shopify": "2.0.0-staging.711",
|
|
31
|
-
"@gem-sdk/styles": "2.0.0-staging.
|
|
31
|
+
"@gem-sdk/styles": "2.0.0-staging.987",
|
|
32
32
|
"@types/classnames": "^2.3.1"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|