@riverbankcms/sdk 0.60.9 → 0.60.11

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.
@@ -57,7 +57,8 @@ export { matchNavigationItems } from "./navigation/matcher";
57
57
  export type { ItemMatch, MatchResult } from "./navigation/matcher";
58
58
  export { extractNavVisibilityConfig, hasNavVisibilityValues, extractSdkDashboardNavVisibilityConfig, mergeNavVisibilityConfig, extractSdkDashboardNavVisibilityConfigForRole, isNavItemVisible, } from "./navigation/visibility";
59
59
  export type { NavStage, NavVisibilityMode, NavVisibilityConfig, NavVisibilityContext, } from "./navigation/visibility";
60
- export { toInternalLinkValue, linkValueToPayload, linkPayloadToValue, } from "./navigation/linkValue";
60
+ export { toInternalLinkValue, linkValueToPayload, linkPayloadToValue, toPersistableNavigationLinkValue, } from "./navigation/linkValue";
61
+ export type { PersistableNavigationLinkError, PersistableNavigationLinkResult, PersistableNavigationLinkValue, } from "./navigation/linkValue";
61
62
  export type { NavigationReferenceMaps, PageNavLinkInfo, EntryNavLinkInfo, NavigationItemForMatching, NavigationItemInput, } from "./navigation/types";
62
63
  export { listRedirectRules, createRedirectRule, deleteRedirectRule, } from "./redirects";
63
64
  export { changePlan } from "./billing";
@@ -4,8 +4,21 @@
4
4
  * Bidirectional conversion between block-level LinkValue (used in the editor)
5
5
  * and LinkPayload (used in the database and API layer).
6
6
  */
7
- import { type LinkValue } from '@riverbankcms/blocks';
7
+ import { type CustomLinkValue, type EntryLinkValue, type ExternalLinkValue, type InternalResolvedLinkValue, type LinkValue, type PageLinkValue } from '@riverbankcms/blocks';
8
8
  import type { LinkPayload, RoutableContentItem } from './types';
9
+ export type PersistableNavigationLinkValue = InternalResolvedLinkValue | ExternalLinkValue | CustomLinkValue | PageLinkValue | EntryLinkValue;
10
+ export type PersistableNavigationLinkError = {
11
+ type: 'internalLinkNotResolved';
12
+ routeId: string;
13
+ };
14
+ export type PersistableNavigationLinkResult = {
15
+ ok: true;
16
+ value: PersistableNavigationLinkValue;
17
+ } | {
18
+ ok: false;
19
+ error: PersistableNavigationLinkError;
20
+ };
9
21
  export declare function toInternalLinkValue(item: RoutableContentItem): LinkValue;
10
- export declare function linkValueToPayload(value: LinkValue): LinkPayload;
22
+ export declare function toPersistableNavigationLinkValue(value: LinkValue): PersistableNavigationLinkResult;
23
+ export declare function linkValueToPayload(value: PersistableNavigationLinkValue): LinkPayload;
11
24
  export declare function linkPayloadToValue(payload: LinkPayload | null | undefined, items?: RoutableContentItem[]): LinkValue | null;
@@ -3,6 +3,8 @@ import type { ApiClient } from './request';
3
3
  export { collectCartLinkStats, collectPortalLinkStats, type CartLinkValidationItem, type CartLinkValidationStats, type NavigationMenuValidationItem, type PortalLinkValidationItem, type PortalLinkValidationStats, } from './navigationMenuValidation';
4
4
  export { isInternalLink, isPageLink, isEntryLink, resolveNavigationLinkInput, } from './navigation/linkResolver';
5
5
  export { toRoutableLinkPayload } from './navigation/routableLink';
6
+ export { linkPayloadToValue, linkValueToPayload, toInternalLinkValue, toPersistableNavigationLinkValue, } from './navigation/linkValue';
7
+ export type { PersistableNavigationLinkError, PersistableNavigationLinkResult, PersistableNavigationLinkValue, } from './navigation/linkValue';
6
8
  export type { CartLinkLabelConfig, CartLinkPayload, EntryLinkPayload, InternalLinkRoutablePayload, LinkResolutionOptions, LinkPayload, NavigationLinkInput, NavigationUrlType, PageLinkPayload, PortalLinkPayload, ResolvedNavigationLink, RoutableContentItem, SitemapRouteItem, } from './navigation/types';
7
9
  export { matchNavigationItems } from './navigation/matcher';
8
10
  export type { ItemMatch, MatchResult } from './navigation/matcher';
@@ -27,7 +27,7 @@ export * from "@riverbankcms/theme-core/runtime/buildThemeRuntimeFromBridge";
27
27
  export * from "@riverbankcms/theme-core/blocks";
28
28
  export * from "./system";
