@gem-sdk/core 3.0.0 → 3.0.17

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,2 +1,2 @@
1
1
  'use client';
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),react=require("react"),reactErrorBoundary=require("react-error-boundary"),BuilderComponent=require("../contexts/BuilderComponent.js"),BuilderContext=require("../contexts/BuilderContext.js"),ComponentWrapper=require("./ComponentWrapper.js"),RenderSection=require("./RenderSection.js");const Render=({uid:e,...r})=>{let t=BuilderContext.useBuilderStore(r=>r.getItem(e)),n=BuilderComponent.useBuilderComponent(t?.tag),s=BuilderContext.useBuilderStore(e=>e.getIsPostPurchase()),i=BuilderContext.useBuilderStore(e=>e.getIsPreview()),u=react.useMemo(()=>s?"POST_PURCHASE":void 0,[s]);return t?t?.type==="section"?jsxRuntime.jsx(RenderSection.default,{sectionId:t.uid}):jsxRuntime.jsx(reactErrorBoundary.ErrorBoundary,{fallbackRender:({error:e,resetErrorBoundary:r})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{"aria-label":"Error message",children:e.message}),jsxRuntime.jsx("button",{type:"button",onClick:r,children:"Try again"})]}),children:jsxRuntime.jsx(ComponentWrapper.default,{...t,pageType:u,children:t?.childrens?.length?jsxRuntime.jsx(n,{builderProps:{uid:e,builderData:t,isPreview:i},styles:t.styles,setting:t.settings,...r,children:t.childrens.map(e=>jsxRuntime.jsx(RenderMemo,{parentStyle:r?.parentStyle,uid:e},e))}):jsxRuntime.jsx(n,{builderProps:{uid:e,builderData:t,isPreview:i},styles:t.styles,setting:t.settings,...r})})},t.uid):null},RenderMemo=react.memo(Render);RenderMemo.displayName="RenderMemo",exports.default=RenderMemo;
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),react=require("react"),reactErrorBoundary=require("react-error-boundary"),BuilderComponent=require("../contexts/BuilderComponent.js"),BuilderContext=require("../contexts/BuilderContext.js"),ComponentWrapper=require("./ComponentWrapper.js"),RenderSection=require("./RenderSection.js");const Render=({uid:e,...r})=>{let t=BuilderContext.useBuilderStore(r=>r.getItem(e)),n=BuilderComponent.useBuilderComponent(t?.tag),s=BuilderContext.useBuilderStore(e=>e.getIsPostPurchase()),i=BuilderContext.useBuilderStore(e=>e.getIsPreview()),d=react.useMemo(()=>s?"POST_PURCHASE":void 0,[s]);return t?t?.type==="section"?jsxRuntime.jsx(RenderSection.default,{sectionId:t.uid}):jsxRuntime.jsx(reactErrorBoundary.ErrorBoundary,{fallbackRender:({error:e,resetErrorBoundary:r})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("span",{"aria-label":"Error message",children:e.message}),jsxRuntime.jsx("button",{type:"button",onClick:r,children:"Try again"})]}),children:jsxRuntime.jsx(ComponentWrapper.default,{...t,pageType:d,children:t?.childrens?.length?jsxRuntime.jsx(n,{builderProps:{uid:e,builderData:t,isPreview:i},styles:t.styles,setting:t.settings,advanced:t.advanced,...r,children:t.childrens.map(e=>jsxRuntime.jsx(RenderMemo,{parentStyle:r?.parentStyle,uid:e},e))}):jsxRuntime.jsx(n,{builderProps:{uid:e,builderData:t,isPreview:i},styles:t.styles,setting:t.settings,advanced:t.advanced,...r})})},t.uid):null},RenderMemo=react.memo(Render);RenderMemo.displayName="RenderMemo",exports.default=RenderMemo;
@@ -5,15 +5,15 @@
5
5
  ${a?`font-weight: ${a};`:""}
6
6
  ${l?`letter-spacing: ${l};`:""}
7
7
  ${y?`line-height: ${y};`:""}
