@riverbankcms/sdk 0.4.1 → 0.4.2

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.
Files changed (101) hide show
  1. package/README.md +73 -0
  2. package/dist/cli/index.js +46 -5
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/client/client.d.mts +3 -3
  5. package/dist/client/client.d.ts +3 -3
  6. package/dist/client/client.js +80 -170
  7. package/dist/client/client.js.map +1 -1
  8. package/dist/client/client.mjs +80 -170
  9. package/dist/client/client.mjs.map +1 -1
  10. package/dist/client/hooks.d.mts +3 -3
  11. package/dist/client/hooks.d.ts +3 -3
  12. package/dist/client/rendering/client.d.mts +1 -1
  13. package/dist/client/rendering/client.d.ts +1 -1
  14. package/dist/client/rendering/client.js +80 -142
  15. package/dist/client/rendering/client.js.map +1 -1
  16. package/dist/client/rendering/client.mjs +80 -142
  17. package/dist/client/rendering/client.mjs.map +1 -1
  18. package/dist/client/resolver-CYyfzTQ9.d.mts +61 -0
  19. package/dist/client/resolver-CYyfzTQ9.d.ts +61 -0
  20. package/dist/client/usePage-BC8Q2E3t.d.mts +6431 -0
  21. package/dist/client/usePage-CHEybPMD.d.ts +6429 -0
  22. package/dist/client/usePage-D4fxZbRR.d.mts +6429 -0
  23. package/dist/client/usePage-DpRNZUtP.d.ts +6431 -0
  24. package/dist/server/{Layout-B_zUr9ci.d.mts → Layout-ByUnm35V.d.mts} +1 -1
  25. package/dist/server/{Layout-CHG77dhK.d.ts → Layout-kRv5sU81.d.ts} +1 -1
  26. package/dist/server/{chunk-ZIM53VP6.js → chunk-6JBKKV3G.js} +27 -4
  27. package/dist/server/chunk-6JBKKV3G.js.map +1 -0
  28. package/dist/server/{chunk-SFQ7VF3G.mjs → chunk-7BOIO2S7.mjs} +7 -5
  29. package/dist/server/{chunk-SFQ7VF3G.mjs.map → chunk-7BOIO2S7.mjs.map} +1 -1
  30. package/dist/server/{chunk-P6CDRJN3.js → chunk-BLKVTULP.js} +13 -11
  31. package/dist/server/chunk-BLKVTULP.js.map +1 -0
  32. package/dist/server/{chunk-BOHTTHY5.mjs → chunk-I6K5REFT.mjs} +27 -4
  33. package/dist/server/chunk-I6K5REFT.mjs.map +1 -0
  34. package/dist/server/{chunk-BUCJWG6G.js → chunk-NW5KHH4A.js} +5 -5
  35. package/dist/server/{chunk-BUCJWG6G.js.map → chunk-NW5KHH4A.js.map} +1 -1
  36. package/dist/server/{chunk-XK2YIISA.mjs → chunk-SPXMMX3C.mjs} +2 -2
  37. package/dist/server/{chunk-IT5ICP43.js → chunk-TKMA6D6U.js} +139 -229
  38. package/dist/server/chunk-TKMA6D6U.js.map +1 -0
  39. package/dist/server/{chunk-NKXS4TBK.mjs → chunk-TNRADRPH.mjs} +79 -169
  40. package/dist/server/chunk-TNRADRPH.mjs.map +1 -0
  41. package/dist/server/{components-Bo3LPpVb.d.mts → components-CY8jDQjv.d.mts} +20 -12
  42. package/dist/server/{components-ClFs4PUa.d.ts → components-D1Z2mSDr.d.ts} +20 -12
  43. package/dist/server/components.d.mts +5 -5
  44. package/dist/server/components.d.ts +5 -5
  45. package/dist/server/components.js +3 -3
  46. package/dist/server/components.mjs +2 -2
  47. package/dist/server/config-validation.d.mts +2 -2
  48. package/dist/server/config-validation.d.ts +2 -2
  49. package/dist/server/config-validation.js +3 -3
  50. package/dist/server/config-validation.mjs +2 -2
  51. package/dist/server/config.d.mts +3 -3
  52. package/dist/server/config.d.ts +3 -3
  53. package/dist/server/config.js +3 -3
  54. package/dist/server/config.mjs +2 -2
  55. package/dist/server/data.d.mts +2 -2
  56. package/dist/server/data.d.ts +2 -2
  57. package/dist/server/{index-DbSfrRA0.d.ts → index-DCIz9Ptv.d.ts} +1 -1
  58. package/dist/server/{index-Dj7VKH34.d.mts → index-DFQwtj3J.d.mts} +1 -1
  59. package/dist/server/index.d.mts +4 -4
  60. package/dist/server/index.d.ts +4 -4
  61. package/dist/server/{loadContent-C_FipaAC.d.mts → loadContent-CWuE8FCx.d.mts} +3 -3
  62. package/dist/server/{loadContent-C2SwqmXy.d.ts → loadContent-DynBuR5f.d.ts} +3 -3
  63. package/dist/server/{loadPage-mavT3Jae.d.mts → loadPage-B8RmlYgV.d.mts} +60 -27
  64. package/dist/server/{loadPage-naVvoua8.d.ts → loadPage-BTkKpizX.d.ts} +60 -27
  65. package/dist/server/metadata.d.mts +3 -3
  66. package/dist/server/metadata.d.ts +3 -3
  67. package/dist/server/navigation.d.mts +2 -2
  68. package/dist/server/navigation.d.ts +2 -2
  69. package/dist/server/rendering/server.d.mts +4 -4
  70. package/dist/server/rendering/server.d.ts +4 -4
  71. package/dist/server/rendering/server.js +4 -4
  72. package/dist/server/rendering/server.mjs +3 -3
  73. package/dist/server/rendering.d.mts +7 -7
  74. package/dist/server/rendering.d.ts +7 -7
  75. package/dist/server/rendering.js +4 -4
  76. package/dist/server/rendering.mjs +3 -3
  77. package/dist/server/routing.d.mts +78 -5
  78. package/dist/server/routing.d.ts +78 -5
  79. package/dist/server/routing.js +56 -2
  80. package/dist/server/routing.js.map +1 -1
  81. package/dist/server/routing.mjs +54 -0
  82. package/dist/server/routing.mjs.map +1 -1
  83. package/dist/server/server.d.mts +5 -5
  84. package/dist/server/server.d.ts +5 -5
  85. package/dist/server/theme-bridge.js +7 -7
  86. package/dist/server/theme-bridge.mjs +1 -1
  87. package/dist/server/{types-5XdVD2J1.d.ts → types-BiRZnxDx.d.ts} +17 -6
  88. package/dist/server/{types-CMqVHYLG.d.ts → types-CL916r6x.d.ts} +23 -1
  89. package/dist/server/{types-BA-J9K8r.d.mts → types-CdrJqlKx.d.mts} +17 -6
  90. package/dist/server/{types-BC9eB2KH.d.mts → types-DkKEctWn.d.mts} +1 -1
  91. package/dist/server/{types-CAnC529E.d.ts → types-oCM-fw4O.d.ts} +1 -1
  92. package/dist/server/{types-CYfHxUhe.d.mts → types-txWsSxN7.d.mts} +23 -1
  93. package/dist/server/{validation-C7W2Fe0i.d.ts → validation-CoU8uAiu.d.ts} +1 -1
  94. package/dist/server/{validation-hg1sqhrt.d.mts → validation-DzvDwwRo.d.mts} +1 -1
  95. package/package.json +1 -1
  96. package/dist/server/chunk-BOHTTHY5.mjs.map +0 -1
  97. package/dist/server/chunk-IT5ICP43.js.map +0 -1
  98. package/dist/server/chunk-NKXS4TBK.mjs.map +0 -1
  99. package/dist/server/chunk-P6CDRJN3.js.map +0 -1
  100. package/dist/server/chunk-ZIM53VP6.js.map +0 -1
  101. /package/dist/server/{chunk-XK2YIISA.mjs.map → chunk-SPXMMX3C.mjs.map} +0 -0
