@elytracms/next 0.0.83 → 0.0.85
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/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2,6 +2,7 @@ import { ComponentRegistry } from '@elytracms/core/component-registry';
|
|
|
2
2
|
export { defineComponent } from '@elytracms/core/component-registry';
|
|
3
3
|
import { basePrimitives, getImplementation, renderDocumentBodyItems, documentBodyItems, ImageManifest, serializeListingQuery, RenderErrorBoundary, documentBodyRichTextValues, documentBodyCompositionNodes, richTextEmbedsInValue, collectReferencedAssetIds, collectRichTextRefsInValue, collectReferencedRelations, collectReferencedListings, collectReferencedRichTextLinks, normalizeImageSource } from '@elytracms/core/runtime-renderer';
|
|
4
4
|
import { isValidElement } from 'react';
|
|
5
|
+
import { isBlockSequenceValueShape } from '@elytracms/core/rich-text';
|
|
5
6
|
import { jsx, Fragment } from 'react/jsx-runtime';
|
|
6
7
|
import { cacheTags, isSectionSourceId, parseCmsSourceQueryConfig, listQueryOfCmsConfig, isDocumentHistory, resolvedAsset, createContentClient, createContentContext } from '@elytracms/core/content';
|
|
7
8
|
import { documentKey, splitLocalePath, hierarchyMount, composePath, localeUrlPath, mergeRouteRecords, fallbackHomeRoutes, presentationBodyFields, splitPath, documentSchema, redirectRecordSchema } from '@elytracms/core/cms-core';
|
|
@@ -160,10 +161,11 @@ function bodyItemsOf(document, presentation) {
|
|
|
160
161
|
}
|
|
161
162
|
function compositionOf(document) {
|
|
162
163
|
const body = document["body"];
|
|
163
|
-
if (Array.isArray(body) || isComponentNodeValue(body)) return body;
|
|
164
|
+
if (isCompositionishSequence(body) || Array.isArray(body) || isComponentNodeValue(body)) return body;
|
|
164
165
|
const content = document["content"];
|
|
165
|
-
if (Array.isArray(content) || isComponentNodeValue(content)) return content;
|
|
166
|
+
if (isCompositionishSequence(content) || Array.isArray(content) || isComponentNodeValue(content)) return content;
|
|
166
167
|
for (const value of Object.values(document)) {
|
|
168
|
+
if (isCompositionishSequence(value)) return value;
|
|
167
169
|
if (isComponentNodeValue(value)) return value;
|
|
168
170
|
if (Array.isArray(value) && value.length > 0 && value.every(isComponentNodeValue)) return value;
|
|
169
171
|
}
|
|
@@ -172,6 +174,11 @@ function compositionOf(document) {
|
|
|
172
174
|
function compositionNodesOf(document, presentation) {
|
|
173
175
|
return documentBodyCompositionNodes(bodyItemsOf(document, presentation));
|
|
174
176
|
}
|
|
177
|
+
function isCompositionishSequence(value) {
|
|
178
|
+
return isBlockSequenceValueShape(value) && value.content.some(
|
|
179
|
+
(node) => typeof node === "object" && node !== null && node.type === "elytra/component"
|
|
180
|
+
);
|
|
181
|
+
}
|
|
175
182
|
function isComponentNodeValue(value) {
|
|
176
183
|
return typeof value === "object" && value !== null && typeof value.id === "string" && typeof value.componentId === "string";
|
|
177
184
|
}
|