8
- `},composeTypographyV2Css=(o,e)=>{let t=o?.custom,{fontFamily:p,fontSize:s,fontWeight:a,lineHeight:y,letterSpacing:l,textShadow:r}=t??{},n=o?.attrs,{bold:i,italic:m,underline:c,transform:g,color:h}=n??{},$=e?"!important":"";return`
9
- ${p?`font-family: ${composeFontFamilyTypographyV2({fontFamily:p,type:o?.type})} ${$}`:""};
10
- ${s?.desktop?`font-size: ${s?.desktop} ${$}`:""};
11
- ${h?`color: ${colors.getSingleColorVariable(h)} ${$}`:""};
12
- ${i?`font-weight: bold ${$}`:a?`font-weight: ${a} ${$}`:""};
13
- ${l?`letter-spacing: ${l} ${$}`:""};
14
- ${y?.desktop?`line-height: ${y?.desktop} ${$}`:""};
15
- ${m?`font-style: italic ${$}`:""};
16
- ${c?`text-decoration-line: underline ${$}`:""};
17
- ${g?`text-transform: ${g} ${$}`:""};
18
- ${r&&"none"!==r.type?`text-shadow: ${composeTextShadowCss(r)}`:"none"};
8
+ `},composeTypographyV2Css=(o,e)=>{let t=o?.custom,{fontFamily:p,fontSize:s,fontWeight:a,lineHeight:y,letterSpacing:l,textShadow:r,hasShadowText:n}=t??{},i=o?.attrs,m=r&&"none"!==r.type&&!1!==r.enable,{bold:c,italic:g,underline:h,transform:$,color:T}=i??{},f=e?"!important":"";return`
9
+ ${p?`font-family: ${composeFontFamilyTypographyV2({fontFamily:p,type:o?.type})} ${f}`:""};
10
+ ${s?.desktop?`font-size: ${s?.desktop} ${f}`:""};
11
+ ${T?`color: ${colors.getSingleColorVariable(T)} ${f}`:""};
12
+ ${c?`font-weight: bold ${f}`:a?`font-weight: ${a} ${f}`:""};
13
+ ${l?`letter-spacing: ${l} ${f}`:""};
14
+ ${y?.desktop?`line-height: ${y?.desktop} ${f}`:""};
15
+ ${g?`font-style: italic ${f}`:""};
16
+ ${h?`text-decoration-line: underline ${f}`:""};
17
+ ${$?`text-transform: ${$} ${f}`:""};
18
+ ${m&&n?`text-shadow: ${composeTextShadowCss(r||{})}`:"none"};
19
19
  `},composeTextShadowCss=o=>{let e="number"==typeof o?.angle?o?.angle:0,t=e*Math.PI/180,p=parseFloat(o?.distance??"0");if(isNaN(p))return"none";let s=Math.round(Math.cos(t)*p*100)/100,a=Math.round(Math.sin(t)*p*100)/100;return`${s}px ${a}px ${o?.blur??"0"} ${o.color}`},composeTextHoverColorCss=(o,e)=>{if(o){let t=e?"!important":"",p=colors.getSingleColorVariable(o.hover);return`${p?`color: ${p} ${t}`:""}`}};function getCustomCSSByDevice(o,e){if(!o||!e)return{};let t="desktop"!==e&&e?`-${e}`:"",{fontFamily:p}=o?.[e]??{};return{[`--size${t}`]:o?.[e]?.fontSize,[`--lh${t}`]:o?.[e]?.lineHeight,[`--fs${t}`]:o?.[e]?.fontStyle,[`--ff${t}`]:composeFontFamilyTypographyV2({fontFamily:p}),[`--weight${t}`]:o?.[e]?.fontWeight,[`--ls${t}`]:o?.[e]?.letterSpacing}}const composeTypography=o=>o?makeStyle.removeNullUndefined({...getCustomCSSByDevice(o,"desktop"),...getCustomCSSByDevice(o,"tablet"),...getCustomCSSByDevice(o,"mobile")}):{},composeTypographyV2=(o,e)=>o?makeStyle.removeNullUndefined({...makeStyle.makeStyle({fs:e?.italic?void 0:o?.fontStyle,ff:composeFontFamilyTypographyV2(o),weight:e?.bold?void 0:o?.fontWeight,ls:o?.letterSpacing}),...makeStyle.makeStyleResponsive("size",o?.fontSize),...makeStyle.makeStyleResponsive("lh",o?.lineHeight)}):{},composeFontFamilyTypographyV2=o=>{let{fontFamily:e,isCustom:t,fallbackFontFamily:p,type:s}=o||{};return e?"string"==typeof e?getFontUsedByTypographyV2({fontFamily:e,fallbackFontFamily:o?.fallbackFontFamily||composeFallbackTypographyStyle(s??"heading")}):"object"==typeof e&&"string"==typeof e?.value?"theme"===e.type?`var(${e?.value}), var(--g-font-body)`:getFontUsedByTypographyV2({fontFamily:e.value,fallbackFontFamily:o?.fallbackFontFamily||composeFallbackTypographyStyle(s??"heading")}):void 0:t?p:void 0},getFontUsedByTypographyV2=({fontFamily:o,fallbackFontFamily:e})=>{if(o)return`var(--g-font-${o?.replace(/ /g,"-")}, '${o}'), ${e}`},composeTypographyAttr=o=>o?makeStyle.removeNullUndefined({...makeStyle.makeStyle({fs:o?.italic?"italic":void 0,weight:o?.bold?"bold":void 0,c:colors.getSingleColorVariable(o?.color),tt:o?.transform,tdl:o?.underline?"underline":void 0})}):{},composeTypographyClassName=(o,e)=>o?o?.type&&!isCustomTypo(o.custom)?genTypoClass(o.type):"":e?.type&&genTypoClass(e?.type),composeFallbackTypographyStyle=o=>o.toLocaleLowerCase().includes("heading")?"var(--g-font-heading, heading)":"var(--g-font-body, body)",composeTypographyStyle=(o,e,t)=>{if(o){let e=composeFallbackTypographyStyle(o.type??"heading"),p={...o.custom,fallbackFontFamily:e,isCustom:isCustomTypo(o.custom)};return{...composeTypographyV2(p,o.attrs),...!t&&composeTypographyAttr(o.attrs)}}return{...e?.type?{}:composeTypography(e?.custom)}},isCustomTypo=o=>o&&Object.keys(o).length>1||o&&1===Object.keys(o).length&&!o.fontSize;exports.composeFallbackTypographyStyle=composeFallbackTypographyStyle,exports.composeFontFamilyTypographyV2=composeFontFamilyTypographyV2,exports.composeTextHoverColorCss=composeTextHoverColorCss,exports.composeTypography=composeTypography,exports.composeTypographyAttr=composeTypographyAttr,exports.composeTypographyClassName=composeTypographyClassName,exports.composeTypographyCss=composeTypographyCss,exports.composeTypographyStyle=composeTypographyStyle,exports.composeTypographyV2=composeTypographyV2,exports.composeTypographyV2Css=composeTypographyV2Css,exports.genTypoClass=genTypoClass;
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import{memo as n,useMemo as o}from"react";import{ErrorBoundary as i}from"react-error-boundary";import{useBuilderComponent as s}from"../contexts/BuilderComponent.js";import{useBuilderStore as l}from"../contexts/BuilderContext.js";import d from"./ComponentWrapper.js";import a from"./RenderSection.js";let Render=({uid:n,...m})=>{let p=l(e=>e.getItem(n)),c=s(p?.tag),u=l(e=>e.getIsPostPurchase()),g=l(e=>e.getIsPreview()),y=o(()=>u?"POST_PURCHASE":void 0,[u]);return p?p?.type==="section"?e(a,{sectionId:p.uid}):e(i,{fallbackRender:({error:n,resetErrorBoundary:o})=>r(t,{children:[e("span",{"aria-label":"Error message",children:n.message}),e("button",{type:"button",onClick:o,children:"Try again"})]}),children:e(d,{...p,pageType:y,children:p?.childrens?.length?e(c,{builderProps:{uid:n,builderData:p,isPreview:g},styles:p.styles,setting:p.settings,...m,children:p.childrens.map(r=>e(RenderMemo,{parentStyle:m?.parentStyle,uid:r},r))}):e(c,{builderProps:{uid:n,builderData:p,isPreview:g},styles:p.styles,setting:p.settings,...m})})},p.uid):null},RenderMemo=n(Render);RenderMemo.displayName="RenderMemo";export{RenderMemo as default};
2
+ import{jsx as e,jsxs as r,Fragment as t}from"react/jsx-runtime";import{memo as n,useMemo as o}from"react";import{ErrorBoundary as d}from"react-error-boundary";import{useBuilderComponent as i}from"../contexts/BuilderComponent.js";import{useBuilderStore as s}from"../contexts/BuilderContext.js";import a from"./ComponentWrapper.js";import l from"./RenderSection.js";let Render=({uid:n,...m})=>{let c=s(e=>e.getItem(n)),p=i(c?.tag),u=s(e=>e.getIsPostPurchase()),g=s(e=>e.getIsPreview()),y=o(()=>u?"POST_PURCHASE":void 0,[u]);return c?c?.type==="section"?e(l,{sectionId:c.uid}):e(d,{fallbackRender:({error:n,resetErrorBoundary:o})=>r(t,{children:[e("span",{"aria-label":"Error message",children:n.message}),e("button",{type:"button",onClick:o,children:"Try again"})]}),children:e(a,{...c,pageType:y,children:c?.childrens?.length?e(p,{builderProps:{uid:n,builderData:c,isPreview:g},styles:c.styles,setting:c.settings,advanced:c.advanced,...m,children:c.childrens.map(r=>e(RenderMemo,{parentStyle:m?.parentStyle,uid:r},r))}):e(p,{builderProps:{uid:n,builderData:c,isPreview:g},styles:c.styles,setting:c.settings,advanced:c.advanced,...m})})},c.uid):null},RenderMemo=n(Render);RenderMemo.displayName="RenderMemo";export{RenderMemo as default};
@@ -5,15 +5,15 @@ import{getSingleColorVariable as o}from"./colors.js";import{removeNullUndefined
5
5
  ${s?`font-weight: ${s};`:""}
6
6
  ${l?`letter-spacing: ${l};`:""}
7
7
  ${y?`line-height: ${y};`:""}
8
- `},composeTypographyV2Css=(e,t)=>{let p=e?.custom,{fontFamily:a,fontSize:s,fontWeight:y,lineHeight:l,letterSpacing:r,textShadow:n}=p??{},i=e?.attrs,{bold:g,italic:c,underline:m,transform:h,color:$}=i??{},f=t?"!important":"";return`
9
- ${a?`font-family: ${composeFontFamilyTypographyV2({fontFamily:a,type:e?.type})} ${f}`:""};
10
- ${s?.desktop?`font-size: ${s?.desktop} ${f}`:""};
11
- ${$?`color: ${o($)} ${f}`:""};
12
- ${g?`font-weight: bold ${f}`:y?`font-weight: ${y} ${f}`:""};
13
- ${r?`letter-spacing: ${r} ${f}`:""};
14
- ${l?.desktop?`line-height: ${l?.desktop} ${f}`:""};
15
- ${c?`font-style: italic ${f}`:""};
16
- ${m?`text-decoration-line: underline ${f}`:""};
17
- ${h?`text-transform: ${h} ${f}`:""};
18
- ${n&&"none"!==n.type?`text-shadow: ${composeTextShadowCss(n)}`:"none"};
8
+ `},composeTypographyV2Css=(e,t)=>{let p=e?.custom,{fontFamily:a,fontSize:s,fontWeight:y,lineHeight:l,letterSpacing:r,textShadow:n,hasShadowText:i}=p??{},g=e?.attrs,c=n&&"none"!==n.type&&!1!==n.enable,{bold:m,italic:h,underline:$,transform:f,color:d}=g??{},T=t?"!important":"";return`
9
+ ${a?`font-family: ${composeFontFamilyTypographyV2({fontFamily:a,type:e?.type})} ${T}`:""};
10
+ ${s?.desktop?`font-size: ${s?.desktop} ${T}`:""};
11
+ ${d?`color: ${o(d)} ${T}`:""};
12
+ ${m?`font-weight: bold ${T}`:y?`font-weight: ${y} ${T}`:""};
13
+ ${r?`letter-spacing: ${r} ${T}`:""};
14
+ ${l?.desktop?`line-height: ${l?.desktop} ${T}`:""};
15
+ ${h?`font-style: italic ${T}`:""};
16
+ ${$?`text-decoration-line: underline ${T}`:""};
17
+ ${f?`text-transform: ${f} ${T}`:""};
18
+ ${c&&i?`text-shadow: ${composeTextShadowCss(n||{})}`:"none"};
19
19
  `},composeTextShadowCss=o=>{let e="number"==typeof o?.angle?o?.angle:0,t=e*Math.PI/180,p=parseFloat(o?.distance??"0");if(isNaN(p))return"none";let a=Math.round(Math.cos(t)*p*100)/100,s=Math.round(Math.sin(t)*p*100)/100;return`${a}px ${s}px ${o?.blur??"0"} ${o.color}`},composeTextHoverColorCss=(e,t)=>{if(e){let p=t?"!important":"",a=o(e.hover);return`${a?`color: ${a} ${p}`:""}`}};function getCustomCSSByDevice(o,e){if(!o||!e)return{};let t="desktop"!==e&&e?`-${e}`:"",{fontFamily:p}=o?.[e]??{};return{[`--size${t}`]:o?.[e]?.fontSize,[`--lh${t}`]:o?.[e]?.lineHeight,[`--fs${t}`]:o?.[e]?.fontStyle,[`--ff${t}`]:composeFontFamilyTypographyV2({fontFamily:p}),[`--weight${t}`]:o?.[e]?.fontWeight,[`--ls${t}`]:o?.[e]?.letterSpacing}}let composeTypography=o=>o?e({...getCustomCSSByDevice(o,"desktop"),...getCustomCSSByDevice(o,"tablet"),...getCustomCSSByDevice(o,"mobile")}):{},composeTypographyV2=(o,a)=>o?e({...t({fs:a?.italic?void 0:o?.fontStyle,ff:composeFontFamilyTypographyV2(o),weight:a?.bold?void 0:o?.fontWeight,ls:o?.letterSpacing}),...p("size",o?.fontSize),...p("lh",o?.lineHeight)}):{},composeFontFamilyTypographyV2=o=>{let{fontFamily:e,isCustom:t,fallbackFontFamily:p,type:a}=o||{};return e?"string"==typeof e?getFontUsedByTypographyV2({fontFamily:e,fallbackFontFamily:o?.fallbackFontFamily||composeFallbackTypographyStyle(a??"heading")}):"object"==typeof e&&"string"==typeof e?.value?"theme"===e.type?`var(${e?.value}), var(--g-font-body)`:getFontUsedByTypographyV2({fontFamily:e.value,fallbackFontFamily:o?.fallbackFontFamily||composeFallbackTypographyStyle(a??"heading")}):void 0:t?p:void 0},getFontUsedByTypographyV2=({fontFamily:o,fallbackFontFamily:e})=>{if(o)return`var(--g-font-${o?.replace(/ /g,"-")}, '${o}'), ${e}`},composeTypographyAttr=p=>p?e({...t({fs:p?.italic?"italic":void 0,weight:p?.bold?"bold":void 0,c:o(p?.color),tt:p?.transform,tdl:p?.underline?"underline":void 0})}):{},composeTypographyClassName=(o,e)=>o?o?.type&&!isCustomTypo(o.custom)?genTypoClass(o.type):"":e?.type&&genTypoClass(e?.type),composeFallbackTypographyStyle=o=>o.toLocaleLowerCase().includes("heading")?"var(--g-font-heading, heading)":"var(--g-font-body, body)",composeTypographyStyle=(o,e,t)=>{if(o){let e=composeFallbackTypographyStyle(o.type??"heading"),p={...o.custom,fallbackFontFamily:e,isCustom:isCustomTypo(o.custom)};return{...composeTypographyV2(p,o.attrs),...!t&&composeTypographyAttr(o.attrs)}}return{...e?.type?{}:composeTypography(e?.custom)}},isCustomTypo=o=>o&&Object.keys(o).length>1||o&&1===Object.keys(o).length&&!o.fontSize;export{composeFallbackTypographyStyle,composeFontFamilyTypographyV2,composeTextHoverColorCss,composeTypography,composeTypographyAttr,composeTypographyClassName,composeTypographyCss,composeTypographyStyle,composeTypographyV2,composeTypographyV2Css,genTypoClass};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "3.0.0",
3
+ "version": "3.0.17",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",