@@ -1,10 +1,10 @@
1
- import { R as RiverbankClient, S as SiteResponse } from './types-CAnC529E.js';
1
+ import { R as RiverbankClient, S as SiteResponse } from './types-oCM-fw4O.js';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import * as React$1 from 'react';
4
- import React__default, { ComponentType } from 'react';
4
+ import React__default from 'react';
5
5
  import { P as PageOutline, S as SdkCustomBlock } from './schema-Bpy9N5ZI.js';
6
6
  import { z } from 'zod';
7
- import { T as Theme } from './types-5XdVD2J1.js';
7
+ import { T as Theme } from './types-BiRZnxDx.js';
8
8
  import { R as ResolvedBlockData, D as DataLoaderOverrides } from './types-DuQCNVV0.js';
9
9
 
10
10
  declare const colorTokens: readonly ["background/base", "background/elevated", "surface/base", "surface/subtle", "surface/inverted", "content/primary", "content/secondary", "accent/primary", "accent/secondary", "border/base"];
@@ -64,22 +64,6 @@ type ResolverContext = {
64
64
  fragmentRegistry?: Record<string, any>;
65
65
  };
66
66
 
67
- type SystemBlockComponentProps<TContent = Record<string, unknown>> = {
68
- content: TContent;
69
- theme?: ThemeTokens;
70
- themeConfig?: Theme;
71
- registry?: ResolverContext["registry"];
72
- transforms?: TransformRegistry;
73
- viewModelOverrides?: Record<string, unknown>;
74
- data?: Record<string, unknown>;
75
- pathBase?: string;
76
- blockId?: string | null;
77
- blockKind?: string;
78
- blockBindings?: Record<string, unknown>;
79
- fragmentRegistry?: ResolverContext["fragmentRegistry"];
80
- };
81
- type SystemBlockComponent<TContent = Record<string, unknown>> = ComponentType<SystemBlockComponentProps<TContent>>;
82
-
83
67
  /**
84
68
  * Occurrence context for event pages.
85
69
  * Passed through to blocks that need occurrence information (e.g., event-registration).
@@ -101,15 +85,64 @@ type PageRendererDataContext = {
101
85
  occurrenceContext?: OccurrenceContextData | null;
102
86
  contentEntry?: Record<string, unknown> | null;
103
87
  };
88
+ /**
89
+ * Props passed to block override components.
90
+ *
91
+ * These props are RSC-safe (no functions) so overrides can be Client Components.
92
+ * Unlike internal SDK block components, overrides don't receive `registry` or
93
+ * `fragmentRegistry` which contain function references that can't cross the
94
+ * RSC serialization boundary.
95
+ *
96
+ * @example
97
+ * ```tsx
98
+ * 'use client';
99
+ *
100
+ * import type { BlockOverrideProps, HeroContent } from '@riverbankcms/sdk/rendering';
101
+ *
102
+ * export function CustomHero({ content, theme, data }: BlockOverrideProps<HeroContent>) {
103
+ * const [expanded, setExpanded] = useState(false);
104
+ * return <div>...</div>;
105
+ * }
106
+ * ```
107
+ */
108
+ type BlockOverrideProps<TContent = Record<string, unknown>> = {
109
+ /** Block content data */
110
+ content: TContent;
111
+ /** Theme tokens for styling */
112
+ theme?: ThemeTokens;
113
+ /** Full theme configuration */
114
+ themeConfig?: Theme;
115
+ /** Pre-fetched data from data loaders */
116
+ data?: Record<string, unknown>;
117
+ /** Block instance ID (null for unsaved blocks) */
118
+ blockId: string | null;
119
+ /** Block kind identifier (e.g., "block.hero" or "custom.my-block") */
120
+ blockKind: string;
121
+ };
104
122
  /**
105
123
  * Block override component type.
106
- * Override components receive the same props as default block components.
107
124
  *
108
- * Uses `any` for content type to allow typed components (e.g., SystemBlockComponentProps<HeroContent>)
109
- * to be used as overrides without type errors. The actual content type is validated at runtime
110
- * based on the block kind.
125
+ * Override components can be either Server Components or Client Components.
126
+ * They receive only serializable props (no functions) to support RSC boundaries.
127
+ *
128
+ * @example Server Component override
129
+ * ```tsx
130
+ * export function CustomHero({ content, theme, data }: BlockOverrideProps<HeroContent>) {
131
+ * return <div className="custom-hero">...</div>;
132
+ * }
133
+ * ```
134
+ *
135
+ * @example Client Component override
136
+ * ```tsx
137
+ * 'use client';
138
+ *
139
+ * export function CustomHero({ content, theme, data }: BlockOverrideProps<HeroContent>) {
140
+ * const [state, setState] = useState(null);
141
+ * return <div className="custom-hero">...</div>;
142
+ * }
143
+ * ```
111
144
  */
