@gem-sdk/core 1.23.0-staging.217 → 1.23.0-staging.222

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.
@@ -262,7 +262,7 @@ const ComponentToolbarPreview = ({ ...props })=>{
262
262
  }),
263
263
  props.tag == 'Section' ? /*#__PURE__*/ jsxRuntime.jsx("div", {
264
264
  "data-toolbar-name": true,
265
- children: isThemeSection ? props.name : `Section ${getIndexSection() + 1}${getSectionNumber() >= SECTION_LIMIT - 5 ? `/${SECTION_LIMIT}` : ''}`
265
+ children: props.name || `Section ${getIndexSection() + 1}${getSectionNumber() >= SECTION_LIMIT - 5 ? `/${SECTION_LIMIT}` : ''}`
266
266
  }) : /*#__PURE__*/ jsxRuntime.jsx("div", {
267
267
  "data-toolbar-name": true,
268
268
  children: toolbarName()
@@ -123,11 +123,18 @@ function Spacing(props) {
123
123
  const toolbar = $component && getChildrenByAttrSelector($component, 'data-toolbar');
124
124
  const isActive = toolbar && toolbar.getAttribute('data-toolbar-active');
125
125
  if (isActive && detail?.marginBottom) {
126
- const currentValue = isNaN(parseInt(detail?.marginBottom)) ? 0 : Math.max(parseInt(detail?.marginBottom), 0);
126
+ const currentValue = parseInt(detail?.marginBottom);
127
127
  const newValue = `${currentValue}px`;
128
128
  if ($bottomDrag.current && $bottomBg.current) {
129
- $bottomBg.current.style.height = newValue;
130
- $bottomDrag.current.style.top = newValue;
129
+ if (currentValue < 0) {
130
+ $bottomBg.current.style.display = 'none';
131
+ $bottomDrag.current.style.display = 'none';
132
+ } else {
133
+ $bottomBg.current.style.display = 'block';
134
+ $bottomDrag.current.style.display = 'block';
135
+ $bottomBg.current.style.height = newValue;
136
+ $bottomDrag.current.style.top = newValue;
137
+ }
131
138
  }
132
139
  }
133
140
  }, []);
@@ -411,6 +411,19 @@ const createBuilderPreviewProvider = (args, isThemeSectionEditor)=>zustand.creat
411
411
  index++;
412
412
  }
413
413
  return parents;
414
+ },
415
+ updateItemName: (id, name)=>{
416
+ const state = get().state;
417
+ const item = state[id];
418
+ if (item) {
419
+ item.name = name;
420
+ set({
421
+ state: {
422
+ ...state,
423
+ [id]: cloneDeep.cloneDeep(item)
424
+ }
425
+ });
426
+ }
414
427
  }
415
428
  }));
