@riverbankcms/sdk 0.128.0 → 0.129.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/README.md +33 -0
- package/dist/{PreviewEditorSidebar-Dbvb7GIr.mjs → PreviewEditorSidebar-B43CJ0g_.mjs} +3 -3
- package/dist/{PreviewEditorUI-e9O9l20X.mjs → PreviewEditorUI-DHirVkeM.mjs} +2 -2
- package/dist/{SdkPreviewModeRuntime-BZHt6e9w.mjs → SdkPreviewModeRuntime-BJumZy1B.mjs} +495 -292
- package/dist/{SiteChromeCustomizeContext-CvuGbHJX.mjs → SiteChromeCustomizeContext-D9SlpwEj.mjs} +140 -140
- package/dist/_dts/blocks/src/PageRenderer.d.ts +20 -10
- package/dist/_dts/blocks/src/index.d.ts +2 -1
- package/dist/_dts/blocks/src/pageRendererBoundaries.d.ts +30 -0
- package/dist/_dts/blocks/src/pageRenderingMode.d.ts +37 -0
- package/dist/_dts/blocks/src/server.d.ts +1 -1
- package/dist/_dts/db/src/generated/supabase/database.types.d.ts +14 -0
- package/dist/_dts/preview-next/src/client/blocks/pageDesignRuntimePreview.d.ts +2 -0
- package/dist/_dts/preview-next/src/client/index.d.ts +47 -47
- package/dist/_dts/preview-next/src/client/preview/PreviewShell.d.ts +18 -6
- package/dist/_dts/preview-next/src/client/preview/PreviewShellLayout.d.ts +30 -21
- package/dist/_dts/preview-next/src/client/preview/PreviewThemedSiteDocument.d.ts +18 -5
- package/dist/_dts/preview-next/src/client/preview/themeRuntime.d.ts +9 -0
- package/dist/_dts/preview-next/src/client/sdk/SdkPreviewMode.d.ts +21 -6
- package/dist/_dts/preview-next/src/client/sdk-runtime.d.ts +8 -8
- package/dist/_dts/sdk/src/next/catch-all.d.ts +6 -0
- package/dist/_dts/sdk/src/next/index.d.ts +2 -1
- package/dist/_dts/sdk/src/next/renderSdkContent.d.ts +33 -0
- package/dist/_dts/sdk/src/next/types.d.ts +23 -9
- package/dist/_dts/sdk/src/preview-next/before-render.d.ts +4 -6
- package/dist/_dts/sdk/src/preview-next/client/index.d.ts +3 -3
- package/dist/_dts/sdk/src/preview-next/client/runtime.d.ts +1 -1
- package/dist/_dts/sdk/src/rendering/blocks-page-renderer.d.ts +25 -3
- package/dist/_dts/sdk/src/rendering/components/Block.shared.d.ts +13 -2
- package/dist/_dts/sdk/src/rendering/components/Layout.d.ts +31 -18
- package/dist/_dts/sdk/src/rendering/components/pageShared.d.ts +20 -9
- package/dist/_dts/sdk/src/rendering/index.d.ts +4 -2
- package/dist/_dts/sdk/src/rendering/renderingMode.d.ts +23 -0
- package/dist/_dts/sdk/src/rendering/server.d.ts +5 -3
- package/dist/_dts/sdk/src/rendering/themeRuntime.d.ts +6 -0
- package/dist/_dts/sdk/src/version.d.ts +1 -1
- package/dist/cli/index.mjs +237 -211
- package/dist/cli/init-docs/content/workflow-preview-mode.md +24 -11
- package/dist/client/client.mjs +420 -337
- package/dist/client/rendering.mjs +503 -358
- package/dist/preview-next/before-render.mjs +10 -3
- package/dist/preview-next/client/runtime.mjs +3 -3
- package/dist/{sdk-runtime-Cn_QSCOg.mjs → sdk-runtime-CfZd5pAm.mjs} +1 -1
- package/dist/{separator-CEoGABRc.mjs → separator-DkTe68HE.mjs} +1 -1
- package/dist/server/components.mjs +478 -351
- package/dist/server/index.mjs +1 -1
- package/dist/server/next.mjs +640 -500
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/rendering/server.mjs +499 -355
- package/dist/server/rendering.mjs +499 -355
- package/dist/server/server.mjs +1 -1
- package/package.json +1 -1
package/dist/server/next.mjs
CHANGED
|
@@ -60092,6 +60092,213 @@ function collectConstrainedVideoMediaValues(options) {
|
|
|
60092
60092
|
return values;
|
|
60093
60093
|
}
|
|
60094
60094
|
//#endregion
|
|
60095
|
+
//#region ../blocks/src/system/manifest/hydrateLinks.ts
|
|
60096
|
+
/**
|
|
60097
|
+
* Hydrates link objects within block content using the provided route map. Returns
|
|
60098
|
+
* the original content reference when no mutations are required to avoid unnecessary renders.
|
|
60099
|
+
*/
|
|
60100
|
+
function hydrateManifestLinks(manifest, content, routes, pagesByIdentifier, entriesByIdentifier) {
|
|
60101
|
+
if (!routes || !manifest?.fields?.length) return content;
|
|
60102
|
+
return hydrateValue(content, {
|
|
60103
|
+
routes,
|
|
60104
|
+
pagesByIdentifier,
|
|
60105
|
+
entriesByIdentifier
|
|
60106
|
+
});
|
|
60107
|
+
}
|
|
60108
|
+
function hydrateValue(value, context) {
|
|
60109
|
+
try {
|
|
60110
|
+
if (Array.isArray(value)) {
|
|
60111
|
+
const resolvedItems = value.map((item) => hydrateValue(item, context));
|
|
60112
|
+
return resolvedItems.every((item, index) => item === value[index]) ? value : resolvedItems;
|
|
60113
|
+
}
|
|
60114
|
+
if (isRecord$26(value)) {
|
|
60115
|
+
if (isInternalLink$1(value)) return hydrateInternalLink(value, context.routes);
|
|
60116
|
+
if (isPageLink$1(value)) return hydratePageLink(value, context);
|
|
60117
|
+
if (isEntryLink$1(value)) return hydrateEntryLink(value, context);
|
|
60118
|
+
const resolvedEntries = Object.entries(value).map(([key, entry]) => [key, hydrateValue(entry, context)]);
|
|
60119
|
+
return resolvedEntries.every(([key, entry]) => entry === value[key]) ? value : Object.fromEntries(resolvedEntries);
|
|
60120
|
+
}
|
|
60121
|
+
return value;
|
|
60122
|
+
} catch (err) {
|
|
60123
|
+
console.error("[hydrateLinks] Error hydrating value:", err, value);
|
|
60124
|
+
return value;
|
|
60125
|
+
}
|
|
60126
|
+
}
|
|
60127
|
+
function hydrateInternalLink(link, routes) {
|
|
60128
|
+
const resolved = resolveRouteTarget(link.routeId, routes);
|
|
60129
|
+
if (!resolved) return link;
|
|
60130
|
+
const nextHref = resolved.href;
|
|
60131
|
+
const currentHref = typeof link.href === "string" && link.href.length > 0 ? link.href : null;
|
|
60132
|
+
const nextUpdatedAt = resolved.updatedAt;
|
|
60133
|
+
const updates = {};
|
|
60134
|
+
if (nextHref && nextHref !== currentHref) updates.href = nextHref;
|
|
60135
|
+
if (nextUpdatedAt && link.updatedAt !== nextUpdatedAt) updates.updatedAt = nextUpdatedAt;
|
|
60136
|
+
return Object.keys(updates).length > 0 ? {
|
|
60137
|
+
...link,
|
|
60138
|
+
...updates
|
|
60139
|
+
} : link;
|
|
60140
|
+
}
|
|
60141
|
+
function isInternalLink$1(value) {
|
|
60142
|
+
if (value.kind !== "internal") return false;
|
|
60143
|
+
if (typeof value.routeId !== "string" || value.routeId.length === 0) return false;
|
|
60144
|
+
return true;
|
|
60145
|
+
}
|
|
60146
|
+
function isPageLink$1(value) {
|
|
60147
|
+
if (value.kind !== "page") return false;
|
|
60148
|
+
if (typeof value.identifier !== "string" || value.identifier.length === 0) return false;
|
|
60149
|
+
return true;
|
|
60150
|
+
}
|
|
60151
|
+
function hydratePageLink(link, context) {
|
|
60152
|
+
const resolved = resolvePageRouteTarget(link, context);
|
|
60153
|
+
if (!resolved) return link;
|
|
60154
|
+
return {
|
|
60155
|
+
...link,
|
|
60156
|
+
href: resolved.href,
|
|
60157
|
+
routeId: resolved.routeId
|
|
60158
|
+
};
|
|
60159
|
+
}
|
|
60160
|
+
function isEntryLink$1(value) {
|
|
60161
|
+
if (value.kind !== "entry") return false;
|
|
60162
|
+
if (typeof value.contentType !== "string" || value.contentType.length === 0) return false;
|
|
60163
|
+
if (typeof value.identifier !== "string" || value.identifier.length === 0) return false;
|
|
60164
|
+
return true;
|
|
60165
|
+
}
|
|
60166
|
+
function hydrateEntryLink(link, context) {
|
|
60167
|
+
const resolved = resolveEntryRouteTarget(link, context);
|
|
60168
|
+
if (!resolved) return link;
|
|
60169
|
+
return {
|
|
60170
|
+
...link,
|
|
60171
|
+
href: resolved.href,
|
|
60172
|
+
routeId: resolved.routeId
|
|
60173
|
+
};
|
|
60174
|
+
}
|
|
60175
|
+
//#endregion
|
|
60176
|
+
//#region ../blocks/src/sdkBlockTransform.ts
|
|
60177
|
+
/**
|
|
60178
|
+
* Transforms an SDK custom block into a BlockManifest.
|
|
60179
|
+
*
|
|
60180
|
+
* If the block has a `layout`, it can be rendered declaratively without React code.
|
|
60181
|
+
* If no layout, the block MUST use blockOverrides for rendering.
|
|
60182
|
+
*/
|
|
60183
|
+
function transformSdkBlockToManifest(sdkBlock) {
|
|
60184
|
+
const hasLayout = Boolean(sdkBlock.layout) || Boolean(sdkBlock.variants && Object.keys(sdkBlock.variants).length > 0);
|
|
60185
|
+
return augmentManifest({
|
|
60186
|
+
name: sdkBlock.id,
|
|
60187
|
+
version: "1.0.0",
|
|
60188
|
+
title: sdkBlock.title,
|
|
60189
|
+
titleSource: sdkBlock.titleSource,
|
|
60190
|
+
description: sdkBlock.description,
|
|
60191
|
+
component: sdkBlock.id,
|
|
60192
|
+
fields: sdkBlock.fields,
|
|
60193
|
+
slots: [],
|
|
60194
|
+
category: sdkBlock.category,
|
|
60195
|
+
tags: sdkBlock.tags,
|
|
60196
|
+
icon: sdkBlock.icon,
|
|
60197
|
+
layout: sdkBlock.layout,
|
|
60198
|
+
variants: sdkBlock.variants,
|
|
60199
|
+
defaultVariant: sdkBlock.defaultVariant,
|
|
60200
|
+
variantOptions: sdkBlock.variantOptions,
|
|
60201
|
+
previewCustomize: sdkBlock.previewCustomize,
|
|
60202
|
+
behaviours: {
|
|
60203
|
+
supportsThemeSwitching: true,
|
|
60204
|
+
inlineEditing: hasLayout,
|
|
60205
|
+
animation: hasLayout,
|
|
60206
|
+
paletteHidden: false
|
|
60207
|
+
}
|
|
60208
|
+
});
|
|
60209
|
+
}
|
|
60210
|
+
/**
|
|
60211
|
+
* Transforms an SDK custom block into a SystemBlockDefinition.
|
|
60212
|
+
*
|
|
60213
|
+
* This creates a minimal definition with just the manifest - no data loaders
|
|
60214
|
+
* or content normalizers since SDK blocks handle their own rendering.
|
|
60215
|
+
*/
|
|
60216
|
+
function transformSdkBlockToDefinition(sdkBlock) {
|
|
60217
|
+
return {
|
|
60218
|
+
manifest: transformSdkBlockToManifest(sdkBlock),
|
|
60219
|
+
dataLoaders: sdkBlock.dataLoaders
|
|
60220
|
+
};
|
|
60221
|
+
}
|
|
60222
|
+
//#endregion
|
|
60223
|
+
//#region ../blocks/src/customBlockRegistry.ts
|
|
60224
|
+
const defaultCustomBlockSourcePolicy = { kind: "canonical-db-fallback-sdk" };
|
|
60225
|
+
function isCustomBlockKind(blockKind) {
|
|
60226
|
+
return blockKind.startsWith("custom.");
|
|
60227
|
+
}
|
|
60228
|
+
function transformToBlockDescriptor(sdkBlock, source = "sdk") {
|
|
60229
|
+
return {
|
|
60230
|
+
name: sdkBlock.id,
|
|
60231
|
+
title: sdkBlock.title,
|
|
60232
|
+
description: sdkBlock.description,
|
|
60233
|
+
category: sdkBlock.category,
|
|
60234
|
+
tags: sdkBlock.tags,
|
|
60235
|
+
icon: sdkBlock.icon,
|
|
60236
|
+
definition: transformSdkBlockToDefinition(sdkBlock),
|
|
60237
|
+
source
|
|
60238
|
+
};
|
|
60239
|
+
}
|
|
60240
|
+
function toResolvedCustomBlock(manifest, source) {
|
|
60241
|
+
return {
|
|
60242
|
+
blockKind: manifest.id,
|
|
60243
|
+
manifest: transformSdkBlockToManifest(manifest),
|
|
60244
|
+
source,
|
|
60245
|
+
descriptor: transformToBlockDescriptor(manifest, source.kind === "managed-database" ? "database" : "sdk")
|
|
60246
|
+
};
|
|
60247
|
+
}
|
|
60248
|
+
function planCustomBlockRegistryResolution({ sdkConfig, customBlocks = [], policy = defaultCustomBlockSourcePolicy }) {
|
|
60249
|
+
switch (policy.kind) {
|
|
60250
|
+
case "canonical-db-fallback-sdk": {
|
|
60251
|
+
const entriesByKind = /* @__PURE__ */ new Map();
|
|
60252
|
+
const conflicts = [];
|
|
60253
|
+
for (const customBlock of customBlocks) entriesByKind.set(customBlock.manifest.id, toResolvedCustomBlock(customBlock.manifest, customBlock.source));
|
|
60254
|
+
for (const sdkBlock of sdkConfig?.customBlocks ?? []) {
|
|
60255
|
+
const existing = entriesByKind.get(sdkBlock.id);
|
|
60256
|
+
if (existing) {
|
|
60257
|
+
conflicts.push({
|
|
60258
|
+
kind: "conflict",
|
|
60259
|
+
blockKind: existing.blockKind,
|
|
60260
|
+
winner: existing.source,
|
|
60261
|
+
loser: { kind: "sdk-config" },
|
|
60262
|
+
reason: "db-canonical-sdk-fallback"
|
|
60263
|
+
});
|
|
60264
|
+
continue;
|
|
60265
|
+
}
|
|
60266
|
+
entriesByKind.set(sdkBlock.id, toResolvedCustomBlock(sdkBlock, { kind: "sdk-config" }));
|
|
60267
|
+
}
|
|
60268
|
+
return {
|
|
60269
|
+
policy,
|
|
60270
|
+
entries: Array.from(entriesByKind.values()),
|
|
60271
|
+
conflicts
|
|
60272
|
+
};
|
|
60273
|
+
}
|
|
60274
|
+
}
|
|
60275
|
+
}
|
|
60276
|
+
function createCustomBlockRegistry({ sdkConfig, customBlocks = [], policy = defaultCustomBlockSourcePolicy, onConflict }) {
|
|
60277
|
+
const plan = planCustomBlockRegistryResolution({
|
|
60278
|
+
sdkConfig,
|
|
60279
|
+
customBlocks,
|
|
60280
|
+
policy
|
|
60281
|
+
});
|
|
60282
|
+
const entriesByKind = new Map(plan.entries.map((entry) => [entry.blockKind, entry]));
|
|
60283
|
+
for (const conflict of plan.conflicts) onConflict?.(`Using ${sourceLabel(conflict.winner)} custom block "${conflict.blockKind}" - ${sourceLabel(conflict.loser)} block is fallback only`);
|
|
60284
|
+
return {
|
|
60285
|
+
entries: plan.entries,
|
|
60286
|
+
conflicts: plan.conflicts,
|
|
60287
|
+
findManifest: (blockKind) => {
|
|
60288
|
+
if (!isCustomBlockKind(blockKind)) return void 0;
|
|
60289
|
+
return entriesByKind.get(blockKind);
|
|
60290
|
+
}
|
|
60291
|
+
};
|
|
60292
|
+
}
|
|
60293
|
+
function sourceLabel(source) {
|
|
60294
|
+
switch (source.kind) {
|
|
60295
|
+
case "managed-database": return "DB";
|
|
60296
|
+
case "sdk-synced": return "SDK-synced DB";
|
|
60297
|
+
case "sdk-config": return "SDK config";
|
|
60298
|
+
default: return assertNever$24(source);
|
|
60299
|
+
}
|
|
60300
|
+
}
|
|
60301
|
+
//#endregion
|
|
60095
60302
|
//#region ../theme-core/src/runtime/fontFamily.ts
|
|
60096
60303
|
/**
|
|
60097
60304
|
* Font Family Formatting Utilities
|
|
@@ -63829,215 +64036,115 @@ function mapFontStyle(italic) {
|
|
|
63829
64036
|
return italic ? "italic" : "normal";
|
|
63830
64037
|
}
|
|
63831
64038
|
//#endregion
|
|
63832
|
-
//#region ../blocks/src/
|
|
63833
|
-
|
|
63834
|
-
|
|
63835
|
-
|
|
63836
|
-
|
|
63837
|
-
|
|
63838
|
-
|
|
63839
|
-
return hydrateValue(content, {
|
|
63840
|
-
routes,
|
|
63841
|
-
pagesByIdentifier,
|
|
63842
|
-
entriesByIdentifier
|
|
63843
|
-
});
|
|
63844
|
-
}
|
|
63845
|
-
function hydrateValue(value, context) {
|
|
63846
|
-
try {
|
|
63847
|
-
if (Array.isArray(value)) {
|
|
63848
|
-
const resolvedItems = value.map((item) => hydrateValue(item, context));
|
|
63849
|
-
return resolvedItems.every((item, index) => item === value[index]) ? value : resolvedItems;
|
|
63850
|
-
}
|
|
63851
|
-
if (isRecord$26(value)) {
|
|
63852
|
-
if (isInternalLink$1(value)) return hydrateInternalLink(value, context.routes);
|
|
63853
|
-
if (isPageLink$1(value)) return hydratePageLink(value, context);
|
|
63854
|
-
if (isEntryLink$1(value)) return hydrateEntryLink(value, context);
|
|
63855
|
-
const resolvedEntries = Object.entries(value).map(([key, entry]) => [key, hydrateValue(entry, context)]);
|
|
63856
|
-
return resolvedEntries.every(([key, entry]) => entry === value[key]) ? value : Object.fromEntries(resolvedEntries);
|
|
63857
|
-
}
|
|
63858
|
-
return value;
|
|
63859
|
-
} catch (err) {
|
|
63860
|
-
console.error("[hydrateLinks] Error hydrating value:", err, value);
|
|
63861
|
-
return value;
|
|
64039
|
+
//#region ../blocks/src/pageRenderingMode.ts
|
|
64040
|
+
var MissingBlockOverrideError$1 = class extends Error {
|
|
64041
|
+
constructor(blockKind) {
|
|
64042
|
+
super(`Override-only rendering requires an override for block kind "${blockKind}".`);
|
|
64043
|
+
this.blockKind = blockKind;
|
|
64044
|
+
this.code = "missing_block_override";
|
|
64045
|
+
this.name = "MissingBlockOverrideError";
|
|
63862
64046
|
}
|
|
64047
|
+
};
|
|
64048
|
+
function isOverrideOnlyResourceInput(props) {
|
|
64049
|
+
return props.rendering?.kind === "overrides-only";
|
|
63863
64050
|
}
|
|
63864
|
-
function
|
|
63865
|
-
|
|
63866
|
-
|
|
63867
|
-
|
|
63868
|
-
|
|
63869
|
-
|
|
63870
|
-
|
|
63871
|
-
if (nextHref && nextHref !== currentHref) updates.href = nextHref;
|
|
63872
|
-
if (nextUpdatedAt && link.updatedAt !== nextUpdatedAt) updates.updatedAt = nextUpdatedAt;
|
|
63873
|
-
return Object.keys(updates).length > 0 ? {
|
|
63874
|
-
...link,
|
|
63875
|
-
...updates
|
|
63876
|
-
} : link;
|
|
64051
|
+
function resolvePageThemeResources(props) {
|
|
64052
|
+
if (isOverrideOnlyResourceInput(props)) return { kind: "unavailable" };
|
|
64053
|
+
return {
|
|
64054
|
+
kind: "available",
|
|
64055
|
+
tokens: props.themeTokens ?? buildThemeRuntime$1(props.theme).tokens,
|
|
64056
|
+
config: props.theme
|
|
64057
|
+
};
|
|
63877
64058
|
}
|
|
63878
|
-
function
|
|
63879
|
-
if (
|
|
63880
|
-
if (typeof value.routeId !== "string" || value.routeId.length === 0) return false;
|
|
63881
|
-
return true;
|
|
64059
|
+
function requireBlockOverride(resources, override, blockKind) {
|
|
64060
|
+
if (resources.kind === "unavailable" && !override) throw new MissingBlockOverrideError$1(blockKind);
|
|
63882
64061
|
}
|
|
63883
|
-
function
|
|
63884
|
-
|
|
63885
|
-
|
|
63886
|
-
|
|
64062
|
+
function overrideThemeProps(resources) {
|
|
64063
|
+
return resources.kind === "available" ? {
|
|
64064
|
+
theme: resources.tokens,
|
|
64065
|
+
themeConfig: resources.config
|
|
64066
|
+
} : {};
|
|
63887
64067
|
}
|
|
63888
|
-
function
|
|
63889
|
-
|
|
63890
|
-
|
|
63891
|
-
return {
|
|
63892
|
-
...link,
|
|
63893
|
-
href: resolved.href,
|
|
63894
|
-
routeId: resolved.routeId
|
|
63895
|
-
};
|
|
64068
|
+
function requireThemeResources(resources, blockKind) {
|
|
64069
|
+
if (resources.kind === "unavailable") throw new MissingBlockOverrideError$1(blockKind);
|
|
64070
|
+
return resources;
|
|
63896
64071
|
}
|
|
63897
|
-
|
|
63898
|
-
|
|
63899
|
-
|
|
63900
|
-
|
|
63901
|
-
return true;
|
|
64072
|
+
//#endregion
|
|
64073
|
+
//#region ../blocks/src/pageRendererBoundaries.tsx
|
|
64074
|
+
const boundaryKey = (previousBlockId, nextBlockId) => `${previousBlockId}\u0000${nextBlockId}`;
|
|
64075
|
+
function isSiteStyleTransitionStyleGroup(value) {
|
|
64076
|
+
return value?.startsWith("site-style-transition-") === true;
|
|
63902
64077
|
}
|
|
63903
|
-
function
|
|
63904
|
-
|
|
63905
|
-
if (!resolved) return link;
|
|
63906
|
-
return {
|
|
63907
|
-
...link,
|
|
63908
|
-
href: resolved.href,
|
|
63909
|
-
routeId: resolved.routeId
|
|
63910
|
-
};
|
|
64078
|
+
function boundaryMapForAdjacentBlockIds(boundaries) {
|
|
64079
|
+
return new Map(boundaries.map((boundary) => [boundaryKey(boundary.previousBlockId, boundary.nextBlockId), boundary]));
|
|
63911
64080
|
}
|
|
63912
|
-
|
|
63913
|
-
|
|
63914
|
-
|
|
63915
|
-
|
|
63916
|
-
|
|
63917
|
-
* If the block has a `layout`, it can be rendered declaratively without React code.
|
|
63918
|
-
* If no layout, the block MUST use blockOverrides for rendering.
|
|
63919
|
-
*/
|
|
63920
|
-
function transformSdkBlockToManifest(sdkBlock) {
|
|
63921
|
-
const hasLayout = Boolean(sdkBlock.layout) || Boolean(sdkBlock.variants && Object.keys(sdkBlock.variants).length > 0);
|
|
63922
|
-
return augmentManifest({
|
|
63923
|
-
name: sdkBlock.id,
|
|
63924
|
-
version: "1.0.0",
|
|
63925
|
-
title: sdkBlock.title,
|
|
63926
|
-
titleSource: sdkBlock.titleSource,
|
|
63927
|
-
description: sdkBlock.description,
|
|
63928
|
-
component: sdkBlock.id,
|
|
63929
|
-
fields: sdkBlock.fields,
|
|
63930
|
-
slots: [],
|
|
63931
|
-
category: sdkBlock.category,
|
|
63932
|
-
tags: sdkBlock.tags,
|
|
63933
|
-
icon: sdkBlock.icon,
|
|
63934
|
-
layout: sdkBlock.layout,
|
|
63935
|
-
variants: sdkBlock.variants,
|
|
63936
|
-
defaultVariant: sdkBlock.defaultVariant,
|
|
63937
|
-
variantOptions: sdkBlock.variantOptions,
|
|
63938
|
-
previewCustomize: sdkBlock.previewCustomize,
|
|
63939
|
-
behaviours: {
|
|
63940
|
-
supportsThemeSwitching: true,
|
|
63941
|
-
inlineEditing: hasLayout,
|
|
63942
|
-
animation: hasLayout,
|
|
63943
|
-
paletteHidden: false
|
|
63944
|
-
}
|
|
63945
|
-
});
|
|
64081
|
+
function boundaryBetweenBlocks(previousBlock, nextBlock, boundaries) {
|
|
64082
|
+
const previousBlockId = previousBlock?.id ?? null;
|
|
64083
|
+
const nextBlockId = nextBlock?.id ?? null;
|
|
64084
|
+
if (!previousBlockId || !nextBlockId) return null;
|
|
64085
|
+
return boundaries.get(boundaryKey(previousBlockId, nextBlockId)) ?? null;
|
|
63946
64086
|
}
|
|
63947
|
-
|
|
63948
|
-
|
|
63949
|
-
|
|
63950
|
-
|
|
63951
|
-
|
|
63952
|
-
|
|
63953
|
-
|
|
64087
|
+
function renderBoundaryAfterBlock(input) {
|
|
64088
|
+
const previousBlockId = input.block.id;
|
|
64089
|
+
const nextBlockId = input.nextBlock?.id ?? null;
|
|
64090
|
+
if (!previousBlockId || !nextBlockId) return null;
|
|
64091
|
+
const boundary = input.boundaryByAdjacentBlockIds.get(boundaryKey(previousBlockId, nextBlockId));
|
|
64092
|
+
if (!boundary) return null;
|
|
64093
|
+
const rendered = /* @__PURE__ */ jsx("div", {
|
|
64094
|
+
"aria-hidden": "true",
|
|
64095
|
+
"data-block-boundary": "",
|
|
64096
|
+
"data-boundary-id": boundary.boundaryId,
|
|
64097
|
+
"data-boundary-previous-block-id": boundary.previousBlockId,
|
|
64098
|
+
"data-boundary-next-block-id": boundary.nextBlockId,
|
|
64099
|
+
"data-style-group": boundary.styleGroup,
|
|
64100
|
+
style: boundaryCssVarsStyle(boundary)
|
|
64101
|
+
}, `${input.blockKey}:boundary`);
|
|
64102
|
+
return input.wrapBoundary ? input.wrapBoundary(boundary, rendered) : rendered;
|
|
64103
|
+
}
|
|
64104
|
+
function boundaryCssVarsStyle(boundary) {
|
|
63954
64105
|
return {
|
|
63955
|
-
|
|
63956
|
-
|
|
64106
|
+
"--site-style-transition-from": boundary.cssVars.from,
|
|
64107
|
+
"--site-style-transition-to": boundary.cssVars.to
|
|
63957
64108
|
};
|
|
63958
64109
|
}
|
|
63959
|
-
|
|
63960
|
-
|
|
63961
|
-
const
|
|
63962
|
-
|
|
63963
|
-
return blockKind.startsWith("custom.");
|
|
63964
|
-
}
|
|
63965
|
-
function transformToBlockDescriptor(sdkBlock, source = "sdk") {
|
|
64110
|
+
function boundaryReserveCssVarsStyle(input) {
|
|
64111
|
+
const before = input.before?.metrics.reserveCss ?? null;
|
|
64112
|
+
const after = input.after?.metrics.reserveCss ?? null;
|
|
64113
|
+
if (!before && !after) return void 0;
|
|
63966
64114
|
return {
|
|
63967
|
-
|
|
63968
|
-
|
|
63969
|
-
description: sdkBlock.description,
|
|
63970
|
-
category: sdkBlock.category,
|
|
63971
|
-
tags: sdkBlock.tags,
|
|
63972
|
-
icon: sdkBlock.icon,
|
|
63973
|
-
definition: transformSdkBlockToDefinition(sdkBlock),
|
|
63974
|
-
source
|
|
64115
|
+
...before ? { "--site-style-boundary-before-reserve": before } : {},
|
|
64116
|
+
...after ? { "--site-style-boundary-after-reserve": after } : {}
|
|
63975
64117
|
};
|
|
63976
64118
|
}
|
|
63977
|
-
function
|
|
64119
|
+
function transitionCssVarsStyle(content) {
|
|
64120
|
+
const transitionStyles = isObjectRecord$1(content._transitionStyles) ? content._transitionStyles : null;
|
|
64121
|
+
const cssVars = isObjectRecord$1(transitionStyles?.cssVars) ? transitionStyles.cssVars : null;
|
|
64122
|
+
const from = typeof cssVars?.from === "string" ? cssVars.from : null;
|
|
64123
|
+
const to = typeof cssVars?.to === "string" ? cssVars.to : null;
|
|
64124
|
+
if (!from && !to) return void 0;
|
|
63978
64125
|
return {
|
|
63979
|
-
|
|
63980
|
-
|
|
63981
|
-
source,
|
|
63982
|
-
descriptor: transformToBlockDescriptor(manifest, source.kind === "managed-database" ? "database" : "sdk")
|
|
64126
|
+
...from ? { "--site-style-transition-from": from } : {},
|
|
64127
|
+
...to ? { "--site-style-transition-to": to } : {}
|
|
63983
64128
|
};
|
|
63984
64129
|
}
|
|
63985
|
-
function
|
|
63986
|
-
|
|
63987
|
-
|
|
63988
|
-
const entriesByKind = /* @__PURE__ */ new Map();
|
|
63989
|
-
const conflicts = [];
|
|
63990
|
-
for (const customBlock of customBlocks) entriesByKind.set(customBlock.manifest.id, toResolvedCustomBlock(customBlock.manifest, customBlock.source));
|
|
63991
|
-
for (const sdkBlock of sdkConfig?.customBlocks ?? []) {
|
|
63992
|
-
const existing = entriesByKind.get(sdkBlock.id);
|
|
63993
|
-
if (existing) {
|
|
63994
|
-
conflicts.push({
|
|
63995
|
-
kind: "conflict",
|
|
63996
|
-
blockKind: existing.blockKind,
|
|
63997
|
-
winner: existing.source,
|
|
63998
|
-
loser: { kind: "sdk-config" },
|
|
63999
|
-
reason: "db-canonical-sdk-fallback"
|
|
64000
|
-
});
|
|
64001
|
-
continue;
|
|
64002
|
-
}
|
|
64003
|
-
entriesByKind.set(sdkBlock.id, toResolvedCustomBlock(sdkBlock, { kind: "sdk-config" }));
|
|
64004
|
-
}
|
|
64005
|
-
return {
|
|
64006
|
-
policy,
|
|
64007
|
-
entries: Array.from(entriesByKind.values()),
|
|
64008
|
-
conflicts
|
|
64009
|
-
};
|
|
64010
|
-
}
|
|
64011
|
-
}
|
|
64012
|
-
}
|
|
64013
|
-
function createCustomBlockRegistry({ sdkConfig, customBlocks = [], policy = defaultCustomBlockSourcePolicy, onConflict }) {
|
|
64014
|
-
const plan = planCustomBlockRegistryResolution({
|
|
64015
|
-
sdkConfig,
|
|
64016
|
-
customBlocks,
|
|
64017
|
-
policy
|
|
64018
|
-
});
|
|
64019
|
-
const entriesByKind = new Map(plan.entries.map((entry) => [entry.blockKind, entry]));
|
|
64020
|
-
for (const conflict of plan.conflicts) onConflict?.(`Using ${sourceLabel(conflict.winner)} custom block "${conflict.blockKind}" - ${sourceLabel(conflict.loser)} block is fallback only`);
|
|
64130
|
+
function mergeStyleObjects(left, right) {
|
|
64131
|
+
if (!left) return right;
|
|
64132
|
+
if (!right) return left;
|
|
64021
64133
|
return {
|
|
64022
|
-
|
|
64023
|
-
|
|
64024
|
-
findManifest: (blockKind) => {
|
|
64025
|
-
if (!isCustomBlockKind(blockKind)) return void 0;
|
|
64026
|
-
return entriesByKind.get(blockKind);
|
|
64027
|
-
}
|
|
64134
|
+
...left,
|
|
64135
|
+
...right
|
|
64028
64136
|
};
|
|
64029
64137
|
}
|
|
64030
|
-
function
|
|
64031
|
-
|
|
64032
|
-
|
|
64033
|
-
|
|
64034
|
-
|
|
64035
|
-
default: return assertNever$24(source);
|
|
64036
|
-
}
|
|
64138
|
+
function pageBlockPosition(index, blockCount) {
|
|
64139
|
+
if (blockCount <= 1) return "only";
|
|
64140
|
+
if (index === 0) return "first";
|
|
64141
|
+
if (index === blockCount - 1) return "last";
|
|
64142
|
+
return "middle";
|
|
64037
64143
|
}
|
|
64038
64144
|
//#endregion
|
|
64039
64145
|
//#region ../blocks/src/PageRenderer.tsx
|
|
64040
|
-
function PageRenderer$1(
|
|
64146
|
+
function PageRenderer$1(props) {
|
|
64147
|
+
const { page, runtimeBoundaries, usePlaceholders = false, dataContext, wrapBlock, wrapBoundary, registry, routeMap, blockOverrides, sdkConfig, customBlocks, previewAuthoring } = props;
|
|
64041
64148
|
const imageResolveContext = React$1.useMemo(() => resolvePageRendererImageResolveContext(dataContext), [
|
|
64042
64149
|
dataContext?.imageResolveContext,
|
|
64043
64150
|
dataContext?.mediaAssets,
|
|
@@ -64046,12 +64153,16 @@ function PageRenderer$1({ theme, page, runtimeBoundaries, usePlaceholders = fals
|
|
|
64046
64153
|
]);
|
|
64047
64154
|
const boundaryByAdjacentBlockIds = React$1.useMemo(() => boundaryMapForAdjacentBlockIds(runtimeBoundaries ?? []), [runtimeBoundaries]);
|
|
64048
64155
|
const usesRuntimeBoundaries = runtimeBoundaries !== void 0;
|
|
64156
|
+
const themeResources = React$1.useMemo(() => resolvePageThemeResources(props), [
|
|
64157
|
+
props.rendering,
|
|
64158
|
+
props.theme,
|
|
64159
|
+
props.themeTokens
|
|
64160
|
+
]);
|
|
64049
64161
|
if (!page || page.blocks.length === 0) return /* @__PURE__ */ jsx("div", {
|
|
64050
64162
|
className: "rb-p-6 rb-caption",
|
|
64051
64163
|
style: textColorStyle("mutedText"),
|
|
64052
64164
|
children: "No blocks found."
|
|
64053
64165
|
});
|
|
64054
|
-
const themeTokens = providedThemeTokens ?? buildThemeRuntime$1(theme).tokens;
|
|
64055
64166
|
const resolvedRegistry = registry ?? getDefaultComponentRegistry();
|
|
64056
64167
|
setContextResolveImageUrlContext(imageResolveContext);
|
|
64057
64168
|
return /* @__PURE__ */ jsx("div", { children: page.blocks.map((block, index) => {
|
|
@@ -64074,22 +64185,14 @@ function PageRenderer$1({ theme, page, runtimeBoundaries, usePlaceholders = fals
|
|
|
64074
64185
|
const renderableContent = getRenderableContent(block, dataContext?.previewStage);
|
|
64075
64186
|
const variantKey = definition?.manifest ? resolveVariantKey(definition.manifest, renderableContent) : null;
|
|
64076
64187
|
const shouldUseWrapper = !managesOwnWrapper || Boolean(wrapBlock);
|
|
64077
|
-
const blockSectionProps = {
|
|
64078
|
-
|
|
64079
|
-
|
|
64188
|
+
const blockSectionProps = buildBlockSectionProps({
|
|
64189
|
+
props,
|
|
64190
|
+
themeResources,
|
|
64080
64191
|
block,
|
|
64081
|
-
usePlaceholders,
|
|
64082
|
-
dataContext,
|
|
64083
64192
|
blockKey,
|
|
64084
|
-
registry: resolvedRegistry,
|
|
64085
|
-
routeMap,
|
|
64086
|
-
wrapBlock,
|
|
64087
|
-
blockOverrides,
|
|
64088
|
-
sdkConfig,
|
|
64089
|
-
customBlocks,
|
|
64090
64193
|
imageResolveContext,
|
|
64091
|
-
|
|
64092
|
-
};
|
|
64194
|
+
registry: resolvedRegistry
|
|
64195
|
+
});
|
|
64093
64196
|
if (!shouldUseWrapper) {
|
|
64094
64197
|
const rendered = /* @__PURE__ */ jsx(MemoBlockSection, { ...blockSectionProps }, `${blockKey}:block`);
|
|
64095
64198
|
return boundaryElement ? /* @__PURE__ */ jsxs(React$1.Fragment, { children: [rendered, boundaryElement] }, blockKey) : rendered;
|
|
@@ -64131,81 +64234,6 @@ function PageRenderer$1({ theme, page, runtimeBoundaries, usePlaceholders = fals
|
|
|
64131
64234
|
})] }, blockKey);
|
|
64132
64235
|
}) });
|
|
64133
64236
|
}
|
|
64134
|
-
function isSiteStyleTransitionStyleGroup(value) {
|
|
64135
|
-
return value?.startsWith("site-style-transition-") === true;
|
|
64136
|
-
}
|
|
64137
|
-
function boundaryMapForAdjacentBlockIds(boundaries) {
|
|
64138
|
-
return new Map(boundaries.map((boundary) => [boundaryKey(boundary.previousBlockId, boundary.nextBlockId), boundary]));
|
|
64139
|
-
}
|
|
64140
|
-
function boundaryKey(previousBlockId, nextBlockId) {
|
|
64141
|
-
return `${previousBlockId}\u0000${nextBlockId}`;
|
|
64142
|
-
}
|
|
64143
|
-
function boundaryBetweenBlocks(previousBlock, nextBlock, boundaryByAdjacentBlockIds) {
|
|
64144
|
-
const previousBlockId = previousBlock?.id ?? null;
|
|
64145
|
-
const nextBlockId = nextBlock?.id ?? null;
|
|
64146
|
-
if (!previousBlockId || !nextBlockId) return null;
|
|
64147
|
-
return boundaryByAdjacentBlockIds.get(boundaryKey(previousBlockId, nextBlockId)) ?? null;
|
|
64148
|
-
}
|
|
64149
|
-
function renderBoundaryAfterBlock(input) {
|
|
64150
|
-
const previousBlockId = input.block.id;
|
|
64151
|
-
const nextBlockId = input.nextBlock?.id ?? null;
|
|
64152
|
-
if (!previousBlockId || !nextBlockId) return null;
|
|
64153
|
-
const boundary = input.boundaryByAdjacentBlockIds.get(boundaryKey(previousBlockId, nextBlockId));
|
|
64154
|
-
if (!boundary) return null;
|
|
64155
|
-
const rendered = /* @__PURE__ */ jsx("div", {
|
|
64156
|
-
"aria-hidden": "true",
|
|
64157
|
-
"data-block-boundary": "",
|
|
64158
|
-
"data-boundary-id": boundary.boundaryId,
|
|
64159
|
-
"data-boundary-previous-block-id": boundary.previousBlockId,
|
|
64160
|
-
"data-boundary-next-block-id": boundary.nextBlockId,
|
|
64161
|
-
"data-style-group": boundary.styleGroup,
|
|
64162
|
-
style: boundaryCssVarsStyle(boundary)
|
|
64163
|
-
}, `${input.blockKey}:boundary`);
|
|
64164
|
-
return input.wrapBoundary ? input.wrapBoundary(boundary, rendered) : rendered;
|
|
64165
|
-
}
|
|
64166
|
-
function boundaryCssVarsStyle(boundary) {
|
|
64167
|
-
return {
|
|
64168
|
-
"--site-style-transition-from": boundary.cssVars.from,
|
|
64169
|
-
"--site-style-transition-to": boundary.cssVars.to
|
|
64170
|
-
};
|
|
64171
|
-
}
|
|
64172
|
-
function boundaryReserveCssVarsStyle(input) {
|
|
64173
|
-
const before = input.before ? boundaryReserveValueForTreatment(input.before) : null;
|
|
64174
|
-
const after = input.after ? boundaryReserveValueForTreatment(input.after) : null;
|
|
64175
|
-
if (!before && !after) return void 0;
|
|
64176
|
-
return {
|
|
64177
|
-
...before ? { "--site-style-boundary-before-reserve": before } : {},
|
|
64178
|
-
...after ? { "--site-style-boundary-after-reserve": after } : {}
|
|
64179
|
-
};
|
|
64180
|
-
}
|
|
64181
|
-
function boundaryReserveValueForTreatment(boundary) {
|
|
64182
|
-
return boundary.metrics.reserveCss;
|
|
64183
|
-
}
|
|
64184
|
-
function transitionCssVarsStyle(content) {
|
|
64185
|
-
const transitionStyles = isObjectRecord$1(content._transitionStyles) ? content._transitionStyles : null;
|
|
64186
|
-
const cssVars = isObjectRecord$1(transitionStyles?.cssVars) ? transitionStyles.cssVars : null;
|
|
64187
|
-
const from = typeof cssVars?.from === "string" ? cssVars.from : null;
|
|
64188
|
-
const to = typeof cssVars?.to === "string" ? cssVars.to : null;
|
|
64189
|
-
if (!from && !to) return void 0;
|
|
64190
|
-
return {
|
|
64191
|
-
...from ? { "--site-style-transition-from": from } : {},
|
|
64192
|
-
...to ? { "--site-style-transition-to": to } : {}
|
|
64193
|
-
};
|
|
64194
|
-
}
|
|
64195
|
-
function mergeStyleObjects(left, right) {
|
|
64196
|
-
if (!left) return right;
|
|
64197
|
-
if (!right) return left;
|
|
64198
|
-
return {
|
|
64199
|
-
...left,
|
|
64200
|
-
...right
|
|
64201
|
-
};
|
|
64202
|
-
}
|
|
64203
|
-
function pageBlockPosition(index, blockCount) {
|
|
64204
|
-
if (blockCount <= 1) return "only";
|
|
64205
|
-
if (index === 0) return "first";
|
|
64206
|
-
if (index === blockCount - 1) return "last";
|
|
64207
|
-
return "middle";
|
|
64208
|
-
}
|
|
64209
64237
|
function resolvePageRendererImageResolveContext(dataContext) {
|
|
64210
64238
|
const input = dataContext?.imageResolveContext;
|
|
64211
64239
|
return buildResolveImageUrlContext({
|
|
@@ -64215,6 +64243,23 @@ function resolvePageRendererImageResolveContext(dataContext) {
|
|
|
64215
64243
|
mediaAssets: input?.mediaAssets ?? dataContext?.mediaAssets
|
|
64216
64244
|
});
|
|
64217
64245
|
}
|
|
64246
|
+
function buildBlockSectionProps(input) {
|
|
64247
|
+
return {
|
|
64248
|
+
themeResources: input.themeResources,
|
|
64249
|
+
block: input.block,
|
|
64250
|
+
usePlaceholders: input.props.usePlaceholders ?? false,
|
|
64251
|
+
dataContext: input.props.dataContext,
|
|
64252
|
+
blockKey: input.blockKey,
|
|
64253
|
+
registry: input.registry,
|
|
64254
|
+
routeMap: input.props.routeMap,
|
|
64255
|
+
wrapBlock: input.props.wrapBlock,
|
|
64256
|
+
blockOverrides: input.props.blockOverrides,
|
|
64257
|
+
sdkConfig: input.props.sdkConfig,
|
|
64258
|
+
customBlocks: input.props.customBlocks,
|
|
64259
|
+
imageResolveContext: input.imageResolveContext,
|
|
64260
|
+
previewAuthoring: input.props.previewAuthoring
|
|
64261
|
+
};
|
|
64262
|
+
}
|
|
64218
64263
|
/**
|
|
64219
64264
|
* Look up a block override component by block kind.
|
|
64220
64265
|
* Supports both full ("block.hero") and short ("hero") keys.
|
|
@@ -64281,7 +64326,7 @@ function getCachedValidator(manifest, flavour) {
|
|
|
64281
64326
|
* referential equality of all props that affect rendering. Standard React.memo
|
|
64282
64327
|
* wouldn't catch all the render triggers from the editor store.
|
|
64283
64328
|
*/
|
|
64284
|
-
const MemoBlockSection = React$1.memo(function MemoBlockSection({
|
|
64329
|
+
const MemoBlockSection = React$1.memo(function MemoBlockSection({ themeResources, block, usePlaceholders, dataContext, registry, routeMap, wrapBlock, blockOverrides, sdkConfig, customBlocks, imageResolveContext, previewAuthoring }) {
|
|
64285
64330
|
const perfStart = globalThis.process?.env?.DEBUG_PERF === "1" && typeof window === "undefined" ? Date.now() : 0;
|
|
64286
64331
|
const fallbackImageResolveContext = getCurrentResolveImageUrlContext();
|
|
64287
64332
|
const resolvedImageResolveContext = imageResolveContext ?? fallbackImageResolveContext;
|
|
@@ -64302,6 +64347,7 @@ const MemoBlockSection = React$1.memo(function MemoBlockSection({ themeTokens, t
|
|
|
64302
64347
|
return node;
|
|
64303
64348
|
}
|
|
64304
64349
|
const OverrideComponent = getBlockOverride(block.kind, blockOverrides);
|
|
64350
|
+
requireBlockOverride(themeResources, OverrideComponent, block.kind);
|
|
64305
64351
|
let definition = getBlockDefinition(block.kind);
|
|
64306
64352
|
if (!definition && block.kind.startsWith("custom.")) definition = createCustomBlockRegistry({
|
|
64307
64353
|
sdkConfig,
|
|
@@ -64314,8 +64360,7 @@ const MemoBlockSection = React$1.memo(function MemoBlockSection({ themeTokens, t
|
|
|
64314
64360
|
if (OverrideComponent) {
|
|
64315
64361
|
const rendered = /* @__PURE__ */ jsx(OverrideComponent, {
|
|
64316
64362
|
content: getRenderableContent(block, dataContext?.previewStage),
|
|
64317
|
-
|
|
64318
|
-
themeConfig,
|
|
64363
|
+
...overrideThemeProps(themeResources),
|
|
64319
64364
|
data: void 0,
|
|
64320
64365
|
siteId: dataContext?.siteId,
|
|
64321
64366
|
apiBaseUrl: dataContext?.apiBaseUrl,
|
|
@@ -64414,8 +64459,7 @@ const MemoBlockSection = React$1.memo(function MemoBlockSection({ themeTokens, t
|
|
|
64414
64459
|
const hasResolvedData = !!resolved && typeof resolved === "object" && Object.keys(resolved).length > 0;
|
|
64415
64460
|
const baseProps = {
|
|
64416
64461
|
content: hydratedContent,
|
|
64417
|
-
|
|
64418
|
-
themeConfig,
|
|
64462
|
+
...overrideThemeProps(themeResources),
|
|
64419
64463
|
data: resolved,
|
|
64420
64464
|
siteId: dataContext?.siteId,
|
|
64421
64465
|
apiBaseUrl: dataContext?.apiBaseUrl,
|
|
@@ -64435,6 +64479,7 @@ const MemoBlockSection = React$1.memo(function MemoBlockSection({ themeTokens, t
|
|
|
64435
64479
|
let rendered;
|
|
64436
64480
|
if (OverrideComponent) rendered = /* @__PURE__ */ jsx(OverrideComponent, { ...baseProps });
|
|
64437
64481
|
else {
|
|
64482
|
+
requireThemeResources(themeResources, block.kind);
|
|
64438
64483
|
const BlockComponent = getCachedBlockComponent(definition.manifest);
|
|
64439
64484
|
const pathBase = typeof block.id === "string" && block.id.length > 0 ? `blocks.${block.id}.` : void 0;
|
|
64440
64485
|
const rootContext = { $root: {
|
|
@@ -64484,7 +64529,7 @@ const MemoBlockSection = React$1.memo(function MemoBlockSection({ themeTokens, t
|
|
|
64484
64529
|
});
|
|
64485
64530
|
}
|
|
64486
64531
|
}, (prev, next) => {
|
|
64487
|
-
return prev.block === next.block && prev.registry === next.registry && prev.dataContext === next.dataContext && prev.
|
|
64532
|
+
return prev.block === next.block && prev.registry === next.registry && prev.dataContext === next.dataContext && prev.themeResources === next.themeResources && prev.routeMap === next.routeMap && prev.usePlaceholders === next.usePlaceholders && prev.wrapBlock === next.wrapBlock && prev.blockOverrides === next.blockOverrides && prev.sdkConfig === next.sdkConfig && prev.customBlocks === next.customBlocks && prev.imageResolveContext === next.imageResolveContext && prev.previewAuthoring === next.previewAuthoring;
|
|
64488
64533
|
});
|
|
64489
64534
|
function fallback(message) {
|
|
64490
64535
|
return /* @__PURE__ */ jsx("div", {
|
|
@@ -83010,8 +83055,9 @@ function toBlocksImageResolveContextInput(context) {
|
|
|
83010
83055
|
mediaAssets: toBlocksMediaAssets(context.mediaAssets)
|
|
83011
83056
|
};
|
|
83012
83057
|
}
|
|
83013
|
-
|
|
83014
|
-
|
|
83058
|
+
function isOverrideOnlyPageRenderer(props) {
|
|
83059
|
+
return props.rendering?.kind === "overrides-only";
|
|
83060
|
+
}
|
|
83015
83061
|
function normalizeSdkCustomBlocks(customBlocks) {
|
|
83016
83062
|
if (!customBlocks) return void 0;
|
|
83017
83063
|
return customBlocks.map((block) => {
|
|
@@ -83042,15 +83088,23 @@ function toBlocksPageRendererDataContext(dataContext) {
|
|
|
83042
83088
|
}
|
|
83043
83089
|
function PageRenderer(props) {
|
|
83044
83090
|
const blocksSdkConfig = props.sdkConfig ? { customBlocks: normalizeSdkCustomBlocks(props.sdkConfig.customBlocks) } : props.sdkConfig;
|
|
83045
|
-
const
|
|
83046
|
-
const
|
|
83047
|
-
...
|
|
83048
|
-
theme: blocksTheme,
|
|
83091
|
+
const { rendering: _rendering, theme: _theme, themeTokens: _themeTokens, ...commonProps } = props;
|
|
83092
|
+
const commonBlocksProps = {
|
|
83093
|
+
...commonProps,
|
|
83049
83094
|
dataContext: props.dataContext ? toBlocksPageRendererDataContext(props.dataContext) : void 0,
|
|
83050
83095
|
blockOverrides: toBlocksBlockOverrides(props.blockOverrides),
|
|
83051
83096
|
sdkConfig: blocksSdkConfig,
|
|
83052
83097
|
customBlocks: normalizeSdkCustomBlocks(props.customBlocks)
|
|
83053
83098
|
};
|
|
83099
|
+
const blocksProps = isOverrideOnlyPageRenderer(props) ? {
|
|
83100
|
+
...commonBlocksProps,
|
|
83101
|
+
rendering: { kind: "overrides-only" },
|
|
83102
|
+
blockOverrides: toBlocksBlockOverrides(props.blockOverrides) ?? {}
|
|
83103
|
+
} : {
|
|
83104
|
+
...commonBlocksProps,
|
|
83105
|
+
theme: parseBlocksTheme(props.theme),
|
|
83106
|
+
themeTokens: props.themeTokens
|
|
83107
|
+
};
|
|
83054
83108
|
return React$1.createElement(PageRenderer$1, blocksProps);
|
|
83055
83109
|
}
|
|
83056
83110
|
//#endregion
|
|
@@ -83081,159 +83135,108 @@ function renderWithSdkThemeRuntime({ themeRuntime, theme, children }) {
|
|
|
83081
83135
|
default: return assertNever$24(themeRuntime);
|
|
83082
83136
|
}
|
|
83083
83137
|
}
|
|
83084
|
-
|
|
83085
|
-
|
|
83086
|
-
|
|
83087
|
-
|
|
83088
|
-
|
|
83089
|
-
|
|
83090
|
-
|
|
83091
|
-
|
|
83092
|
-
}
|
|
83093
|
-
function PageContent({ page, runtimeBoundaries, theme, themeTokens: providedTokens, siteId, resolvedData, bookingOfferingPresets, routeMap, pagesByIdentifier, entriesByIdentifier, wrapBlock, registry, usePlaceholders = false, blockOverrides, sdkConfig, customBlocks, supabaseUrl, mediaAssets, apiBaseUrl, portalToken, previewToken, dataContext, themeRuntime = defaultPageThemeRuntime }) {
|
|
83094
|
-
const baseTokens = providedTokens ?? buildThemeRuntime(theme).tokens;
|
|
83095
|
-
return renderWithSdkThemeRuntime({
|
|
83096
|
-
themeRuntime,
|
|
83097
|
-
theme,
|
|
83098
|
-
children: /* @__PURE__ */ jsx(PageRenderer, {
|
|
83099
|
-
theme,
|
|
83100
|
-
page,
|
|
83101
|
-
runtimeBoundaries,
|
|
83102
|
-
themeTokens: sdkConfig?.theme?.palette ? {
|
|
83103
|
-
...baseTokens,
|
|
83104
|
-
palette: {
|
|
83105
|
-
...baseTokens.palette,
|
|
83106
|
-
...sdkConfig.theme.palette
|
|
83107
|
-
}
|
|
83108
|
-
} : baseTokens,
|
|
83109
|
-
usePlaceholders,
|
|
83110
|
-
dataContext: {
|
|
83111
|
-
siteId,
|
|
83112
|
-
apiBaseUrl,
|
|
83113
|
-
portalToken,
|
|
83114
|
-
previewToken,
|
|
83115
|
-
resolvedData,
|
|
83116
|
-
bookingOfferingPresets: bookingOfferingPresets ?? [],
|
|
83117
|
-
routes: routeMap,
|
|
83118
|
-
pagesByIdentifier,
|
|
83119
|
-
entriesByIdentifier,
|
|
83120
|
-
occurrenceContext: dataContext?.occurrenceContext ?? null,
|
|
83121
|
-
entrySubrouteContext: dataContext?.entrySubrouteContext ?? null,
|
|
83122
|
-
contentEntry: dataContext?.contentEntry ?? null,
|
|
83123
|
-
pageSurface: dataContext?.pageSurface ?? null,
|
|
83124
|
-
subject: dataContext?.subject ?? null,
|
|
83125
|
-
editableRouteMetadataFieldIds: dataContext?.editableRouteMetadataFieldIds ?? null,
|
|
83126
|
-
previewStage: dataContext?.previewStage,
|
|
83127
|
-
supabaseUrl,
|
|
83128
|
-
mediaAssets,
|
|
83129
|
-
imageResolveContext: {
|
|
83130
|
-
siteId,
|
|
83131
|
-
supabaseUrl,
|
|
83132
|
-
mediaAssets
|
|
83133
|
-
}
|
|
83134
|
-
},
|
|
83135
|
-
routeMap,
|
|
83136
|
-
wrapBlock,
|
|
83137
|
-
registry,
|
|
83138
|
-
blockOverrides,
|
|
83139
|
-
sdkConfig: sdkConfig ? { customBlocks: sdkConfig.customBlocks } : null,
|
|
83140
|
-
customBlocks
|
|
83141
|
-
})
|
|
83142
|
-
});
|
|
83143
|
-
}
|
|
83144
|
-
//#endregion
|
|
83145
|
-
//#region src/rendering/components/Page.server.tsx
|
|
83146
|
-
function Page(props) {
|
|
83147
|
-
return /* @__PURE__ */ jsx(PageContent, { ...props });
|
|
83148
|
-
}
|
|
83149
|
-
//#endregion
|
|
83150
|
-
//#region src/rendering/overrides.ts
|
|
83151
|
-
const lazyBlockOverrideSymbol = Symbol.for("riverbankcms.sdk.lazyBlockOverride");
|
|
83152
|
-
//#endregion
|
|
83153
|
-
//#region src/rendering/overrideResolution.ts
|
|
83154
|
-
function isRecord(value) {
|
|
83155
|
-
return typeof value === "object" && value !== null;
|
|
83156
|
-
}
|
|
83157
|
-
function isBlockOutlineLike(value) {
|
|
83158
|
-
const id = value.id;
|
|
83159
|
-
return typeof value.kind === "string" && (typeof id === "string" || id === null) && (typeof value.purpose === "string" || isRecord(value.content) || isRecord(value.draftContent) || isRecord(value.bindings));
|
|
83160
|
-
}
|
|
83161
|
-
/**
|
|
83162
|
-
* Walk a page's block tree and collect override candidate kinds.
|
|
83163
|
-
*
|
|
83164
|
-
* The CMS block contract is structural at this boundary: nested blocks can live
|
|
83165
|
-
* inside custom block content, so traversal cannot rely on a fixed property
|
|
83166
|
-
* name. To avoid matching arbitrary content such as `{ kind: "video" }`, only
|
|
83167
|
-
* objects with a block identity (`id` plus `kind`) and at least one block
|
|
83168
|
-
* contract field (`purpose`, `content`, `draftContent`, or `bindings`) count.
|
|
83169
|
-
*/
|
|
83170
|
-
function collectBlockKindsFromValue(value, usedKinds, seen) {
|
|
83171
|
-
if (!isRecord(value)) return;
|
|
83172
|
-
if (seen.has(value)) return;
|
|
83173
|
-
seen.add(value);
|
|
83174
|
-
if (isBlockOutlineLike(value)) usedKinds.add(value.kind);
|
|
83175
|
-
for (const child of Object.values(value)) {
|
|
83176
|
-
if (Array.isArray(child)) {
|
|
83177
|
-
for (const item of child) collectBlockKindsFromValue(item, usedKinds, seen);
|
|
83178
|
-
continue;
|
|
83179
|
-
}
|
|
83180
|
-
collectBlockKindsFromValue(child, usedKinds, seen);
|
|
83181
|
-
}
|
|
83182
|
-
}
|
|
83183
|
-
function collectUsedBlockKindsFromPageOutline(page) {
|
|
83184
|
-
const usedKinds = /* @__PURE__ */ new Set();
|
|
83185
|
-
const seen = /* @__PURE__ */ new WeakSet();
|
|
83186
|
-
for (const block of page?.blocks ?? []) collectBlockKindsFromValue(block, usedKinds, seen);
|
|
83187
|
-
return usedKinds;
|
|
83188
|
-
}
|
|
83189
|
-
function buildPageBlockKindIndex(page) {
|
|
83190
|
-
return {
|
|
83191
|
-
kind: "page-block-kind-index",
|
|
83192
|
-
blockKinds: collectUsedBlockKindsFromPageOutline(page)
|
|
83193
|
-
};
|
|
83194
|
-
}
|
|
83195
|
-
function shortBlockKind(blockKind) {
|
|
83196
|
-
return blockKind.replace(/^block\./, "");
|
|
83197
|
-
}
|
|
83198
|
-
function selectOverrideKeysForUsedKinds(usedKinds, entries) {
|
|
83199
|
-
const availableKeys = new Set(entries.map(([key]) => key));
|
|
83200
|
-
const selectedKeys = /* @__PURE__ */ new Set();
|
|
83201
|
-
for (const blockKind of usedKinds) {
|
|
83202
|
-
if (availableKeys.has(blockKind)) {
|
|
83203
|
-
selectedKeys.add(blockKind);
|
|
83204
|
-
continue;
|
|
83205
|
-
}
|
|
83206
|
-
const shortKind = shortBlockKind(blockKind);
|
|
83207
|
-
if (availableKeys.has(shortKind)) selectedKeys.add(shortKind);
|
|
83138
|
+
function renderWithOverrideOnlyRuntime({ runtime, children }) {
|
|
83139
|
+
switch (runtime.kind) {
|
|
83140
|
+
case "responsive-only": return /* @__PURE__ */ jsx(ResponsiveScope, {
|
|
83141
|
+
responsiveMode: runtime.responsiveMode,
|
|
83142
|
+
children
|
|
83143
|
+
});
|
|
83144
|
+
case "none": return /* @__PURE__ */ jsx(Fragment, { children });
|
|
83145
|
+
default: return assertNever$24(runtime);
|
|
83208
83146
|
}
|
|
83209
|
-
return selectedKeys;
|
|
83210
83147
|
}
|
|
83211
|
-
|
|
83212
|
-
|
|
83148
|
+
//#endregion
|
|
83149
|
+
//#region src/rendering/components/pageShared.tsx
|
|
83150
|
+
function isOverrideOnlyPage(props) {
|
|
83151
|
+
return props.rendering?.kind === "overrides-only";
|
|
83213
83152
|
}
|
|
83214
|
-
|
|
83215
|
-
|
|
83216
|
-
return
|
|
83153
|
+
function resolvePageThemeTokens(props) {
|
|
83154
|
+
const baseTokens = props.themeTokens ?? buildThemeRuntime(props.theme).tokens;
|
|
83155
|
+
return props.sdkConfig?.theme?.palette ? {
|
|
83156
|
+
...baseTokens,
|
|
83157
|
+
palette: {
|
|
83158
|
+
...baseTokens.palette,
|
|
83159
|
+
...props.sdkConfig.theme.palette
|
|
83160
|
+
}
|
|
83161
|
+
} : baseTokens;
|
|
83217
83162
|
}
|
|
83218
|
-
|
|
83219
|
-
|
|
83220
|
-
|
|
83221
|
-
|
|
83222
|
-
|
|
83223
|
-
|
|
83224
|
-
|
|
83225
|
-
|
|
83226
|
-
|
|
83227
|
-
const
|
|
83228
|
-
|
|
83229
|
-
|
|
83230
|
-
|
|
83231
|
-
|
|
83232
|
-
|
|
83233
|
-
|
|
83234
|
-
|
|
83235
|
-
|
|
83236
|
-
|
|
83163
|
+
function toPageHydrationBootstrapConfig(props) {
|
|
83164
|
+
return {
|
|
83165
|
+
siteId: props.siteId,
|
|
83166
|
+
supabaseUrl: props.supabaseUrl,
|
|
83167
|
+
mediaAssets: props.mediaAssets
|
|
83168
|
+
};
|
|
83169
|
+
}
|
|
83170
|
+
function PageContent(props) {
|
|
83171
|
+
const { page, runtimeBoundaries, siteId, resolvedData, bookingOfferingPresets, routeMap, pagesByIdentifier, entriesByIdentifier, wrapBlock, registry, usePlaceholders = false, blockOverrides, sdkConfig, customBlocks, supabaseUrl, mediaAssets, apiBaseUrl, portalToken, previewToken, dataContext } = props;
|
|
83172
|
+
const rendererCommonProps = {
|
|
83173
|
+
page,
|
|
83174
|
+
runtimeBoundaries,
|
|
83175
|
+
usePlaceholders,
|
|
83176
|
+
dataContext: {
|
|
83177
|
+
siteId,
|
|
83178
|
+
apiBaseUrl,
|
|
83179
|
+
portalToken,
|
|
83180
|
+
previewToken,
|
|
83181
|
+
resolvedData,
|
|
83182
|
+
bookingOfferingPresets: bookingOfferingPresets ?? [],
|
|
83183
|
+
routes: routeMap,
|
|
83184
|
+
pagesByIdentifier,
|
|
83185
|
+
entriesByIdentifier,
|
|
83186
|
+
occurrenceContext: dataContext?.occurrenceContext ?? null,
|
|
83187
|
+
entrySubrouteContext: dataContext?.entrySubrouteContext ?? null,
|
|
83188
|
+
contentEntry: dataContext?.contentEntry ?? null,
|
|
83189
|
+
pageSurface: dataContext?.pageSurface ?? null,
|
|
83190
|
+
subject: dataContext?.subject ?? null,
|
|
83191
|
+
editableRouteMetadataFieldIds: dataContext?.editableRouteMetadataFieldIds ?? null,
|
|
83192
|
+
previewStage: dataContext?.previewStage,
|
|
83193
|
+
supabaseUrl,
|
|
83194
|
+
mediaAssets,
|
|
83195
|
+
imageResolveContext: {
|
|
83196
|
+
siteId,
|
|
83197
|
+
supabaseUrl,
|
|
83198
|
+
mediaAssets
|
|
83199
|
+
}
|
|
83200
|
+
},
|
|
83201
|
+
routeMap,
|
|
83202
|
+
wrapBlock,
|
|
83203
|
+
registry,
|
|
83204
|
+
sdkConfig: sdkConfig ? { customBlocks: sdkConfig.customBlocks } : null,
|
|
83205
|
+
customBlocks
|
|
83206
|
+
};
|
|
83207
|
+
const content = isOverrideOnlyPage(props) ? /* @__PURE__ */ jsx(PageRenderer, {
|
|
83208
|
+
...rendererCommonProps,
|
|
83209
|
+
rendering: { kind: "overrides-only" },
|
|
83210
|
+
blockOverrides: props.blockOverrides
|
|
83211
|
+
}) : /* @__PURE__ */ jsx(PageRenderer, {
|
|
83212
|
+
...rendererCommonProps,
|
|
83213
|
+
theme: props.theme,
|
|
83214
|
+
themeTokens: resolvePageThemeTokens(props),
|
|
83215
|
+
blockOverrides
|
|
83216
|
+
});
|
|
83217
|
+
return isOverrideOnlyPage(props) ? renderWithOverrideOnlyRuntime({
|
|
83218
|
+
runtime: props.rendering.runtime,
|
|
83219
|
+
children: content
|
|
83220
|
+
}) : renderWithSdkThemeRuntime({
|
|
83221
|
+
themeRuntime: props.themeRuntime ?? defaultPageThemeRuntime,
|
|
83222
|
+
theme: props.theme,
|
|
83223
|
+
children: content
|
|
83224
|
+
});
|
|
83225
|
+
}
|
|
83226
|
+
//#endregion
|
|
83227
|
+
//#region src/rendering/renderingMode.ts
|
|
83228
|
+
const defaultOverrideOnlyRuntime = { kind: "responsive-only" };
|
|
83229
|
+
function normalizeSdkRenderingMode(input) {
|
|
83230
|
+
return input.rendering?.kind === "overrides-only" ? {
|
|
83231
|
+
kind: "overrides-only",
|
|
83232
|
+
runtime: input.rendering.runtime ?? defaultOverrideOnlyRuntime
|
|
83233
|
+
} : {
|
|
83234
|
+
kind: "themed",
|
|
83235
|
+
themeRuntime: input.themeRuntime
|
|
83236
|
+
};
|
|
83237
|
+
}
|
|
83238
|
+
function themeRuntimeForRendering(rendering) {
|
|
83239
|
+
return rendering.kind === "themed" ? rendering.themeRuntime : rendering.runtime;
|
|
83237
83240
|
}
|
|
83238
83241
|
//#endregion
|
|
83239
83242
|
//#region src/metadata/generatePageMetadata.ts
|
|
@@ -84306,7 +84309,7 @@ var CircuitOpenError = class extends Error {
|
|
|
84306
84309
|
* 1. This constant
|
|
84307
84310
|
* 2. The "version" field in package.json
|
|
84308
84311
|
*/
|
|
84309
|
-
const SDK_VERSION = "0.
|
|
84312
|
+
const SDK_VERSION = "0.129.0";
|
|
84310
84313
|
//#endregion
|
|
84311
84314
|
//#region src/next/content-load-failure.ts
|
|
84312
84315
|
const SdkContentLoadError = RiverbankContentLoadError;
|
|
@@ -84467,6 +84470,159 @@ function appendSearchToRedirectDestination(destination, incomingSearch) {
|
|
|
84467
84470
|
return `${destination.slice(0, hashIndex)}?${search}${destination.slice(hashIndex)}`;
|
|
84468
84471
|
}
|
|
84469
84472
|
//#endregion
|
|
84473
|
+
//#region src/rendering/components/Page.server.tsx
|
|
84474
|
+
function Page(props) {
|
|
84475
|
+
return /* @__PURE__ */ jsx(PageContent, { ...props });
|
|
84476
|
+
}
|
|
84477
|
+
//#endregion
|
|
84478
|
+
//#region src/rendering/overrides.ts
|
|
84479
|
+
const lazyBlockOverrideSymbol = Symbol.for("riverbankcms.sdk.lazyBlockOverride");
|
|
84480
|
+
//#endregion
|
|
84481
|
+
//#region src/rendering/overrideResolution.ts
|
|
84482
|
+
function isRecord(value) {
|
|
84483
|
+
return typeof value === "object" && value !== null;
|
|
84484
|
+
}
|
|
84485
|
+
function isBlockOutlineLike(value) {
|
|
84486
|
+
const id = value.id;
|
|
84487
|
+
return typeof value.kind === "string" && (typeof id === "string" || id === null) && (typeof value.purpose === "string" || isRecord(value.content) || isRecord(value.draftContent) || isRecord(value.bindings));
|
|
84488
|
+
}
|
|
84489
|
+
/**
|
|
84490
|
+
* Walk a page's block tree and collect override candidate kinds.
|
|
84491
|
+
*
|
|
84492
|
+
* The CMS block contract is structural at this boundary: nested blocks can live
|
|
84493
|
+
* inside custom block content, so traversal cannot rely on a fixed property
|
|
84494
|
+
* name. To avoid matching arbitrary content such as `{ kind: "video" }`, only
|
|
84495
|
+
* objects with a block identity (`id` plus `kind`) and at least one block
|
|
84496
|
+
* contract field (`purpose`, `content`, `draftContent`, or `bindings`) count.
|
|
84497
|
+
*/
|
|
84498
|
+
function collectBlockKindsFromValue(value, usedKinds, seen) {
|
|
84499
|
+
if (!isRecord(value)) return;
|
|
84500
|
+
if (seen.has(value)) return;
|
|
84501
|
+
seen.add(value);
|
|
84502
|
+
if (isBlockOutlineLike(value)) usedKinds.add(value.kind);
|
|
84503
|
+
for (const child of Object.values(value)) {
|
|
84504
|
+
if (Array.isArray(child)) {
|
|
84505
|
+
for (const item of child) collectBlockKindsFromValue(item, usedKinds, seen);
|
|
84506
|
+
continue;
|
|
84507
|
+
}
|
|
84508
|
+
collectBlockKindsFromValue(child, usedKinds, seen);
|
|
84509
|
+
}
|
|
84510
|
+
}
|
|
84511
|
+
function collectUsedBlockKindsFromPageOutline(page) {
|
|
84512
|
+
const usedKinds = /* @__PURE__ */ new Set();
|
|
84513
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
84514
|
+
for (const block of page?.blocks ?? []) collectBlockKindsFromValue(block, usedKinds, seen);
|
|
84515
|
+
return usedKinds;
|
|
84516
|
+
}
|
|
84517
|
+
function buildPageBlockKindIndex(page) {
|
|
84518
|
+
return {
|
|
84519
|
+
kind: "page-block-kind-index",
|
|
84520
|
+
blockKinds: collectUsedBlockKindsFromPageOutline(page)
|
|
84521
|
+
};
|
|
84522
|
+
}
|
|
84523
|
+
function shortBlockKind(blockKind) {
|
|
84524
|
+
return blockKind.replace(/^block\./, "");
|
|
84525
|
+
}
|
|
84526
|
+
function selectOverrideKeysForUsedKinds(usedKinds, entries) {
|
|
84527
|
+
const availableKeys = new Set(entries.map(([key]) => key));
|
|
84528
|
+
const selectedKeys = /* @__PURE__ */ new Set();
|
|
84529
|
+
for (const blockKind of usedKinds) {
|
|
84530
|
+
if (availableKeys.has(blockKind)) {
|
|
84531
|
+
selectedKeys.add(blockKind);
|
|
84532
|
+
continue;
|
|
84533
|
+
}
|
|
84534
|
+
const shortKind = shortBlockKind(blockKind);
|
|
84535
|
+
if (availableKeys.has(shortKind)) selectedKeys.add(shortKind);
|
|
84536
|
+
}
|
|
84537
|
+
return selectedKeys;
|
|
84538
|
+
}
|
|
84539
|
+
function isLazyRegistration(registration) {
|
|
84540
|
+
return isRecord(registration) && registration[lazyBlockOverrideSymbol] === true;
|
|
84541
|
+
}
|
|
84542
|
+
async function resolveOverrideComponent(registration) {
|
|
84543
|
+
if (isLazyRegistration(registration)) return registration.load();
|
|
84544
|
+
return registration;
|
|
84545
|
+
}
|
|
84546
|
+
/**
|
|
84547
|
+
* Resolve only override registrations used by the current page or template.
|
|
84548
|
+
*
|
|
84549
|
+
* Eager components are passed through unchanged. Lazy registrations created
|
|
84550
|
+
* with `defineLazyBlockOverride()` are loaded only after their block kind is
|
|
84551
|
+
* found in the rendered block tree.
|
|
84552
|
+
*/
|
|
84553
|
+
async function resolveBlockOverridesForPage(registrations, page) {
|
|
84554
|
+
if (!registrations) return void 0;
|
|
84555
|
+
const entries = Object.entries(registrations);
|
|
84556
|
+
if (entries.length === 0) return void 0;
|
|
84557
|
+
const selectedKeys = selectOverrideKeysForUsedKinds(buildPageBlockKindIndex(page).blockKinds, entries);
|
|
84558
|
+
if (selectedKeys.size === 0) return void 0;
|
|
84559
|
+
const resolved = {};
|
|
84560
|
+
for (const [key, registration] of entries) {
|
|
84561
|
+
if (!selectedKeys.has(key)) continue;
|
|
84562
|
+
resolved[key] = await resolveOverrideComponent(registration);
|
|
84563
|
+
}
|
|
84564
|
+
return resolved;
|
|
84565
|
+
}
|
|
84566
|
+
//#endregion
|
|
84567
|
+
//#region src/next/renderSdkContent.tsx
|
|
84568
|
+
async function renderPage(input, page, dataContext) {
|
|
84569
|
+
const resolvedOverrides = await resolveBlockOverridesForPage(input.blockOverrides, page);
|
|
84570
|
+
const commonProps = {
|
|
84571
|
+
page,
|
|
84572
|
+
siteId: input.content.siteId,
|
|
84573
|
+
apiBaseUrl: input.apiBaseUrl,
|
|
84574
|
+
portalToken: input.portalToken,
|
|
84575
|
+
resolvedData: input.content.resolvedData,
|
|
84576
|
+
bookingOfferingPresets: input.content.bookingOfferingPresets,
|
|
84577
|
+
sdkConfig: input.content.sdkConfig,
|
|
84578
|
+
supabaseUrl: input.content.supabaseUrl,
|
|
84579
|
+
mediaAssets: input.content.mediaAssets,
|
|
84580
|
+
dataContext
|
|
84581
|
+
};
|
|
84582
|
+
return input.kind === "overrides-only" ? /* @__PURE__ */ jsx(Page, {
|
|
84583
|
+
...commonProps,
|
|
84584
|
+
rendering: input.rendering,
|
|
84585
|
+
blockOverrides: resolvedOverrides ?? {}
|
|
84586
|
+
}) : /* @__PURE__ */ jsx(Page, {
|
|
84587
|
+
...commonProps,
|
|
84588
|
+
theme: input.theme,
|
|
84589
|
+
themeRuntime: input.themeRuntime,
|
|
84590
|
+
blockOverrides: resolvedOverrides
|
|
84591
|
+
});
|
|
84592
|
+
}
|
|
84593
|
+
async function renderSdkContent(input) {
|
|
84594
|
+
const previewStage = input.preview ? "preview" : "published";
|
|
84595
|
+
const occurrenceContext = input.entrySubrouteContext?.kind === "event-occurrence" ? input.entrySubrouteContext.occurrence : null;
|
|
84596
|
+
const render = (page, dataContext) => renderPage(input, page, dataContext);
|
|
84597
|
+
if (isPageContent(input.content)) return {
|
|
84598
|
+
kind: "rendered",
|
|
84599
|
+
node: await render(input.content.page, { previewStage })
|
|
84600
|
+
};
|
|
84601
|
+
if (isEntryContent(input.content)) {
|
|
84602
|
+
if (!input.content.templatePage) return { kind: "not-found" };
|
|
84603
|
+
return {
|
|
84604
|
+
kind: "rendered",
|
|
84605
|
+
node: await render(input.content.templatePage, {
|
|
84606
|
+
contentEntry: input.content.dataContext.contentEntry,
|
|
84607
|
+
occurrenceContext,
|
|
84608
|
+
entrySubrouteContext: input.entrySubrouteContext,
|
|
84609
|
+
previewStage
|
|
84610
|
+
})
|
|
84611
|
+
};
|
|
84612
|
+
}
|
|
84613
|
+
if (!isPageSurfaceContent(input.content) || !input.content.templatePage) return { kind: "not-found" };
|
|
84614
|
+
return {
|
|
84615
|
+
kind: "rendered",
|
|
84616
|
+
node: await render(input.content.templatePage, {
|
|
84617
|
+
occurrenceContext,
|
|
84618
|
+
entrySubrouteContext: input.entrySubrouteContext,
|
|
84619
|
+
pageSurface: input.content.dataContext.pageSurface,
|
|
84620
|
+
subject: input.content.dataContext.subject,
|
|
84621
|
+
previewStage
|
|
84622
|
+
})
|
|
84623
|
+
};
|
|
84624
|
+
}
|
|
84625
|
+
//#endregion
|
|
84470
84626
|
//#region src/next/catch-all.tsx
|
|
84471
84627
|
function throwUpstreamContentError(path, resolution) {
|
|
84472
84628
|
throw new RiverbankContentLoadError(`Riverbank content load failed for ${path}: ${resolution.error.message}`, {
|
|
@@ -84476,14 +84632,34 @@ function throwUpstreamContentError(path, resolution) {
|
|
|
84476
84632
|
});
|
|
84477
84633
|
}
|
|
84478
84634
|
function createCatchAllRuntime(options) {
|
|
84635
|
+
validateCatchAllRenderingOptions(options);
|
|
84636
|
+
const preview = options.preview ?? detectPreviewFromClient(options.getClient);
|
|
84637
|
+
const rendering = normalizeSdkRenderingMode({
|
|
84638
|
+
rendering: options.rendering,
|
|
84639
|
+
themeRuntime: options.themeRuntime ?? defaultCatchAllThemeRuntime
|
|
84640
|
+
});
|
|
84479
84641
|
return {
|
|
84480
84642
|
options,
|
|
84481
|
-
preview
|
|
84643
|
+
preview,
|
|
84482
84644
|
enablePortal: options.enablePortal ?? options.config.enablePortal ?? false,
|
|
84483
84645
|
contentTypes: (options.config.content?.contentTypes ?? []).map(toRoutingInfo),
|
|
84484
|
-
|
|
84646
|
+
rendering,
|
|
84647
|
+
themeRuntime: themeRuntimeForRendering(rendering)
|
|
84485
84648
|
};
|
|
84486
84649
|
}
|
|
84650
|
+
var InvalidCatchAllRenderingOptionsError = class extends Error {
|
|
84651
|
+
constructor(code) {
|
|
84652
|
+
super(code === "missing_block_overrides" ? "Override-only rendering requires blockOverrides." : code === "theme_runtime_in_overrides_only" ? "Override-only rendering owns its runtime wrapper; remove themeRuntime." : "Override-only rendering cannot be combined with theme resolution options.");
|
|
84653
|
+
this.code = code;
|
|
84654
|
+
this.name = "InvalidCatchAllRenderingOptionsError";
|
|
84655
|
+
}
|
|
84656
|
+
};
|
|
84657
|
+
function validateCatchAllRenderingOptions(options) {
|
|
84658
|
+
if (options.rendering?.kind !== "overrides-only") return;
|
|
84659
|
+
if (!options.blockOverrides) throw new InvalidCatchAllRenderingOptionsError("missing_block_overrides");
|
|
84660
|
+
if ("themeRuntime" in options) throw new InvalidCatchAllRenderingOptionsError("theme_runtime_in_overrides_only");
|
|
84661
|
+
if ("theme" in options || "themes" in options || "themeSwitch" in options || "getTheme" in options) throw new InvalidCatchAllRenderingOptionsError("theme_option_in_overrides_only");
|
|
84662
|
+
}
|
|
84487
84663
|
const pageNotFoundMetadata = () => ({
|
|
84488
84664
|
title: "Page Not Found",
|
|
84489
84665
|
robots: {
|
|
@@ -84621,6 +84797,7 @@ async function resolveCatchAllTheme(runtime, input) {
|
|
|
84621
84797
|
path: input.path,
|
|
84622
84798
|
preview: runtime.preview,
|
|
84623
84799
|
themeRuntime: runtime.themeRuntime,
|
|
84800
|
+
rendering: runtime.rendering,
|
|
84624
84801
|
searchParams: input.searchParams,
|
|
84625
84802
|
config: runtime.options.config,
|
|
84626
84803
|
themeKey: requestedThemeKey(runtime, input.searchParams)
|
|
@@ -84637,60 +84814,6 @@ async function resolveCatchAllTheme(runtime, input) {
|
|
|
84637
84814
|
context
|
|
84638
84815
|
});
|
|
84639
84816
|
}
|
|
84640
|
-
async function renderPageComponent(runtime, input) {
|
|
84641
|
-
const resolvedBlockOverrides = await resolveBlockOverridesForPage(runtime.options.blockOverrides, input.page);
|
|
84642
|
-
return /* @__PURE__ */ jsx(Page, {
|
|
84643
|
-
page: input.page,
|
|
84644
|
-
theme: input.theme,
|
|
84645
|
-
siteId: input.content.siteId,
|
|
84646
|
-
apiBaseUrl: input.apiBaseUrl,
|
|
84647
|
-
portalToken: input.portalToken,
|
|
84648
|
-
resolvedData: input.content.resolvedData,
|
|
84649
|
-
bookingOfferingPresets: input.content.bookingOfferingPresets,
|
|
84650
|
-
blockOverrides: resolvedBlockOverrides,
|
|
84651
|
-
sdkConfig: input.content.sdkConfig,
|
|
84652
|
-
supabaseUrl: input.content.supabaseUrl,
|
|
84653
|
-
mediaAssets: input.content.mediaAssets,
|
|
84654
|
-
themeRuntime: runtime.themeRuntime,
|
|
84655
|
-
dataContext: input.dataContext
|
|
84656
|
-
});
|
|
84657
|
-
}
|
|
84658
|
-
async function renderSdkContent(runtime, input) {
|
|
84659
|
-
const previewStage = runtime.preview ? "preview" : "published";
|
|
84660
|
-
const occurrenceContext = input.entrySubrouteContext?.kind === "event-occurrence" ? input.entrySubrouteContext.occurrence : null;
|
|
84661
|
-
const render = (page, dataContext) => renderPageComponent(runtime, {
|
|
84662
|
-
...input,
|
|
84663
|
-
page,
|
|
84664
|
-
dataContext
|
|
84665
|
-
});
|
|
84666
|
-
if (isPageContent(input.content)) return {
|
|
84667
|
-
kind: "rendered",
|
|
84668
|
-
node: await render(input.content.page, { previewStage })
|
|
84669
|
-
};
|
|
84670
|
-
if (isEntryContent(input.content)) {
|
|
84671
|
-
if (!input.content.templatePage) return { kind: "not-found" };
|
|
84672
|
-
return {
|
|
84673
|
-
kind: "rendered",
|
|
84674
|
-
node: await render(input.content.templatePage, {
|
|
84675
|
-
contentEntry: input.content.dataContext.contentEntry,
|
|
84676
|
-
occurrenceContext,
|
|
84677
|
-
entrySubrouteContext: input.entrySubrouteContext,
|
|
84678
|
-
previewStage
|
|
84679
|
-
})
|
|
84680
|
-
};
|
|
84681
|
-
}
|
|
84682
|
-
if (!isPageSurfaceContent(input.content) || !input.content.templatePage) return { kind: "not-found" };
|
|
84683
|
-
return {
|
|
84684
|
-
kind: "rendered",
|
|
84685
|
-
node: await render(input.content.templatePage, {
|
|
84686
|
-
occurrenceContext,
|
|
84687
|
-
entrySubrouteContext: input.entrySubrouteContext,
|
|
84688
|
-
pageSurface: input.content.dataContext.pageSurface,
|
|
84689
|
-
subject: input.content.dataContext.subject,
|
|
84690
|
-
previewStage
|
|
84691
|
-
})
|
|
84692
|
-
};
|
|
84693
|
-
}
|
|
84694
84817
|
async function renderResolvedCatchAllPage(runtime, input) {
|
|
84695
84818
|
if (runtime.options.beforeRender) {
|
|
84696
84819
|
const intercepted = await runtime.options.beforeRender({
|
|
@@ -84698,20 +84821,36 @@ async function renderResolvedCatchAllPage(runtime, input) {
|
|
|
84698
84821
|
path: input.path,
|
|
84699
84822
|
preview: runtime.preview,
|
|
84700
84823
|
themeRuntime: runtime.themeRuntime,
|
|
84824
|
+
rendering: runtime.rendering,
|
|
84701
84825
|
searchParams: input.searchParams
|
|
84702
84826
|
});
|
|
84703
84827
|
if (intercepted !== null) return wrapCatchAllNode(runtime, intercepted);
|
|
84704
84828
|
}
|
|
84705
|
-
const
|
|
84706
|
-
if (themeResult.kind === "not-found") return notFound();
|
|
84707
|
-
if (themeResult.warning) console.warn(themeResult.warning);
|
|
84708
|
-
const rendered = await renderSdkContent(runtime, {
|
|
84829
|
+
const commonRenderInput = {
|
|
84709
84830
|
apiBaseUrl: input.apiBaseUrl,
|
|
84710
84831
|
content: input.content,
|
|
84711
84832
|
entrySubrouteContext: input.entrySubrouteContext,
|
|
84712
|
-
portalToken: input.portalToken
|
|
84713
|
-
|
|
84714
|
-
|
|
84833
|
+
portalToken: input.portalToken
|
|
84834
|
+
};
|
|
84835
|
+
const rendered = runtime.rendering.kind === "overrides-only" ? await renderSdkContent({
|
|
84836
|
+
...commonRenderInput,
|
|
84837
|
+
blockOverrides: runtime.options.blockOverrides,
|
|
84838
|
+
kind: "overrides-only",
|
|
84839
|
+
preview: runtime.preview,
|
|
84840
|
+
rendering: runtime.rendering
|
|
84841
|
+
}) : await (async () => {
|
|
84842
|
+
const themeResult = await resolveCatchAllTheme(runtime, input);
|
|
84843
|
+
if (themeResult.kind === "not-found") return notFound();
|
|
84844
|
+
if (themeResult.warning) console.warn(themeResult.warning);
|
|
84845
|
+
return renderSdkContent({
|
|
84846
|
+
...commonRenderInput,
|
|
84847
|
+
blockOverrides: runtime.options.blockOverrides,
|
|
84848
|
+
kind: "themed",
|
|
84849
|
+
preview: runtime.preview,
|
|
84850
|
+
theme: themeResult.theme,
|
|
84851
|
+
themeRuntime: runtime.themeRuntime
|
|
84852
|
+
});
|
|
84853
|
+
})();
|
|
84715
84854
|
if (rendered.kind === "not-found") return notFound();
|
|
84716
84855
|
return wrapCatchAllNode(runtime, /* @__PURE__ */ jsxs("main", { children: [/* @__PURE__ */ jsx(BlocksIslandsHydrator, { ...toPageHydrationBootstrapConfig({
|
|
84717
84856
|
siteId: input.content.siteId,
|
|
@@ -84776,6 +84915,7 @@ async function resolveCatchAllMetadata(runtime, input) {
|
|
|
84776
84915
|
path: input.path,
|
|
84777
84916
|
preview: runtime.preview,
|
|
84778
84917
|
themeRuntime: runtime.themeRuntime,
|
|
84918
|
+
rendering: runtime.rendering,
|
|
84779
84919
|
searchParams: input.searchParams
|
|
84780
84920
|
});
|
|
84781
84921
|
const resolvedUrl = runtime.options.siteUrl ?? (runtime.preview ? runtime.options.config.previewUrl : runtime.options.config.liveUrl) ?? "";
|
|
@@ -86794,4 +86934,4 @@ function getISRConfig() {
|
|
|
86794
86934
|
};
|
|
86795
86935
|
}
|
|
86796
86936
|
//#endregion
|
|
86797
|
-
export { ISR_REVALIDATE_SECONDS, RiverbankContentLoadError, SdkContentLoadError, classifyContentLoadError, createCatchAllPage, createGenerateStaticParams, createRobots, createSitemap, generateAllStaticParams, getISRConfig, isSdkContentLoadError, normalizeStaticRoutePath, pathToSlugArray, routesToStaticParams, toContentLoadFailureLogFields, validateStaticParamsEnv };
|
|
86937
|
+
export { ISR_REVALIDATE_SECONDS, InvalidCatchAllRenderingOptionsError, RiverbankContentLoadError, SdkContentLoadError, classifyContentLoadError, createCatchAllPage, createGenerateStaticParams, createRobots, createSitemap, generateAllStaticParams, getISRConfig, isSdkContentLoadError, normalizeStaticRoutePath, pathToSlugArray, routesToStaticParams, toContentLoadFailureLogFields, validateStaticParamsEnv };
|