112
- type BlockOverrideComponent = SystemBlockComponent<any>;
145
+ type BlockOverrideComponent = React$1.ComponentType<BlockOverrideProps<any>>;
113
146
  /**
114
147
  * Map of block kinds to custom override components.
115
148
  * Keys can be either:
@@ -119,8 +152,8 @@ type BlockOverrideComponent = SystemBlockComponent<any>;
119
152
  * @example
120
153
  * ```tsx
121
154
  * const overrides: BlockOverrides = {
122
- * 'hero': CustomHero, // CustomHero: SystemBlockComponentProps<HeroContent>
123
- * 'bodyText': CustomBodyText, // CustomBodyText: SystemBlockComponentProps<BodyTextContent>
155
+ * 'hero': CustomHero, // CustomHero uses BlockOverrideProps<HeroContent>
156
+ * 'bodyText': CustomBodyText, // CustomBodyText uses BlockOverrideProps<BodyTextContent>
124
157
  * };
125
158
  * ```
126
159
  */
@@ -374,4 +407,4 @@ type LoadPageResult = Omit<PageProps, 'registry' | 'wrapBlock' | 'usePlaceholder
374
407
  */
375
408
  declare function loadPage(params: LoadPageParams): Promise<LoadPageResult>;
376
409
 
377
- export { type BlockOverrides as B, type LoadPageParams as L, type PageProps as P, type RuntimeSdkConfig as R, type SystemBlockComponentProps as S, type ThemeTokens as T, type LoadPageResult as a, Page as b, PageRenderer as c, type RouteMap as d, type BlockOverrideComponent as e, loadPage as l };
410
+ export { type BlockOverrides as B, type LoadPageParams as L, type PageProps as P, type RuntimeSdkConfig as R, type ThemeTokens as T, type LoadPageResult as a, Page as b, PageRenderer as c, type RouteMap as d, type BlockOverrideComponent as e, type BlockOverrideProps as f, type ResolverContext as g, type TransformRegistry as h, loadPage as l };
@@ -1,10 +1,10 @@
1
- import { a as LoadPageResult } from './loadPage-mavT3Jae.mjs';
2
- import { S as SiteResponse } from './types-BC9eB2KH.mjs';
1
+ import { a as LoadPageResult } from './loadPage-B8RmlYgV.mjs';
2
+ import { S as SiteResponse } from './types-DkKEctWn.mjs';
3
3
  import 'react/jsx-runtime';
4
4
  import 'react';
5
5
  import './schema-Bpy9N5ZI.mjs';
6
6
  import 'zod';
7
- import './types-BA-J9K8r.mjs';
7
+ import './types-CdrJqlKx.mjs';
8
8
  import '@riverbankcms/ai';
9
9
  import '@riverbankcms/media-storage-supabase';
10
10
  import '@riverbankcms/db';
@@ -1,10 +1,10 @@
1
- import { a as LoadPageResult } from './loadPage-naVvoua8.js';
2
- import { S as SiteResponse } from './types-CAnC529E.js';
1
+ import { a as LoadPageResult } from './loadPage-BTkKpizX.js';
2
+ import { S as SiteResponse } from './types-oCM-fw4O.js';
3
3
  import 'react/jsx-runtime';
4
4
  import 'react';
5
5
  import './schema-Bpy9N5ZI.js';
6
6
  import 'zod';
7
- import './types-5XdVD2J1.js';
7
+ import './types-BiRZnxDx.js';
8
8
  import '@riverbankcms/ai';
9
9
  import '@riverbankcms/media-storage-supabase';
10
10
  import '@riverbankcms/db';