29
29
  export { SUPPORTED_LOADER_ENDPOINTS, isSupportedLoaderEndpoint, type SupportedLoaderEndpoint, } from "./system/data";
30
- export type { LinkValue, InternalLinkValue, InternalResolvedLinkValue, InternalRouteOnlyLinkValue, ExternalLinkValue, CustomLinkValue, PageLinkValue, EntryLinkValue, } from "./system/types/link";
30
+ export type { AuthoredLinkValue, LinkValue, InternalLinkValue, InternalResolvedLinkValue, InternalRouteOnlyLinkValue, ExternalLinkValue, CustomLinkValue, PageLinkValue, EntryLinkValue, } from "./system/types/link";
31
31
  export { linkSchema, internalLinkSchema, internalResolvedLinkSchema, internalRouteOnlyLinkSchema, externalLinkSchema, customLinkSchema, pageLinkSchema, entryLinkSchema, isInternalResolvedLinkValue, } from "./system/types/link";
32
32
  export { heroManifest } from "./system/blocks/hero";
33
33
  export type { HeroContent, HeroMedia } from "./system/blocks/hero";
@@ -1,5 +1,5 @@
1
1
  import type { NodeDefinition } from "../schema";
2
- import type { ThemedButtonSize } from "../../runtime/shared/themedButtonClass";
2
+ import type { ButtonSizeName } from "@riverbankcms/theme-core/buttons";
3
3
  export declare function ctaButton(opts?: {
4
4
  basePath?: string;
5
5
  linkPath?: string;
@@ -15,5 +15,5 @@ export declare function ctaButton(opts?: {
15
15
  };
16
16
  className?: string;
17
17
  variantFallback?: string;
18
- sizeFallback?: ThemedButtonSize;
18
+ sizeFallback?: ButtonSizeName;
19
19
  }): NodeDefinition;
@@ -1,4 +1,5 @@
1
1
  import React from 'react';
2
+ import { type ButtonSizeName } from '@riverbankcms/theme-core/buttons';
2
3
  export type TextNodeProps = {
3
4
  value?: React.ReactNode;
4
5
  className?: string;
@@ -35,7 +36,7 @@ export type ButtonNodeProps = {
35
36
  /** Button variant ID (reads from theme.buttons.variants) */
36
37
  variantId?: string;
37
38
  /** Button size (reads from theme.buttons.sizes via .btn-{size}) */
38
- size?: 'sm' | 'md' | 'lg' | 'xl';
39
+ size?: ButtonSizeName;
39
40
  /** Disabled state */
40
41
  disabled?: boolean;
41
42
  /** Button type (for form buttons) */
@@ -41,7 +41,13 @@ export type EntryLinkValue = {
41
41
  contentType: string;
42
42
  identifier: string;
43
43
  };
44
- export type LinkValue = InternalLinkValue | ExternalLinkValue | CustomLinkValue | PageLinkValue | EntryLinkValue;
44
+ export type AuthoredLinkValue = InternalLinkValue | ExternalLinkValue | CustomLinkValue | PageLinkValue | EntryLinkValue;
45
+ /**
46
+ * Broad authored/editor link value accepted by block manifests and link widgets.
47
+ * Route-only internal links are valid here, but must be resolved before any
48
+ * navigation-persistence converter accepts them.
49
+ */
50
+ export type LinkValue = AuthoredLinkValue;
45
51
  export declare const internalRouteOnlyLinkSchema: z.ZodObject<{
46
52
  kind: z.ZodLiteral<"internal">;
47
53
  routeId: z.ZodString;
@@ -51,7 +51,13 @@ export type EntryLinkValue = {
51
51
  contentType: string;
52
52
  identifier: string;
53
53
  };
54
- export type LinkValue = InternalLinkValue | ExternalLinkValue | CustomLinkValue | PageLinkValue | EntryLinkValue;
54
+ export type AuthoredLinkValue = InternalLinkValue | ExternalLinkValue | CustomLinkValue | PageLinkValue | EntryLinkValue;
55
+ /**
56
+ * Broad authored/editor link value accepted by SDK content contracts.
57
+ * Route-only internal links remain part of the public wire contract; navigation
58
+ * persistence must narrow to a persistable lifecycle value first.
59
+ */
60
+ export type LinkValue = AuthoredLinkValue;
55
61
  export type MediaTypeDiscriminant = 'image' | 'video' | 'audio' | 'document' | 'spreadsheet' | 'archive';
56
62
  export type Media = {
57
63
  type: MediaTypeDiscriminant;
@@ -8,4 +8,4 @@
8
8
  * 1. This constant
9
9
  * 2. The "version" field in package.json
10
10
  */
11
- export declare const SDK_VERSION = "0.60.9";
11
+ export declare const SDK_VERSION = "0.60.11";
@@ -0,0 +1,21 @@
1
+ import { type ButtonSizeName, type DefaultVariantAliasId, type VariantId } from './types';
2
+ export type ThemeButtonVariantId = VariantId | DefaultVariantAliasId;
3
+ export type ThemeButtonClassName = string & {
4
+ readonly __brand: 'ThemeButtonClassName';
5
+ };
6
+ export type ThemeButtonSizeClassName = `btn-${ButtonSizeName}`;
7
+ export type ThemeButtonClassSpec = Readonly<{
8
+ variant: ThemeButtonVariantId;
9
+ size: ButtonSizeName;
10
+ extraClassName?: string | null;
11
+ }>;
12
+ /**
13
+ * Parse content/runtime variant identifiers into the closed theme-button class
14
+ * contract. Empty input is the intentional local/unstyled escape hatch used by
15
+ * a few block renderers; non-empty, non-semantic ids become branded special ids.
16
+ */
17
+ export declare function parseThemeButtonVariantId(value: string | null | undefined): ThemeButtonVariantId | null;
18
+ export declare function themeButtonVariantClassNames(variant: ThemeButtonVariantId): readonly [string] | readonly [string, string];
19
+ export declare function themeButtonSizeClassName(size: ButtonSizeName): ThemeButtonSizeClassName;
20
+ export declare function themeButtonSelector(variant: ThemeButtonVariantId, size?: ButtonSizeName): string;
21
+ export declare function themeButtonClassName(spec: ThemeButtonClassSpec): ThemeButtonClassName;
@@ -4,6 +4,7 @@
4
4
  * Complete button system including types, schemas, presets, and CSS variable generation.
5
5
  */
6
6
  export * from './types';
7
+ export * from './classNames';
7
8
  export * from './generateButtonCss';
8
9
  export * from './generateDefaultButtonSystem';
9
10
  export * from './constants';
@@ -35,6 +35,7 @@ export type ButtonSizes = Record<ButtonSizeName, ButtonSizeConfig>;
35
35
  */
36
36
  export declare const VARIANT_ROLES: readonly ["primary", "secondary", "outline", "ghost", "link", "tertiary", "accent"];
37
37
  export type VariantRole = (typeof VARIANT_ROLES)[number];
38
+ export declare function isVariantRole(value: string): value is VariantRole;
38
39
  declare const SpecialVariantIdBrand: unique symbol;
39
40
  /**
40
41
  * Branded ID for theme-specific special variants that don't map to a standard role
@@ -2291,6 +2291,13 @@ var init_personalities = __esm({
2291
2291
  }
2292
2292
  });
2293
2293
 
2294
+ // ../theme-core/src/buttons/classNames.ts
2295
+ var init_classNames = __esm({
2296
+ "../theme-core/src/buttons/classNames.ts"() {
2297
+ init_types2();
2298
+ }
2299
+ });
2300
+
2294
2301
  // ../theme-core/src/tokens/resolver.ts
2295
2302
  var init_resolver = __esm({
2296
2303
  "../theme-core/src/tokens/resolver.ts"() {
@@ -2409,6 +2416,7 @@ var init_generateDefaultButtonSystem = __esm({
2409
2416
  var init_generateButtonCss = __esm({
2410
2417
  "../theme-core/src/buttons/generateButtonCss.ts"() {
2411
2418
  init_types2();
2419
+ init_classNames();
2412
2420
  init_resolver();
2413
2421
  init_generateEffectsCSS();
2414
2422
  init_constants();
@@ -2439,6 +2447,7 @@ var init_core = __esm({
2439
2447
  var init_buttons = __esm({
2440
2448
  "../theme-core/src/buttons/index.ts"() {
2441
2449
  init_types2();
2450
+ init_classNames();
2442
2451
  init_generateButtonCss();
2443
2452
  init_generateDefaultButtonSystem();
2444
2453
  init_constants();
@@ -21152,6 +21161,9 @@ function validationContext(options = {}) {
21152
21161
  allowIncomplete: isDraft || (options.allowIncomplete ?? false)
21153
21162
  };
21154
21163
  }
21164
+ function formatFieldPath(path21) {
21165
+ return path21.map((segment) => String(segment)).join(".");
21166
+ }
21155
21167
  function fieldIssueToMessage(issue2) {
21156
21168
  switch (issue2.kind) {
21157
21169
  case "required":
@@ -21375,7 +21387,7 @@ function normalizeRepeaterItems(plan, value, ctx) {
21375
21387
  return normalizeObjectChildren(fields3, itemRecord, ctx);
21376
21388
  });
21377
21389
  }
21378
- function normalizeNumberInput(value, allowNull) {
21390
+ function normalizeNumberInput(value, _allowNull) {
21379
21391
  if (value === "") return void 0;
21380
21392
  if (typeof value === "string" && value.trim() !== "") return Number(value);
21381
21393
  return value;
@@ -21507,7 +21519,7 @@ function validateRepeaterItem(plan, item, index, ctx) {
21507
21519
  const fields3 = plan.repeatedItemVariants ? plan.repeatedItemVariants.find((variant) => variant.typeId === itemType)?.fields : plan.repeatedItemPlan;
21508
21520
  if (!fields3) return [];
21509
21521
  return fields3.flatMap((childPlan) => {
21510
- const indexedPlan = withIndexedPath(childPlan, plan.path, index);
21522
+ const indexedPlan = materializeRepeaterItemPlan(childPlan, plan.path, index);
21511
21523
  return validateNormalizedFieldValue(indexedPlan, item[childPlan.fieldId], ctx);
21512
21524
  });
21513
21525
  }
@@ -21519,12 +21531,58 @@ function validateGroupPlan(plan, value, ctx) {
21519
21531
  function childValidationContext(plan, ctx) {
21520
21532
  return plan.allowNullChildren ? { ...ctx, allowNull: true } : ctx;
21521
21533
  }
21522
- function withIndexedPath(plan, parentPath, index) {
21523
- const suffix = plan.path.slice(parentPath.length + 1);
21524
- return {
21525
- ...plan,
21526
- path: [...parentPath, index, plan.fieldId, ...suffix]
21527
- };
21534
+ function materializeRepeaterItemPlan(plan, parentPath, index) {
21535
+ return rebaseFieldPlanPath(plan, [...parentPath, 0], [...parentPath, index]);
21536
+ }
21537
+ function rebaseFieldPlanPath(plan, fromPrefix, toPrefix) {
21538
+ const path21 = rebaseFieldPath(plan.path, fromPrefix, toPrefix);
21539
+ switch (plan.kind) {
21540
+ case "group":
21541
+ return {
21542
+ ...plan,
21543
+ path: path21,
21544
+ children: plan.children.map((childPlan) => rebaseFieldPlanPath(childPlan, fromPrefix, toPrefix))
21545
+ };
21546
+ case "repeater":
21547
+ return {
21548
+ ...plan,
21549
+ path: path21,
21550
+ ...plan.repeatedItemVariants ? {
21551
+ repeatedItemVariants: plan.repeatedItemVariants.map((variant) => ({
21552
+ ...variant,
21553
+ fields: variant.fields.map((fieldPlan) => rebaseFieldPlanPath(fieldPlan, fromPrefix, toPrefix))
21554
+ }))
21555
+ } : {},
21556
+ ...plan.repeatedItemPlan ? {
21557
+ repeatedItemPlan: plan.repeatedItemPlan.map(
21558
+ (fieldPlan) => rebaseFieldPlanPath(fieldPlan, fromPrefix, toPrefix)
21559
+ )
21560
+ } : {}
21561
+ };
21562
+ case "string":
21563
+ case "number":
21564
+ case "boolean":
21565
+ case "richText":
21566
+ case "media":
21567
+ case "link":
21568
+ case "select":
21569
+ case "passthrough":
21570
+ return {
21571
+ ...plan,
21572
+ path: path21
21573
+ };
21574
+ default:
21575
+ return assertNever2(plan);
21576
+ }
21577
+ }
21578
+ function rebaseFieldPath(path21, fromPrefix, toPrefix) {
21579
+ if (!startsWithFieldPath(path21, fromPrefix)) {
21580
+ throw new Error(`Cannot rebase field path ${formatFieldPath(path21)} from ${formatFieldPath(fromPrefix)}`);
21581
+ }
21582
+ return [...toPrefix, ...path21.slice(fromPrefix.length)];
21583
+ }
21584
+ function startsWithFieldPath(path21, prefix) {
21585
+ return prefix.every((segment, index) => path21[index] === segment);
21528
21586
  }
21529
21587
  function issue(plan, kind, extra) {
21530
21588
  return {
@@ -32197,6 +32255,9 @@ init_shadow2();
32197
32255
  // ../blocks/src/index.ts
32198
32256
  init_blocks();
32199
32257
  init_colorStyles();
32258
+
32259
+ // ../api/src/navigation/linkValue.ts
32260
+ init_src();
32200
32261
  var Rfc6902PatchOp = z.discriminatedUnion("op", [
32201
32262
  // Standard RFC-6902 operations
32202
32263
  z.object({
@@ -45358,7 +45419,7 @@ var SimpleCache = class {
45358
45419
  };
45359
45420
 
45360
45421
  // src/version.ts
45361
- var SDK_VERSION = "0.60.9";
45422
+ var SDK_VERSION = "0.60.11";
45362
45423
 
45363
45424
  // src/client/error.ts
45364
45425
  var RiverbankApiError = class _RiverbankApiError extends Error {