@gem-sdk/core 1.23.0-staging.32 → 1.23.0-staging.35

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.
@@ -10,6 +10,17 @@ var RenderCustomCode = require('./RenderCustomCode.js');
10
10
  var ComponentToolbarPreview = require('./ComponentToolbarPreview.js');
11
11
 
12
12
  const ComponentWrapperPreview = ({ children, ...props })=>{
13
+ react.useEffect(()=>{
14
+ const event = new CustomEvent('editor:component:render', {
15
+ bubbles: true,
16
+ detail: {
17
+ componentUid: props.uid
18
+ }
19
+ });
20
+ window.dispatchEvent(event);
21
+ }, [
22
+ props.uid
23
+ ]);
13
24
  if (props.type === 'section') {
14
25
  return null;
15
26
  }
@@ -25,14 +25,14 @@ const composeTypographyV2Css = (typography, isImportant)=>{
25
25
  const { bold, italic, underline, transform } = typographyAttrs ?? {};
26
26
  const composeImportant = isImportant ? '!important' : '';
27
27
  return `
28
- ${fontFamily ? `font-family: var(--g-font-${fontFamily}, ${fontFamily})${composeImportant};` : ''}
29
- ${fontSize?.desktop ? `font-size: ${fontSize?.desktop}${composeImportant};` : ''}
30
- ${bold ? `font-weight: bold;` : fontWeight ? `font-weight: ${fontWeight}${composeImportant};` : ''}
31
- ${letterSpacing ? `letter-spacing: ${letterSpacing}${composeImportant};` : ''}
32
- ${lineHeight ? `line-height: ${lineHeight}${composeImportant};` : ''}
28
+ ${fontFamily ? `font-family: var(--g-font-${fontFamily}, ${fontFamily}) ${composeImportant};` : ''}
29
+ ${fontSize?.desktop ? `font-size: ${fontSize?.desktop} ${composeImportant};` : ''}
30
+ ${bold ? `font-weight: bold;` : fontWeight ? `font-weight: ${fontWeight} ${composeImportant};` : ''}
31
+ ${letterSpacing ? `letter-spacing: ${letterSpacing} ${composeImportant};` : ''}
32
+ ${lineHeight ? `line-height: ${lineHeight} ${composeImportant};` : ''}
33
33
  ${italic ? `font-style: italic${composeImportant};` : ''}
34
- ${underline ? `text-decoration-line: underline${composeImportant};` : ''}
35
- ${transform ? `text-transform: ${transform}${composeImportant};` : ''}
34
+ ${underline ? `text-decoration-line: underline ${composeImportant};` : ''}
35
+ ${transform ? `text-transform: ${transform} ${composeImportant};` : ''}
36
36
  `;
37
37
  };
38
38
  function getCustomCSSByDevice(typography, device) {
@@ -1,11 +1,22 @@
1
1
  import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
2
- import { isValidElement } from 'react';
2
+ import { useEffect, isValidElement } from 'react';
3
3
  import { composeAdvanceStyle } from '../helpers/compose-advance-style.js';
4
4
  import { disableWrap } from './constant.js';
5
5
  import RenderCustomCode from './RenderCustomCode.js';
6
6
  import { ComponentToolbarPreview } from './ComponentToolbarPreview.js';
7
7
 
8
8
  const ComponentWrapperPreview = ({ children, ...props })=>{
9
+ useEffect(()=>{
10
+ const event = new CustomEvent('editor:component:render', {
11
+ bubbles: true,
12
+ detail: {
13
+ componentUid: props.uid
14
+ }
15
+ });
16
+ window.dispatchEvent(event);
17
+ }, [
18
+ props.uid
19
+ ]);
9
20
  if (props.type === 'section') {
10
21
  return null;
11
22
  }
@@ -23,14 +23,14 @@ const composeTypographyV2Css = (typography, isImportant)=>{
23
23
  const { bold, italic, underline, transform } = typographyAttrs ?? {};
24
24
  const composeImportant = isImportant ? '!important' : '';
25
25
  return `
26
- ${fontFamily ? `font-family: var(--g-font-${fontFamily}, ${fontFamily})${composeImportant};` : ''}
27
- ${fontSize?.desktop ? `font-size: ${fontSize?.desktop}${composeImportant};` : ''}
28
- ${bold ? `font-weight: bold;` : fontWeight ? `font-weight: ${fontWeight}${composeImportant};` : ''}
29
- ${letterSpacing ? `letter-spacing: ${letterSpacing}${composeImportant};` : ''}
30
- ${lineHeight ? `line-height: ${lineHeight}${composeImportant};` : ''}
26
+ ${fontFamily ? `font-family: var(--g-font-${fontFamily}, ${fontFamily}) ${composeImportant};` : ''}
27
+ ${fontSize?.desktop ? `font-size: ${fontSize?.desktop} ${composeImportant};` : ''}
28
+ ${bold ? `font-weight: bold;` : fontWeight ? `font-weight: ${fontWeight} ${composeImportant};` : ''}
29
+ ${letterSpacing ? `letter-spacing: ${letterSpacing} ${composeImportant};` : ''}
30
+ ${lineHeight ? `line-height: ${lineHeight} ${composeImportant};` : ''}
31
31
  ${italic ? `font-style: italic${composeImportant};` : ''}
32
- ${underline ? `text-decoration-line: underline${composeImportant};` : ''}
33
- ${transform ? `text-transform: ${transform}${composeImportant};` : ''}
32
+ ${underline ? `text-decoration-line: underline ${composeImportant};` : ''}
33
+ ${transform ? `text-transform: ${transform} ${composeImportant};` : ''}
34
34
  `;
35
35
  };
36
36
  function getCustomCSSByDevice(typography, device) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "1.23.0-staging.32",
3
+ "version": "1.23.0-staging.35",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "devDependencies": {
27
27
  "@gem-sdk/adapter-shopify": "1.23.0-staging.26",
28
- "@gem-sdk/styles": "1.23.0-staging.32"
28
+ "@gem-sdk/styles": "1.23.0-staging.35"
29
29
  },
30
30
  "dependencies": {
31
31
  "react-error-boundary": "4.0.10",