@cmssy/react 13.0.0 → 14.0.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
@@ -13,17 +13,23 @@ function buildBlockMap(blocks) {
13
13
  for (const block of blocks) map[block.type] = block.component;
14
14
  return map;
15
15
  }
16
+ function propsToSchema(props) {
17
+ const schema = {};
18
+ for (const [key, def] of Object.entries(props)) {
19
+ schema[key] = { ...def, label: def.label || key };
20
+ }
21
+ return schema;
22
+ }
16
23
  function blocksToSchemas(blocks) {
17
24
  const out = /* @__PURE__ */ Object.create(null);
18
- for (const block of blocks) {
19
- const schema = {};
20
- for (const [key, def] of Object.entries(block.props)) {
21
- schema[key] = { ...def, label: def.label || key };
22
- }
23
- out[block.type] = schema;
24
- }
25
+ for (const block of blocks) out[block.type] = propsToSchema(block.props);
25
26
  return out;
26
27
  }
28
+ function layoutRegionsToBridge(regions) {
29
+ return regions.map(
30
+ (region) => region.settings ? { ...region, settings: propsToSchema(region.settings) } : { ...region }
31
+ );
32
+ }
27
33
  function blocksToMeta(blocks, defaults = {}) {
28
34
  const out = /* @__PURE__ */ Object.create(null);
29
35
  for (const block of blocks) {
@@ -316,7 +322,7 @@ function useEditBridge(page, config) {
316
322
  schemas: config.schemas ?? /* @__PURE__ */ Object.create(null),
317
323
  blockMeta: config.blockMeta ?? /* @__PURE__ */ Object.create(null),
318
324
  capabilities: canDetectInvisibleBlocks() ? ["shortcuts", "invisible-blocks"] : ["shortcuts"],
319
- ...config.layoutRegions ? { layoutRegions: [...config.layoutRegions] } : {}
325
+ ...config.layoutRegions ? { layoutRegions: layoutRegionsToBridge(config.layoutRegions) } : {}
320
326
  });
321
327
  } catch (error) {
322
328
  if (typeof console !== "undefined") {
package/dist/client.js CHANGED
@@ -11,17 +11,23 @@ function buildBlockMap(blocks) {
11
11
  for (const block of blocks) map[block.type] = block.component;
12
12
  return map;
13
13
  }
14
+ function propsToSchema(props) {
15
+ const schema = {};
16
+ for (const [key, def] of Object.entries(props)) {
17
+ schema[key] = { ...def, label: def.label || key };
18
+ }
19
+ return schema;
20
+ }
14
21
  function blocksToSchemas(blocks) {
15
22
  const out = /* @__PURE__ */ Object.create(null);
16
- for (const block of blocks) {
17
- const schema = {};
18
- for (const [key, def] of Object.entries(block.props)) {
19
- schema[key] = { ...def, label: def.label || key };
20
- }
21
- out[block.type] = schema;
22
- }
23
+ for (const block of blocks) out[block.type] = propsToSchema(block.props);
23
24
  return out;
24
25
  }
26
+ function layoutRegionsToBridge(regions) {
27
+ return regions.map(
28
+ (region) => region.settings ? { ...region, settings: propsToSchema(region.settings) } : { ...region }
29
+ );
30
+ }
25
31
  function blocksToMeta(blocks, defaults = {}) {
26
32
  const out = /* @__PURE__ */ Object.create(null);
27
33
  for (const block of blocks) {
@@ -314,7 +320,7 @@ function useEditBridge(page, config) {
314
320
  schemas: config.schemas ?? /* @__PURE__ */ Object.create(null),
315
321
  blockMeta: config.blockMeta ?? /* @__PURE__ */ Object.create(null),
316
322
  capabilities: canDetectInvisibleBlocks() ? ["shortcuts", "invisible-blocks"] : ["shortcuts"],
317
- ...config.layoutRegions ? { layoutRegions: [...config.layoutRegions] } : {}
323
+ ...config.layoutRegions ? { layoutRegions: layoutRegionsToBridge(config.layoutRegions) } : {}
318
324
  });
319
325
  } catch (error) {
320
326
  if (typeof console !== "undefined") {
package/dist/index.cjs CHANGED
@@ -25,15 +25,16 @@ function buildLoaderMap(blocks) {
25
25
  }
26
26
  return map;
27
27
  }
28
+ function propsToSchema(props) {
29
+ const schema = {};
30
+ for (const [key, def] of Object.entries(props)) {
31
+ schema[key] = { ...def, label: def.label || key };
32
+ }
33
+ return schema;
34
+ }
28
35
  function blocksToSchemas(blocks) {
29
36
  const out = /* @__PURE__ */ Object.create(null);
30
- for (const block of blocks) {
31
- const schema = {};
32
- for (const [key, def] of Object.entries(block.props)) {
33
- schema[key] = { ...def, label: def.label || key };
34
- }
35
- out[block.type] = schema;
36
- }
37
+ for (const block of blocks) out[block.type] = propsToSchema(block.props);
37
38
  return out;
38
39
  }
39
40
 
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CmssyPageData, CmssyClientConfig, CmssyFormDefinition, CmssyBlockAuthContext, CmssyBlockWorkspace, CmssyLayoutGroup, RetryOption, CmssyConfig, RawBlock, CmssyBlockContext } from '@cmssy/core';
2
- export { AppToEditorMessage, BlockMeta, BlockPropsSchema, BlockRect, BlockSchema, BoundsMessage, BuildBlockContextExtra, ClickMessage, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockPage, CmssyBlockWorkspace, CmssyBranding, CmssyClient, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayout, CmssyLayoutGroup, CmssyLayoutSettings, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssyRegion, CmssyRegionOf, CmssyRequestError, CmssyRetryMode, CmssySiteConfig, CmssyTypedDocument, EditorToAppMessage, FetchLike, FetchLikeResponse, FetchPageOptions, FieldControl, FieldDefinition, FieldType, GraphqlRequestOptions, InferBlockContent, LayoutPosition, LayoutRegion, MediaLike, PROTOCOL_VERSION, ParentReadyMessage, PatchMessage, PostTarget, QueryScopedOptions, RawBlock, RawLayoutBlock, ReadyMessage, RetryOption, RetryPolicy, SelectMessage, SubmitFormInput, TypedField, createCmssyClient, defineCmssyLayout, fields, graphqlRequest, isProtocolCompatible, mediaAlt, mediaUrl, mediaUrls, normalizeOrigin, parseEditorMessage, postToEditor } from '@cmssy/core';
2
+ export { AppToEditorMessage, BlockMeta, BlockPropsSchema, BlockRect, BlockSchema, BoundsMessage, BuildBlockContextExtra, ClickMessage, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockPage, CmssyBlockWorkspace, CmssyBranding, CmssyClient, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayout, CmssyLayoutGroup, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssyRegion, CmssyRegionOf, CmssyRegionSettings, CmssyRequestError, CmssyRetryMode, CmssySiteConfig, CmssyTypedDocument, EditorToAppMessage, FetchLike, FetchLikeResponse, FetchPageOptions, FieldControl, FieldDefinition, FieldType, GraphqlRequestOptions, InferBlockContent, LayoutPosition, LayoutRegion, MediaLike, PROTOCOL_VERSION, ParentReadyMessage, PatchMessage, PostTarget, QueryScopedOptions, RawBlock, RawLayoutBlock, ReadyMessage, RetryOption, RetryPolicy, SelectMessage, SubmitFormInput, TypedField, createCmssyClient, defineCmssyLayout, fields, graphqlRequest, isProtocolCompatible, mediaAlt, mediaUrl, mediaUrls, normalizeOrigin, parseEditorMessage, postToEditor } from '@cmssy/core';
3
3
  import { B as BlockDefinition, a as BlockMap } from './registry-CwJ2cby4.cjs';
4
4
  export { b as BlockProps, c as buildBlockMap, d as defineBlock } from './registry-CwJ2cby4.cjs';
5
5
  import { FieldDefinition } from '@cmssy/types';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { CmssyPageData, CmssyClientConfig, CmssyFormDefinition, CmssyBlockAuthContext, CmssyBlockWorkspace, CmssyLayoutGroup, RetryOption, CmssyConfig, RawBlock, CmssyBlockContext } from '@cmssy/core';
2
- export { AppToEditorMessage, BlockMeta, BlockPropsSchema, BlockRect, BlockSchema, BoundsMessage, BuildBlockContextExtra, ClickMessage, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockPage, CmssyBlockWorkspace, CmssyBranding, CmssyClient, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayout, CmssyLayoutGroup, CmssyLayoutSettings, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssyRegion, CmssyRegionOf, CmssyRequestError, CmssyRetryMode, CmssySiteConfig, CmssyTypedDocument, EditorToAppMessage, FetchLike, FetchLikeResponse, FetchPageOptions, FieldControl, FieldDefinition, FieldType, GraphqlRequestOptions, InferBlockContent, LayoutPosition, LayoutRegion, MediaLike, PROTOCOL_VERSION, ParentReadyMessage, PatchMessage, PostTarget, QueryScopedOptions, RawBlock, RawLayoutBlock, ReadyMessage, RetryOption, RetryPolicy, SelectMessage, SubmitFormInput, TypedField, createCmssyClient, defineCmssyLayout, fields, graphqlRequest, isProtocolCompatible, mediaAlt, mediaUrl, mediaUrls, normalizeOrigin, parseEditorMessage, postToEditor } from '@cmssy/core';
2
+ export { AppToEditorMessage, BlockMeta, BlockPropsSchema, BlockRect, BlockSchema, BoundsMessage, BuildBlockContextExtra, ClickMessage, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockPage, CmssyBlockWorkspace, CmssyBranding, CmssyClient, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayout, CmssyLayoutGroup, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssyRegion, CmssyRegionOf, CmssyRegionSettings, CmssyRequestError, CmssyRetryMode, CmssySiteConfig, CmssyTypedDocument, EditorToAppMessage, FetchLike, FetchLikeResponse, FetchPageOptions, FieldControl, FieldDefinition, FieldType, GraphqlRequestOptions, InferBlockContent, LayoutPosition, LayoutRegion, MediaLike, PROTOCOL_VERSION, ParentReadyMessage, PatchMessage, PostTarget, QueryScopedOptions, RawBlock, RawLayoutBlock, ReadyMessage, RetryOption, RetryPolicy, SelectMessage, SubmitFormInput, TypedField, createCmssyClient, defineCmssyLayout, fields, graphqlRequest, isProtocolCompatible, mediaAlt, mediaUrl, mediaUrls, normalizeOrigin, parseEditorMessage, postToEditor } from '@cmssy/core';
3
3
  import { B as BlockDefinition, a as BlockMap } from './registry-CwJ2cby4.js';
4
4
  export { b as BlockProps, c as buildBlockMap, d as defineBlock } from './registry-CwJ2cby4.js';
5
5
  import { FieldDefinition } from '@cmssy/types';
package/dist/index.js CHANGED
@@ -25,15 +25,16 @@ function buildLoaderMap(blocks) {
25
25
  }
26
26
  return map;
27
27
  }
28
+ function propsToSchema(props) {
29
+ const schema = {};
30
+ for (const [key, def] of Object.entries(props)) {
31
+ schema[key] = { ...def, label: def.label || key };
32
+ }
33
+ return schema;
34
+ }
28
35
  function blocksToSchemas(blocks) {
29
36
  const out = /* @__PURE__ */ Object.create(null);
30
- for (const block of blocks) {
31
- const schema = {};
32
- for (const [key, def] of Object.entries(block.props)) {
33
- schema[key] = { ...def, label: def.label || key };
34
- }
35
- out[block.type] = schema;
36
- }
37
+ for (const block of blocks) out[block.type] = propsToSchema(block.props);
37
38
  return out;
38
39
  }
39
40
 
@@ -12,15 +12,16 @@ function buildLoaderMap(blocks) {
12
12
  }
13
13
  return map;
14
14
  }
