@riverbankcms/sdk 0.4.2 → 0.5.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 +84 -0
- package/dist/cli/index.js +3104 -120
- package/dist/cli/index.js.map +1 -1
- package/dist/client/analytics.js +1 -1
- package/dist/client/analytics.js.map +1 -1
- package/dist/client/analytics.mjs +1 -1
- package/dist/client/analytics.mjs.map +1 -1
- package/dist/client/bookings.js +6 -6
- package/dist/client/bookings.js.map +1 -1
- package/dist/client/bookings.mjs +6 -6
- package/dist/client/bookings.mjs.map +1 -1
- package/dist/client/client.d.mts +2 -2
- package/dist/client/client.d.ts +2 -2
- package/dist/client/client.js +1368 -520
- package/dist/client/client.js.map +1 -1
- package/dist/client/client.mjs +1368 -520
- package/dist/client/client.mjs.map +1 -1
- package/dist/client/hooks.d.mts +2 -2
- package/dist/client/hooks.d.ts +2 -2
- package/dist/client/hooks.js +26 -11
- package/dist/client/hooks.js.map +1 -1
- package/dist/client/hooks.mjs +26 -11
- package/dist/client/hooks.mjs.map +1 -1
- package/dist/client/rendering/client.js +24 -14
- package/dist/client/rendering/client.js.map +1 -1
- package/dist/client/rendering/client.mjs +24 -14
- package/dist/client/rendering/client.mjs.map +1 -1
- package/dist/client/usePage--fGlyrgj.d.mts +6439 -0
- package/dist/client/usePage-BTPnCuWC.d.mts +6511 -0
- package/dist/client/usePage-BafOS9UT.d.mts +6512 -0
- package/dist/client/usePage-Bnx-kA6x.d.mts +6670 -0
- package/dist/client/usePage-CE7X5NcN.d.ts +6439 -0
- package/dist/client/usePage-DoPI6b8V.d.ts +6511 -0
- package/dist/client/usePage-QNWArrVO.d.ts +6670 -0
- package/dist/client/usePage-fBgPB6Oq.d.ts +6512 -0
- package/dist/server/{Layout-kRv5sU81.d.ts → Layout-B-q2Py4v.d.ts} +4 -4
- package/dist/server/{Layout-ByUnm35V.d.mts → Layout-Cc5HUXAH.d.mts} +4 -4
- package/dist/server/{chunk-6JBKKV3G.js → chunk-2KCF2DNK.js} +30 -10
- package/dist/server/chunk-2KCF2DNK.js.map +1 -0
- package/dist/server/{chunk-N3PX76AP.mjs → chunk-4HIRA33Z.mjs} +247 -135
- package/dist/server/chunk-4HIRA33Z.mjs.map +1 -0
- package/dist/server/chunk-5STV4MWD.js +189 -0
- package/dist/server/chunk-5STV4MWD.js.map +1 -0
- package/dist/server/{chunk-R5B6IOFQ.js → chunk-6OSNCH4F.js} +247 -135
- package/dist/server/chunk-6OSNCH4F.js.map +1 -0
- package/dist/server/{chunk-TKMA6D6U.js → chunk-7UPVCT3K.js} +1215 -497
- package/dist/server/chunk-7UPVCT3K.js.map +1 -0
- package/dist/server/{chunk-7DS4Q3GA.mjs → chunk-AEFWG657.mjs} +3 -3
- package/dist/server/chunk-AEFWG657.mjs.map +1 -0
- package/dist/server/{chunk-USQF2XTU.mjs → chunk-BYBJA6SP.mjs} +26 -11
- package/dist/server/chunk-BYBJA6SP.mjs.map +1 -0
- package/dist/server/{chunk-ZEAJW6T3.mjs → chunk-C6FIJC7T.mjs} +4 -3
- package/dist/server/chunk-C6FIJC7T.mjs.map +1 -0
- package/dist/server/{chunk-TO7FD6TQ.js → chunk-I2D7KOEA.js} +4 -4
- package/dist/server/{chunk-TO7FD6TQ.js.map → chunk-I2D7KOEA.js.map} +1 -1
- package/dist/server/chunk-KFLZGNPO.mjs +189 -0
- package/dist/server/chunk-KFLZGNPO.mjs.map +1 -0
- package/dist/server/chunk-L5EA4FXU.mjs +134 -0
- package/dist/server/chunk-L5EA4FXU.mjs.map +1 -0
- package/dist/server/{chunk-TNRADRPH.mjs → chunk-LNOUXALA.mjs} +1137 -419
- package/dist/server/chunk-LNOUXALA.mjs.map +1 -0
- package/dist/server/{chunk-SPXMMX3C.mjs → chunk-OSF34JTQ.mjs} +4 -4
- package/dist/server/{chunk-SWPHIUVE.js → chunk-P3NNN73G.js} +5 -4
- package/dist/server/chunk-P3NNN73G.js.map +1 -0
- package/dist/server/{chunk-I6K5REFT.mjs → chunk-P4K63SBZ.mjs} +24 -4
- package/dist/server/chunk-P4K63SBZ.mjs.map +1 -0
- package/dist/server/{chunk-HOY77YBF.js → chunk-RVDS7VSP.js} +5 -5
- package/dist/server/chunk-RVDS7VSP.js.map +1 -0
- package/dist/server/{chunk-NW5KHH4A.js → chunk-TT5JWA4X.js} +9 -9
- package/dist/server/{chunk-NW5KHH4A.js.map → chunk-TT5JWA4X.js.map} +1 -1
- package/dist/server/chunk-VSFQRHYZ.js +134 -0
- package/dist/server/chunk-VSFQRHYZ.js.map +1 -0
- package/dist/server/{chunk-EGTDJ4PL.js → chunk-YYO3RIFO.js} +26 -11
- package/dist/server/chunk-YYO3RIFO.js.map +1 -0
- package/dist/server/{chunk-OP2GHK27.mjs → chunk-Z5ZA6Q4D.mjs} +2 -2
- package/dist/server/{components-D1Z2mSDr.d.ts → components-CU46ZkAv.d.mts} +20 -75
- package/dist/server/{components-CY8jDQjv.d.mts → components-DvozDwRN.d.ts} +20 -75
- package/dist/server/components.d.mts +11 -8
- package/dist/server/components.d.ts +11 -8
- package/dist/server/components.js +5 -4
- package/dist/server/components.js.map +1 -1
- package/dist/server/components.mjs +4 -3
- package/dist/server/config-validation.d.mts +3 -3
- package/dist/server/config-validation.d.ts +3 -3
- package/dist/server/config-validation.js +9 -5
- package/dist/server/config-validation.js.map +1 -1
- package/dist/server/config-validation.mjs +8 -4
- package/dist/server/config.d.mts +243 -5
- package/dist/server/config.d.ts +243 -5
- package/dist/server/config.js +72 -5
- package/dist/server/config.js.map +1 -1
- package/dist/server/config.mjs +72 -5
- package/dist/server/config.mjs.map +1 -1
- package/dist/server/core-DsNWrl3o.d.mts +44 -0
- package/dist/server/core-DsNWrl3o.d.ts +44 -0
- package/dist/server/data.d.mts +4 -3
- package/dist/server/data.d.ts +4 -3
- package/dist/server/data.js +3 -3
- package/dist/server/data.mjs +2 -2
- package/dist/server/{index-DCIz9Ptv.d.ts → index-CJfMXZQr.d.ts} +2 -1
- package/dist/server/{index-DFQwtj3J.d.mts → index-Q7RLMAQ6.d.mts} +2 -1
- package/dist/server/index.d.mts +63 -6
- package/dist/server/index.d.ts +63 -6
- package/dist/server/index.js +91 -2
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +90 -1
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/link-DjxLyC82.d.mts +23 -0
- package/dist/server/link-DjxLyC82.d.ts +23 -0
- package/dist/server/{loadContent-CWuE8FCx.d.mts → loadContent-DgpSKWqY.d.mts} +4 -4
- package/dist/server/{loadContent-DynBuR5f.d.ts → loadContent-GPvUI1bN.d.ts} +4 -4
- package/dist/server/{loadPage-B8RmlYgV.d.mts → loadPage-DGnIK7s4.d.mts} +17 -47
- package/dist/server/loadPage-DNQTTRHL.mjs +11 -0
- package/dist/server/{loadPage-BTkKpizX.d.ts → loadPage-DW9WB-u9.d.ts} +17 -47
- package/dist/server/loadPage-IDGVDFBB.js +11 -0
- package/dist/server/{loadPage-DUHBXDEW.js.map → loadPage-IDGVDFBB.js.map} +1 -1
- package/dist/server/metadata.d.mts +6 -4
- package/dist/server/metadata.d.ts +6 -4
- package/dist/server/navigation.d.mts +199 -29
- package/dist/server/navigation.d.ts +199 -29
- package/dist/server/navigation.js +27 -43
- package/dist/server/navigation.js.map +1 -1
- package/dist/server/navigation.mjs +20 -36
- package/dist/server/navigation.mjs.map +1 -1
- package/dist/server/rendering/server.d.mts +8 -6
- package/dist/server/rendering/server.d.ts +8 -6
- package/dist/server/rendering/server.js +7 -6
- package/dist/server/rendering/server.js.map +1 -1
- package/dist/server/rendering/server.mjs +6 -5
- package/dist/server/rendering.d.mts +14 -10
- package/dist/server/rendering.d.ts +14 -10
- package/dist/server/rendering.js +9 -8
- package/dist/server/rendering.js.map +1 -1
- package/dist/server/rendering.mjs +8 -7
- package/dist/server/richTextSchema-DURiozvD.d.mts +62 -0
- package/dist/server/richTextSchema-DURiozvD.d.ts +62 -0
- package/dist/server/routing.d.mts +178 -11
- package/dist/server/routing.d.ts +178 -11
- package/dist/server/routing.js +95 -2
- package/dist/server/routing.js.map +1 -1
- package/dist/server/routing.mjs +94 -1
- package/dist/server/routing.mjs.map +1 -1
- package/dist/server/{schema-Bpy9N5ZI.d.ts → schema-Z6-afHJG.d.mts} +1 -1
- package/dist/server/{schema-Bpy9N5ZI.d.mts → schema-Z6-afHJG.d.ts} +1 -1
- package/dist/server/server.d.mts +9 -7
- package/dist/server/server.d.ts +9 -7
- package/dist/server/server.js +6 -6
- package/dist/server/server.mjs +5 -5
- package/dist/server/theme-bridge.js +8 -8
- package/dist/server/theme-bridge.mjs +2 -2
- package/dist/server/{types-oCM-fw4O.d.ts → types-0f4PIlgx.d.mts} +55 -2
- package/dist/server/{types-txWsSxN7.d.mts → types-BjgZt8xJ.d.mts} +63 -2
- package/dist/server/{types-BiRZnxDx.d.ts → types-C28kMfa1.d.ts} +256 -82
- package/dist/server/{types-CL916r6x.d.ts → types-DLBhEPSt.d.ts} +63 -2
- package/dist/server/{types-CdrJqlKx.d.mts → types-DuzJZKJI.d.mts} +256 -82
- package/dist/server/{types-DkKEctWn.d.mts → types-kOQyCFXO.d.ts} +55 -2
- package/dist/server/{validation-DzvDwwRo.d.mts → validation-BGuRo8P1.d.mts} +18 -5
- package/dist/server/{validation-CoU8uAiu.d.ts → validation-DU2YE7u5.d.ts} +18 -5
- package/package.json +5 -3
- package/dist/server/chunk-6JBKKV3G.js.map +0 -1
- package/dist/server/chunk-7BOIO2S7.mjs +0 -833
- package/dist/server/chunk-7BOIO2S7.mjs.map +0 -1
- package/dist/server/chunk-7DS4Q3GA.mjs.map +0 -1
- package/dist/server/chunk-BLKVTULP.js +0 -833
- package/dist/server/chunk-BLKVTULP.js.map +0 -1
- package/dist/server/chunk-EGTDJ4PL.js.map +0 -1
- package/dist/server/chunk-HOY77YBF.js.map +0 -1
- package/dist/server/chunk-I6K5REFT.mjs.map +0 -1
- package/dist/server/chunk-N3PX76AP.mjs.map +0 -1
- package/dist/server/chunk-R5B6IOFQ.js.map +0 -1
- package/dist/server/chunk-SWPHIUVE.js.map +0 -1
- package/dist/server/chunk-TKMA6D6U.js.map +0 -1
- package/dist/server/chunk-TNRADRPH.mjs.map +0 -1
- package/dist/server/chunk-USQF2XTU.mjs.map +0 -1
- package/dist/server/chunk-ZEAJW6T3.mjs.map +0 -1
- package/dist/server/loadPage-DUHBXDEW.js +0 -11
- package/dist/server/loadPage-LYVKY3WZ.mjs +0 -11
- /package/dist/server/{chunk-SPXMMX3C.mjs.map → chunk-OSF34JTQ.mjs.map} +0 -0
- /package/dist/server/{chunk-OP2GHK27.mjs.map → chunk-Z5ZA6Q4D.mjs.map} +0 -0
- /package/dist/server/{loadPage-LYVKY3WZ.mjs.map → loadPage-DNQTTRHL.mjs.map} +0 -0
package/dist/server/config.d.mts
CHANGED
|
@@ -1,10 +1,248 @@
|
|
|
1
|
-
import { R as RiverbankSiteConfig,
|
|
2
|
-
export { m as BlockConfig, B as BlockFieldConfig,
|
|
3
|
-
export { C as ContentConfigInput, z as ContentConfigOutput, V as ValidatedRiverbankSiteConfig, y as ValidatedSdkCustomBlock, x as blockConfigSchema, k as blockFieldConfigSchema, m as blockFieldExtensionSchema, n as blockFieldExtensionsSchema, l as blockFieldOptionsSchema, d as containerAlignmentSchema, c as containerMaxWidthSchema, f as containerOptionsSchema, o as contentConfigSchema, p as contentTypeConfigSchema, t as entryConfigSchema, j as fieldSelectOptionSchema, v as navigationItemConfigSchema, u as navigationMenuConfigSchema, q as pageConfigSchema, r as riverbankSiteConfigSchema, i as sdkCustomBlockSchema, g as sdkThemeConfigSchema, h as sdkThemePaletteSchema, a as sectionBackgroundSchema, e as sectionOptionsSchema, b as sectionSpacingSchema, w as siteSettingsConfigSchema, s as siteStyleConfigSchema } from './validation-
|
|
1
|
+
import { C as ContentTypeConfig, E as EntryConfig, R as RiverbankSiteConfig, a as ContentConfig } from './types-BjgZt8xJ.mjs';
|
|
2
|
+
export { m as BlockConfig, B as BlockFieldConfig, k as BlockFieldExtension, l as BlockFieldExtensionsMap, j as BlockFieldOptionsMap, g as ContainerAlignment, f as ContainerMaxWidth, d as ContainerOptionsConfig, F as FieldSelectOption, n as NavigationItemConfig, o as NavigationLinkType, N as NavigationMenuConfig, P as PageConfig, h as SdkThemeConfig, i as SdkThemePalette, b as SectionBackground, c as SectionOptionsConfig, e as SectionSpacing, p as SiteSettingsConfig, S as SiteStyleConfig } from './types-BjgZt8xJ.mjs';
|
|
3
|
+
export { C as ContentConfigInput, z as ContentConfigOutput, V as ValidatedRiverbankSiteConfig, y as ValidatedSdkCustomBlock, x as blockConfigSchema, k as blockFieldConfigSchema, m as blockFieldExtensionSchema, n as blockFieldExtensionsSchema, l as blockFieldOptionsSchema, d as containerAlignmentSchema, c as containerMaxWidthSchema, f as containerOptionsSchema, o as contentConfigSchema, p as contentTypeConfigSchema, t as entryConfigSchema, j as fieldSelectOptionSchema, v as navigationItemConfigSchema, u as navigationMenuConfigSchema, q as pageConfigSchema, r as riverbankSiteConfigSchema, i as sdkCustomBlockSchema, g as sdkThemeConfigSchema, h as sdkThemePaletteSchema, a as sectionBackgroundSchema, e as sectionOptionsSchema, b as sectionSpacingSchema, w as siteSettingsConfigSchema, s as siteStyleConfigSchema } from './validation-BGuRo8P1.mjs';
|
|
4
4
|
export { B as BlockKind, C as CustomBlockKind, S as SYSTEM_BLOCK_KINDS, a as SystemBlockKind } from './blockKinds-B6MWzNWp.mjs';
|
|
5
|
-
|
|
5
|
+
import { F as FieldDefinition, T as TextFieldDefinition, B as BooleanFieldDefinition, N as NumberFieldDefinition, R as RichTextFieldDefinition, M as MediaFieldDefinition, L as LinkFieldDefinition, D as DateFieldDefinition, a as TimeFieldDefinition, b as DateTimeFieldDefinition, c as SlugFieldDefinition, U as UrlFieldDefinition, d as ReferenceFieldDefinition, e as PresetOrCustomFieldDefinition, C as ContentTypeSelectFieldDefinition, f as SelectFieldDefinition, E as EntryPickerFieldDefinition, G as GroupFieldDefinition, g as ModalFieldDefinition, h as RepeaterFieldDefinition, i as TabGroupFieldDefinition } from './schema-Z6-afHJG.mjs';
|
|
6
|
+
export { S as SdkCustomBlock } from './schema-Z6-afHJG.mjs';
|
|
7
|
+
import { T as TipTapNode, M as Media } from './richTextSchema-DURiozvD.mjs';
|
|
8
|
+
import { L as LinkValue } from './link-DjxLyC82.mjs';
|
|
9
|
+
export { C as CustomLinkValue, E as ExternalLinkValue, I as InternalLinkValue } from './link-DjxLyC82.mjs';
|
|
6
10
|
import 'zod';
|
|
7
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Type-Safe Content Entries
|
|
14
|
+
*
|
|
15
|
+
* This module provides type-safe helpers for defining content types and entries
|
|
16
|
+
* in SDK site configurations. When used with `as const`, TypeScript can infer
|
|
17
|
+
* the exact shape of entry data from the content type's field definitions.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import { defineTypedContentType, createEntry, tiptap } from '@riverbankcms/sdk/config';
|
|
22
|
+
*
|
|
23
|
+
* // Define content type with `as const` for type inference
|
|
24
|
+
* export const testimonialType = defineTypedContentType({
|
|
25
|
+
* key: 'testimonial',
|
|
26
|
+
* name: 'Testimonial',
|
|
27
|
+
* hasPages: false,
|
|
28
|
+
* fields: [
|
|
29
|
+
* { id: 'name', type: 'text', label: 'Name', required: true, multiline: false },
|
|
30
|
+
* { id: 'quote', type: 'richText', label: 'Quote', required: true, format: 'html' },
|
|
31
|
+
* ],
|
|
32
|
+
* } as const);
|
|
33
|
+
*
|
|
34
|
+
* // Create entry with full type safety
|
|
35
|
+
* const entry = createEntry(testimonialType, {
|
|
36
|
+
* identifier: 'testimonial-1',
|
|
37
|
+
* data: {
|
|
38
|
+
* name: 'John Doe', // TypeScript knows this is string
|
|
39
|
+
* quote: tiptap.paragraph('Great service!'), // TypeScript knows this is TipTapNode
|
|
40
|
+
* },
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Infers the data object shape from tabGroup tabs (flattens all tab fields).
|
|
47
|
+
* TabGroup fields flatten all their tab fields into a single data object.
|
|
48
|
+
*/
|
|
49
|
+
type InferDataFromTabs<Tabs extends readonly {
|
|
50
|
+
fields: readonly FieldDefinition[];
|
|
51
|
+
}[]> = InferDataFromFields<Tabs[number]['fields']>;
|
|
52
|
+
/**
|
|
53
|
+
* Maps a field definition to its TypeScript value type.
|
|
54
|
+
* Uses conditional types to infer the correct type based on field.type.
|
|
55
|
+
*
|
|
56
|
+
* Coverage:
|
|
57
|
+
* - Simple primitives: text, boolean, number
|
|
58
|
+
* - Complex types: richText (TipTapNode), media (Media | null), link (LinkValue | null)
|
|
59
|
+
* - Date/time: date, time, datetime (all ISO strings)
|
|
60
|
+
* - String-value: slug, url, reference, presetOrCustom, contentTypeSelect
|
|
61
|
+
* - Select: single (string) vs multiple (string[])
|
|
62
|
+
* - Entry picker: string | null
|
|
63
|
+
* - Nested: group, modal (nested InferDataFromFields)
|
|
64
|
+
* - Repeater: monomorphic (array) and polymorphic (discriminated union array)
|
|
65
|
+
* - TabGroup: flattened fields from all tabs
|
|
66
|
+
*/
|
|
67
|
+
type FieldValueType<F extends FieldDefinition> = F extends TextFieldDefinition ? string : F extends BooleanFieldDefinition ? boolean : F extends NumberFieldDefinition ? number : F extends RichTextFieldDefinition ? TipTapNode : F extends MediaFieldDefinition ? Media | null : F extends LinkFieldDefinition ? LinkValue | null : F extends DateFieldDefinition ? string : F extends TimeFieldDefinition ? string : F extends DateTimeFieldDefinition ? string : F extends SlugFieldDefinition ? string : F extends UrlFieldDefinition ? string : F extends ReferenceFieldDefinition ? string : F extends PresetOrCustomFieldDefinition ? string : F extends ContentTypeSelectFieldDefinition ? string : F extends SelectFieldDefinition & {
|
|
68
|
+
multiple: true;
|
|
69
|
+
} ? string[] : F extends SelectFieldDefinition ? string : F extends EntryPickerFieldDefinition ? string | null : F extends GroupFieldDefinition & {
|
|
70
|
+
schema: {
|
|
71
|
+
fields: infer GF;
|
|
72
|
+
};
|
|
73
|
+
} ? GF extends readonly FieldDefinition[] ? InferDataFromFields<GF> : never : F extends ModalFieldDefinition & {
|
|
74
|
+
schema: {
|
|
75
|
+
fields: infer MF;
|
|
76
|
+
};
|
|
77
|
+
} ? MF extends readonly FieldDefinition[] ? InferDataFromFields<MF> : never : F extends {
|
|
78
|
+
type: 'repeater';
|
|
79
|
+
polymorphic: true;
|
|
80
|
+
} ? unknown[] : F extends RepeaterFieldDefinition & {
|
|
81
|
+
schema: {
|
|
82
|
+
fields: infer RF;
|
|
83
|
+
};
|
|
84
|
+
} ? RF extends readonly FieldDefinition[] ? InferDataFromFields<RF>[] : never : F extends TabGroupFieldDefinition & {
|
|
85
|
+
tabs: infer T;
|
|
86
|
+
} ? T extends readonly {
|
|
87
|
+
fields: readonly FieldDefinition[];
|
|
88
|
+
}[] ? InferDataFromTabs<T> : never : unknown;
|
|
89
|
+
/**
|
|
90
|
+
* Infers the data object shape from an array of field definitions.
|
|
91
|
+
* Required fields are non-optional, optional fields are `| undefined`.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* const fields = [
|
|
96
|
+
* { id: 'name', type: 'text', required: true },
|
|
97
|
+
* { id: 'bio', type: 'text', required: false },
|
|
98
|
+
* ] as const;
|
|
99
|
+
*
|
|
100
|
+
* type Data = InferDataFromFields<typeof fields>;
|
|
101
|
+
* // { name: string; bio: string | undefined }
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
type InferDataFromFields<Fields extends readonly FieldDefinition[]> = {
|
|
105
|
+
[F in Fields[number] as F['id']]: F extends {
|
|
106
|
+
required: true;
|
|
107
|
+
} ? FieldValueType<F> : FieldValueType<F> | undefined;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* A content type definition with preserved field types for type inference.
|
|
111
|
+
* Extends ContentTypeConfig to ensure all required fields are present.
|
|
112
|
+
* The generic parameters capture the literal types from `as const`.
|
|
113
|
+
*/
|
|
114
|
+
interface TypedContentType<K extends string = string, F extends readonly FieldDefinition[] = readonly FieldDefinition[]> extends Omit<ContentTypeConfig, 'key' | 'fields'> {
|
|
115
|
+
key: K;
|
|
116
|
+
fields: F;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Define a content type with preserved field types for type inference.
|
|
120
|
+
*
|
|
121
|
+
* IMPORTANT: Use `as const` on the config object to enable type inference.
|
|
122
|
+
* Without `as const`, TypeScript widens literal types and inference won't work.
|
|
123
|
+
*
|
|
124
|
+
* @param config - The content type configuration
|
|
125
|
+
* @returns The same config object with preserved types
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* export const testimonialType = defineTypedContentType({
|
|
130
|
+
* key: 'testimonial',
|
|
131
|
+
* name: 'Testimonial',
|
|
132
|
+
* hasPages: false,
|
|
133
|
+
* fields: [
|
|
134
|
+
* { id: 'name', type: 'text', label: 'Name', required: true, multiline: false },
|
|
135
|
+
* { id: 'quote', type: 'richText', label: 'Quote', required: true, format: 'html' },
|
|
136
|
+
* ],
|
|
137
|
+
* } as const);
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
declare function defineTypedContentType<K extends string, F extends readonly FieldDefinition[]>(config: TypedContentType<K, F>): TypedContentType<K, F>;
|
|
141
|
+
/**
|
|
142
|
+
* Entry configuration with typed data field.
|
|
143
|
+
* Used internally by createEntry to enforce type safety.
|
|
144
|
+
*/
|
|
145
|
+
interface TypedEntryConfig<Data extends Record<string, unknown>> {
|
|
146
|
+
/** Unique identifier for this entry. Required for SDK sync. */
|
|
147
|
+
identifier: string;
|
|
148
|
+
/** Title for the entry */
|
|
149
|
+
title?: string;
|
|
150
|
+
/** Slug for routable entries */
|
|
151
|
+
slug?: string;
|
|
152
|
+
/** Status: 'draft' or 'published' */
|
|
153
|
+
status?: 'draft' | 'published';
|
|
154
|
+
/** Summary/description */
|
|
155
|
+
summary?: string;
|
|
156
|
+
/** SEO meta title */
|
|
157
|
+
metaTitle?: string;
|
|
158
|
+
/** SEO meta description */
|
|
159
|
+
metaDescription?: string;
|
|
160
|
+
/** Entry data matching the content type's field definitions */
|
|
161
|
+
data: Data;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Create a type-safe content entry for a typed content type.
|
|
165
|
+
*
|
|
166
|
+
* The data field is validated against the content type's field definitions.
|
|
167
|
+
* TypeScript will error if:
|
|
168
|
+
* - A required field is missing
|
|
169
|
+
* - A field name is misspelled
|
|
170
|
+
* - A field value has the wrong type
|
|
171
|
+
* - An extra field is provided (with strict mode)
|
|
172
|
+
*
|
|
173
|
+
* @param contentType - The typed content type definition
|
|
174
|
+
* @param entry - The entry configuration with typed data
|
|
175
|
+
* @returns EntryConfig compatible with SDK content configuration
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```typescript
|
|
179
|
+
* const entry = createEntry(testimonialType, {
|
|
180
|
+
* identifier: 'testimonial-1',
|
|
181
|
+
* title: 'John Doe',
|
|
182
|
+
* status: 'published',
|
|
183
|
+
* data: {
|
|
184
|
+
* name: 'John Doe',
|
|
185
|
+
* quote: tiptap.paragraph('Great service!'),
|
|
186
|
+
* },
|
|
187
|
+
* });
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
declare function createEntry<K extends string, F extends readonly FieldDefinition[]>(contentType: TypedContentType<K, F>, entry: TypedEntryConfig<InferDataFromFields<F>>): EntryConfig;
|
|
191
|
+
/**
|
|
192
|
+
* Helpers for creating TipTap document structures.
|
|
193
|
+
*
|
|
194
|
+
* Use these helpers when populating richText fields to avoid manually
|
|
195
|
+
* constructing the TipTap JSON structure.
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```typescript
|
|
199
|
+
* // Simple paragraph
|
|
200
|
+
* const body = tiptap.paragraph('Hello, world!');
|
|
201
|
+
*
|
|
202
|
+
* // Empty document
|
|
203
|
+
* const emptyDoc = tiptap.empty();
|
|
204
|
+
*
|
|
205
|
+
* // Complex document
|
|
206
|
+
* const doc = tiptap.doc([
|
|
207
|
+
* tiptap.heading(1, 'Welcome'),
|
|
208
|
+
* { type: 'paragraph', content: [{ type: 'text', text: 'Introduction...' }] },
|
|
209
|
+
* ]);
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
declare const tiptap: {
|
|
213
|
+
/**
|
|
214
|
+
* Create an empty TipTap document.
|
|
215
|
+
*
|
|
216
|
+
* @returns An empty TipTap document node
|
|
217
|
+
*/
|
|
218
|
+
empty(): TipTapNode;
|
|
219
|
+
/**
|
|
220
|
+
* Create a TipTap document with a single paragraph.
|
|
221
|
+
*
|
|
222
|
+
* @param text - The paragraph text content
|
|
223
|
+
* @returns A TipTap document with one paragraph
|
|
224
|
+
*/
|
|
225
|
+
paragraph(text: string): TipTapNode;
|
|
226
|
+
/**
|
|
227
|
+
* Create a TipTap document with custom content nodes.
|
|
228
|
+
*
|
|
229
|
+
* @param content - Array of TipTap nodes to include in the document
|
|
230
|
+
* @returns A TipTap document wrapping the content
|
|
231
|
+
*/
|
|
232
|
+
doc(content: TipTapNode[]): TipTapNode;
|
|
233
|
+
/**
|
|
234
|
+
* Create a heading node.
|
|
235
|
+
*
|
|
236
|
+
* Note: This returns a heading node, not a document. Use with tiptap.doc()
|
|
237
|
+
* to create a complete document.
|
|
238
|
+
*
|
|
239
|
+
* @param level - Heading level (1-6)
|
|
240
|
+
* @param text - Heading text content
|
|
241
|
+
* @returns A TipTap heading node
|
|
242
|
+
*/
|
|
243
|
+
heading(level: 1 | 2 | 3 | 4 | 5 | 6, text: string): TipTapNode;
|
|
244
|
+
};
|
|
245
|
+
|
|
8
246
|
/**
|
|
9
247
|
* SDK Site Configuration
|
|
10
248
|
*
|
|
@@ -74,4 +312,4 @@ declare function defineConfig(config: RiverbankSiteConfig): RiverbankSiteConfig;
|
|
|
74
312
|
*/
|
|
75
313
|
declare function defineContentConfig(config: ContentConfig): ContentConfig;
|
|
76
314
|
|
|
77
|
-
export { ContentConfig, RiverbankSiteConfig, defineConfig, defineContentConfig };
|
|
315
|
+
export { ContentConfig, ContentTypeConfig, EntryConfig, FieldDefinition, type FieldValueType, type InferDataFromFields, LinkValue, Media, RiverbankSiteConfig, TipTapNode, type TypedContentType, type TypedEntryConfig, createEntry, defineConfig, defineContentConfig, defineTypedContentType, tiptap };
|
package/dist/server/config.d.ts
CHANGED
|
@@ -1,10 +1,248 @@
|
|
|
1
|
-
import { R as RiverbankSiteConfig,
|
|
2
|
-
export { m as BlockConfig, B as BlockFieldConfig,
|
|
3
|
-
export { C as ContentConfigInput, z as ContentConfigOutput, V as ValidatedRiverbankSiteConfig, y as ValidatedSdkCustomBlock, x as blockConfigSchema, k as blockFieldConfigSchema, m as blockFieldExtensionSchema, n as blockFieldExtensionsSchema, l as blockFieldOptionsSchema, d as containerAlignmentSchema, c as containerMaxWidthSchema, f as containerOptionsSchema, o as contentConfigSchema, p as contentTypeConfigSchema, t as entryConfigSchema, j as fieldSelectOptionSchema, v as navigationItemConfigSchema, u as navigationMenuConfigSchema, q as pageConfigSchema, r as riverbankSiteConfigSchema, i as sdkCustomBlockSchema, g as sdkThemeConfigSchema, h as sdkThemePaletteSchema, a as sectionBackgroundSchema, e as sectionOptionsSchema, b as sectionSpacingSchema, w as siteSettingsConfigSchema, s as siteStyleConfigSchema } from './validation-
|
|
1
|
+
import { C as ContentTypeConfig, E as EntryConfig, R as RiverbankSiteConfig, a as ContentConfig } from './types-DLBhEPSt.js';
|
|
2
|
+
export { m as BlockConfig, B as BlockFieldConfig, k as BlockFieldExtension, l as BlockFieldExtensionsMap, j as BlockFieldOptionsMap, g as ContainerAlignment, f as ContainerMaxWidth, d as ContainerOptionsConfig, F as FieldSelectOption, n as NavigationItemConfig, o as NavigationLinkType, N as NavigationMenuConfig, P as PageConfig, h as SdkThemeConfig, i as SdkThemePalette, b as SectionBackground, c as SectionOptionsConfig, e as SectionSpacing, p as SiteSettingsConfig, S as SiteStyleConfig } from './types-DLBhEPSt.js';
|
|
3
|
+
export { C as ContentConfigInput, z as ContentConfigOutput, V as ValidatedRiverbankSiteConfig, y as ValidatedSdkCustomBlock, x as blockConfigSchema, k as blockFieldConfigSchema, m as blockFieldExtensionSchema, n as blockFieldExtensionsSchema, l as blockFieldOptionsSchema, d as containerAlignmentSchema, c as containerMaxWidthSchema, f as containerOptionsSchema, o as contentConfigSchema, p as contentTypeConfigSchema, t as entryConfigSchema, j as fieldSelectOptionSchema, v as navigationItemConfigSchema, u as navigationMenuConfigSchema, q as pageConfigSchema, r as riverbankSiteConfigSchema, i as sdkCustomBlockSchema, g as sdkThemeConfigSchema, h as sdkThemePaletteSchema, a as sectionBackgroundSchema, e as sectionOptionsSchema, b as sectionSpacingSchema, w as siteSettingsConfigSchema, s as siteStyleConfigSchema } from './validation-DU2YE7u5.js';
|
|
4
4
|
export { B as BlockKind, C as CustomBlockKind, S as SYSTEM_BLOCK_KINDS, a as SystemBlockKind } from './blockKinds-B6MWzNWp.js';
|
|
5
|
-
|
|
5
|
+
import { F as FieldDefinition, T as TextFieldDefinition, B as BooleanFieldDefinition, N as NumberFieldDefinition, R as RichTextFieldDefinition, M as MediaFieldDefinition, L as LinkFieldDefinition, D as DateFieldDefinition, a as TimeFieldDefinition, b as DateTimeFieldDefinition, c as SlugFieldDefinition, U as UrlFieldDefinition, d as ReferenceFieldDefinition, e as PresetOrCustomFieldDefinition, C as ContentTypeSelectFieldDefinition, f as SelectFieldDefinition, E as EntryPickerFieldDefinition, G as GroupFieldDefinition, g as ModalFieldDefinition, h as RepeaterFieldDefinition, i as TabGroupFieldDefinition } from './schema-Z6-afHJG.js';
|
|
6
|
+
export { S as SdkCustomBlock } from './schema-Z6-afHJG.js';
|
|
7
|
+
import { T as TipTapNode, M as Media } from './richTextSchema-DURiozvD.js';
|
|
8
|
+
import { L as LinkValue } from './link-DjxLyC82.js';
|
|
9
|
+
export { C as CustomLinkValue, E as ExternalLinkValue, I as InternalLinkValue } from './link-DjxLyC82.js';
|
|
6
10
|
import 'zod';
|
|
7
11
|
|
|
12
|
+
/**
|
|
13
|
+
* Type-Safe Content Entries
|
|
14
|
+
*
|
|
15
|
+
* This module provides type-safe helpers for defining content types and entries
|
|
16
|
+
* in SDK site configurations. When used with `as const`, TypeScript can infer
|
|
17
|
+
* the exact shape of entry data from the content type's field definitions.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```typescript
|
|
21
|
+
* import { defineTypedContentType, createEntry, tiptap } from '@riverbankcms/sdk/config';
|
|
22
|
+
*
|
|
23
|
+
* // Define content type with `as const` for type inference
|
|
24
|
+
* export const testimonialType = defineTypedContentType({
|
|
25
|
+
* key: 'testimonial',
|
|
26
|
+
* name: 'Testimonial',
|
|
27
|
+
* hasPages: false,
|
|
28
|
+
* fields: [
|
|
29
|
+
* { id: 'name', type: 'text', label: 'Name', required: true, multiline: false },
|
|
30
|
+
* { id: 'quote', type: 'richText', label: 'Quote', required: true, format: 'html' },
|
|
31
|
+
* ],
|
|
32
|
+
* } as const);
|
|
33
|
+
*
|
|
34
|
+
* // Create entry with full type safety
|
|
35
|
+
* const entry = createEntry(testimonialType, {
|
|
36
|
+
* identifier: 'testimonial-1',
|
|
37
|
+
* data: {
|
|
38
|
+
* name: 'John Doe', // TypeScript knows this is string
|
|
39
|
+
* quote: tiptap.paragraph('Great service!'), // TypeScript knows this is TipTapNode
|
|
40
|
+
* },
|
|
41
|
+
* });
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Infers the data object shape from tabGroup tabs (flattens all tab fields).
|
|
47
|
+
* TabGroup fields flatten all their tab fields into a single data object.
|
|
48
|
+
*/
|
|
49
|
+
type InferDataFromTabs<Tabs extends readonly {
|
|
50
|
+
fields: readonly FieldDefinition[];
|
|
51
|
+
}[]> = InferDataFromFields<Tabs[number]['fields']>;
|
|
52
|
+
/**
|
|
53
|
+
* Maps a field definition to its TypeScript value type.
|
|
54
|
+
* Uses conditional types to infer the correct type based on field.type.
|
|
55
|
+
*
|
|
56
|
+
* Coverage:
|
|
57
|
+
* - Simple primitives: text, boolean, number
|
|
58
|
+
* - Complex types: richText (TipTapNode), media (Media | null), link (LinkValue | null)
|
|
59
|
+
* - Date/time: date, time, datetime (all ISO strings)
|
|
60
|
+
* - String-value: slug, url, reference, presetOrCustom, contentTypeSelect
|
|
61
|
+
* - Select: single (string) vs multiple (string[])
|
|
62
|
+
* - Entry picker: string | null
|
|
63
|
+
* - Nested: group, modal (nested InferDataFromFields)
|
|
64
|
+
* - Repeater: monomorphic (array) and polymorphic (discriminated union array)
|
|
65
|
+
* - TabGroup: flattened fields from all tabs
|
|
66
|
+
*/
|
|
67
|
+
type FieldValueType<F extends FieldDefinition> = F extends TextFieldDefinition ? string : F extends BooleanFieldDefinition ? boolean : F extends NumberFieldDefinition ? number : F extends RichTextFieldDefinition ? TipTapNode : F extends MediaFieldDefinition ? Media | null : F extends LinkFieldDefinition ? LinkValue | null : F extends DateFieldDefinition ? string : F extends TimeFieldDefinition ? string : F extends DateTimeFieldDefinition ? string : F extends SlugFieldDefinition ? string : F extends UrlFieldDefinition ? string : F extends ReferenceFieldDefinition ? string : F extends PresetOrCustomFieldDefinition ? string : F extends ContentTypeSelectFieldDefinition ? string : F extends SelectFieldDefinition & {
|
|
68
|
+
multiple: true;
|
|
69
|
+
} ? string[] : F extends SelectFieldDefinition ? string : F extends EntryPickerFieldDefinition ? string | null : F extends GroupFieldDefinition & {
|
|
70
|
+
schema: {
|
|
71
|
+
fields: infer GF;
|
|
72
|
+
};
|
|
73
|
+
} ? GF extends readonly FieldDefinition[] ? InferDataFromFields<GF> : never : F extends ModalFieldDefinition & {
|
|
74
|
+
schema: {
|
|
75
|
+
fields: infer MF;
|
|
76
|
+
};
|
|
77
|
+
} ? MF extends readonly FieldDefinition[] ? InferDataFromFields<MF> : never : F extends {
|
|
78
|
+
type: 'repeater';
|
|
79
|
+
polymorphic: true;
|
|
80
|
+
} ? unknown[] : F extends RepeaterFieldDefinition & {
|
|
81
|
+
schema: {
|
|
82
|
+
fields: infer RF;
|
|
83
|
+
};
|
|
84
|
+
} ? RF extends readonly FieldDefinition[] ? InferDataFromFields<RF>[] : never : F extends TabGroupFieldDefinition & {
|
|
85
|
+
tabs: infer T;
|
|
86
|
+
} ? T extends readonly {
|
|
87
|
+
fields: readonly FieldDefinition[];
|
|
88
|
+
}[] ? InferDataFromTabs<T> : never : unknown;
|
|
89
|
+
/**
|
|
90
|
+
* Infers the data object shape from an array of field definitions.
|
|
91
|
+
* Required fields are non-optional, optional fields are `| undefined`.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* const fields = [
|
|
96
|
+
* { id: 'name', type: 'text', required: true },
|
|
97
|
+
* { id: 'bio', type: 'text', required: false },
|
|
98
|
+
* ] as const;
|
|
99
|
+
*
|
|
100
|
+
* type Data = InferDataFromFields<typeof fields>;
|
|
101
|
+
* // { name: string; bio: string | undefined }
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
type InferDataFromFields<Fields extends readonly FieldDefinition[]> = {
|
|
105
|
+
[F in Fields[number] as F['id']]: F extends {
|
|
106
|
+
required: true;
|
|
107
|
+
} ? FieldValueType<F> : FieldValueType<F> | undefined;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* A content type definition with preserved field types for type inference.
|
|
111
|
+
* Extends ContentTypeConfig to ensure all required fields are present.
|
|
112
|
+
* The generic parameters capture the literal types from `as const`.
|
|
113
|
+
*/
|
|
114
|
+
interface TypedContentType<K extends string = string, F extends readonly FieldDefinition[] = readonly FieldDefinition[]> extends Omit<ContentTypeConfig, 'key' | 'fields'> {
|
|
115
|
+
key: K;
|
|
116
|
+
fields: F;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Define a content type with preserved field types for type inference.
|
|
120
|
+
*
|
|
121
|
+
* IMPORTANT: Use `as const` on the config object to enable type inference.
|
|
122
|
+
* Without `as const`, TypeScript widens literal types and inference won't work.
|
|
123
|
+
*
|
|
124
|
+
* @param config - The content type configuration
|
|
125
|
+
* @returns The same config object with preserved types
|
|
126
|
+
*
|
|
127
|
+
* @example
|
|
128
|
+
* ```typescript
|
|
129
|
+
* export const testimonialType = defineTypedContentType({
|
|
130
|
+
* key: 'testimonial',
|
|
131
|
+
* name: 'Testimonial',
|
|
132
|
+
* hasPages: false,
|
|
133
|
+
* fields: [
|
|
134
|
+
* { id: 'name', type: 'text', label: 'Name', required: true, multiline: false },
|
|
135
|
+
* { id: 'quote', type: 'richText', label: 'Quote', required: true, format: 'html' },
|
|
136
|
+
* ],
|
|
137
|
+
* } as const);
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
declare function defineTypedContentType<K extends string, F extends readonly FieldDefinition[]>(config: TypedContentType<K, F>): TypedContentType<K, F>;
|
|
141
|
+
/**
|
|
142
|
+
* Entry configuration with typed data field.
|
|
143
|
+
* Used internally by createEntry to enforce type safety.
|
|
144
|
+
*/
|
|
145
|
+
interface TypedEntryConfig<Data extends Record<string, unknown>> {
|
|
146
|
+
/** Unique identifier for this entry. Required for SDK sync. */
|
|
147
|
+
identifier: string;
|
|
148
|
+
/** Title for the entry */
|
|
149
|
+
title?: string;
|
|
150
|
+
/** Slug for routable entries */
|
|
151
|
+
slug?: string;
|
|
152
|
+
/** Status: 'draft' or 'published' */
|
|
153
|
+
status?: 'draft' | 'published';
|
|
154
|
+
/** Summary/description */
|
|
155
|
+
summary?: string;
|
|
156
|
+
/** SEO meta title */
|
|
157
|
+
metaTitle?: string;
|
|
158
|
+
/** SEO meta description */
|
|
159
|
+
metaDescription?: string;
|
|
160
|
+
/** Entry data matching the content type's field definitions */
|
|
161
|
+
data: Data;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Create a type-safe content entry for a typed content type.
|
|
165
|
+
*
|
|
166
|
+
* The data field is validated against the content type's field definitions.
|
|
167
|
+
* TypeScript will error if:
|
|
168
|
+
* - A required field is missing
|
|
169
|
+
* - A field name is misspelled
|
|
170
|
+
* - A field value has the wrong type
|
|
171
|
+
* - An extra field is provided (with strict mode)
|
|
172
|
+
*
|
|
173
|
+
* @param contentType - The typed content type definition
|
|
174
|
+
* @param entry - The entry configuration with typed data
|
|
175
|
+
* @returns EntryConfig compatible with SDK content configuration
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```typescript
|
|
179
|
+
* const entry = createEntry(testimonialType, {
|
|
180
|
+
* identifier: 'testimonial-1',
|
|
181
|
+
* title: 'John Doe',
|
|
182
|
+
* status: 'published',
|
|
183
|
+
* data: {
|
|
184
|
+
* name: 'John Doe',
|
|
185
|
+
* quote: tiptap.paragraph('Great service!'),
|
|
186
|
+
* },
|
|
187
|
+
* });
|
|
188
|
+
* ```
|
|
189
|
+
*/
|
|
190
|
+
declare function createEntry<K extends string, F extends readonly FieldDefinition[]>(contentType: TypedContentType<K, F>, entry: TypedEntryConfig<InferDataFromFields<F>>): EntryConfig;
|
|
191
|
+
/**
|
|
192
|
+
* Helpers for creating TipTap document structures.
|
|
193
|
+
*
|
|
194
|
+
* Use these helpers when populating richText fields to avoid manually
|
|
195
|
+
* constructing the TipTap JSON structure.
|
|
196
|
+
*
|
|
197
|
+
* @example
|
|
198
|
+
* ```typescript
|
|
199
|
+
* // Simple paragraph
|
|
200
|
+
* const body = tiptap.paragraph('Hello, world!');
|
|
201
|
+
*
|
|
202
|
+
* // Empty document
|
|
203
|
+
* const emptyDoc = tiptap.empty();
|
|
204
|
+
*
|
|
205
|
+
* // Complex document
|
|
206
|
+
* const doc = tiptap.doc([
|
|
207
|
+
* tiptap.heading(1, 'Welcome'),
|
|
208
|
+
* { type: 'paragraph', content: [{ type: 'text', text: 'Introduction...' }] },
|
|
209
|
+
* ]);
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
declare const tiptap: {
|
|
213
|
+
/**
|
|
214
|
+
* Create an empty TipTap document.
|
|
215
|
+
*
|
|
216
|
+
* @returns An empty TipTap document node
|
|
217
|
+
*/
|
|
218
|
+
empty(): TipTapNode;
|
|
219
|
+
/**
|
|
220
|
+
* Create a TipTap document with a single paragraph.
|
|
221
|
+
*
|
|
222
|
+
* @param text - The paragraph text content
|
|
223
|
+
* @returns A TipTap document with one paragraph
|
|
224
|
+
*/
|
|
225
|
+
paragraph(text: string): TipTapNode;
|
|
226
|
+
/**
|
|
227
|
+
* Create a TipTap document with custom content nodes.
|
|
228
|
+
*
|
|
229
|
+
* @param content - Array of TipTap nodes to include in the document
|
|
230
|
+
* @returns A TipTap document wrapping the content
|
|
231
|
+
*/
|
|
232
|
+
doc(content: TipTapNode[]): TipTapNode;
|
|
233
|
+
/**
|
|
234
|
+
* Create a heading node.
|
|
235
|
+
*
|
|
236
|
+
* Note: This returns a heading node, not a document. Use with tiptap.doc()
|
|
237
|
+
* to create a complete document.
|
|
238
|
+
*
|
|
239
|
+
* @param level - Heading level (1-6)
|
|
240
|
+
* @param text - Heading text content
|
|
241
|
+
* @returns A TipTap heading node
|
|
242
|
+
*/
|
|
243
|
+
heading(level: 1 | 2 | 3 | 4 | 5 | 6, text: string): TipTapNode;
|
|
244
|
+
};
|
|
245
|
+
|
|
8
246
|
/**
|
|
9
247
|
* SDK Site Configuration
|
|
10
248
|
*
|
|
@@ -74,4 +312,4 @@ declare function defineConfig(config: RiverbankSiteConfig): RiverbankSiteConfig;
|
|
|
74
312
|
*/
|
|
75
313
|
declare function defineContentConfig(config: ContentConfig): ContentConfig;
|
|
76
314
|
|
|
77
|
-
export { ContentConfig, RiverbankSiteConfig, defineConfig, defineContentConfig };
|
|
315
|
+
export { ContentConfig, ContentTypeConfig, EntryConfig, FieldDefinition, type FieldValueType, type InferDataFromFields, LinkValue, Media, RiverbankSiteConfig, TipTapNode, type TypedContentType, type TypedEntryConfig, createEntry, defineConfig, defineContentConfig, defineTypedContentType, tiptap };
|
package/dist/server/config.js
CHANGED
|
@@ -23,15 +23,79 @@
|
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
|
|
26
|
-
var
|
|
26
|
+
var _chunk2KCF2DNKjs = require('./chunk-2KCF2DNK.js');
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
var _chunkGERCMTPQjs = require('./chunk-GERCMTPQ.js');
|
|
30
|
-
require('./chunk-
|
|
31
|
-
require('./chunk-
|
|
32
|
-
require('./chunk-
|
|
30
|
+
require('./chunk-7UPVCT3K.js');
|
|
31
|
+
require('./chunk-RVDS7VSP.js');
|
|
32
|
+
require('./chunk-YYO3RIFO.js');
|
|
33
33
|
require('./chunk-DGUM43GV.js');
|
|
34
34
|
|
|
35
|
+
// src/config/typed-entries.ts
|
|
36
|
+
function defineTypedContentType(config) {
|
|
37
|
+
return config;
|
|
38
|
+
}
|
|
39
|
+
function createEntry(contentType, entry) {
|
|
40
|
+
return {
|
|
41
|
+
...entry,
|
|
42
|
+
contentType: contentType.key
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
var tiptap = {
|
|
46
|
+
/**
|
|
47
|
+
* Create an empty TipTap document.
|
|
48
|
+
*
|
|
49
|
+
* @returns An empty TipTap document node
|
|
50
|
+
*/
|
|
51
|
+
empty() {
|
|
52
|
+
return { type: "doc", content: [] };
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* Create a TipTap document with a single paragraph.
|
|
56
|
+
*
|
|
57
|
+
* @param text - The paragraph text content
|
|
58
|
+
* @returns A TipTap document with one paragraph
|
|
59
|
+
*/
|
|
60
|
+
paragraph(text) {
|
|
61
|
+
return {
|
|
62
|
+
type: "doc",
|
|
63
|
+
content: [
|
|
64
|
+
{
|
|
65
|
+
type: "paragraph",
|
|
66
|
+
content: text ? [{ type: "text", text }] : []
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
};
|
|
70
|
+
},
|
|
71
|
+
/**
|
|
72
|
+
* Create a TipTap document with custom content nodes.
|
|
73
|
+
*
|
|
74
|
+
* @param content - Array of TipTap nodes to include in the document
|
|
75
|
+
* @returns A TipTap document wrapping the content
|
|
76
|
+
*/
|
|
77
|
+
doc(content) {
|
|
78
|
+
return { type: "doc", content };
|
|
79
|
+
},
|
|
80
|
+
/**
|
|
81
|
+
* Create a heading node.
|
|
82
|
+
*
|
|
83
|
+
* Note: This returns a heading node, not a document. Use with tiptap.doc()
|
|
84
|
+
* to create a complete document.
|
|
85
|
+
*
|
|
86
|
+
* @param level - Heading level (1-6)
|
|
87
|
+
* @param text - Heading text content
|
|
88
|
+
* @returns A TipTap heading node
|
|
89
|
+
*/
|
|
90
|
+
heading(level, text) {
|
|
91
|
+
return {
|
|
92
|
+
type: "heading",
|
|
93
|
+
attrs: { level },
|
|
94
|
+
content: [{ type: "text", text }]
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
35
99
|
// src/config/index.ts
|
|
36
100
|
function defineConfig(config) {
|
|
37
101
|
return config;
|
|
@@ -67,5 +131,8 @@ function defineContentConfig(config) {
|
|
|
67
131
|
|
|
68
132
|
|
|
69
133
|
|
|
70
|
-
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
exports.SYSTEM_BLOCK_KINDS = _chunkGERCMTPQjs.SYSTEM_BLOCK_KINDS; exports.blockConfigSchema = _chunk2KCF2DNKjs.blockConfigSchema; exports.blockFieldConfigSchema = _chunk2KCF2DNKjs.blockFieldConfigSchema; exports.blockFieldExtensionSchema = _chunk2KCF2DNKjs.blockFieldExtensionSchema; exports.blockFieldExtensionsSchema = _chunk2KCF2DNKjs.blockFieldExtensionsSchema; exports.blockFieldOptionsSchema = _chunk2KCF2DNKjs.blockFieldOptionsSchema; exports.containerAlignmentSchema = _chunk2KCF2DNKjs.containerAlignmentSchema; exports.containerMaxWidthSchema = _chunk2KCF2DNKjs.containerMaxWidthSchema; exports.containerOptionsSchema = _chunk2KCF2DNKjs.containerOptionsSchema; exports.contentConfigSchema = _chunk2KCF2DNKjs.contentConfigSchema; exports.contentTypeConfigSchema = _chunk2KCF2DNKjs.contentTypeConfigSchema; exports.createEntry = createEntry; exports.defineConfig = defineConfig; exports.defineContentConfig = defineContentConfig; exports.defineTypedContentType = defineTypedContentType; exports.entryConfigSchema = _chunk2KCF2DNKjs.entryConfigSchema; exports.fieldSelectOptionSchema = _chunk2KCF2DNKjs.fieldSelectOptionSchema; exports.navigationItemConfigSchema = _chunk2KCF2DNKjs.navigationItemConfigSchema; exports.navigationMenuConfigSchema = _chunk2KCF2DNKjs.navigationMenuConfigSchema; exports.pageConfigSchema = _chunk2KCF2DNKjs.pageConfigSchema; exports.riverbankSiteConfigSchema = _chunk2KCF2DNKjs.riverbankSiteConfigSchema; exports.sdkCustomBlockSchema = _chunk2KCF2DNKjs.sdkCustomBlockSchema; exports.sdkThemeConfigSchema = _chunk2KCF2DNKjs.sdkThemeConfigSchema; exports.sdkThemePaletteSchema = _chunk2KCF2DNKjs.sdkThemePaletteSchema; exports.sectionBackgroundSchema = _chunk2KCF2DNKjs.sectionBackgroundSchema; exports.sectionOptionsSchema = _chunk2KCF2DNKjs.sectionOptionsSchema; exports.sectionSpacingSchema = _chunk2KCF2DNKjs.sectionSpacingSchema; exports.siteSettingsConfigSchema = _chunk2KCF2DNKjs.siteSettingsConfigSchema; exports.siteStyleConfigSchema = _chunk2KCF2DNKjs.siteStyleConfigSchema; exports.tiptap = tiptap;
|
|
71
138
|
//# sourceMappingURL=config.js.map
|