@cmssy/react 12.5.0 → 12.6.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 +1 -1
- package/dist/client.d.cts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +2 -2
- package/dist/index.cjs +16 -9
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +17 -10
- package/dist/internal-server.cjs +16 -8
- package/dist/internal-server.d.cts +2 -1
- package/dist/internal-server.d.ts +2 -1
- package/dist/internal-server.js +17 -10
- package/dist/{registry-fguZApc8.d.cts → registry-CwJ2cby4.d.cts} +3 -2
- package/dist/{registry-fguZApc8.d.ts → registry-CwJ2cby4.d.ts} +3 -2
- package/package.json +2 -2
package/dist/client.cjs
CHANGED
|
@@ -639,7 +639,7 @@ function CmssyBlock({
|
|
|
639
639
|
}
|
|
640
640
|
const base = resolvedContent ? { ...resolvedContent } : internal.getBlockContentForLanguage(block.content, locale, defaultLocale);
|
|
641
641
|
const content = patchedContent ? { ...base, ...patchedContent } : base;
|
|
642
|
-
if (schema) internal.
|
|
642
|
+
if (schema) internal.normalizeBlockContent(content, schema, resolvedContent);
|
|
643
643
|
const style = patchedStyle ? { ...internal.asBucket(block.style), ...patchedStyle } : internal.asBucket(block.style);
|
|
644
644
|
const advanced = patchedAdvanced ? { ...internal.asBucket(block.advanced), ...patchedAdvanced } : internal.asBucket(block.advanced);
|
|
645
645
|
return wrap(
|
package/dist/client.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { BlockSchema, BlockMeta, CmssyPageData, CmssyFormDefinition, CmssyLayoutGroup } from '@cmssy/core';
|
|
3
|
-
import { B as BlockDefinition } from './registry-
|
|
3
|
+
import { B as BlockDefinition } from './registry-CwJ2cby4.cjs';
|
|
4
4
|
import 'react';
|
|
5
5
|
|
|
6
6
|
interface EditBridgeConfig {
|
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
import { BlockSchema, BlockMeta, CmssyPageData, CmssyFormDefinition, CmssyLayoutGroup } from '@cmssy/core';
|
|
3
|
-
import { B as BlockDefinition } from './registry-
|
|
3
|
+
import { B as BlockDefinition } from './registry-CwJ2cby4.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
|
|
6
6
|
interface EditBridgeConfig {
|
package/dist/client.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useState, useRef, useEffect, useMemo, createElement } from 'react';
|
|
3
3
|
import { postToEditor, PROTOCOL_VERSION, parseEditorMessage } from '@cmssy/core';
|
|
4
|
-
import { resolveInitialTarget, buildBlockContext, getBlockContentForLanguage,
|
|
4
|
+
import { resolveInitialTarget, buildBlockContext, getBlockContentForLanguage, normalizeBlockContent, asBucket } from '@cmssy/core/internal';
|
|
5
5
|
import { BlockErrorBoundary } from '@cmssy/react/block-error-boundary';
|
|
6
6
|
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
7
7
|
|
|
@@ -637,7 +637,7 @@ function CmssyBlock({
|
|
|
637
637
|
}
|
|
638
638
|
const base = resolvedContent ? { ...resolvedContent } : getBlockContentForLanguage(block.content, locale, defaultLocale);
|
|
639
639
|
const content = patchedContent ? { ...base, ...patchedContent } : base;
|
|
640
|
-
if (schema)
|
|
640
|
+
if (schema) normalizeBlockContent(content, schema, resolvedContent);
|
|
641
641
|
const style = patchedStyle ? { ...asBucket(block.style), ...patchedStyle } : asBucket(block.style);
|
|
642
642
|
const advanced = patchedAdvanced ? { ...asBucket(block.advanced), ...patchedAdvanced } : asBucket(block.advanced);
|
|
643
643
|
return wrap(
|
package/dist/index.cjs
CHANGED
|
@@ -195,14 +195,21 @@ async function resolveBlocks(blocks, loaderMap, locale, defaultLocale, context,
|
|
|
195
195
|
enabledLocales?.length ? enabledLocales : void 0
|
|
196
196
|
)
|
|
197
197
|
);
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
198
|
+
const schemas = options?.schemas;
|
|
199
|
+
if (schemas) {
|
|
200
|
+
if (options?.config) {
|
|
201
|
+
await internal.resolveRelationContent(
|
|
202
|
+
options.config,
|
|
203
|
+
blocks.map((block, i) => ({ type: block.type, content: contents[i] })),
|
|
204
|
+
schemas,
|
|
205
|
+
locale,
|
|
206
|
+
options.workspaceId ? { workspaceId: options.workspaceId } : {}
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
blocks.forEach((block, i) => {
|
|
210
|
+
const schema = schemas[block.type];
|
|
211
|
+
if (schema) internal.normalizeBlockContent(contents[i], schema);
|
|
212
|
+
});
|
|
206
213
|
}
|
|
207
214
|
return Promise.all(
|
|
208
215
|
blocks.map(async (block, i) => {
|
|
@@ -540,7 +547,7 @@ function CmssyBlock({
|
|
|
540
547
|
}
|
|
541
548
|
const base = resolvedContent ? { ...resolvedContent } : internal.getBlockContentForLanguage(block.content, locale, defaultLocale);
|
|
542
549
|
const content = patchedContent ? { ...base, ...patchedContent } : base;
|
|
543
|
-
if (schema) internal.
|
|
550
|
+
if (schema) internal.normalizeBlockContent(content, schema, resolvedContent);
|
|
544
551
|
const style = patchedStyle ? { ...internal.asBucket(block.style), ...patchedStyle } : internal.asBucket(block.style);
|
|
545
552
|
const advanced = patchedAdvanced ? { ...internal.asBucket(block.advanced), ...patchedAdvanced } : internal.asBucket(block.advanced);
|
|
546
553
|
return wrap(
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CmssyPageData, CmssyClientConfig, CmssyFormDefinition, CmssyBlockAuthContext, CmssyBlockWorkspace, CmssyLayoutGroup, CmssyConfig, RawBlock, CmssyBlockContext } from '@cmssy/core';
|
|
2
2
|
export { AppToEditorMessage, BlockMeta, BlockPropsSchema, BlockRect, BlockSchema, BoundsMessage, BuildBlockContextExtra, ClickMessage, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockPage, CmssyBlockWorkspace, CmssyBranding, CmssyClient, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayoutGroup, CmssyLayoutSettings, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssyRequestError, CmssySiteConfig, CmssyTypedDocument, EditorToAppMessage, FetchLike, FetchLikeResponse, FetchPageOptions, FieldControl, FieldDefinition, FieldType, GraphqlRequestOptions, InferBlockContent, LayoutPosition, MediaLike, PROTOCOL_VERSION, ParentReadyMessage, PatchMessage, PostTarget, QueryScopedOptions, RawBlock, RawLayoutBlock, ReadyMessage, RetryPolicy, SelectMessage, SubmitFormInput, TypedField, createCmssyClient, fields, graphqlRequest, isProtocolCompatible, layoutPositionValues, mediaAlt, mediaUrl, mediaUrls, normalizeOrigin, parseEditorMessage, postToEditor } from '@cmssy/core';
|
|
3
|
-
import { B as BlockDefinition, a as BlockMap } from './registry-
|
|
4
|
-
export { b as BlockProps, c as buildBlockMap, d as defineBlock } from './registry-
|
|
3
|
+
import { B as BlockDefinition, a as BlockMap } from './registry-CwJ2cby4.cjs';
|
|
4
|
+
export { b as BlockProps, c as buildBlockMap, d as defineBlock } from './registry-CwJ2cby4.cjs';
|
|
5
5
|
import { FieldDefinition } from '@cmssy/types';
|
|
6
6
|
export { FieldCondition, FieldConditionGroup, FieldConditionLogic } from '@cmssy/types';
|
|
7
7
|
export { buildBlockContext } from '@cmssy/core/internal';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CmssyPageData, CmssyClientConfig, CmssyFormDefinition, CmssyBlockAuthContext, CmssyBlockWorkspace, CmssyLayoutGroup, CmssyConfig, RawBlock, CmssyBlockContext } from '@cmssy/core';
|
|
2
2
|
export { AppToEditorMessage, BlockMeta, BlockPropsSchema, BlockRect, BlockSchema, BoundsMessage, BuildBlockContextExtra, ClickMessage, CmssyBlockAuthContext, CmssyBlockContext, CmssyBlockMember, CmssyBlockPage, CmssyBlockWorkspace, CmssyBranding, CmssyClient, CmssyClientConfig, CmssyFormDefinition, CmssyFormField, CmssyFormSettings, CmssyFormSubmitResponse, CmssyLayoutGroup, CmssyLayoutSettings, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssyRequestError, CmssySiteConfig, CmssyTypedDocument, EditorToAppMessage, FetchLike, FetchLikeResponse, FetchPageOptions, FieldControl, FieldDefinition, FieldType, GraphqlRequestOptions, InferBlockContent, LayoutPosition, MediaLike, PROTOCOL_VERSION, ParentReadyMessage, PatchMessage, PostTarget, QueryScopedOptions, RawBlock, RawLayoutBlock, ReadyMessage, RetryPolicy, SelectMessage, SubmitFormInput, TypedField, createCmssyClient, fields, graphqlRequest, isProtocolCompatible, layoutPositionValues, mediaAlt, mediaUrl, mediaUrls, normalizeOrigin, parseEditorMessage, postToEditor } from '@cmssy/core';
|
|
3
|
-
import { B as BlockDefinition, a as BlockMap } from './registry-
|
|
4
|
-
export { b as BlockProps, c as buildBlockMap, d as defineBlock } from './registry-
|
|
3
|
+
import { B as BlockDefinition, a as BlockMap } from './registry-CwJ2cby4.js';
|
|
4
|
+
export { b as BlockProps, c as buildBlockMap, d as defineBlock } from './registry-CwJ2cby4.js';
|
|
5
5
|
import { FieldDefinition } from '@cmssy/types';
|
|
6
6
|
export { FieldCondition, FieldConditionGroup, FieldConditionLogic } from '@cmssy/types';
|
|
7
7
|
export { buildBlockContext } from '@cmssy/core/internal';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { resolveEditorOrigin } from '@cmssy/core';
|
|
2
2
|
export { CmssyRequestError, PROTOCOL_VERSION, createCmssyClient, fields, graphqlRequest, isProtocolCompatible, layoutPositionValues, mediaAlt, mediaUrl, mediaUrls, normalizeOrigin, parseEditorMessage, postToEditor } from '@cmssy/core';
|
|
3
|
-
import { buildBlockContext, fetchLayouts, getBlockContentForLanguage,
|
|
3
|
+
import { buildBlockContext, fetchLayouts, getBlockContentForLanguage, normalizeBlockContent, asBucket, resolveSiteLocales as resolveSiteLocales$1, resolveRelationContent } from '@cmssy/core/internal';
|
|
4
4
|
export { buildBlockContext } from '@cmssy/core/internal';
|
|
5
5
|
import { createElement } from 'react';
|
|
6
6
|
import { BlockErrorBoundary } from '@cmssy/react/block-error-boundary';
|
|
@@ -195,14 +195,21 @@ async function resolveBlocks(blocks, loaderMap, locale, defaultLocale, context,
|
|
|
195
195
|
enabledLocales?.length ? enabledLocales : void 0
|
|
196
196
|
)
|
|
197
197
|
);
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
198
|
+
const schemas = options?.schemas;
|
|
199
|
+
if (schemas) {
|
|
200
|
+
if (options?.config) {
|
|
201
|
+
await resolveRelationContent(
|
|
202
|
+
options.config,
|
|
203
|
+
blocks.map((block, i) => ({ type: block.type, content: contents[i] })),
|
|
204
|
+
schemas,
|
|
205
|
+
locale,
|
|
206
|
+
options.workspaceId ? { workspaceId: options.workspaceId } : {}
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
blocks.forEach((block, i) => {
|
|
210
|
+
const schema = schemas[block.type];
|
|
211
|
+
if (schema) normalizeBlockContent(contents[i], schema);
|
|
212
|
+
});
|
|
206
213
|
}
|
|
207
214
|
return Promise.all(
|
|
208
215
|
blocks.map(async (block, i) => {
|
|
@@ -540,7 +547,7 @@ function CmssyBlock({
|
|
|
540
547
|
}
|
|
541
548
|
const base = resolvedContent ? { ...resolvedContent } : getBlockContentForLanguage(block.content, locale, defaultLocale);
|
|
542
549
|
const content = patchedContent ? { ...base, ...patchedContent } : base;
|
|
543
|
-
if (schema)
|
|
550
|
+
if (schema) normalizeBlockContent(content, schema, resolvedContent);
|
|
544
551
|
const style = patchedStyle ? { ...asBucket(block.style), ...patchedStyle } : asBucket(block.style);
|
|
545
552
|
const advanced = patchedAdvanced ? { ...asBucket(block.advanced), ...patchedAdvanced } : asBucket(block.advanced);
|
|
546
553
|
return wrap(
|
package/dist/internal-server.cjs
CHANGED
|
@@ -41,14 +41,21 @@ async function resolveBlocks(blocks, loaderMap, locale, defaultLocale, context,
|
|
|
41
41
|
enabledLocales?.length ? enabledLocales : void 0
|
|
42
42
|
)
|
|
43
43
|
);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
const schemas = options?.schemas;
|
|
45
|
+
if (schemas) {
|
|
46
|
+
if (options?.config) {
|
|
47
|
+
await internal.resolveRelationContent(
|
|
48
|
+
options.config,
|
|
49
|
+
blocks.map((block, i) => ({ type: block.type, content: contents[i] })),
|
|
50
|
+
schemas,
|
|
51
|
+
locale,
|
|
52
|
+
options.workspaceId ? { workspaceId: options.workspaceId } : {}
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
blocks.forEach((block, i) => {
|
|
56
|
+
const schema = schemas[block.type];
|
|
57
|
+
if (schema) internal.normalizeBlockContent(contents[i], schema);
|
|
58
|
+
});
|
|
52
59
|
}
|
|
53
60
|
return Promise.all(
|
|
54
61
|
blocks.map(async (block, i) => {
|
|
@@ -164,6 +171,7 @@ async function resolveLayoutBlockData(options) {
|
|
|
164
171
|
return (await resolveEditorLayoutBlockData(options)).data;
|
|
165
172
|
}
|
|
166
173
|
|
|
174
|
+
exports.blocksToSchemas = blocksToSchemas;
|
|
167
175
|
exports.resolveBlockData = resolveBlockData;
|
|
168
176
|
exports.resolveEditorBlockData = resolveEditorBlockData;
|
|
169
177
|
exports.resolveEditorLayoutBlockData = resolveEditorLayoutBlockData;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CmssyPageData, CmssyFormDefinition, CmssyClientConfig, CmssyLayoutGroup } from '@cmssy/core';
|
|
2
|
-
import { B as BlockDefinition } from './registry-
|
|
2
|
+
import { B as BlockDefinition } from './registry-CwJ2cby4.cjs';
|
|
3
|
+
export { e as blocksToSchemas } from './registry-CwJ2cby4.cjs';
|
|
3
4
|
import 'react';
|
|
4
5
|
|
|
5
6
|
interface EditorBlockData {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CmssyPageData, CmssyFormDefinition, CmssyClientConfig, CmssyLayoutGroup } from '@cmssy/core';
|
|
2
|
-
import { B as BlockDefinition } from './registry-
|
|
2
|
+
import { B as BlockDefinition } from './registry-CwJ2cby4.js';
|
|
3
|
+
export { e as blocksToSchemas } from './registry-CwJ2cby4.js';
|
|
3
4
|
import 'react';
|
|
4
5
|
|
|
5
6
|
interface EditorBlockData {
|
package/dist/internal-server.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { buildBlockContext, getBlockContentForLanguage, resolveRelationContent } from '@cmssy/core/internal';
|
|
1
|
+
import { buildBlockContext, getBlockContentForLanguage, resolveRelationContent, normalizeBlockContent } from '@cmssy/core/internal';
|
|
2
2
|
|
|
3
3
|
// src/components/resolve-block-data.ts
|
|
4
4
|
|
|
@@ -39,14 +39,21 @@ async function resolveBlocks(blocks, loaderMap, locale, defaultLocale, context,
|
|
|
39
39
|
enabledLocales?.length ? enabledLocales : void 0
|
|
40
40
|
)
|
|
41
41
|
);
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
42
|
+
const schemas = options?.schemas;
|
|
43
|
+
if (schemas) {
|
|
44
|
+
if (options?.config) {
|
|
45
|
+
await resolveRelationContent(
|
|
46
|
+
options.config,
|
|
47
|
+
blocks.map((block, i) => ({ type: block.type, content: contents[i] })),
|
|
48
|
+
schemas,
|
|
49
|
+
locale,
|
|
50
|
+
options.workspaceId ? { workspaceId: options.workspaceId } : {}
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
blocks.forEach((block, i) => {
|
|
54
|
+
const schema = schemas[block.type];
|
|
55
|
+
if (schema) normalizeBlockContent(contents[i], schema);
|
|
56
|
+
});
|
|
50
57
|
}
|
|
51
58
|
return Promise.all(
|
|
52
59
|
blocks.map(async (block, i) => {
|
|
@@ -162,4 +169,4 @@ async function resolveLayoutBlockData(options) {
|
|
|
162
169
|
return (await resolveEditorLayoutBlockData(options)).data;
|
|
163
170
|
}
|
|
164
171
|
|
|
165
|
-
export { resolveBlockData, resolveEditorBlockData, resolveEditorLayoutBlockData, resolveLayoutBlockData };
|
|
172
|
+
export { blocksToSchemas, resolveBlockData, resolveEditorBlockData, resolveEditorLayoutBlockData, resolveLayoutBlockData };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
|
-
import { FieldDefinition, CmssyBlockContext, BlockPropsSchema, InferBlockContent } from '@cmssy/core';
|
|
2
|
+
import { FieldDefinition, CmssyBlockContext, BlockPropsSchema, InferBlockContent, BlockSchema } from '@cmssy/core';
|
|
3
3
|
|
|
4
4
|
interface BlockProps<P extends BlockPropsSchema, D = unknown> {
|
|
5
5
|
content: InferBlockContent<P>;
|
|
@@ -65,5 +65,6 @@ type BlockMap = Record<string, ComponentType<{
|
|
|
65
65
|
data?: unknown;
|
|
66
66
|
}>>;
|
|
67
67
|
declare function buildBlockMap(blocks: BlockDefinition[]): BlockMap;
|
|
68
|
+
declare function blocksToSchemas(blocks: BlockDefinition[]): Record<string, BlockSchema>;
|
|
68
69
|
|
|
69
|
-
export { type BlockDefinition as B, type BlockMap as a, type BlockProps as b, buildBlockMap as c, defineBlock as d };
|
|
70
|
+
export { type BlockDefinition as B, type BlockMap as a, type BlockProps as b, buildBlockMap as c, defineBlock as d, blocksToSchemas as e };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
|
-
import { FieldDefinition, CmssyBlockContext, BlockPropsSchema, InferBlockContent } from '@cmssy/core';
|
|
2
|
+
import { FieldDefinition, CmssyBlockContext, BlockPropsSchema, InferBlockContent, BlockSchema } from '@cmssy/core';
|
|
3
3
|
|
|
4
4
|
interface BlockProps<P extends BlockPropsSchema, D = unknown> {
|
|
5
5
|
content: InferBlockContent<P>;
|
|
@@ -65,5 +65,6 @@ type BlockMap = Record<string, ComponentType<{
|
|
|
65
65
|
data?: unknown;
|
|
66
66
|
}>>;
|
|
67
67
|
declare function buildBlockMap(blocks: BlockDefinition[]): BlockMap;
|
|
68
|
+
declare function blocksToSchemas(blocks: BlockDefinition[]): Record<string, BlockSchema>;
|
|
68
69
|
|
|
69
|
-
export { type BlockDefinition as B, type BlockMap as a, type BlockProps as b, buildBlockMap as c, defineBlock as d };
|
|
70
|
+
export { type BlockDefinition as B, type BlockMap as a, type BlockProps as b, buildBlockMap as c, defineBlock as d, blocksToSchemas as e };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmssy/react",
|
|
3
|
-
"version": "12.
|
|
3
|
+
"version": "12.6.0",
|
|
4
4
|
"description": "React blocks, renderers, data client and editor bridge for cmssy headless sites",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cmssy",
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
},
|
|
98
98
|
"dependencies": {
|
|
99
99
|
"@cmssy/types": "0.35.0",
|
|
100
|
-
"@cmssy/core": "12.
|
|
100
|
+
"@cmssy/core": "12.6.0"
|
|
101
101
|
},
|
|
102
102
|
"scripts": {
|
|
103
103
|
"build": "tsup",
|