@riverbankcms/sdk 0.70.2 → 0.70.3
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 +29 -0
- package/dist/_dts/sdk/src/cli/commands/delete.d.ts +3 -0
- package/dist/_dts/sdk/src/cli/commands/style.d.ts +18 -0
- package/dist/_dts/sdk/src/cli/helpers.d.ts +8 -33
- package/dist/_dts/sdk/src/cli/site-commands/oneOffCommands.d.ts +81 -0
- package/dist/_dts/sdk/src/components.d.ts +2 -1
- package/dist/_dts/sdk/src/next/types.d.ts +4 -2
- package/dist/_dts/sdk/src/rendering/index.d.ts +2 -1
- package/dist/_dts/sdk/src/rendering/overrideResolution.d.ts +10 -0
- package/dist/_dts/sdk/src/rendering/overrides.d.ts +12 -0
- package/dist/_dts/sdk/src/version.d.ts +1 -1
- package/dist/cli/index.mjs +678 -100
- package/dist/client/client.mjs +201 -201
- package/dist/client/rendering.mjs +25412 -25402
- package/dist/preview-next/client/runtime.mjs +8 -1
- package/dist/server/components.mjs +10 -0
- package/dist/server/index.mjs +1 -1
- package/dist/server/next.mjs +82 -3
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/rendering.mjs +10 -0
- package/dist/server/server.mjs +1 -1
- package/package.json +4 -3
|
@@ -94542,6 +94542,13 @@ function RichTextToolbar({
|
|
|
94542
94542
|
}
|
|
94543
94543
|
return toolbarEl;
|
|
94544
94544
|
}
|
|
94545
|
+
function shouldHandleRichTextActivationKey(container, target) {
|
|
94546
|
+
if (!(target instanceof HTMLElement)) return true;
|
|
94547
|
+
if (target === container) return true;
|
|
94548
|
+
return !target.closest(
|
|
94549
|
+
'[contenteditable="true"], .ProseMirror, input, textarea, select, button, a[href]'
|
|
94550
|
+
);
|
|
94551
|
+
}
|
|
94545
94552
|
function RichTextEditorSurface({
|
|
94546
94553
|
editor,
|
|
94547
94554
|
config,
|
|
@@ -94565,7 +94572,7 @@ function RichTextEditorSurface({
|
|
|
94565
94572
|
role: "button",
|
|
94566
94573
|
tabIndex: 0,
|
|
94567
94574
|
onKeyDown: (event) => {
|
|
94568
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
94575
|
+
if ((event.key === "Enter" || event.key === " ") && shouldHandleRichTextActivationKey(event.currentTarget, event.target)) {
|
|
94569
94576
|
event.preventDefault();
|
|
94570
94577
|
onClick();
|
|
94571
94578
|
}
|
|
@@ -56249,6 +56249,15 @@ function resolveImageUrlWithContext2(value, options, context, transformAspectRat
|
|
|
56249
56249
|
function resolveImageSourceSetWithContext2(value, options, context) {
|
|
56250
56250
|
return resolveImageSourceSetWithContext(value, options, context);
|
|
56251
56251
|
}
|
|
56252
|
+
|
|
56253
|
+
// src/rendering/overrides.ts
|
|
56254
|
+
var lazyBlockOverrideSymbol = /* @__PURE__ */ Symbol.for("riverbankcms.sdk.lazyBlockOverride");
|
|
56255
|
+
function defineLazyBlockOverride(load) {
|
|
56256
|
+
return {
|
|
56257
|
+
[lazyBlockOverrideSymbol]: true,
|
|
56258
|
+
load
|
|
56259
|
+
};
|
|
56260
|
+
}
|
|
56252
56261
|
export {
|
|
56253
56262
|
ImagePresets2 as ImagePresets,
|
|
56254
56263
|
Layout,
|
|
@@ -56257,6 +56266,7 @@ export {
|
|
|
56257
56266
|
RichText3 as RichText,
|
|
56258
56267
|
ThemeScope2 as ThemeScope,
|
|
56259
56268
|
buildThemeRuntime2 as buildThemeRuntime,
|
|
56269
|
+
defineLazyBlockOverride,
|
|
56260
56270
|
resolveImageSourceSetWithContext2 as resolveImageSourceSetWithContext,
|
|
56261
56271
|
resolveImageUrl2 as resolveImageUrl,
|
|
56262
56272
|
resolveImageUrlWithContext2 as resolveImageUrlWithContext
|
package/dist/server/index.mjs
CHANGED
package/dist/server/next.mjs
CHANGED
|
@@ -57097,6 +57097,83 @@ function Page(props2) {
|
|
|
57097
57097
|
return /* @__PURE__ */ jsx59(PageContent, { ...props2 });
|
|
57098
57098
|
}
|
|
57099
57099
|
|
|
57100
|
+
// src/rendering/overrides.ts
|
|
57101
|
+
var lazyBlockOverrideSymbol = /* @__PURE__ */ Symbol.for("riverbankcms.sdk.lazyBlockOverride");
|
|
57102
|
+
|
|
57103
|
+
// src/rendering/overrideResolution.ts
|
|
57104
|
+
function isRecord6(value) {
|
|
57105
|
+
return typeof value === "object" && value !== null;
|
|
57106
|
+
}
|
|
57107
|
+
function isBlockOutlineLike(value) {
|
|
57108
|
+
const id = value.id;
|
|
57109
|
+
return typeof value.kind === "string" && (typeof id === "string" || id === null) && (typeof value.purpose === "string" || isRecord6(value.content) || isRecord6(value.draftContent) || isRecord6(value.bindings));
|
|
57110
|
+
}
|
|
57111
|
+
function collectBlockKindsFromValue(value, usedKinds, seen) {
|
|
57112
|
+
if (!isRecord6(value)) return;
|
|
57113
|
+
if (seen.has(value)) return;
|
|
57114
|
+
seen.add(value);
|
|
57115
|
+
if (isBlockOutlineLike(value)) {
|
|
57116
|
+
usedKinds.add(value.kind);
|
|
57117
|
+
}
|
|
57118
|
+
for (const child of Object.values(value)) {
|
|
57119
|
+
if (Array.isArray(child)) {
|
|
57120
|
+
for (const item of child) {
|
|
57121
|
+
collectBlockKindsFromValue(item, usedKinds, seen);
|
|
57122
|
+
}
|
|
57123
|
+
continue;
|
|
57124
|
+
}
|
|
57125
|
+
collectBlockKindsFromValue(child, usedKinds, seen);
|
|
57126
|
+
}
|
|
57127
|
+
}
|
|
57128
|
+
function collectUsedBlockKinds(page) {
|
|
57129
|
+
const usedKinds = /* @__PURE__ */ new Set();
|
|
57130
|
+
const seen = /* @__PURE__ */ new WeakSet();
|
|
57131
|
+
for (const block of page?.blocks ?? []) {
|
|
57132
|
+
collectBlockKindsFromValue(block, usedKinds, seen);
|
|
57133
|
+
}
|
|
57134
|
+
return usedKinds;
|
|
57135
|
+
}
|
|
57136
|
+
function shortBlockKind(blockKind) {
|
|
57137
|
+
return blockKind.replace(/^block\./, "");
|
|
57138
|
+
}
|
|
57139
|
+
function selectOverrideKeysForUsedKinds(usedKinds, entries) {
|
|
57140
|
+
const availableKeys = new Set(entries.map(([key]) => key));
|
|
57141
|
+
const selectedKeys = /* @__PURE__ */ new Set();
|
|
57142
|
+
for (const blockKind of usedKinds) {
|
|
57143
|
+
if (availableKeys.has(blockKind)) {
|
|
57144
|
+
selectedKeys.add(blockKind);
|
|
57145
|
+
continue;
|
|
57146
|
+
}
|
|
57147
|
+
const shortKind = shortBlockKind(blockKind);
|
|
57148
|
+
if (availableKeys.has(shortKind)) {
|
|
57149
|
+
selectedKeys.add(shortKind);
|
|
57150
|
+
}
|
|
57151
|
+
}
|
|
57152
|
+
return selectedKeys;
|
|
57153
|
+
}
|
|
57154
|
+
function isLazyRegistration(registration) {
|
|
57155
|
+
return isRecord6(registration) && registration[lazyBlockOverrideSymbol] === true;
|
|
57156
|
+
}
|
|
57157
|
+
async function resolveOverrideComponent(registration) {
|
|
57158
|
+
if (isLazyRegistration(registration)) {
|
|
57159
|
+
return registration.load();
|
|
57160
|
+
}
|
|
57161
|
+
return registration;
|
|
57162
|
+
}
|
|
57163
|
+
async function resolveBlockOverridesForPage(registrations, page) {
|
|
57164
|
+
if (!registrations) return void 0;
|
|
57165
|
+
const entries = Object.entries(registrations);
|
|
57166
|
+
if (entries.length === 0) return void 0;
|
|
57167
|
+
const selectedKeys = selectOverrideKeysForUsedKinds(collectUsedBlockKinds(page), entries);
|
|
57168
|
+
if (selectedKeys.size === 0) return void 0;
|
|
57169
|
+
const resolved = {};
|
|
57170
|
+
for (const [key, registration] of entries) {
|
|
57171
|
+
if (!selectedKeys.has(key)) continue;
|
|
57172
|
+
resolved[key] = await resolveOverrideComponent(registration);
|
|
57173
|
+
}
|
|
57174
|
+
return resolved;
|
|
57175
|
+
}
|
|
57176
|
+
|
|
57100
57177
|
// src/metadata/generatePageMetadata.ts
|
|
57101
57178
|
function generatePageMetadata(input) {
|
|
57102
57179
|
const { page, site, path, siteUrl, overrides, googleSiteVerification, titleMode = "append-site-title" } = input;
|
|
@@ -57819,6 +57896,7 @@ function createCatchAllPage(options) {
|
|
|
57819
57896
|
const resolvedTheme = themeResult.theme;
|
|
57820
57897
|
let rendered;
|
|
57821
57898
|
if (isPageContent(content)) {
|
|
57899
|
+
const resolvedBlockOverrides = await resolveBlockOverridesForPage(blockOverrides, content.page);
|
|
57822
57900
|
rendered = /* @__PURE__ */ jsx60(
|
|
57823
57901
|
Page,
|
|
57824
57902
|
{
|
|
@@ -57828,7 +57906,7 @@ function createCatchAllPage(options) {
|
|
|
57828
57906
|
apiBaseUrl,
|
|
57829
57907
|
portalToken,
|
|
57830
57908
|
resolvedData: content.resolvedData,
|
|
57831
|
-
blockOverrides,
|
|
57909
|
+
blockOverrides: resolvedBlockOverrides,
|
|
57832
57910
|
sdkConfig: content.sdkConfig,
|
|
57833
57911
|
supabaseUrl: content.supabaseUrl,
|
|
57834
57912
|
mediaAssets: content.mediaAssets,
|
|
@@ -57842,6 +57920,7 @@ function createCatchAllPage(options) {
|
|
|
57842
57920
|
if (!content.templatePage) {
|
|
57843
57921
|
return notFound();
|
|
57844
57922
|
}
|
|
57923
|
+
const resolvedBlockOverrides = await resolveBlockOverridesForPage(blockOverrides, content.templatePage);
|
|
57845
57924
|
rendered = /* @__PURE__ */ jsx60(
|
|
57846
57925
|
Page,
|
|
57847
57926
|
{
|
|
@@ -57851,7 +57930,7 @@ function createCatchAllPage(options) {
|
|
|
57851
57930
|
apiBaseUrl,
|
|
57852
57931
|
portalToken,
|
|
57853
57932
|
resolvedData: content.resolvedData,
|
|
57854
|
-
blockOverrides,
|
|
57933
|
+
blockOverrides: resolvedBlockOverrides,
|
|
57855
57934
|
sdkConfig: content.sdkConfig,
|
|
57856
57935
|
supabaseUrl: content.supabaseUrl,
|
|
57857
57936
|
mediaAssets: content.mediaAssets,
|
|
@@ -58063,7 +58142,7 @@ var SimpleCache = class {
|
|
|
58063
58142
|
};
|
|
58064
58143
|
|
|
58065
58144
|
// src/version.ts
|
|
58066
|
-
var SDK_VERSION = "0.70.
|
|
58145
|
+
var SDK_VERSION = "0.70.3";
|
|
58067
58146
|
|
|
58068
58147
|
// src/client/error.ts
|
|
58069
58148
|
var RiverbankApiError = class _RiverbankApiError extends Error {
|
package/dist/server/prebuild.mjs
CHANGED
|
@@ -57611,6 +57611,15 @@ function resolveImageUrlWithContext2(value, options, context, transformAspectRat
|
|
|
57611
57611
|
function resolveImageSourceSetWithContext2(value, options, context) {
|
|
57612
57612
|
return resolveImageSourceSetWithContext(value, options, context);
|
|
57613
57613
|
}
|
|
57614
|
+
|
|
57615
|
+
// src/rendering/overrides.ts
|
|
57616
|
+
var lazyBlockOverrideSymbol = /* @__PURE__ */ Symbol.for("riverbankcms.sdk.lazyBlockOverride");
|
|
57617
|
+
function defineLazyBlockOverride(load) {
|
|
57618
|
+
return {
|
|
57619
|
+
[lazyBlockOverrideSymbol]: true,
|
|
57620
|
+
load
|
|
57621
|
+
};
|
|
57622
|
+
}
|
|
57614
57623
|
export {
|
|
57615
57624
|
Block,
|
|
57616
57625
|
ImagePresets2 as ImagePresets,
|
|
@@ -57620,6 +57629,7 @@ export {
|
|
|
57620
57629
|
RichText3 as RichText,
|
|
57621
57630
|
ThemeScope2 as ThemeScope,
|
|
57622
57631
|
buildThemeRuntime2 as buildThemeRuntime,
|
|
57632
|
+
defineLazyBlockOverride,
|
|
57623
57633
|
isEntryContent,
|
|
57624
57634
|
isPageContent,
|
|
57625
57635
|
loadContent,
|
package/dist/server/server.mjs
CHANGED
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@riverbankcms/sdk",
|
|
3
|
-
"version": "0.70.
|
|
3
|
+
"version": "0.70.3",
|
|
4
4
|
"description": "Riverbank CMS SDK for headless content consumption",
|
|
5
5
|
"main": "./dist/server/index.mjs",
|
|
6
6
|
"module": "./dist/server/index.mjs",
|
|
7
7
|
"types": "./dist/_dts/sdk/src/index.d.ts",
|
|
8
8
|
"imports": {
|
|
9
9
|
"#sdk-rendering-client": {
|
|
10
|
-
"types": "./dist/_dts/sdk/src/rendering/client.d.ts",
|
|
11
|
-
"import": "./dist/client/rendering/
|
|
10
|
+
"types": "./dist/_dts/sdk/src/rendering/islands/client.d.ts",
|
|
11
|
+
"import": "./dist/client/rendering/islands.mjs"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"bin": {
|
|
@@ -224,6 +224,7 @@
|
|
|
224
224
|
"lint": "eslint --cache --cache-location node_modules/.cache/eslint/.eslintcache src",
|
|
225
225
|
"test": "vitest run",
|
|
226
226
|
"test:edge-smoke": "sh -c \"cd src/next/__fixtures__/edge-theme-smoke && mkdir -p node_modules/@riverbankcms && ln -sfn ../../../../../.. node_modules/@riverbankcms/sdk && NEXT_TELEMETRY_DISABLED=1 next build\"",
|
|
227
|
+
"test:lazy-overrides-smoke": "node scripts/lazy-overrides-smoke.mjs",
|
|
227
228
|
"test:layout-page-hydration-smoke": "node scripts/layout-page-hydration-smoke.mjs",
|
|
228
229
|
"verify": "./verify.sh",
|
|
229
230
|
"cli": "tsx src/cli/index.ts"
|