@gem-sdk/core 1.36.1 → 1.36.16

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.
@@ -163,15 +163,7 @@ const ComponentToolbarPreview = ({ ...props })=>{
163
163
  return false;
164
164
  };
165
165
  const toolbarName = ()=>{
166
- const tag = props.tag;
167
- if (tag === 'IconListV2') {
168
- return 'Item list';
169
- }
170
- if (tag === 'IconList') {
171
- return 'Advanced list';
172
- }
173
- const name = props.customLabel || props.label;
174
- return name;
166
+ return props.customLabel || props.label;
175
167
  };
176
168
  const onZoomOut = (e)=>{
177
169
  e.preventDefault();
@@ -424,6 +424,30 @@ const createBuilderPreviewProvider = (args, isThemeSectionEditor)=>zustand.creat
424
424
  }
425
425
  });
426
426
  }
427
+ },
428
+ updateItemAttribute: (id, value, attr)=>{
429
+ if (!attr || ![
430
+ 'label',
431
+ 'customLabel'
432
+ ].includes(attr)) return;
433
+ const state = get().state;
434
+ const item = state[id];
435
+ // Ignore section
436
+ if (item?.type === 'section') return;
437
+ if (item) {
438
+ const dateModified = Date.now();
439
+ item.dateModified = dateModified;
440
+ const updatedItem = {
441
+ ...item,
442
+ [attr]: value
443
+ };
444
+ set({
445
+ state: {
446
+ ...state,
447
+ [id]: updatedItem
448
+ }
449
+ });
450
+ }
427
451
  }
428
452
  }));
429
453
  const BuilderPreviewProvider = ({ children, state, isThemeSectionEditor, lazy, ...passProps })=>{
@@ -161,15 +161,7 @@ const ComponentToolbarPreview = ({ ...props })=>{
161
161
  return false;
162
162
  };
163
163
  const toolbarName = ()=>{
164
- const tag = props.tag;
165
- if (tag === 'IconListV2') {
166
- return 'Item list';
167
- }
168
- if (tag === 'IconList') {
169
- return 'Advanced list';
170
- }
171
- const name = props.customLabel || props.label;
172
- return name;
164
+ return props.customLabel || props.label;
173
165
  };
174
166
  const onZoomOut = (e)=>{
175
167
  e.preventDefault();
@@ -422,6 +422,30 @@ const createBuilderPreviewProvider = (args, isThemeSectionEditor)=>createStore((
422
422
  }
423
423
  });
424
424
  }
425
+ },
426
+ updateItemAttribute: (id, value, attr)=>{
427
+ if (!attr || ![
428
+ 'label',
429
+ 'customLabel'
430
+ ].includes(attr)) return;
431
+ const state = get().state;
432
+ const item = state[id];
433
+ // Ignore section
434
+ if (item?.type === 'section') return;
435
+ if (item) {
436
+ const dateModified = Date.now();
437
+ item.dateModified = dateModified;
438
+ const updatedItem = {
439
+ ...item,
440
+ [attr]: value
441
+ };
442
+ set({
443
+ state: {
444
+ ...state,
445
+ [id]: updatedItem
446
+ }
447
+ });
448
+ }
425
449
  }
426
450
  }));
427
451
  const BuilderPreviewProvider = ({ children, state, isThemeSectionEditor, lazy, ...passProps })=>{
@@ -507,6 +507,7 @@ type Option$3<T> = {
507
507
  label?: string | number;
508
508
  type?: string;
509
509
  icon?: string;
510
+ tooltip?: string;
510
511
  };
511
512
  type Mapped$4<K, T> = NonNullable<T> extends ObjectDevices<infer U> ? {
512
513
  id: K;
@@ -7704,6 +7705,7 @@ type BuilderPreviewContextProps = {
7704
7705
  initState: (data: BuilderEntityNested | BuilderEntityNested[]) => void;
7705
7706
  getParents: (id: string, limit?: number) => BuilderEntity[];
7706
7707
  updateItemName: (id: string, name: string) => void;
7708
+ updateItemAttribute: (id: string, value: string, attr: string) => void;
7707
7709
  };
7708
7710
  type BuilderPreviewProviderProps = Pick<BuilderPreviewContextProps, 'state'> & {
7709
7711
  children: React.ReactNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/core",
3
- "version": "1.36.1",
3
+ "version": "1.36.16",
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.25.0",
28
- "@gem-sdk/styles": "1.36.1"
28
+ "@gem-sdk/styles": "1.36.13"
29
29
  },
30
30
  "dependencies": {
31
31
  "react-error-boundary": "4.0.10",