@@ -1,5 +1,5 @@
1
- import { N as NavigationMenuWithItems } from './types-BA-J9K8r.mjs';
2
- export { L as LinkPayload, a as NavigationItemRecord } from './types-BA-J9K8r.mjs';
1
+ import { N as NavigationMenuWithItems } from './types-CdrJqlKx.mjs';
2
+ export { L as LinkPayload, a as NavigationItemRecord } from './types-CdrJqlKx.mjs';
3
3
  import '@riverbankcms/ai';
4
4
  import './schema-Bpy9N5ZI.mjs';
5
5
  import 'zod';
@@ -1,5 +1,5 @@
1
- import { N as NavigationMenuWithItems } from './types-5XdVD2J1.js';
2
- export { L as LinkPayload, a as NavigationItemRecord } from './types-5XdVD2J1.js';
1
+ import { N as NavigationMenuWithItems } from './types-BiRZnxDx.js';
2
+ export { L as LinkPayload, a as NavigationItemRecord } from './types-BiRZnxDx.js';
3
3
  import '@riverbankcms/ai';
4
4
  import './schema-Bpy9N5ZI.js';
5
5
  import 'zod';
@@ -1,10 +1,10 @@
1
- export { b as Page, P as PageProps } from '../loadPage-mavT3Jae.mjs';
2
- export { H as HeaderData, L as Layout, a as LayoutProps } from '../Layout-B_zUr9ci.mjs';
1
+ export { b as Page, P as PageProps } from '../loadPage-B8RmlYgV.mjs';
2
+ export { H as HeaderData, L as Layout, a as LayoutProps } from '../Layout-ByUnm35V.mjs';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as React from 'react';
5
- import { T as Theme } from '../types-BA-J9K8r.mjs';
5
+ import { T as Theme } from '../types-CdrJqlKx.mjs';
6
6
  import '../schema-Bpy9N5ZI.mjs';
7
- import { R as RiverbankClient } from '../types-BC9eB2KH.mjs';
7
+ import { R as RiverbankClient } from '../types-DkKEctWn.mjs';
8
8
  import { B as BlockKind } from '../blockKinds-B6MWzNWp.mjs';
9
9
  import 'zod';
10
10
  import '../types-CbagRQ_7.mjs';
@@ -1,10 +1,10 @@
1
- export { b as Page, P as PageProps } from '../loadPage-naVvoua8.js';
2
- export { H as HeaderData, L as Layout, a as LayoutProps } from '../Layout-CHG77dhK.js';
1
+ export { b as Page, P as PageProps } from '../loadPage-BTkKpizX.js';
2
+ export { H as HeaderData, L as Layout, a as LayoutProps } from '../Layout-kRv5sU81.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as React from 'react';
5
- import { T as Theme } from '../types-5XdVD2J1.js';
5
+ import { T as Theme } from '../types-BiRZnxDx.js';
6
6
  import '../schema-Bpy9N5ZI.js';
7
- import { R as RiverbankClient } from '../types-CAnC529E.js';
7
+ import { R as RiverbankClient } from '../types-oCM-fw4O.js';
8
8
  import { B as BlockKind } from '../blockKinds-B6MWzNWp.js';
9
9
  import 'zod';
10
10
  import '../types-DuQCNVV0.js';
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkBUCJWG6Gjs = require('../chunk-BUCJWG6G.js');
3
+ var _chunkNW5KHH4Ajs = require('../chunk-NW5KHH4A.js');
4
4
 
5
5
 
6
6
 
7
- var _chunkP6CDRJN3js = require('../chunk-P6CDRJN3.js');
8
- require('../chunk-IT5ICP43.js');
7
+ var _chunkBLKVTULPjs = require('../chunk-BLKVTULP.js');
8
+ require('../chunk-TKMA6D6U.js');
9
9
  require('../chunk-HOY77YBF.js');
10
10
  require('../chunk-EGTDJ4PL.js');
11
11
  require('../chunk-DGUM43GV.js');
@@ -13,5 +13,5 @@ require('../chunk-DGUM43GV.js');
13
13
 
14
14
 
15
15
 
16
- exports.Block = _chunkBUCJWG6Gjs.Block; exports.Layout = _chunkP6CDRJN3js.Layout; exports.Page = _chunkP6CDRJN3js.Page;
16
+ exports.Block = _chunkNW5KHH4Ajs.Block; exports.Layout = _chunkBLKVTULPjs.Layout; exports.Page = _chunkBLKVTULPjs.Page;
17
17
  //# sourceMappingURL=server.js.map
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  Block
3
- } from "../chunk-XK2YIISA.mjs";
3
+ } from "../chunk-SPXMMX3C.mjs";
4
4
  import {
5
5
  Layout,
6
6
  Page
7
- } from "../chunk-SFQ7VF3G.mjs";
8
- import "../chunk-NKXS4TBK.mjs";
7
+ } from "../chunk-7BOIO2S7.mjs";
8
+ import "../chunk-TNRADRPH.mjs";
9
9
  import "../chunk-7DS4Q3GA.mjs";
10
10
  import "../chunk-USQF2XTU.mjs";
11
11
  import "../chunk-BJTO5JO5.mjs";
@@ -1,12 +1,12 @@
1
- export { e as BlockOverrideComponent, B as BlockOverrides, L as LoadPageParams, a as LoadPageResult, b as Page, P as PageProps, c as PageRenderer, d as RouteMap, S as SystemBlockComponentProps, T as ThemeTokens, l as loadPage } from './loadPage-mavT3Jae.mjs';
2
- export { H as HeaderData, L as Layout, a as LayoutProps } from './Layout-B_zUr9ci.mjs';
1
+ export { e as BlockOverrideComponent, f as BlockOverrideProps, B as BlockOverrides, L as LoadPageParams, a as LoadPageResult, b as Page, P as PageProps, c as PageRenderer, d as RouteMap, T as ThemeTokens, l as loadPage } from './loadPage-B8RmlYgV.mjs';
2
+ export { H as HeaderData, L as Layout, a as LayoutProps } from './Layout-ByUnm35V.mjs';
3
3
  export { Block, BlockProps } from './rendering/server.mjs';
