@cmssy/react 14.1.0 → 14.2.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 +4 -36
- package/dist/client.d.cts +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.js +1 -33
- package/dist/index.cjs +4 -18
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -15
- package/dist/{internal-server-CP0tEgpM.d.cts → internal-server-Hogm3pjD.d.cts} +2 -3
- package/dist/{internal-server-CP0tEgpM.d.ts → internal-server-Hogm3pjD.d.ts} +2 -3
- package/dist/internal-server.cjs +7 -17
- package/dist/internal-server.d.cts +2 -2
- package/dist/internal-server.d.ts +2 -2
- package/dist/internal-server.js +3 -15
- package/package.json +2 -2
package/dist/client.cjs
CHANGED
|
@@ -7,43 +7,11 @@ var internal = require('@cmssy/core/internal');
|
|
|
7
7
|
var blockErrorBoundary = require('@cmssy/react/block-error-boundary');
|
|
8
8
|
var jsxRuntime = require('react/jsx-runtime');
|
|
9
9
|
|
|
10
|
-
// src/registry.ts
|
|
11
10
|
function buildBlockMap(blocks) {
|
|
12
11
|
const map = /* @__PURE__ */ Object.create(null);
|
|
13
12
|
for (const block of blocks) map[block.type] = block.component;
|
|
14
13
|
return map;
|
|
15
14
|
}
|
|
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
|
-
}
|
|
23
|
-
function blocksToSchemas(blocks) {
|
|
24
|
-
const out = /* @__PURE__ */ Object.create(null);
|
|
25
|
-
for (const block of blocks) out[block.type] = propsToSchema(block.props);
|
|
26
|
-
return out;
|
|
27
|
-
}
|
|
28
|
-
function layoutRegionsToBridge(regions) {
|
|
29
|
-
return regions.map(
|
|
30
|
-
(region) => region.settings ? { ...region, settings: propsToSchema(region.settings) } : { ...region }
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
function blocksToMeta(blocks, defaults = {}) {
|
|
34
|
-
const out = /* @__PURE__ */ Object.create(null);
|
|
35
|
-
for (const block of blocks) {
|
|
36
|
-
const category = block.category ?? defaults.category;
|
|
37
|
-
out[block.type] = {
|
|
38
|
-
label: block.label ?? block.type,
|
|
39
|
-
...category ? { category } : {},
|
|
40
|
-
...block.icon ? { icon: block.icon } : {},
|
|
41
|
-
...block.layoutPositions ? { layoutPositions: block.layoutPositions } : {},
|
|
42
|
-
...block.description ? { description: block.description } : {}
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
return out;
|
|
46
|
-
}
|
|
47
15
|
|
|
48
16
|
// src/bridge/shortcut-keys.ts
|
|
49
17
|
function isMacPlatform() {
|
|
@@ -322,7 +290,7 @@ function useEditBridge(page, config) {
|
|
|
322
290
|
schemas: config.schemas ?? /* @__PURE__ */ Object.create(null),
|
|
323
291
|
blockMeta: config.blockMeta ?? /* @__PURE__ */ Object.create(null),
|
|
324
292
|
capabilities: canDetectInvisibleBlocks() ? ["shortcuts", "invisible-blocks"] : ["shortcuts"],
|
|
325
|
-
...config.layoutRegions ? { layoutRegions: layoutRegionsToBridge(config.layoutRegions) } : {}
|
|
293
|
+
...config.layoutRegions ? { layoutRegions: core.layoutRegionsToBridge(config.layoutRegions) } : {}
|
|
326
294
|
});
|
|
327
295
|
} catch (error) {
|
|
328
296
|
if (typeof console !== "undefined") {
|
|
@@ -879,8 +847,8 @@ function EditableBlocks({
|
|
|
879
847
|
const bridgeConfig = react.useMemo(
|
|
880
848
|
() => ({
|
|
881
849
|
...edit,
|
|
882
|
-
schemas: edit.schemas ?? blocksToSchemas(blocks),
|
|
883
|
-
blockMeta: edit.blockMeta ?? blocksToMeta(blocks, { category })
|
|
850
|
+
schemas: edit.schemas ?? core.blocksToSchemas(blocks),
|
|
851
|
+
blockMeta: edit.blockMeta ?? core.blocksToMeta(blocks, { category })
|
|
884
852
|
}),
|
|
885
853
|
[edit, blocks, category]
|
|
886
854
|
);
|
|
@@ -1023,7 +991,7 @@ function CmssyEditableLayout({
|
|
|
1023
991
|
}) {
|
|
1024
992
|
const blockMap = react.useMemo(() => buildBlockMap(blocks), [blocks]);
|
|
1025
993
|
const schemas = react.useMemo(
|
|
1026
|
-
() => edit.schemas ?? blocksToSchemas(blocks),
|
|
994
|
+
() => edit.schemas ?? core.blocksToSchemas(blocks),
|
|
1027
995
|
[edit.schemas, blocks]
|
|
1028
996
|
);
|
|
1029
997
|
const layoutBlocks = react.useMemo(() => {
|
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, LayoutRegion, CmssyPageData, CmssyFormDefinition, CmssyLayoutGroup } from '@cmssy/core';
|
|
3
|
-
import { B as BlockDefinition, L as LayoutBlockPage } from './internal-server-
|
|
3
|
+
import { B as BlockDefinition, L as LayoutBlockPage } from './internal-server-Hogm3pjD.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, LayoutRegion, CmssyPageData, CmssyFormDefinition, CmssyLayoutGroup } from '@cmssy/core';
|
|
3
|
-
import { B as BlockDefinition, L as LayoutBlockPage } from './internal-server-
|
|
3
|
+
import { B as BlockDefinition, L as LayoutBlockPage } from './internal-server-Hogm3pjD.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
|
|
6
6
|
interface EditBridgeConfig {
|
package/dist/client.js
CHANGED
|
@@ -1,47 +1,15 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useState, useRef, useEffect, useMemo, createElement } from 'react';
|
|
3
|
-
import { postToEditor, PROTOCOL_VERSION, parseEditorMessage } from '@cmssy/core';
|
|
3
|
+
import { blocksToMeta, blocksToSchemas, postToEditor, layoutRegionsToBridge, PROTOCOL_VERSION, parseEditorMessage } from '@cmssy/core';
|
|
4
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
|
|
|
8
|
-
// src/registry.ts
|
|
9
8
|
function buildBlockMap(blocks) {
|
|
10
9
|
const map = /* @__PURE__ */ Object.create(null);
|
|
11
10
|
for (const block of blocks) map[block.type] = block.component;
|
|
12
11
|
return map;
|
|
13
12
|
}
|
|
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
|
-
}
|
|
21
|
-
function blocksToSchemas(blocks) {
|
|
22
|
-
const out = /* @__PURE__ */ Object.create(null);
|
|
23
|
-
for (const block of blocks) out[block.type] = propsToSchema(block.props);
|
|
24
|
-
return out;
|
|
25
|
-
}
|
|
26
|
-
function layoutRegionsToBridge(regions) {
|
|
27
|
-
return regions.map(
|
|
28
|
-
(region) => region.settings ? { ...region, settings: propsToSchema(region.settings) } : { ...region }
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
function blocksToMeta(blocks, defaults = {}) {
|
|
32
|
-
const out = /* @__PURE__ */ Object.create(null);
|
|
33
|
-
for (const block of blocks) {
|
|
34
|
-
const category = block.category ?? defaults.category;
|
|
35
|
-
out[block.type] = {
|
|
36
|
-
label: block.label ?? block.type,
|
|
37
|
-
...category ? { category } : {},
|
|
38
|
-
...block.icon ? { icon: block.icon } : {},
|
|
39
|
-
...block.layoutPositions ? { layoutPositions: block.layoutPositions } : {},
|
|
40
|
-
...block.description ? { description: block.description } : {}
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
return out;
|
|
44
|
-
}
|
|
45
13
|
|
|
46
14
|
// src/bridge/shortcut-keys.ts
|
|
47
15
|
function isMacPlatform() {
|
package/dist/index.cjs
CHANGED
|
@@ -8,8 +8,6 @@ var jsxRuntime = require('react/jsx-runtime');
|
|
|
8
8
|
var locale = require('@cmssy/core/internal/locale');
|
|
9
9
|
|
|
10
10
|
// src/index.ts
|
|
11
|
-
|
|
12
|
-
// src/registry.ts
|
|
13
11
|
function defineBlock(def) {
|
|
14
12
|
return def;
|
|
15
13
|
}
|
|
@@ -25,18 +23,6 @@ function buildLoaderMap(blocks) {
|
|
|
25
23
|
}
|
|
26
24
|
return map;
|
|
27
25
|
}
|
|
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
|
-
}
|
|
35
|
-
function blocksToSchemas(blocks) {
|
|
36
|
-
const out = /* @__PURE__ */ Object.create(null);
|
|
37
|
-
for (const block of blocks) out[block.type] = propsToSchema(block.props);
|
|
38
|
-
return out;
|
|
39
|
-
}
|
|
40
26
|
|
|
41
27
|
// src/components/block-error.ts
|
|
42
28
|
var BLOCK_ERROR_KEY = "__cmssyBlockError";
|
|
@@ -300,7 +286,7 @@ async function CmssyServerPage({
|
|
|
300
286
|
defaultLocale,
|
|
301
287
|
context,
|
|
302
288
|
enabledLocales,
|
|
303
|
-
{ schemas: blocksToSchemas(blocks), config, workspaceId: workspace?.id }
|
|
289
|
+
{ schemas: core.blocksToSchemas(blocks), config, workspaceId: workspace?.id }
|
|
304
290
|
);
|
|
305
291
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: page.blocks.map(
|
|
306
292
|
(block, i) => renderResolvedBlock(block, map, locale, defaultLocale, {
|
|
@@ -356,7 +342,7 @@ async function resolveEditorBlockData({
|
|
|
356
342
|
defaultLocale,
|
|
357
343
|
context,
|
|
358
344
|
enabledLocales,
|
|
359
|
-
{ schemas: blocksToSchemas(blocks), config }
|
|
345
|
+
{ schemas: core.blocksToSchemas(blocks), config }
|
|
360
346
|
);
|
|
361
347
|
return collectBlockData(page.blocks, resolved, isPreview);
|
|
362
348
|
}
|
|
@@ -392,7 +378,7 @@ async function resolveEditorLayoutBlockData({
|
|
|
392
378
|
defaultLocale,
|
|
393
379
|
context,
|
|
394
380
|
enabledLocales,
|
|
395
|
-
{ schemas: blocksToSchemas(blocks), config }
|
|
381
|
+
{ schemas: core.blocksToSchemas(blocks), config }
|
|
396
382
|
);
|
|
397
383
|
return collectBlockData(layoutBlocks, resolved, isPreview);
|
|
398
384
|
}
|
|
@@ -491,7 +477,7 @@ async function CmssyServerLayout({
|
|
|
491
477
|
defaultLocale,
|
|
492
478
|
context,
|
|
493
479
|
enabledLocales,
|
|
494
|
-
{ schemas: blocksToSchemas(blocks), config }
|
|
480
|
+
{ schemas: core.blocksToSchemas(blocks), config }
|
|
495
481
|
);
|
|
496
482
|
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: layoutBlocks.map(
|
|
497
483
|
(block, i) => renderResolvedBlock(block, map, locale, defaultLocale, {
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CmssyPageData, CmssyClientConfig, CmssyFormDefinition, CmssyBlockAuthContext, CmssyBlockWorkspace, CmssyLayoutGroup, CmssyBlockPage, RetryOption, CmssyConfig, CmssyRegionOf, CmssyRegionSettingsOf, 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, CmssyLayout, CmssyLayoutGroup, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssyRegion, CmssyRegionOf, CmssyRegionSettings, CmssyRegionSettingsOf, 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
|
-
import { B as BlockDefinition, L as LayoutBlockPage, a as BlockMap } from './internal-server-
|
|
4
|
-
export { b as BlockProps, E as EditorBlockData, R as ResolveBlockDataOptions, c as ResolveLayoutBlockDataOptions, d as buildBlockMap, e as defineBlock, r as resolveEditorBlockData, f as resolveEditorLayoutBlockData } from './internal-server-
|
|
3
|
+
import { B as BlockDefinition, L as LayoutBlockPage, a as BlockMap } from './internal-server-Hogm3pjD.cjs';
|
|
4
|
+
export { b as BlockProps, E as EditorBlockData, R as ResolveBlockDataOptions, c as ResolveLayoutBlockDataOptions, d as buildBlockMap, e as defineBlock, r as resolveEditorBlockData, f as resolveEditorLayoutBlockData } from './internal-server-Hogm3pjD.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, CmssyBlockPage, RetryOption, CmssyConfig, CmssyRegionOf, CmssyRegionSettingsOf, 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, CmssyLayout, CmssyLayoutGroup, CmssyLocaleContext, CmssyLocalizedValue, CmssyModelDefinition, CmssyModelRecord, CmssyPageData, CmssyPageMeta, CmssyPageSummary, CmssyRecordList, CmssyRegion, CmssyRegionOf, CmssyRegionSettings, CmssyRegionSettingsOf, 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
|
-
import { B as BlockDefinition, L as LayoutBlockPage, a as BlockMap } from './internal-server-
|
|
4
|
-
export { b as BlockProps, E as EditorBlockData, R as ResolveBlockDataOptions, c as ResolveLayoutBlockDataOptions, d as buildBlockMap, e as defineBlock, r as resolveEditorBlockData, f as resolveEditorLayoutBlockData } from './internal-server-
|
|
3
|
+
import { B as BlockDefinition, L as LayoutBlockPage, a as BlockMap } from './internal-server-Hogm3pjD.js';
|
|
4
|
+
export { b as BlockProps, E as EditorBlockData, R as ResolveBlockDataOptions, c as ResolveLayoutBlockDataOptions, d as buildBlockMap, e as defineBlock, r as resolveEditorBlockData, f as resolveEditorLayoutBlockData } from './internal-server-Hogm3pjD.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,4 +1,4 @@
|
|
|
1
|
-
import { resolveEditorOrigin } from '@cmssy/core';
|
|
1
|
+
import { blocksToSchemas, resolveEditorOrigin } from '@cmssy/core';
|
|
2
2
|
export { CmssyRequestError, PROTOCOL_VERSION, createCmssyClient, defineCmssyLayout, fields, graphqlRequest, isProtocolCompatible, mediaAlt, mediaUrl, mediaUrls, normalizeOrigin, parseEditorMessage, postToEditor } from '@cmssy/core';
|
|
3
3
|
import { buildBlockContext, fetchLayouts, getBlockContentForLanguage, normalizeBlockContent, asBucket, resolveSiteLocales as resolveSiteLocales$1, resolveRelationContent } from '@cmssy/core/internal';
|
|
4
4
|
export { buildBlockContext } from '@cmssy/core/internal';
|
|
@@ -8,8 +8,6 @@ import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
|
8
8
|
import { resolveSiteLocales, splitLocaleFromPath } from '@cmssy/core/internal/locale';
|
|
9
9
|
|
|
10
10
|
// src/index.ts
|
|
11
|
-
|
|
12
|
-
// src/registry.ts
|
|
13
11
|
function defineBlock(def) {
|
|
14
12
|
return def;
|
|
15
13
|
}
|
|
@@ -25,18 +23,6 @@ function buildLoaderMap(blocks) {
|
|
|
25
23
|
}
|
|
26
24
|
return map;
|
|
27
25
|
}
|
|
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
|
-
}
|
|
35
|
-
function blocksToSchemas(blocks) {
|
|
36
|
-
const out = /* @__PURE__ */ Object.create(null);
|
|
37
|
-
for (const block of blocks) out[block.type] = propsToSchema(block.props);
|
|
38
|
-
return out;
|
|
39
|
-
}
|
|
40
26
|
|
|
41
27
|
// src/components/block-error.ts
|
|
42
28
|
var BLOCK_ERROR_KEY = "__cmssyBlockError";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldDefinition, CmssyBlockContext, BlockPropsSchema, InferBlockContent,
|
|
1
|
+
import { FieldDefinition, CmssyBlockContext, BlockPropsSchema, InferBlockContent, BuildBlockContextExtra, CmssyPageData, CmssyFormDefinition, CmssyClientConfig, CmssyLayoutGroup } from '@cmssy/core';
|
|
2
2
|
import { ComponentType } from 'react';
|
|
3
3
|
|
|
4
4
|
interface BlockProps<P extends BlockPropsSchema, D = unknown> {
|
|
@@ -65,7 +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>;
|
|
69
68
|
|
|
70
69
|
type LayoutBlockPage = NonNullable<BuildBlockContextExtra["page"]>;
|
|
71
70
|
interface EditorBlockData {
|
|
@@ -101,4 +100,4 @@ interface ResolveLayoutBlockDataOptions {
|
|
|
101
100
|
declare function resolveEditorLayoutBlockData({ groups, blocks, position, page, locale, defaultLocale, enabledLocales, forms, isPreview, config, appContext, }: ResolveLayoutBlockDataOptions): Promise<EditorBlockData>;
|
|
102
101
|
declare function resolveLayoutBlockData(options: ResolveLayoutBlockDataOptions): Promise<Record<string, unknown>>;
|
|
103
102
|
|
|
104
|
-
export { type BlockDefinition as B, type EditorBlockData as E, type LayoutBlockPage as L, type ResolveBlockDataOptions as R, type BlockMap as a, type BlockProps as b, type ResolveLayoutBlockDataOptions as c, buildBlockMap as d, defineBlock as e, resolveEditorLayoutBlockData as f,
|
|
103
|
+
export { type BlockDefinition as B, type EditorBlockData as E, type LayoutBlockPage as L, type ResolveBlockDataOptions as R, type BlockMap as a, type BlockProps as b, type ResolveLayoutBlockDataOptions as c, buildBlockMap as d, defineBlock as e, resolveEditorLayoutBlockData as f, resolveBlockData as g, resolveLayoutBlockData as h, resolveEditorBlockData as r };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FieldDefinition, CmssyBlockContext, BlockPropsSchema, InferBlockContent,
|
|
1
|
+
import { FieldDefinition, CmssyBlockContext, BlockPropsSchema, InferBlockContent, BuildBlockContextExtra, CmssyPageData, CmssyFormDefinition, CmssyClientConfig, CmssyLayoutGroup } from '@cmssy/core';
|
|
2
2
|
import { ComponentType } from 'react';
|
|
3
3
|
|
|
4
4
|
interface BlockProps<P extends BlockPropsSchema, D = unknown> {
|
|
@@ -65,7 +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>;
|
|
69
68
|
|
|
70
69
|
type LayoutBlockPage = NonNullable<BuildBlockContextExtra["page"]>;
|
|
71
70
|
interface EditorBlockData {
|
|
@@ -101,4 +100,4 @@ interface ResolveLayoutBlockDataOptions {
|
|
|
101
100
|
declare function resolveEditorLayoutBlockData({ groups, blocks, position, page, locale, defaultLocale, enabledLocales, forms, isPreview, config, appContext, }: ResolveLayoutBlockDataOptions): Promise<EditorBlockData>;
|
|
102
101
|
declare function resolveLayoutBlockData(options: ResolveLayoutBlockDataOptions): Promise<Record<string, unknown>>;
|
|
103
102
|
|
|
104
|
-
export { type BlockDefinition as B, type EditorBlockData as E, type LayoutBlockPage as L, type ResolveBlockDataOptions as R, type BlockMap as a, type BlockProps as b, type ResolveLayoutBlockDataOptions as c, buildBlockMap as d, defineBlock as e, resolveEditorLayoutBlockData as f,
|
|
103
|
+
export { type BlockDefinition as B, type EditorBlockData as E, type LayoutBlockPage as L, type ResolveBlockDataOptions as R, type BlockMap as a, type BlockProps as b, type ResolveLayoutBlockDataOptions as c, buildBlockMap as d, defineBlock as e, resolveEditorLayoutBlockData as f, resolveBlockData as g, resolveLayoutBlockData as h, resolveEditorBlockData as r };
|
package/dist/internal-server.cjs
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var internal = require('@cmssy/core/internal');
|
|
4
|
+
var core = require('@cmssy/core');
|
|
4
5
|
|
|
5
6
|
// src/components/resolve-block-data.ts
|
|
6
|
-
|
|
7
|
-
// src/registry.ts
|
|
8
7
|
function buildLoaderMap(blocks) {
|
|
9
8
|
const map = /* @__PURE__ */ Object.create(null);
|
|
10
9
|
for (const block of blocks) {
|
|
@@ -12,18 +11,6 @@ function buildLoaderMap(blocks) {
|
|
|
12
11
|
}
|
|
13
12
|
return map;
|
|
14
13
|
}
|
|
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
|
-
}
|
|
22
|
-
function blocksToSchemas(blocks) {
|
|
23
|
-
const out = /* @__PURE__ */ Object.create(null);
|
|
24
|
-
for (const block of blocks) out[block.type] = propsToSchema(block.props);
|
|
25
|
-
return out;
|
|
26
|
-
}
|
|
27
14
|
|
|
28
15
|
// src/components/block-error.ts
|
|
29
16
|
var BLOCK_ERROR_KEY = "__cmssyBlockError";
|
|
@@ -126,7 +113,7 @@ async function resolveEditorBlockData({
|
|
|
126
113
|
defaultLocale,
|
|
127
114
|
context,
|
|
128
115
|
enabledLocales,
|
|
129
|
-
{ schemas: blocksToSchemas(blocks), config }
|
|
116
|
+
{ schemas: core.blocksToSchemas(blocks), config }
|
|
130
117
|
);
|
|
131
118
|
return collectBlockData(page.blocks, resolved, isPreview);
|
|
132
119
|
}
|
|
@@ -165,7 +152,7 @@ async function resolveEditorLayoutBlockData({
|
|
|
165
152
|
defaultLocale,
|
|
166
153
|
context,
|
|
167
154
|
enabledLocales,
|
|
168
|
-
{ schemas: blocksToSchemas(blocks), config }
|
|
155
|
+
{ schemas: core.blocksToSchemas(blocks), config }
|
|
169
156
|
);
|
|
170
157
|
return collectBlockData(layoutBlocks, resolved, isPreview);
|
|
171
158
|
}
|
|
@@ -173,7 +160,10 @@ async function resolveLayoutBlockData(options) {
|
|
|
173
160
|
return (await resolveEditorLayoutBlockData(options)).data;
|
|
174
161
|
}
|
|
175
162
|
|
|
176
|
-
exports
|
|
163
|
+
Object.defineProperty(exports, "blocksToSchemas", {
|
|
164
|
+
enumerable: true,
|
|
165
|
+
get: function () { return core.blocksToSchemas; }
|
|
166
|
+
});
|
|
177
167
|
exports.resolveBlockData = resolveBlockData;
|
|
178
168
|
exports.resolveEditorBlockData = resolveEditorBlockData;
|
|
179
169
|
exports.resolveEditorLayoutBlockData = resolveEditorLayoutBlockData;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { E as EditorBlockData, R as ResolveBlockDataOptions, c as ResolveLayoutBlockDataOptions, g as
|
|
2
|
-
|
|
1
|
+
export { E as EditorBlockData, R as ResolveBlockDataOptions, c as ResolveLayoutBlockDataOptions, g as resolveBlockData, r as resolveEditorBlockData, f as resolveEditorLayoutBlockData, h as resolveLayoutBlockData } from './internal-server-Hogm3pjD.cjs';
|
|
2
|
+
export { blocksToSchemas } from '@cmssy/core';
|
|
3
3
|
import 'react';
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { E as EditorBlockData, R as ResolveBlockDataOptions, c as ResolveLayoutBlockDataOptions, g as
|
|
2
|
-
|
|
1
|
+
export { E as EditorBlockData, R as ResolveBlockDataOptions, c as ResolveLayoutBlockDataOptions, g as resolveBlockData, r as resolveEditorBlockData, f as resolveEditorLayoutBlockData, h as resolveLayoutBlockData } from './internal-server-Hogm3pjD.js';
|
|
2
|
+
export { blocksToSchemas } from '@cmssy/core';
|
|
3
3
|
import 'react';
|
package/dist/internal-server.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { buildBlockContext, getBlockContentForLanguage, resolveRelationContent, normalizeBlockContent } from '@cmssy/core/internal';
|
|
2
|
+
import { blocksToSchemas } from '@cmssy/core';
|
|
3
|
+
export { blocksToSchemas } from '@cmssy/core';
|
|
2
4
|
|
|
3
5
|
// src/components/resolve-block-data.ts
|
|
4
|
-
|
|
5
|
-
// src/registry.ts
|
|
6
6
|
function buildLoaderMap(blocks) {
|
|
7
7
|
const map = /* @__PURE__ */ Object.create(null);
|
|
8
8
|
for (const block of blocks) {
|
|
@@ -10,18 +10,6 @@ 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
|
-
}
|
|
20
|
-
function blocksToSchemas(blocks) {
|
|
21
|
-
const out = /* @__PURE__ */ Object.create(null);
|
|
22
|
-
for (const block of blocks) out[block.type] = propsToSchema(block.props);
|
|
23
|
-
return out;
|
|
24
|
-
}
|
|
25
13
|
|
|
26
14
|
// src/components/block-error.ts
|
|
27
15
|
var BLOCK_ERROR_KEY = "__cmssyBlockError";
|
|
@@ -171,4 +159,4 @@ async function resolveLayoutBlockData(options) {
|
|
|
171
159
|
return (await resolveEditorLayoutBlockData(options)).data;
|
|
172
160
|
}
|
|
173
161
|
|
|
174
|
-
export {
|
|
162
|
+
export { resolveBlockData, resolveEditorBlockData, resolveEditorLayoutBlockData, resolveLayoutBlockData };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmssy/react",
|
|
3
|
-
"version": "14.
|
|
3
|
+
"version": "14.2.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.39.0",
|
|
100
|
-
"@cmssy/core": "14.
|
|
100
|
+
"@cmssy/core": "14.2.0"
|
|
101
101
|
},
|
|
102
102
|
"scripts": {
|
|
103
103
|
"build": "tsup",
|