@cmssy/react 0.16.0 → 0.17.0

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.
package/dist/client.cjs CHANGED
@@ -74,6 +74,8 @@ function parseEditorMessage(data, origin, expectedOrigin) {
74
74
  blockId: data.blockId,
75
75
  content: data.content,
76
76
  protocolVersion: PROTOCOL_VERSION,
77
+ ...isObject(data.style) ? { style: data.style } : {},
78
+ ...isObject(data.advanced) ? { advanced: data.advanced } : {},
77
79
  ...typeof data.layoutPosition === "string" ? { layoutPosition: data.layoutPosition } : {}
78
80
  } : null;
79
81
  case "cmssy:parent-ready":
@@ -85,6 +87,8 @@ function parseEditorMessage(data, origin, expectedOrigin) {
85
87
  blockId: data.blockId,
86
88
  blockType: data.blockType,
87
89
  content: data.content,
90
+ ...isObject(data.style) ? { style: data.style } : {},
91
+ ...isObject(data.advanced) ? { advanced: data.advanced } : {},
88
92
  index: data.index
89
93
  } : null;
90
94
  case "cmssy:reorder":
@@ -148,6 +152,8 @@ function collectLayoutBlocks(rects, pageIds) {
148
152
  }
149
153
  function useEditBridge(page, config) {
150
154
  const [patches, setPatches] = react.useState({});
155
+ const [patchesStyle, setPatchesStyle] = react.useState({});
156
+ const [patchesAdvanced, setPatchesAdvanced] = react.useState({});
151
157
  const [selected, setSelected] = react.useState(null);
152
158
  const [inserted, setInserted] = react.useState([]);
153
159
  const [order, setOrder] = react.useState(null);
@@ -157,6 +163,8 @@ function useEditBridge(page, config) {
157
163
  const blocksKey = blocks.map((b) => `${b.id}:${b.type}`).join("|");
158
164
  react.useEffect(() => {
159
165
  setPatches({});
166
+ setPatchesStyle({});
167
+ setPatchesAdvanced({});
160
168
  setSelected(null);
161
169
  setInserted([]);
162
170
  setOrder(null);
@@ -209,6 +217,21 @@ function useEditBridge(page, config) {
209
217
  ...prev,
210
218
  [message.blockId]: { ...prev[message.blockId], ...message.content }
211
219
  }));
220
+ if (message.style) {
221
+ setPatchesStyle((prev) => ({
222
+ ...prev,
223
+ [message.blockId]: { ...prev[message.blockId], ...message.style }
224
+ }));
225
+ }
226
+ if (message.advanced) {
227
+ setPatchesAdvanced((prev) => ({
228
+ ...prev,
229
+ [message.blockId]: {
230
+ ...prev[message.blockId],
231
+ ...message.advanced
232
+ }
233
+ }));
234
+ }
212
235
  } else if (message.type === "cmssy:select") {
213
236
  setSelected(message.blockId);
214
237
  selectedIdRef.current = message.blockId;
@@ -219,6 +242,8 @@ function useEditBridge(page, config) {
219
242
  blockId: message.blockId,
220
243
  blockType: message.blockType,
221
244
  content: message.content,
245
+ style: message.style,
246
+ advanced: message.advanced,
222
247
  index: message.index
223
248
  });
224
249
  return next;
@@ -295,7 +320,15 @@ function useEditBridge(page, config) {
295
320
  window.removeEventListener("resize", emitSelectedBounds);
296
321
  };
297
322
  }, [config.editorOrigin, pageId, blocksKey]);
298
- return { patches, selected, inserted, order, removed };
323
+ return {
324
+ patches,
325
+ patchesStyle,
326
+ patchesAdvanced,
327
+ selected,
328
+ inserted,
329
+ order,
330
+ removed
331
+ };
299
332
  }
300
333
  var MOVE_MIME = "application/x-cmssy-move";