4
- export { C as ContentEntryData, L as LoadContentParams, b as LoadContentResult, a as isEntryContent, i as isPageContent, l as loadContent } from './loadContent-C_FipaAC.mjs';
5
- export { C as CustomLinkValue, E as ExternalLinkValue, I as InternalLinkValue, d as LinkValue, c as SiteFooterContent, S as SiteHeaderContent, T as Theme } from './types-BA-J9K8r.mjs';
4
+ export { C as ContentEntryData, L as LoadContentParams, b as LoadContentResult, a as isEntryContent, i as isPageContent, l as loadContent } from './loadContent-CWuE8FCx.mjs';
5
+ export { C as CustomLinkValue, E as ExternalLinkValue, I as InternalLinkValue, d as LinkValue, c as SiteFooterContent, S as SiteHeaderContent, T as Theme } from './types-CdrJqlKx.mjs';
6
6
  export { P as PageOutline } from './schema-Bpy9N5ZI.mjs';
7
- import { G as GradientConfig, M as Media } from './components-Bo3LPpVb.mjs';
8
- export { e as BackgroundInput, B as BodyTextContent, H as HeroContent, a as HeroMedia, f as ResolvedBackground, R as RichText, c as RichTextPrimitiveProps, S as SectionBackground, g as SectionBackgroundProps, T as TipTapNode, b as buildThemeRuntime, d as resolveBackground, r as resolveImageUrl } from './components-Bo3LPpVb.mjs';
9
- import './types-BC9eB2KH.mjs';
7
+ import { G as GradientConfig, M as Media } from './components-CY8jDQjv.mjs';
8
+ export { f as BackgroundInput, B as BodyTextContent, H as HeroContent, a as HeroMedia, g as ResolvedBackground, R as RichText, c as RichTextPrimitiveProps, e as SectionBackground, h as SectionBackgroundProps, S as SystemBlockComponentProps, T as TipTapNode, b as buildThemeRuntime, d as resolveBackground, r as resolveImageUrl } from './components-CY8jDQjv.mjs';
9
+ import './types-DkKEctWn.mjs';
10
10
  import 'react/jsx-runtime';
11
11
  import 'react';
12
12
  import 'zod';
@@ -1,12 +1,12 @@
1
- export { e as BlockOverrideComponent, B as BlockOverrides, L as LoadPageParams, a as LoadPageResult, b as Page, P as PageProps, c as PageRenderer, d as RouteMap, S as SystemBlockComponentProps, T as ThemeTokens, l as loadPage } from './loadPage-naVvoua8.js';
2
- export { H as HeaderData, L as Layout, a as LayoutProps } from './Layout-CHG77dhK.js';
1
+ export { e as BlockOverrideComponent, f as BlockOverrideProps, B as BlockOverrides, L as LoadPageParams, a as LoadPageResult, b as Page, P as PageProps, c as PageRenderer, d as RouteMap, T as ThemeTokens, l as loadPage } from './loadPage-BTkKpizX.js';
2
+ export { H as HeaderData, L as Layout, a as LayoutProps } from './Layout-kRv5sU81.js';
3
3
  export { Block, BlockProps } from './rendering/server.js';
4
- export { C as ContentEntryData, L as LoadContentParams, b as LoadContentResult, a as isEntryContent, i as isPageContent, l as loadContent } from './loadContent-C2SwqmXy.js';
5
- export { C as CustomLinkValue, E as ExternalLinkValue, I as InternalLinkValue, d as LinkValue, c as SiteFooterContent, S as SiteHeaderContent, T as Theme } from './types-5XdVD2J1.js';
4
+ export { C as ContentEntryData, L as LoadContentParams, b as LoadContentResult, a as isEntryContent, i as isPageContent, l as loadContent } from './loadContent-DynBuR5f.js';
5
+ export { C as CustomLinkValue, E as ExternalLinkValue, I as InternalLinkValue, d as LinkValue, c as SiteFooterContent, S as SiteHeaderContent, T as Theme } from './types-BiRZnxDx.js';
6
6
  export { P as PageOutline } from './schema-Bpy9N5ZI.js';
7
- import { G as GradientConfig, M as Media } from './components-ClFs4PUa.js';
8
- export { e as BackgroundInput, B as BodyTextContent, H as HeroContent, a as HeroMedia, f as ResolvedBackground, R as RichText, c as RichTextPrimitiveProps, S as SectionBackground, g as SectionBackgroundProps, T as TipTapNode, b as buildThemeRuntime, d as resolveBackground, r as resolveImageUrl } from './components-ClFs4PUa.js';
9
- import './types-CAnC529E.js';
7
+ import { G as GradientConfig, M as Media } from './components-D1Z2mSDr.js';
8
+ export { f as BackgroundInput, B as BodyTextContent, H as HeroContent, a as HeroMedia, g as ResolvedBackground, R as RichText, c as RichTextPrimitiveProps, e as SectionBackground, h as SectionBackgroundProps, S as SystemBlockComponentProps, T as TipTapNode, b as buildThemeRuntime, d as resolveBackground, r as resolveImageUrl } from './components-D1Z2mSDr.js';
9
+ import './types-oCM-fw4O.js';
10
10
  import 'react/jsx-runtime';
11
11
  import 'react';
12
12
  import 'zod';