15
+ function propsToSchema(props) {
16
+ const schema = {};
17
+ for (const [key, def] of Object.entries(props)) {
18
+ schema[key] = { ...def, label: def.label || key };
19
+ }
20
+ return schema;
21
+ }
15
22
  function blocksToSchemas(blocks) {
16
23
  const out = /* @__PURE__ */ Object.create(null);
17
- for (const block of blocks) {
18
- const schema = {};
19
- for (const [key, def] of Object.entries(block.props)) {
20
- schema[key] = { ...def, label: def.label || key };
21
- }
22
- out[block.type] = schema;
23
- }
24
+ for (const block of blocks) out[block.type] = propsToSchema(block.props);
24
25
  return out;
25
26
  }
26
27
 
@@ -10,15 +10,16 @@ function buildLoaderMap(blocks) {
10
10
  }
11
11
  return map;
12
12
  }
13
+ function propsToSchema(props) {
14
+ const schema = {};
15
+ for (const [key, def] of Object.entries(props)) {
16
+ schema[key] = { ...def, label: def.label || key };
17
+ }
18
+ return schema;
19
+ }
13
20
  function blocksToSchemas(blocks) {
14
21
  const out = /* @__PURE__ */ Object.create(null);
15
- for (const block of blocks) {
16
- const schema = {};
17
- for (const [key, def] of Object.entries(block.props)) {
18
- schema[key] = { ...def, label: def.label || key };
19
- }
20
- out[block.type] = schema;
21
- }
22
+ for (const block of blocks) out[block.type] = propsToSchema(block.props);
22
23
  return out;
23
24
  }
24
25
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmssy/react",
3
- "version": "13.0.0",
3
+ "version": "14.0.0",
4
4
  "description": "React blocks, renderers, data client and editor bridge for cmssy headless sites",
5
5
  "keywords": [
6
6
  "cmssy",
@@ -96,8 +96,8 @@
96
96
  "vitest": "^2.1.0"
97
97
  },
98
98
  "dependencies": {
99
- "@cmssy/types": "0.37.0",
100
- "@cmssy/core": "13.0.0"
99
+ "@cmssy/types": "0.38.0",
100
+ "@cmssy/core": "14.0.0"
101
101
  },
102
102
  "scripts": {
103
103
  "build": "tsup",