301
334
  function visible(el) {
@@ -504,6 +537,8 @@ function CmssyBlock({
504
537
  defaultLocale,
505
538
  blockMap,
506
539
  patchedContent,
540
+ patchedStyle,
541
+ patchedAdvanced,
507
542
  editable,
508
543
  layoutPosition,
509
544
  context
@@ -511,6 +546,8 @@ function CmssyBlock({
511
546
  const Component = Object.hasOwn(blockMap, block.type) ? blockMap[block.type] : void 0;
512
547
  const base = getBlockContentForLanguage(block.content, locale, defaultLocale);
513
548
  const content = patchedContent ? { ...base, ...patchedContent } : base;
549
+ const style = patchedStyle ? { ...asBucket(block.style), ...patchedStyle } : asBucket(block.style);
550
+ const advanced = patchedAdvanced ? { ...asBucket(block.advanced), ...patchedAdvanced } : asBucket(block.advanced);
514
551
  return /* @__PURE__ */ jsxRuntime.jsx(
515
552
  "div",
516
553
  {
@@ -521,8 +558,8 @@ function CmssyBlock({
521
558
  style: Component ? void 0 : { display: "none" },
522
559
  children: Component ? react.createElement(Component, {
523
560
  content,
524
- style: asBucket(block.style),
525
- advanced: asBucket(block.advanced),
561
+ style,
562
+ advanced,
526
563
  context
527
564
  }) : /* @__PURE__ */ jsxRuntime.jsx(UnknownBlock, { type: block.type })
528
565
  }
@@ -581,10 +618,7 @@ function EditableBlocks({
581
618
  }),
582
619
  [edit, blocks, category]
583
620
  );
584
- const { patches, inserted, order, removed } = useEditBridge(
585
- page,
586
- bridgeConfig
587
- );
621
+ const { patches, patchesStyle, patchesAdvanced, inserted, order, removed } = useEditBridge(page, bridgeConfig);
588
622
  const { dropY } = useDragAgent(bridgeConfig);
589
623
  const renderBlocks = react.useMemo(() => {
590
624
  const removedSet = new Set(removed);
@@ -595,7 +629,9 @@ function EditableBlocks({
595
629
  merged.splice(at, 0, {
596
630
  id: ins.blockId,
597
631
  type: ins.blockType,
598
- content: ins.content
632
+ content: ins.content,
633
+ style: ins.style,
634
+ advanced: ins.advanced
599
635
  });
600
636
  }
601
637
  if (order) {
@@ -615,6 +651,8 @@ function EditableBlocks({
615
651
  locale,
616
652
  defaultLocale,
617
653
  patchedContent: patches[block.id],
654
+ patchedStyle: patchesStyle[block.id],
655
+ patchedAdvanced: patchesAdvanced[block.id],
618
656
  blockMap,
619
657
  editable: true,
620
658
  context
package/dist/client.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { B as BlockSchema, a as BlockMeta, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, e as CmssyLocaleContext, f as CmssyCart, g as CmssyOrder, h as CmssyProduct } from './commerce-queries-D9lXIaCQ.cjs';
3
- export { i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, l as CmssyOrderItem, m as CmssyProductVariant } from './commerce-queries-D9lXIaCQ.cjs';
2
+ import { B as BlockSchema, a as BlockMeta, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, e as CmssyLocaleContext, f as CmssyCart, g as CmssyOrder, h as CmssyProduct } from './commerce-queries-CxUeiT52.cjs';
3
+ export { i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, l as CmssyOrderItem, m as CmssyProductVariant } from './commerce-queries-CxUeiT52.cjs';
4
4
  import { ReactNode } from 'react';
5
5
  import '@cmssy/types';
6
6
 
@@ -14,10 +14,14 @@ interface InsertedBlock {
14
14
  blockId: string;
15
15
  blockType: string;
16
16
  content: Record<string, unknown>;
17
+ style?: Record<string, unknown>;
18
+ advanced?: Record<string, unknown>;
17
19
  index: number;
18
20
  }
19
21
  interface EditBridgeState {
20
22
  patches: PatchMap;
23
+ patchesStyle: PatchMap;
24
+ patchesAdvanced: PatchMap;
21
25
  selected: string | null;
22
26
  inserted: InsertedBlock[];
23
27
  order: string[] | null;
package/dist/client.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { B as BlockSchema, a as BlockMeta, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, e as CmssyLocaleContext, f as CmssyCart, g as CmssyOrder, h as CmssyProduct } from './commerce-queries-D9lXIaCQ.js';
3
- export { i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, l as CmssyOrderItem, m as CmssyProductVariant } from './commerce-queries-D9lXIaCQ.js';
2
+ import { B as BlockSchema, a as BlockMeta, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, e as CmssyLocaleContext, f as CmssyCart, g as CmssyOrder, h as CmssyProduct } from './commerce-queries-CxUeiT52.js';
3
+ export { i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, l as CmssyOrderItem, m as CmssyProductVariant } from './commerce-queries-CxUeiT52.js';
4
4
  import { ReactNode } from 'react';
5
5
  import '@cmssy/types';
6
6
 
@@ -14,10 +14,14 @@ interface InsertedBlock {
14
14
  blockId: string;
15
15
  blockType: string;
16
16
  content: Record<string, unknown>;
17
+ style?: Record<string, unknown>;
18
+ advanced?: Record<string, unknown>;
17
19
  index: number;
18
20
  }
19
21
  interface EditBridgeState {
20
22
  patches: PatchMap;
23
+ patchesStyle: PatchMap;
24
+ patchesAdvanced: PatchMap;
21
25
  selected: string | null;
22
26
  inserted: InsertedBlock[];
23
27
  order: string[] | null;
package/dist/client.js CHANGED
@@ -72,6 +72,8 @@ function parseEditorMessage(data, origin, expectedOrigin) {
72
72
  blockId: data.blockId,
73
73
  content: data.content,
74
74
  protocolVersion: PROTOCOL_VERSION,
75
+ ...isObject(data.style) ? { style: data.style } : {},
76
+ ...isObject(data.advanced) ? { advanced: data.advanced } : {},
75
77
  ...typeof data.layoutPosition === "string" ? { layoutPosition: data.layoutPosition } : {}
76
78
  } : null;
77
79
  case "cmssy:parent-ready":
@@ -83,6 +85,8 @@ function parseEditorMessage(data, origin, expectedOrigin) {
83
85
  blockId: data.blockId,
84
86
  blockType: data.blockType,
85
87
  content: data.content,
88
+ ...isObject(data.style) ? { style: data.style } : {},
89
+ ...isObject(data.advanced) ? { advanced: data.advanced } : {},
86
90
  index: data.index
87
91
  } : null;
88
92
  case "cmssy:reorder":
@@ -146,6 +150,8 @@ function collectLayoutBlocks(rects, pageIds) {
146
150
  }
147
151
  function useEditBridge(page, config) {
148
152
  const [patches, setPatches] = useState({});
153
+ const [patchesStyle, setPatchesStyle] = useState({});
154
+ const [patchesAdvanced, setPatchesAdvanced] = useState({});
149
155
  const [selected, setSelected] = useState(null);
150
156
  const [inserted, setInserted] = useState([]);
151
157
  const [order, setOrder] = useState(null);
@@ -155,6 +161,8 @@ function useEditBridge(page, config) {
155
161
  const blocksKey = blocks.map((b) => `${b.id}:${b.type}`).join("|");
156
162
  useEffect(() => {
157
163
  setPatches({});
164
+ setPatchesStyle({});
165
+ setPatchesAdvanced({});
158
166
  setSelected(null);
159
167
  setInserted([]);
160
168
  setOrder(null);
@@ -207,6 +215,21 @@ function useEditBridge(page, config) {
207
215
  ...prev,
208
216
  [message.blockId]: { ...prev[message.blockId], ...message.content }
209
217
  }));
218
+ if (message.style) {
219
+ setPatchesStyle((prev) => ({
220
+ ...prev,
221
+ [message.blockId]: { ...prev[message.blockId], ...message.style }
222
+ }));
223
+ }
224
+ if (message.advanced) {
225
+ setPatchesAdvanced((prev) => ({
226
+ ...prev,
227
+ [message.blockId]: {
228
+ ...prev[message.blockId],
229
+ ...message.advanced
230
+ }
231
+ }));
232
+ }
210
233
  } else if (message.type === "cmssy:select") {
211
234
  setSelected(message.blockId);
212
235
  selectedIdRef.current = message.blockId;
@@ -217,6 +240,8 @@ function useEditBridge(page, config) {
217
240
  blockId: message.blockId,
218
241
  blockType: message.blockType,
219
242
  content: message.content,
243
+ style: message.style,
244
+ advanced: message.advanced,
220
245
  index: message.index
221
246
  });
222
247
  return next;
@@ -293,7 +318,15 @@ function useEditBridge(page, config) {
293
318
  window.removeEventListener("resize", emitSelectedBounds);
294
319
  };
295
320
  }, [config.editorOrigin, pageId, blocksKey]);
296
- return { patches, selected, inserted, order, removed };
321
+ return {
322
+ patches,
323
+ patchesStyle,
324
+ patchesAdvanced,
325
+ selected,
326
+ inserted,
327
+ order,
328
+ removed
329
+ };
297
330
  }
298
331
  var MOVE_MIME = "application/x-cmssy-move";
299
332
  function visible(el) {
@@ -502,6 +535,8 @@ function CmssyBlock({
502
535
  defaultLocale,
503
536
  blockMap,
504
537
  patchedContent,
538
+ patchedStyle,
539
+ patchedAdvanced,
505
540
  editable,
506
541
  layoutPosition,
507
542
  context
@@ -509,6 +544,8 @@ function CmssyBlock({
509
544
  const Component = Object.hasOwn(blockMap, block.type) ? blockMap[block.type] : void 0;
510
545
  const base = getBlockContentForLanguage(block.content, locale, defaultLocale);
511
546
  const content = patchedContent ? { ...base, ...patchedContent } : base;
547
+ const style = patchedStyle ? { ...asBucket(block.style), ...patchedStyle } : asBucket(block.style);
548
+ const advanced = patchedAdvanced ? { ...asBucket(block.advanced), ...patchedAdvanced } : asBucket(block.advanced);
512
549
  return /* @__PURE__ */ jsx(
513
550
  "div",
514
551
  {
@@ -519,8 +556,8 @@ function CmssyBlock({
519
556
  style: Component ? void 0 : { display: "none" },
520
557
  children: Component ? createElement(Component, {
521
558
  content,
522
- style: asBucket(block.style),
523
- advanced: asBucket(block.advanced),
559
+ style,
560
+ advanced,
524
561
  context
525
562
  }) : /* @__PURE__ */ jsx(UnknownBlock, { type: block.type })
526
563
  }
@@ -579,10 +616,7 @@ function EditableBlocks({
579
616
  }),
580
617
  [edit, blocks, category]
581
618
  );
582
- const { patches, inserted, order, removed } = useEditBridge(
583
- page,
584
- bridgeConfig
585
- );
619
+ const { patches, patchesStyle, patchesAdvanced, inserted, order, removed } = useEditBridge(page, bridgeConfig);
586
620
  const { dropY } = useDragAgent(bridgeConfig);
587
621
  const renderBlocks = useMemo(() => {
588
622
  const removedSet = new Set(removed);
@@ -593,7 +627,9 @@ function EditableBlocks({
593
627
  merged.splice(at, 0, {
594
628
  id: ins.blockId,
595
629
  type: ins.blockType,
596
- content: ins.content
630
+ content: ins.content,
631
+ style: ins.style,
632
+ advanced: ins.advanced
597
633
  });
598
634
  }
599
635
  if (order) {
@@ -613,6 +649,8 @@ function EditableBlocks({
613
649
  locale,
614
650
  defaultLocale,
615
651
  patchedContent: patches[block.id],
652
+ patchedStyle: patchesStyle[block.id],
653
+ patchedAdvanced: patchesAdvanced[block.id],
616
654
  blockMap,
617
655
  editable: true,
618
656
  context
@@ -288,6 +288,8 @@ interface PatchMessage {
288
288
  protocolVersion: number;
289
289
  blockId: string;
290
290
  content: Record<string, unknown>;
291
+ style?: Record<string, unknown>;
292
+ advanced?: Record<string, unknown>;
291
293
  layoutPosition?: string;
292
294
  }
293
295
  interface ParentReadyMessage {
@@ -300,6 +302,8 @@ interface InsertMessage {
300
302
  blockId: string;
301
303
  blockType: string;
302
304
  content: Record<string, unknown>;
305
+ style?: Record<string, unknown>;
306
+ advanced?: Record<string, unknown>;
303
307
  index: number;
304
308
  }
305
309
  interface ReorderMessage {
@@ -288,6 +288,8 @@ interface PatchMessage {
288
288
  protocolVersion: number;
289
289
  blockId: string;
290
290
  content: Record<string, unknown>;
291
+ style?: Record<string, unknown>;
292
+ advanced?: Record<string, unknown>;
291
293
  layoutPosition?: string;
292
294
  }
293
295
  interface ParentReadyMessage {
@@ -300,6 +302,8 @@ interface InsertMessage {
300
302
  blockId: string;
301
303
  blockType: string;
302
304
  content: Record<string, unknown>;
305
+ style?: Record<string, unknown>;
306
+ advanced?: Record<string, unknown>;
303
307
  index: number;
304
308
  }
305
309
  interface ReorderMessage {
package/dist/index.cjs CHANGED
@@ -269,6 +269,8 @@ function parseEditorMessage(data, origin, expectedOrigin) {
269
269
  blockId: data.blockId,
270
270
  content: data.content,
271
271
  protocolVersion: PROTOCOL_VERSION,
272
+ ...isObject(data.style) ? { style: data.style } : {},
273
+ ...isObject(data.advanced) ? { advanced: data.advanced } : {},
272
274
  ...typeof data.layoutPosition === "string" ? { layoutPosition: data.layoutPosition } : {}
273
275
  } : null;
274
276
  case "cmssy:parent-ready":
@@ -280,6 +282,8 @@ function parseEditorMessage(data, origin, expectedOrigin) {
280
282
  blockId: data.blockId,
281
283
  blockType: data.blockType,
282
284
  content: data.content,
285
+ ...isObject(data.style) ? { style: data.style } : {},
286
+ ...isObject(data.advanced) ? { advanced: data.advanced } : {},
283
287
  index: data.index
284
288
  } : null;
285
289
  case "cmssy:reorder":
@@ -899,6 +903,8 @@ function CmssyBlock({
899
903
  defaultLocale,
900
904
  blockMap,
901
905
  patchedContent,
906
+ patchedStyle,
907
+ patchedAdvanced,
902
908
  editable,
903
909
  layoutPosition,
904
910
  context
@@ -906,6 +912,8 @@ function CmssyBlock({
906
912
  const Component = Object.hasOwn(blockMap, block.type) ? blockMap[block.type] : void 0;
907
913
  const base = getBlockContentForLanguage(block.content, locale, defaultLocale);
908
914
  const content = patchedContent ? { ...base, ...patchedContent } : base;
915
+ const style = patchedStyle ? { ...asBucket(block.style), ...patchedStyle } : asBucket(block.style);
916
+ const advanced = patchedAdvanced ? { ...asBucket(block.advanced), ...patchedAdvanced } : asBucket(block.advanced);
909
917
  return /* @__PURE__ */ jsxRuntime.jsx(
910
918
  "div",
911
919
  {
@@ -916,8 +924,8 @@ function CmssyBlock({
916
924
  style: Component ? void 0 : { display: "none" },
917
925
  children: Component ? react.createElement(Component, {
918
926
  content,
919
- style: asBucket(block.style),
920
- advanced: asBucket(block.advanced),
927
+ style,
928
+ advanced,
921
929
  context
922
930
  }) : /* @__PURE__ */ jsxRuntime.jsx(UnknownBlock, { type: block.type })
923
931
  }
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FieldDefinition, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, n as CmssyBlockAuthContext, o as CmssyBlockWorkspace, d as CmssyLayoutGroup, E as EditorToAppMessage, A as AppToEditorMessage, p as FetchLike, q as CmssyClientConfig, r as CmssySiteConfig, R as RawBlock, e as CmssyLocaleContext, s as BlockMap, t as CmssyBlockContext } from './commerce-queries-D9lXIaCQ.cjs';
2
- export { a as BlockMeta, u as BlockRect, B as BlockSchema, v as BoundsMessage, w as BuildBlockContextExtra, x as ClickMessage, y as CmssyBlockMember, z as CmssyBranding, f as CmssyCart, i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, D as CmssyFormField, G as CmssyFormSettings, H as CmssyFormSubmitResponse, I as CmssyLocalizedValue, J as CmssyModelDefinition, K as CmssyModelRecord, g as CmssyOrder, L as CmssyPageMeta, M as CmssyPageSummary, h as CmssyProduct, m as CmssyProductVariant, N as CmssyRecordList, O as DEFAULT_CMSSY_API_URL, P as FORM_QUERY, Q as FetchLikeResponse, S as FetchPageOptions, T as MODEL_DEFINITIONS_QUERY, U as MODEL_RECORDS_QUERY, V as PROTOCOL_VERSION, W as ParentReadyMessage, X as PatchMessage, Y as RawLayoutBlock, Z as ReadyMessage, _ as SITE_CONFIG_QUERY, $ as SUBMIT_FORM_MUTATION, a0 as SelectMessage, a1 as SubmitFormInput, a2 as blocksToMeta, a3 as blocksToSchemas, a4 as buildBlockContext, a5 as buildBlockMap, a6 as defineBlock, a7 as fetchLayouts, a8 as fetchPage, a9 as fetchPageById, aa as fetchPageMeta, ab as fetchPages, ac as isProtocolCompatible, ad as normalizeSlug, ae as resolveApiUrl, af as resolvePublicUrl } from './commerce-queries-D9lXIaCQ.cjs';
1
+ import { F as FieldDefinition, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, n as CmssyBlockAuthContext, o as CmssyBlockWorkspace, d as CmssyLayoutGroup, E as EditorToAppMessage, A as AppToEditorMessage, p as FetchLike, q as CmssyClientConfig, r as CmssySiteConfig, R as RawBlock, e as CmssyLocaleContext, s as BlockMap, t as CmssyBlockContext } from './commerce-queries-CxUeiT52.cjs';
2
+ export { a as BlockMeta, u as BlockRect, B as BlockSchema, v as BoundsMessage, w as BuildBlockContextExtra, x as ClickMessage, y as CmssyBlockMember, z as CmssyBranding, f as CmssyCart, i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, D as CmssyFormField, G as CmssyFormSettings, H as CmssyFormSubmitResponse, I as CmssyLocalizedValue, J as CmssyModelDefinition, K as CmssyModelRecord, g as CmssyOrder, L as CmssyPageMeta, M as CmssyPageSummary, h as CmssyProduct, m as CmssyProductVariant, N as CmssyRecordList, O as DEFAULT_CMSSY_API_URL, P as FORM_QUERY, Q as FetchLikeResponse, S as FetchPageOptions, T as MODEL_DEFINITIONS_QUERY, U as MODEL_RECORDS_QUERY, V as PROTOCOL_VERSION, W as ParentReadyMessage, X as PatchMessage, Y as RawLayoutBlock, Z as ReadyMessage, _ as SITE_CONFIG_QUERY, $ as SUBMIT_FORM_MUTATION, a0 as SelectMessage, a1 as SubmitFormInput, a2 as blocksToMeta, a3 as blocksToSchemas, a4 as buildBlockContext, a5 as buildBlockMap, a6 as defineBlock, a7 as fetchLayouts, a8 as fetchPage, a9 as fetchPageById, aa as fetchPageMeta, ab as fetchPages, ac as isProtocolCompatible, ad as normalizeSlug, ae as resolveApiUrl, af as resolvePublicUrl } from './commerce-queries-CxUeiT52.cjs';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  export { FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldType, evaluateFieldConditionGroup } from '@cmssy/types';
5
5
  import 'react';
@@ -135,11 +135,13 @@ interface CmssyBlockProps {
135
135
  defaultLocale: string;
136
136
  blockMap: BlockMap;
137
137
  patchedContent?: Record<string, unknown>;
138
+ patchedStyle?: Record<string, unknown>;
139
+ patchedAdvanced?: Record<string, unknown>;
138
140
  editable?: boolean;
139
141
  layoutPosition?: string;
140
142
  context?: CmssyBlockContext;
141
143
  }
142
- declare function CmssyBlock({ block, locale, defaultLocale, blockMap, patchedContent, editable, layoutPosition, context, }: CmssyBlockProps): react_jsx_runtime.JSX.Element;
144
+ declare function CmssyBlock({ block, locale, defaultLocale, blockMap, patchedContent, patchedStyle, patchedAdvanced, editable, layoutPosition, context, }: CmssyBlockProps): react_jsx_runtime.JSX.Element;
143
145
 
144
146
  interface UnknownBlockProps {
145
147
  type: string;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { F as FieldDefinition, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, n as CmssyBlockAuthContext, o as CmssyBlockWorkspace, d as CmssyLayoutGroup, E as EditorToAppMessage, A as AppToEditorMessage, p as FetchLike, q as CmssyClientConfig, r as CmssySiteConfig, R as RawBlock, e as CmssyLocaleContext, s as BlockMap, t as CmssyBlockContext } from './commerce-queries-D9lXIaCQ.js';
2
- export { a as BlockMeta, u as BlockRect, B as BlockSchema, v as BoundsMessage, w as BuildBlockContextExtra, x as ClickMessage, y as CmssyBlockMember, z as CmssyBranding, f as CmssyCart, i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, D as CmssyFormField, G as CmssyFormSettings, H as CmssyFormSubmitResponse, I as CmssyLocalizedValue, J as CmssyModelDefinition, K as CmssyModelRecord, g as CmssyOrder, L as CmssyPageMeta, M as CmssyPageSummary, h as CmssyProduct, m as CmssyProductVariant, N as CmssyRecordList, O as DEFAULT_CMSSY_API_URL, P as FORM_QUERY, Q as FetchLikeResponse, S as FetchPageOptions, T as MODEL_DEFINITIONS_QUERY, U as MODEL_RECORDS_QUERY, V as PROTOCOL_VERSION, W as ParentReadyMessage, X as PatchMessage, Y as RawLayoutBlock, Z as ReadyMessage, _ as SITE_CONFIG_QUERY, $ as SUBMIT_FORM_MUTATION, a0 as SelectMessage, a1 as SubmitFormInput, a2 as blocksToMeta, a3 as blocksToSchemas, a4 as buildBlockContext, a5 as buildBlockMap, a6 as defineBlock, a7 as fetchLayouts, a8 as fetchPage, a9 as fetchPageById, aa as fetchPageMeta, ab as fetchPages, ac as isProtocolCompatible, ad as normalizeSlug, ae as resolveApiUrl, af as resolvePublicUrl } from './commerce-queries-D9lXIaCQ.js';
1
+ import { F as FieldDefinition, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, n as CmssyBlockAuthContext, o as CmssyBlockWorkspace, d as CmssyLayoutGroup, E as EditorToAppMessage, A as AppToEditorMessage, p as FetchLike, q as CmssyClientConfig, r as CmssySiteConfig, R as RawBlock, e as CmssyLocaleContext, s as BlockMap, t as CmssyBlockContext } from './commerce-queries-CxUeiT52.js';
2
+ export { a as BlockMeta, u as BlockRect, B as BlockSchema, v as BoundsMessage, w as BuildBlockContextExtra, x as ClickMessage, y as CmssyBlockMember, z as CmssyBranding, f as CmssyCart, i as CmssyCartDiscount, j as CmssyCartItem, k as CmssyCartItemSnapshot, D as CmssyFormField, G as CmssyFormSettings, H as CmssyFormSubmitResponse, I as CmssyLocalizedValue, J as CmssyModelDefinition, K as CmssyModelRecord, g as CmssyOrder, L as CmssyPageMeta, M as CmssyPageSummary, h as CmssyProduct, m as CmssyProductVariant, N as CmssyRecordList, O as DEFAULT_CMSSY_API_URL, P as FORM_QUERY, Q as FetchLikeResponse, S as FetchPageOptions, T as MODEL_DEFINITIONS_QUERY, U as MODEL_RECORDS_QUERY, V as PROTOCOL_VERSION, W as ParentReadyMessage, X as PatchMessage, Y as RawLayoutBlock, Z as ReadyMessage, _ as SITE_CONFIG_QUERY, $ as SUBMIT_FORM_MUTATION, a0 as SelectMessage, a1 as SubmitFormInput, a2 as blocksToMeta, a3 as blocksToSchemas, a4 as buildBlockContext, a5 as buildBlockMap, a6 as defineBlock, a7 as fetchLayouts, a8 as fetchPage, a9 as fetchPageById, aa as fetchPageMeta, ab as fetchPages, ac as isProtocolCompatible, ad as normalizeSlug, ae as resolveApiUrl, af as resolvePublicUrl } from './commerce-queries-CxUeiT52.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  export { FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldType, evaluateFieldConditionGroup } from '@cmssy/types';
5
5
  import 'react';
@@ -135,11 +135,13 @@ interface CmssyBlockProps {
135
135
  defaultLocale: string;
136
136
  blockMap: BlockMap;
137
137
  patchedContent?: Record<string, unknown>;
138
+ patchedStyle?: Record<string, unknown>;
139
+ patchedAdvanced?: Record<string, unknown>;
138
140
  editable?: boolean;
139
141
  layoutPosition?: string;
140
142
  context?: CmssyBlockContext;
141
143
  }
142
- declare function CmssyBlock({ block, locale, defaultLocale, blockMap, patchedContent, editable, layoutPosition, context, }: CmssyBlockProps): react_jsx_runtime.JSX.Element;
144
+ declare function CmssyBlock({ block, locale, defaultLocale, blockMap, patchedContent, patchedStyle, patchedAdvanced, editable, layoutPosition, context, }: CmssyBlockProps): react_jsx_runtime.JSX.Element;
143
145
 
144
146
  interface UnknownBlockProps {
145
147
  type: string;
package/dist/index.js CHANGED
@@ -267,6 +267,8 @@ function parseEditorMessage(data, origin, expectedOrigin) {
267
267
  blockId: data.blockId,
268
268
  content: data.content,
269
269
  protocolVersion: PROTOCOL_VERSION,
270
+ ...isObject(data.style) ? { style: data.style } : {},
271
+ ...isObject(data.advanced) ? { advanced: data.advanced } : {},
270
272
  ...typeof data.layoutPosition === "string" ? { layoutPosition: data.layoutPosition } : {}
271
273
  } : null;
272
274
  case "cmssy:parent-ready":
@@ -278,6 +280,8 @@ function parseEditorMessage(data, origin, expectedOrigin) {
278
280
  blockId: data.blockId,
279
281
  blockType: data.blockType,
280
282
  content: data.content,
283
+ ...isObject(data.style) ? { style: data.style } : {},
284
+ ...isObject(data.advanced) ? { advanced: data.advanced } : {},
281
285
  index: data.index
282
286
  } : null;
283
287
  case "cmssy:reorder":
@@ -897,6 +901,8 @@ function CmssyBlock({
897
901
  defaultLocale,
898
902
  blockMap,
899
903
  patchedContent,
904
+ patchedStyle,
905
+ patchedAdvanced,
900
906
  editable,
901
907
  layoutPosition,
902
908
  context
@@ -904,6 +910,8 @@ function CmssyBlock({
904
910
  const Component = Object.hasOwn(blockMap, block.type) ? blockMap[block.type] : void 0;
905
911
  const base = getBlockContentForLanguage(block.content, locale, defaultLocale);
906
912
  const content = patchedContent ? { ...base, ...patchedContent } : base;
913
+ const style = patchedStyle ? { ...asBucket(block.style), ...patchedStyle } : asBucket(block.style);
914
+ const advanced = patchedAdvanced ? { ...asBucket(block.advanced), ...patchedAdvanced } : asBucket(block.advanced);
907
915
  return /* @__PURE__ */ jsx(
908
916
  "div",
909
917
  {
@@ -914,8 +922,8 @@ function CmssyBlock({
914
922
  style: Component ? void 0 : { display: "none" },
915
923
  children: Component ? createElement(Component, {
916
924
  content,
917
- style: asBucket(block.style),
918
- advanced: asBucket(block.advanced),
925
+ style,
926
+ advanced,
919
927
  context
920
928
  }) : /* @__PURE__ */ jsx(UnknownBlock, { type: block.type })
921
929
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/react",
3
- "version": "0.16.0",
3
+ "version": "0.17.0",
4
4
  "description": "React blocks, renderers, data client and editor bridge for cmssy headless sites",
5
5
  "keywords": [
6
6
  "cmssy",