@@ -8,11 +8,11 @@ var _chunkTO7FD6TQjs = require('./chunk-TO7FD6TQ.js');
8
8
  var _chunkSWPHIUVEjs = require('./chunk-SWPHIUVE.js');
9
9
 
10
10
 
11
- var _chunkBUCJWG6Gjs = require('./chunk-BUCJWG6G.js');
11
+ var _chunkNW5KHH4Ajs = require('./chunk-NW5KHH4A.js');
12
12
 
13
13
 
14
14
 
15
- var _chunkP6CDRJN3js = require('./chunk-P6CDRJN3.js');
15
+ var _chunkBLKVTULPjs = require('./chunk-BLKVTULP.js');
16
16
 
17
17
 
18
18
 
@@ -20,7 +20,7 @@ var _chunkP6CDRJN3js = require('./chunk-P6CDRJN3.js');
20
20
 
21
21
 
22
22
 
23
- var _chunkIT5ICP43js = require('./chunk-IT5ICP43.js');
23
+ var _chunkTKMA6D6Ujs = require('./chunk-TKMA6D6U.js');
24
24
  require('./chunk-Y7347JMZ.js');
25
25
  require('./chunk-HOY77YBF.js');
26
26
  require('./chunk-EGTDJ4PL.js');
@@ -39,5 +39,5 @@ require('./chunk-DGUM43GV.js');
39
39
 
40
40
 
41
41
 
42
- exports.Block = _chunkBUCJWG6Gjs.Block; exports.Layout = _chunkP6CDRJN3js.Layout; exports.Page = _chunkP6CDRJN3js.Page; exports.PageRenderer = _chunkIT5ICP43js.PageRenderer; exports.RichText = _chunkIT5ICP43js.RichText; exports.SectionBackground = _chunkIT5ICP43js.SectionBackground; exports.buildThemeRuntime = _chunkIT5ICP43js.buildThemeRuntime; exports.isEntryContent = _chunkTO7FD6TQjs.isEntryContent; exports.isPageContent = _chunkTO7FD6TQjs.isPageContent; exports.loadContent = _chunkTO7FD6TQjs.loadContent; exports.loadPage = _chunkSWPHIUVEjs.loadPage; exports.resolveBackground = _chunkIT5ICP43js.resolveBackground; exports.resolveImageUrl = _chunkIT5ICP43js.resolveImageUrl;
42
+ exports.Block = _chunkNW5KHH4Ajs.Block; exports.Layout = _chunkBLKVTULPjs.Layout; exports.Page = _chunkBLKVTULPjs.Page; exports.PageRenderer = _chunkTKMA6D6Ujs.PageRenderer; exports.RichText = _chunkTKMA6D6Ujs.RichText; exports.SectionBackground = _chunkTKMA6D6Ujs.SectionBackground; exports.buildThemeRuntime = _chunkTKMA6D6Ujs.buildThemeRuntime; exports.isEntryContent = _chunkTO7FD6TQjs.isEntryContent; exports.isPageContent = _chunkTO7FD6TQjs.isPageContent; exports.loadContent = _chunkTO7FD6TQjs.loadContent; exports.loadPage = _chunkSWPHIUVEjs.loadPage; exports.resolveBackground = _chunkTKMA6D6Ujs.resolveBackground; exports.resolveImageUrl = _chunkTKMA6D6Ujs.resolveImageUrl;
43
43
  //# sourceMappingURL=rendering.js.map
@@ -8,11 +8,11 @@ import {
8
8
  } from "./chunk-ZEAJW6T3.mjs";
9
9
  import {
10
10
  Block
11
- } from "./chunk-XK2YIISA.mjs";
11
+ } from "./chunk-SPXMMX3C.mjs";
12
12
  import {
13
13
  Layout,
14
14
  Page
15
- } from "./chunk-SFQ7VF3G.mjs";
15
+ } from "./chunk-7BOIO2S7.mjs";
16
16
  import {
17
17
  PageRenderer,
18
18
  RichText,
@@ -20,7 +20,7 @@ import {
20
20
  buildThemeRuntime,
21
21
  resolveBackground,
22
22
  resolveImageUrl
23
- } from "./chunk-NKXS4TBK.mjs";
23
+ } from "./chunk-TNRADRPH.mjs";
24
24
  import "./chunk-A2FZMRDW.mjs";
25
25
  import "./chunk-7DS4Q3GA.mjs";
26
26
  import "./chunk-USQF2XTU.mjs";
@@ -1,8 +1,9 @@
1
- import { R as RiverbankClient } from './types-BC9eB2KH.mjs';
2
- import { a as LoadPageResult } from './loadPage-mavT3Jae.mjs';
3
- import './types-BA-J9K8r.mjs';
4
- import '@riverbankcms/ai';
1
+ import { R as RiverbankClient } from './types-DkKEctWn.mjs';
2
+ import { a as LoadPageResult } from './loadPage-B8RmlYgV.mjs';
3
+ import { R as RiverbankSiteConfig } from './types-txWsSxN7.mjs';
5
4
  import './schema-Bpy9N5ZI.mjs';
5
+ import './types-CdrJqlKx.mjs';
6
+ import '@riverbankcms/ai';
6
7
  import 'zod';
7
8
  import '@riverbankcms/media-storage-supabase';
8
9
  import '@riverbankcms/db';