416
429
  const BuilderPreviewProvider = ({ children, state, isThemeSectionEditor, lazy, ...passProps })=>{
@@ -18,9 +18,9 @@ const composeSpacingV2 = ({ source, spacing, suffix = '' })=>{
18
18
  if (spacing && spacing.margin) {
19
19
  const { top, left, bottom, right } = spacing.margin;
20
20
  if (top) source[`--mt${suffix}`] = top;
21
- if (left) source[`--ml${suffix}`] = left;
21
+ if (left) source[`--ml${suffix}`] = left === '0px' ? 'auto' : left;
22
22
  if (bottom) source[`--mb${suffix}`] = bottom;
23
- if (right) source[`--mr${suffix}`] = right;
23
+ if (right) source[`--mr${suffix}`] = right === '0px' ? 'auto' : right;
24
24
  }
25
25
  if (spacing && spacing.padding) {
26
26
  const { top, left, bottom, right } = spacing.padding;
@@ -260,7 +260,7 @@ const ComponentToolbarPreview = ({ ...props })=>{
260
260
  }),
261
261
  props.tag == 'Section' ? /*#__PURE__*/ jsx("div", {
262
262
  "data-toolbar-name": true,
263
- children: isThemeSection ? props.name : `Section ${getIndexSection() + 1}${getSectionNumber() >= SECTION_LIMIT - 5 ? `/${SECTION_LIMIT}` : ''}`
263
+ children: props.name || `Section ${getIndexSection() + 1}${getSectionNumber() >= SECTION_LIMIT - 5 ? `/${SECTION_LIMIT}` : ''}`
264
264
  }) : /*#__PURE__*/ jsx("div", {
265
265
  "data-toolbar-name": true,
266
266
  children: toolbarName()
@@ -119,11 +119,18 @@ function Spacing(props) {
119
119
  const toolbar = $component && getChildrenByAttrSelector($component, 'data-toolbar');
120
120
  const isActive = toolbar && toolbar.getAttribute('data-toolbar-active');
121
121
  if (isActive && detail?.marginBottom) {
122
- const currentValue = isNaN(parseInt(detail?.marginBottom)) ? 0 : Math.max(parseInt(detail?.marginBottom), 0);
122
+ const currentValue = parseInt(detail?.marginBottom);
123
123
  const newValue = `${currentValue}px`;
124
124
  if ($bottomDrag.current && $bottomBg.current) {
125
- $bottomBg.current.style.height = newValue;
126
- $bottomDrag.current.style.top = newValue;
125
+ if (currentValue < 0) {
126
+ $bottomBg.current.style.display = 'none';
127
+ $bottomDrag.current.style.display = 'none';
128
+ } else {
129
+ $bottomBg.current.style.display = 'block';
130
+ $bottomDrag.current.style.display = 'block';
131
+ $bottomBg.current.style.height = newValue;
132
+ $bottomDrag.current.style.top = newValue;
133
+ }
127
134
  }
128
135
  }
129
136
  }, []);
@@ -409,6 +409,19 @@ const createBuilderPreviewProvider = (args, isThemeSectionEditor)=>createStore((
409
409
  index++;
410
410
  }
411
411
  return parents;
412
+ },
413
+ updateItemName: (id, name)=>{
414
+ const state = get().state;
415
+ const item = state[id];
416
+ if (item) {
417
+ item.name = name;
418
+ set({
419
+ state: {
420
+ ...state,
421
+ [id]: cloneDeep(item)
422
+ }
423
+ });
424
+ }
412
425
  }
413
426
  }));
414
427
  const BuilderPreviewProvider = ({ children, state, isThemeSectionEditor, lazy, ...passProps })=>{
@@ -16,9 +16,9 @@ const composeSpacingV2 = ({ source, spacing, suffix = '' })=>{
16
16
  if (spacing && spacing.margin) {
17
17
  const { top, left, bottom, right } = spacing.margin;
18
18
  if (top) source[`--mt${suffix}`] = top;
19
- if (left) source[`--ml${suffix}`] = left;
19
+ if (left) source[`--ml${suffix}`] = left === '0px' ? 'auto' : left;
20
20
  if (bottom) source[`--mb${suffix}`] = bottom;
21
- if (right) source[`--mr${suffix}`] = right;
21
+ if (right) source[`--mr${suffix}`] = right === '0px' ? 'auto' : right;
22
22
  }
23
23
  if (spacing && spacing.padding) {
24
24
  const { top, left, bottom, right } = spacing.padding;
@@ -7469,6 +7469,7 @@ type BuilderPreviewContextProps = {
7469
7469
  forceChangeState: (data: BuilderState) => void;
7470
7470
  initState: (data: BuilderEntityNested | BuilderEntityNested[]) => void;
7471
7471
  getParents: (id: string, limit?: number) => BuilderEntity[];
7472
+ updateItemName: (id: string, name: string) => void;
7472
7473
  };
7473
7474
  type BuilderPreviewProviderProps = Pick<BuilderPreviewContextProps, 'state'> & {
7474
7475
  children: React.ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "1.23.0-staging.217",
3
+ "version": "1.23.0-staging.222",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",