@gem-sdk/core 1.14.0-dev.574 → 1.14.0-dev.575

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 borders=require("./borders.js"),colors=require("./colors.js"),constant=require("./constant.js"),makeStyle=require("./make-style.js"),radius=require("./radius.js"),shadow=require("./shadow.js");const composeSpacing=({source:e,spacing:s,type:o,suffix:a=""})=>{let{top:r,left:t,bottom:i,right:c}=s;r&&(e[`--${o}t${a}`]=r),t&&(e[`--${o}l${a}`]=t),i&&(e[`--${o}b${a}`]=i),c&&(e[`--${o}r${a}`]=c)},composeSpacingV2=({source:e,spacing:s,suffix:o=""})=>{if(s&&s.margin){let{top:a,left:r,bottom:t,right:i}=s.margin;a&&(e[`--mt${o}`]=a),r&&(e[`--ml${o}`]="0px"===r?"auto":r),t&&(e[`--mb${o}`]=t),i&&(e[`--mr${o}`]="0px"===i?"auto":i)}if(s&&s.padding){let{top:a,left:r,bottom:t,right:i}=s.padding;a&&(e[`--pt${o}`]=a),r&&(e[`--pl${o}`]=r),t&&(e[`--pb${o}`]=t),i&&(e[`--pr${o}`]=i)}},getAttrValue=(e,s,o)=>{if(null!=s)switch(e){case"bgc":case"c":return colors.isColor(s.toString())?s:`var(--g-c-${s})`;case"d":if(!s)return"none";if(s&&o&&constant.layoutComponent.includes(o))return"grid";return"block";default:return s}};function composeAdvanceStyle(e,s){if(!e)return{};let o={},a=["desktop","tablet","mobile"],r=["hover","normal"];return Object.keys(e).forEach(t=>{let i=e[t];if("cssClass"===t||null==i)return;let c=e.hasBoxShadow?e.hasBoxShadow:{};if("object"==typeof i){if(Array.isArray(i))return;Object.keys(i).forEach(d=>{if(a.includes(d)){let e=i[d];if(void 0!==e){if("border"===t&&Object.assign(o,borders.handleConvertBorderStyle(i),borders.handleConvertBorderWidth(i),borders.handleConvertBorderColor(i)),"rounded"===t&&Object.assign(o,radius.composeRadius(i)),"desktop"===d)switch(t){case"padding":composeSpacing({source:o,spacing:e,type:"p"});break;case"margin":composeSpacing({source:o,spacing:e,type:"m"});break;case"spacing-setting":composeSpacingV2({source:o,spacing:e});break;case"m":case"p":break;default:o[`--${t}`]=getAttrValue(t,e,s)}else switch(t){case"padding":composeSpacing({source:o,spacing:e,type:"p",suffix:`-${d}`});break;case"margin":composeSpacing({source:o,spacing:e,type:"m",suffix:`-${d}`});break;case"spacing-setting":composeSpacingV2({source:o,spacing:e,suffix:`-${d}`});break;case"m":case"p":break;default:o[`--${t}-${d}`]=getAttrValue(t,e,s)}}}else if(r.includes(d))switch(t){case"hasBoxShadow":break;case"boxShadow":Object.assign(o,shadow.getStyleShadowState(i,"box-shadow",c))}else"border"===t&&("none"===i.border&&(i.border="solid",i.color="#121212",i.isCustom=!0,i.width="0px",i.position="all"),Object.assign(o,borders.getBorderStyle(i))),"rounded"===t&&Object.assign(o,radius.getCornerCSSFromGlobal(i)),"hasBoxShadow"===t&&Object.assign(o,shadow.getStyleShadow({value:e.boxShadow,styleAppliedFor:"box-shadow",isEnableShadow:e.hasBoxShadow})),"boxShadow"===t&&Object.assign(o,shadow.getStyleShadow({value:i,styleAppliedFor:"box-shadow",isEnableShadow:e.hasBoxShadow}))})}else o[`--${t}`]=getAttrValue(t,i,s),"hasBoxShadow"===t&&e.boxShadow&&Object.assign(o,shadow.getStyleShadow({value:e.boxShadow,styleAppliedFor:"box-shadow",isEnableShadow:e.hasBoxShadow}))}),o}const splitStyle=(e,s={})=>{let o=e.map(e=>makeStyle.makeStyleKey(e)).flat(),a=Object.keys(s).filter(e=>o.includes(e)),r=a.reduce((e,o)=>({...e,[o]:s[o]}),{}),t=Object.keys(s).filter(e=>!a.includes(e)).reduce((e,o)=>({...e,[o]:s[o]}),{});return[r,t]};exports.composeAdvanceStyle=composeAdvanceStyle,exports.splitStyle=splitStyle;
1
+ "use strict";var borders=require("./borders.js"),colors=require("./colors.js"),constant=require("./constant.js"),makeStyle=require("./make-style.js"),radius=require("./radius.js"),shadow=require("./shadow.js");const composeSpacing=({source:e,spacing:o,type:s,suffix:a=""})=>{let{top:t,left:r,bottom:c,right:i}=o;t&&(e[`--${s}t${a}`]=t),r&&(e[`--${s}l${a}`]=r),c&&(e[`--${s}b${a}`]=c),i&&(e[`--${s}r${a}`]=i)},composeSpacingV2=({source:e,spacing:o,suffix:s="",tag:a=""})=>{if(o&&o.margin){let{top:t,left:r,bottom:c,right:i}=o.margin;t&&(e[`--mt${s}`]=t),r&&(e[`--ml${s}`]=constant.layoutComponent.includes(a)&&"0px"===r?"auto":r),c&&(e[`--mb${s}`]=c),i&&(e[`--mr${s}`]=constant.layoutComponent.includes(a)&&"0px"===i?"auto":i)}if(o&&o.padding){let{top:a,left:t,bottom:r,right:c}=o.padding;a&&(e[`--pt${s}`]=a),t&&(e[`--pl${s}`]=t),r&&(e[`--pb${s}`]=r),c&&(e[`--pr${s}`]=c)}},getAttrValue=(e,o,s)=>{if(null!=o)switch(e){case"bgc":case"c":return colors.isColor(o.toString())?o:`var(--g-c-${o})`;case"d":if(!o)return"none";if(o&&s&&constant.layoutComponent.includes(s))return"grid";return"block";default:return o}};function composeAdvanceStyle(e,o){if(!e)return{};let s={},a=["desktop","tablet","mobile"],t=["hover","normal"];return Object.keys(e).forEach(r=>{let c=e[r];if("cssClass"===r||null==c)return;let i=e.hasBoxShadow?e.hasBoxShadow:{};if("object"==typeof c){if(Array.isArray(c))return;Object.keys(c).forEach(n=>{if(a.includes(n)){let e=c[n];if(void 0!==e){if("border"===r&&Object.assign(s,borders.handleConvertBorderStyle(c),borders.handleConvertBorderWidth(c),borders.handleConvertBorderColor(c)),"rounded"===r&&Object.assign(s,radius.composeRadius(c)),"desktop"===n)switch(r){case"padding":composeSpacing({source:s,spacing:e,type:"p"});break;case"margin":composeSpacing({source:s,spacing:e,type:"m"});break;case"spacing-setting":composeSpacingV2({source:s,spacing:e,tag:o});break;case"m":case"p":break;default:s[`--${r}`]=getAttrValue(r,e,o)}else switch(r){case"padding":composeSpacing({source:s,spacing:e,type:"p",suffix:`-${n}`});break;case"margin":composeSpacing({source:s,spacing:e,type:"m",suffix:`-${n}`});break;case"spacing-setting":composeSpacingV2({source:s,spacing:e,suffix:`-${n}`,tag:o});break;case"m":case"p":break;default:s[`--${r}-${n}`]=getAttrValue(r,e,o)}}}else if(t.includes(n))switch(r){case"hasBoxShadow":break;case"boxShadow":Object.assign(s,shadow.getStyleShadowState(c,"box-shadow",i))}else"border"===r&&("none"===c.border&&(c.border="solid",c.color="#121212",c.isCustom=!0,c.width="0px",c.position="all"),Object.assign(s,borders.getBorderStyle(c))),"rounded"===r&&Object.assign(s,radius.getCornerCSSFromGlobal(c)),"hasBoxShadow"===r&&Object.assign(s,shadow.getStyleShadow({value:e.boxShadow,styleAppliedFor:"box-shadow",isEnableShadow:e.hasBoxShadow})),"boxShadow"===r&&Object.assign(s,shadow.getStyleShadow({value:c,styleAppliedFor:"box-shadow",isEnableShadow:e.hasBoxShadow}))})}else s[`--${r}`]=getAttrValue(r,c,o),"hasBoxShadow"===r&&e.boxShadow&&Object.assign(s,shadow.getStyleShadow({value:e.boxShadow,styleAppliedFor:"box-shadow",isEnableShadow:e.hasBoxShadow}))}),s}const splitStyle=(e,o={})=>{let s=e.map(e=>makeStyle.makeStyleKey(e)).flat(),a=Object.keys(o).filter(e=>s.includes(e)),t=a.reduce((e,s)=>({...e,[s]:o[s]}),{}),r=Object.keys(o).filter(e=>!a.includes(e)).reduce((e,s)=>({...e,[s]:o[s]}),{});return[t,r]};exports.composeAdvanceStyle=composeAdvanceStyle,exports.splitStyle=splitStyle;
@@ -1 +1 @@
1
- import{handleConvertBorderStyle as e,handleConvertBorderWidth as s,handleConvertBorderColor as a,getBorderStyle as o}from"./borders.js";import{isColor as t}from"./colors.js";import{layoutComponent as r}from"./constant.js";import{makeStyleKey as i}from"./make-style.js";import{composeRadius as c,getCornerCSSFromGlobal as n}from"./radius.js";import{getStyleShadowState as l,getStyleShadow as p}from"./shadow.js";let composeSpacing=({source:e,spacing:s,type:a,suffix:o=""})=>{let{top:t,left:r,bottom:i,right:c}=s;t&&(e[`--${a}t${o}`]=t),r&&(e[`--${a}l${o}`]=r),i&&(e[`--${a}b${o}`]=i),c&&(e[`--${a}r${o}`]=c)},composeSpacingV2=({source:e,spacing:s,suffix:a=""})=>{if(s&&s.margin){let{top:o,left:t,bottom:r,right:i}=s.margin;o&&(e[`--mt${a}`]=o),t&&(e[`--ml${a}`]="0px"===t?"auto":t),r&&(e[`--mb${a}`]=r),i&&(e[`--mr${a}`]="0px"===i?"auto":i)}if(s&&s.padding){let{top:o,left:t,bottom:r,right:i}=s.padding;o&&(e[`--pt${a}`]=o),t&&(e[`--pl${a}`]=t),r&&(e[`--pb${a}`]=r),i&&(e[`--pr${a}`]=i)}},getAttrValue=(e,s,a)=>{if(null!=s)switch(e){case"bgc":case"c":return t(s.toString())?s:`var(--g-c-${s})`;case"d":if(!s)return"none";if(s&&a&&r.includes(a))return"grid";return"block";default:return s}};function composeAdvanceStyle(t,r){if(!t)return{};let i={},d=["desktop","tablet","mobile"],b=["hover","normal"];return Object.keys(t).forEach(u=>{let g=t[u];if("cssClass"===u||null==g)return;let m=t.hasBoxShadow?t.hasBoxShadow:{};if("object"==typeof g){if(Array.isArray(g))return;Object.keys(g).forEach(h=>{if(d.includes(h)){let o=g[h];if(void 0!==o){if("border"===u&&Object.assign(i,e(g),s(g),a(g)),"rounded"===u&&Object.assign(i,c(g)),"desktop"===h)switch(u){case"padding":composeSpacing({source:i,spacing:o,type:"p"});break;case"margin":composeSpacing({source:i,spacing:o,type:"m"});break;case"spacing-setting":composeSpacingV2({source:i,spacing:o});break;case"m":case"p":break;default:i[`--${u}`]=getAttrValue(u,o,r)}else switch(u){case"padding":composeSpacing({source:i,spacing:o,type:"p",suffix:`-${h}`});break;case"margin":composeSpacing({source:i,spacing:o,type:"m",suffix:`-${h}`});break;case"spacing-setting":composeSpacingV2({source:i,spacing:o,suffix:`-${h}`});break;case"m":case"p":break;default:i[`--${u}-${h}`]=getAttrValue(u,o,r)}}}else if(b.includes(h))switch(u){case"hasBoxShadow":break;case"boxShadow":Object.assign(i,l(g,"box-shadow",m))}else"border"===u&&("none"===g.border&&(g.border="solid",g.color="#121212",g.isCustom=!0,g.width="0px",g.position="all"),Object.assign(i,o(g))),"rounded"===u&&Object.assign(i,n(g)),"hasBoxShadow"===u&&Object.assign(i,p({value:t.boxShadow,styleAppliedFor:"box-shadow",isEnableShadow:t.hasBoxShadow})),"boxShadow"===u&&Object.assign(i,p({value:g,styleAppliedFor:"box-shadow",isEnableShadow:t.hasBoxShadow}))})}else i[`--${u}`]=getAttrValue(u,g,r),"hasBoxShadow"===u&&t.boxShadow&&Object.assign(i,p({value:t.boxShadow,styleAppliedFor:"box-shadow",isEnableShadow:t.hasBoxShadow}))}),i}let splitStyle=(e,s={})=>{let a=e.map(e=>i(e)).flat(),o=Object.keys(s).filter(e=>a.includes(e)),t=o.reduce((e,a)=>({...e,[a]:s[a]}),{}),r=Object.keys(s).filter(e=>!o.includes(e)).reduce((e,a)=>({...e,[a]:s[a]}),{});return[t,r]};export{composeAdvanceStyle,splitStyle};
1
+ import{handleConvertBorderStyle as e,handleConvertBorderWidth as s,handleConvertBorderColor as a,getBorderStyle as o}from"./borders.js";import{isColor as t}from"./colors.js";import{layoutComponent as r}from"./constant.js";import{makeStyleKey as i}from"./make-style.js";import{composeRadius as c,getCornerCSSFromGlobal as n}from"./radius.js";import{getStyleShadowState as l,getStyleShadow as p}from"./shadow.js";let composeSpacing=({source:e,spacing:s,type:a,suffix:o=""})=>{let{top:t,left:r,bottom:i,right:c}=s;t&&(e[`--${a}t${o}`]=t),r&&(e[`--${a}l${o}`]=r),i&&(e[`--${a}b${o}`]=i),c&&(e[`--${a}r${o}`]=c)},composeSpacingV2=({source:e,spacing:s,suffix:a="",tag:o=""})=>{if(s&&s.margin){let{top:t,left:i,bottom:c,right:n}=s.margin;t&&(e[`--mt${a}`]=t),i&&(e[`--ml${a}`]=r.includes(o)&&"0px"===i?"auto":i),c&&(e[`--mb${a}`]=c),n&&(e[`--mr${a}`]=r.includes(o)&&"0px"===n?"auto":n)}if(s&&s.padding){let{top:o,left:t,bottom:r,right:i}=s.padding;o&&(e[`--pt${a}`]=o),t&&(e[`--pl${a}`]=t),r&&(e[`--pb${a}`]=r),i&&(e[`--pr${a}`]=i)}},getAttrValue=(e,s,a)=>{if(null!=s)switch(e){case"bgc":case"c":return t(s.toString())?s:`var(--g-c-${s})`;case"d":if(!s)return"none";if(s&&a&&r.includes(a))return"grid";return"block";default:return s}};function composeAdvanceStyle(t,r){if(!t)return{};let i={},d=["desktop","tablet","mobile"],u=["hover","normal"];return Object.keys(t).forEach(b=>{let g=t[b];if("cssClass"===b||null==g)return;let m=t.hasBoxShadow?t.hasBoxShadow:{};if("object"==typeof g){if(Array.isArray(g))return;Object.keys(g).forEach(h=>{if(d.includes(h)){let o=g[h];if(void 0!==o){if("border"===b&&Object.assign(i,e(g),s(g),a(g)),"rounded"===b&&Object.assign(i,c(g)),"desktop"===h)switch(b){case"padding":composeSpacing({source:i,spacing:o,type:"p"});break;case"margin":composeSpacing({source:i,spacing:o,type:"m"});break;case"spacing-setting":composeSpacingV2({source:i,spacing:o,tag:r});break;case"m":case"p":break;default:i[`--${b}`]=getAttrValue(b,o,r)}else switch(b){case"padding":composeSpacing({source:i,spacing:o,type:"p",suffix:`-${h}`});break;case"margin":composeSpacing({source:i,spacing:o,type:"m",suffix:`-${h}`});break;case"spacing-setting":composeSpacingV2({source:i,spacing:o,suffix:`-${h}`,tag:r});break;case"m":case"p":break;default:i[`--${b}-${h}`]=getAttrValue(b,o,r)}}}else if(u.includes(h))switch(b){case"hasBoxShadow":break;case"boxShadow":Object.assign(i,l(g,"box-shadow",m))}else"border"===b&&("none"===g.border&&(g.border="solid",g.color="#121212",g.isCustom=!0,g.width="0px",g.position="all"),Object.assign(i,o(g))),"rounded"===b&&Object.assign(i,n(g)),"hasBoxShadow"===b&&Object.assign(i,p({value:t.boxShadow,styleAppliedFor:"box-shadow",isEnableShadow:t.hasBoxShadow})),"boxShadow"===b&&Object.assign(i,p({value:g,styleAppliedFor:"box-shadow",isEnableShadow:t.hasBoxShadow}))})}else i[`--${b}`]=getAttrValue(b,g,r),"hasBoxShadow"===b&&t.boxShadow&&Object.assign(i,p({value:t.boxShadow,styleAppliedFor:"box-shadow",isEnableShadow:t.hasBoxShadow}))}),i}let splitStyle=(e,s={})=>{let a=e.map(e=>i(e)).flat(),o=Object.keys(s).filter(e=>a.includes(e)),t=o.reduce((e,a)=>({...e,[a]:s[a]}),{}),r=Object.keys(s).filter(e=>!o.includes(e)).reduce((e,a)=>({...e,[a]:s[a]}),{});return[t,r]};export{composeAdvanceStyle,splitStyle};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "1.14.0-dev.574",
3
+ "version": "1.14.0-dev.575",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",