@@ -117,4 +118,76 @@ declare function resolveRoutes(params: {
117
118
  resolution: RouteResolution;
118
119
  }>>;
119
120
 
120
- export { type ResolveRouteParams, type RouteResolution, resolveRoute, resolveRoutes };
121
+ /**
122
+ * Content route matching utilities.
123
+ *
124
+ * Derive route matching from SDK config to determine whether a URL path
125
+ * is a CMS page or a content entry, without duplicating route patterns.
126
+ */
127
+
128
+ /**
129
+ * Extract the first path segment from each routable content type's routePattern.
130
+ *
131
+ * Useful for simple prefix-based routing decisions. For more precise matching
132
+ * that handles nested patterns, use `isContentEntryPath` instead.
133
+ *
134
+ * @param config - The SDK config object from defineConfig()
135
+ * @returns Array of first path segments from content type routePatterns
136
+ *
137
+ * @example
138
+ * ```typescript
139
+ * import { getContentEntryPrefixes } from '@riverbankcms/sdk/routing';
140
+ * import config from '../riverbank.config';
141
+ *
142
+ * // Config with routePatterns: '/blog/{slug}', '/work/projects/{slug}'
143
+ * const prefixes = getContentEntryPrefixes(config);
144
+ * // Returns ['blog', 'work']
145
+ * ```
146
+ */
147
+ declare function getContentEntryPrefixes(config: RiverbankSiteConfig): string[];
148
+ /**
149
+ * Result of checking if a path matches a content entry route.
150
+ */
151
+ type ContentEntryMatch = {
152
+ /** Whether the path matches a content entry route pattern */
153
+ isEntry: boolean;
154
+ /** The content type key if matched (e.g., 'blog-post') */
155
+ contentType?: string;
156
+ /** The slug extracted from the path if matched */
157
+ slug?: string;
158
+ };
159
+ /**
160
+ * Check if a URL path matches any content entry route pattern.
161
+ *
162
+ * Supports nested patterns like '/work/projects/{slug}'. Returns the matched
163
+ * content type key and extracted slug, useful for routing decisions.
164
+ *
165
+ * **Note:** Content types are checked in array order. If multiple patterns
166
+ * could match a path, the first matching content type wins. Order more specific
167
+ * patterns before generic ones in your config.
168
+ *
169
+ * @param config - The SDK config object from defineConfig()
170
+ * @param path - URL path as string ('/blog/my-post') or segments ['blog', 'my-post']
171
+ * @returns Match result with content type and slug if matched
172
+ *
173
+ * @example
174
+ * ```typescript
175
+ * import { isContentEntryPath } from '@riverbankcms/sdk/routing';
176
+ * import config from '../riverbank.config';
177
+ *
178
+ * // Simple pattern: '/blog/{slug}'
179
+ * isContentEntryPath(config, '/blog/my-post');
180
+ * // Returns { isEntry: true, contentType: 'blog-post', slug: 'my-post' }
181
+ *
182
+ * // Nested pattern: '/work/projects/{slug}'
183
+ * isContentEntryPath(config, '/work/projects/website-redesign');
184
+ * // Returns { isEntry: true, contentType: 'project', slug: 'website-redesign' }
185
+ *
186
+ * // Non-matching path
187
+ * isContentEntryPath(config, '/about');
188
+ * // Returns { isEntry: false }
189
+ * ```
190
+ */
191
+ declare function isContentEntryPath(config: RiverbankSiteConfig, path: string | string[]): ContentEntryMatch;
192
+
193
+ export { type ContentEntryMatch, type ResolveRouteParams, type RouteResolution, getContentEntryPrefixes, isContentEntryPath, resolveRoute, resolveRoutes };
@@ -1,8 +1,9 @@
1
- import { R as RiverbankClient } from './types-CAnC529E.js';
2
- import { a as LoadPageResult } from './loadPage-naVvoua8.js';
3
- import './types-5XdVD2J1.js';
4
- import '@riverbankcms/ai';
1
+ import { R as RiverbankClient } from './types-oCM-fw4O.js';
2
+ import { a as LoadPageResult } from './loadPage-BTkKpizX.js';
3
+ import { R as RiverbankSiteConfig } from './types-CL916r6x.js';
5
4
  import './schema-Bpy9N5ZI.js';
5
+ import './types-BiRZnxDx.js';
6
+ import '@riverbankcms/ai';
6
7
  import 'zod';
7
8
  import '@riverbankcms/media-storage-supabase';
8
9
  import '@riverbankcms/db';
@@ -117,4 +118,76 @@ declare function resolveRoutes(params: {
117
118
  resolution: RouteResolution;
118
119
  }>>;
119
120
 
120
- export { type ResolveRouteParams, type RouteResolution, resolveRoute, resolveRoutes };
121
+ /**
122
+ * Content route matching utilities.
123
+ *
124
+ * Derive route matching from SDK config to determine whether a URL path
125
+ * is a CMS page or a content entry, without duplicating route patterns.
126
+ */
127
+
128
+ /**
129
+ * Extract the first path segment from each routable content type's routePattern.
130
+ *
131
+ * Useful for simple prefix-based routing decisions. For more precise matching
132
+ * that handles nested patterns, use `isContentEntryPath` instead.
133
+ *
134
+ * @param config - The SDK config object from defineConfig()
135
+ * @returns Array of first path segments from content type routePatterns
136
+ *
137
+ * @example
138
+ * ```typescript
139
+ * import { getContentEntryPrefixes } from '@riverbankcms/sdk/routing';
140
+ * import config from '../riverbank.config';
141
+ *
142
+ * // Config with routePatterns: '/blog/{slug}', '/work/projects/{slug}'
143
+ * const prefixes = getContentEntryPrefixes(config);
144
+ * // Returns ['blog', 'work']
145
+ * ```
146
+ */
147
+ declare function getContentEntryPrefixes(config: RiverbankSiteConfig): string[];
148
+ /**
149
+ * Result of checking if a path matches a content entry route.
150
+ */
151
+ type ContentEntryMatch = {
152
+ /** Whether the path matches a content entry route pattern */
153
+ isEntry: boolean;
154
+ /** The content type key if matched (e.g., 'blog-post') */
155
+ contentType?: string;
156
+ /** The slug extracted from the path if matched */
157
+ slug?: string;
158
+ };
159
+ /**
160
+ * Check if a URL path matches any content entry route pattern.
161
+ *
162
+ * Supports nested patterns like '/work/projects/{slug}'. Returns the matched
163
+ * content type key and extracted slug, useful for routing decisions.
164
+ *
165
+ * **Note:** Content types are checked in array order. If multiple patterns
166
+ * could match a path, the first matching content type wins. Order more specific
167
+ * patterns before generic ones in your config.
168
+ *
169
+ * @param config - The SDK config object from defineConfig()
170
+ * @param path - URL path as string ('/blog/my-post') or segments ['blog', 'my-post']
171
+ * @returns Match result with content type and slug if matched
172
+ *
173
+ * @example
174
+ * ```typescript
175
+ * import { isContentEntryPath } from '@riverbankcms/sdk/routing';
176
+ * import config from '../riverbank.config';
177
+ *
178
+ * // Simple pattern: '/blog/{slug}'
179
+ * isContentEntryPath(config, '/blog/my-post');
180
+ * // Returns { isEntry: true, contentType: 'blog-post', slug: 'my-post' }
181
+ *
182
+ * // Nested pattern: '/work/projects/{slug}'
183
+ * isContentEntryPath(config, '/work/projects/website-redesign');
184
+ * // Returns { isEntry: true, contentType: 'project', slug: 'website-redesign' }
185
+ *
186
+ * // Non-matching path
187
+ * isContentEntryPath(config, '/about');
188
+ * // Returns { isEntry: false }
189
+ * ```
190
+ */
191
+ declare function isContentEntryPath(config: RiverbankSiteConfig, path: string | string[]): ContentEntryMatch;
192
+
193
+ export { type ContentEntryMatch, type ResolveRouteParams, type RouteResolution, getContentEntryPrefixes, isContentEntryPath, resolveRoute, resolveRoutes };
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } }require('./chunk-DGUM43GV.js');
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }require('./chunk-DGUM43GV.js');
2
2
 
3
3
  // src/routing/resolveRoute.ts
4
4
  async function resolveRoute(params) {
@@ -53,7 +53,61 @@ async function resolveRoutes(params) {
53
53
  return resolutions;
54
54
  }
55
55
 
56
+ // src/routing/contentRoutes.ts
57
+ function getContentEntryPrefixes(config) {
58
+ const contentTypes = _nullishCoalesce(_optionalChain([config, 'access', _ => _.content, 'optionalAccess', _2 => _2.contentTypes]), () => ( []));
59
+ return contentTypes.filter(
60
+ (ct) => ct.hasPages && typeof ct.routePattern === "string"
61
+ ).map((ct) => {
62
+ const match = ct.routePattern.match(/^\/([^/]+)/);
63
+ const segment = _optionalChain([match, 'optionalAccess', _3 => _3[1]]);
64
+ if (_optionalChain([segment, 'optionalAccess', _4 => _4.includes, 'call', _5 => _5("{")])) return void 0;
65
+ return segment;
66
+ }).filter((prefix) => typeof prefix === "string");
67
+ }
68
+ function isContentEntryPath(config, path) {
69
+ const segments = typeof path === "string" ? path.split("/").filter(Boolean) : path;
70
+ const contentTypes = _nullishCoalesce(_optionalChain([config, 'access', _6 => _6.content, 'optionalAccess', _7 => _7.contentTypes]), () => ( []));
71
+ for (const ct of contentTypes) {
72
+ if (!ct.hasPages || !ct.routePattern) continue;
73
+ const patternSegments = parseRoutePattern(ct.routePattern);
74
+ const match = matchPattern(segments, patternSegments);
75
+ if (match.matches) {
76
+ return {
77
+ isEntry: true,
78
+ contentType: ct.key,
79
+ slug: match.slug
80
+ };
81
+ }
82
+ }
83
+ return { isEntry: false };
84
+ }
85
+ function parseRoutePattern(pattern) {
86
+ const segments = pattern.split("/").filter(Boolean);
87
+ const staticSegments = [];
88
+ for (const segment of segments) {
89
+ if (segment.includes("{")) break;
90
+ staticSegments.push(segment);
91
+ }
92
+ return staticSegments;
93
+ }
94
+ function matchPattern(pathSegments, patternSegments) {
95
+ if (pathSegments.length < patternSegments.length + 1) {
96
+ return { matches: false };
97
+ }
98
+ for (let i = 0; i < patternSegments.length; i++) {
99
+ if (pathSegments[i] !== patternSegments[i]) {
100
+ return { matches: false };
101
+ }
102
+ }
103
+ const slugSegments = pathSegments.slice(patternSegments.length);
104
+ const slug = slugSegments.join("/");
105
+ return { matches: true, slug };
106
+ }
107
+
108
+
109
+
56
110
 
57
111
 
58
- exports.resolveRoute = resolveRoute; exports.resolveRoutes = resolveRoutes;
112
+ exports.getContentEntryPrefixes = getContentEntryPrefixes; exports.isContentEntryPath = isContentEntryPath; exports.resolveRoute = resolveRoute; exports.resolveRoutes = resolveRoutes;
59
113
  //# sourceMappingURL=routing.js.map