@blinkk/root-cms 2.5.15 → 2.5.17

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/dist/app.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  getServerVersion
3
- } from "./chunk-NMUXWSFO.js";
3
+ } from "./chunk-MVSVVVHN.js";
4
4
  import {
5
5
  getCollectionSchema,
6
6
  getProjectSchemas
7
- } from "./chunk-MSJGHSR6.js";
7
+ } from "./chunk-HDIPAT3C.js";
8
8
  import "./chunk-MLKGABMK.js";
9
9
 
10
10
  // core/app.tsx
@@ -234,8 +234,10 @@ async function renderSignIn(req, res, options) {
234
234
  ctx.warning = "Dev warning: Server may be misconfigured. See logs for more information.";
235
235
  }
236
236
  }
237
+ const siteName = ctx.name;
238
+ const title = siteName ? `Sign in \u2013 ${siteName}` : "Sign in";
237
239
  const mainHtml = renderToString(
238
- /* @__PURE__ */ jsx(SignIn, { title: "Sign in", ctx, favicon: options.cmsConfig.favicon })
240
+ /* @__PURE__ */ jsx(SignIn, { title, ctx, favicon: options.cmsConfig.favicon })
239
241
  );
240
242
  const nonce = generateNonce();
241
243
  const html = `<!doctype html>
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  RootCMSClient,
3
3
  getCmsPlugin
4
- } from "./chunk-47KOES6P.js";
4
+ } from "./chunk-JUCNU5AP.js";
5
5
 
6
6
  // core/versions.ts
7
7
  import fs from "fs";
@@ -57,10 +57,10 @@ function testValidCollectionId(id) {
57
57
  function isSchemaPattern(value) {
58
58
  return typeof value === "object" && value !== null && "_schemaPattern" in value && value._schemaPattern === true;
59
59
  }
60
- function buildSchemaNameMap() {
60
+ function buildSchemaNameMap(schemaModules = SCHEMA_MODULES) {
61
61
  const nameMap = {};
62
- for (const fileId in SCHEMA_MODULES) {
63
- const module = SCHEMA_MODULES[fileId];
62
+ for (const fileId in schemaModules) {
63
+ const module = schemaModules[fileId];
64
64
  if (module.default && module.default.name) {
65
65
  nameMap[module.default.name] = module.default;
66
66
  }
@@ -71,16 +71,16 @@ function globToRegex(pattern) {
71
71
  const regexStr = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*\*/g, "{{DOUBLE_STAR}}").replace(/\*/g, "[^/]*").replace(/\{\{DOUBLE_STAR\}\}/g, ".*");
72
72
  return new RegExp(`^${regexStr}$`);
73
73
  }
74
- function resolveSchemaPattern(pattern) {
74
+ function resolveSchemaPattern(pattern, schemaModules = SCHEMA_MODULES) {
75
75
  const regex = globToRegex(pattern.pattern);
76
76
  const excludeSet = new Set(pattern.exclude || []);
77
77
  const names = [];
78
78
  const schemas = {};
79
- for (const fileId in SCHEMA_MODULES) {
79
+ for (const fileId in schemaModules) {
80
80
  if (!regex.test(fileId)) {
81
81
  continue;
82
82
  }
83
- const module = SCHEMA_MODULES[fileId];
83
+ const module = schemaModules[fileId];
84
84
  if (!module.default || !module.default.name) {
85
85
  continue;
86
86
  }
@@ -88,28 +88,25 @@ function resolveSchemaPattern(pattern) {
88
88
  if (excludeSet.has(schemaName)) {
89
89
  continue;
90
90
  }
91
- let schemaObj = module.default;
91
+ const schemaObj = structuredClone(module.default);
92
92
  if (pattern.omitFields && pattern.omitFields.length > 0) {
93
93
  const omitSet = new Set(pattern.omitFields);
94
- schemaObj = {
95
- ...schemaObj,
96
- fields: schemaObj.fields.filter(
97
- (f) => !omitSet.has(f.id || "")
98
- )
99
- };
94
+ schemaObj.fields = schemaObj.fields.filter(
95
+ (f) => !omitSet.has(f.id || "")
96
+ );
100
97
  }
101
98
  names.push(schemaName);
102
99
  schemas[schemaName] = schemaObj;
103
100
  }
104
101
  return { names, schemas };
105
102
  }
106
- function convertOneOfTypes(collection) {
103
+ function convertOneOfTypes(collection, schemaModules = SCHEMA_MODULES) {
107
104
  const clone = structuredClone(collection);
108
105
  const types = clone.types || {};
109
- const schemaNameMap = buildSchemaNameMap();
106
+ const schemaNameMap = buildSchemaNameMap(schemaModules);
110
107
  function handleOneOfField(field) {
111
108
  if (isSchemaPattern(field.types)) {
112
- const resolved = resolveSchemaPattern(field.types);
109
+ const resolved = resolveSchemaPattern(field.types, schemaModules);
113
110
  for (const [name, schemaObj] of Object.entries(resolved.schemas)) {
114
111
  if (!types[name]) {
115
112
  types[name] = schemaObj;
@@ -126,7 +123,7 @@ function convertOneOfTypes(collection) {
126
123
  if (typeof sub === "string") {
127
124
  names.push(sub);
128
125
  if (!types[sub] && schemaNameMap[sub]) {
129
- const resolvedSchema = schemaNameMap[sub];
126
+ const resolvedSchema = structuredClone(schemaNameMap[sub]);
130
127
  types[sub] = resolvedSchema;
131
128
  if (resolvedSchema.fields) {
132
129
  walk(resolvedSchema);
@@ -168,5 +165,6 @@ export {
168
165
  SCHEMA_MODULES,
169
166
  getProjectSchemas,
170
167
  resolveOneOfPatterns,
171
- getCollectionSchema
168
+ getCollectionSchema,
169
+ convertOneOfTypes
172
170
  };
@@ -1615,6 +1615,40 @@ ${errorMessages}`);
1615
1615
  console.log(`published data ${dataSourceId}`);
1616
1616
  console.log(`published by: ${publishedBy}`);
1617
1617
  }
1618
+ /**
1619
+ * Unpublishes a data source. Removes the `publishedAt`/`publishedBy`
1620
+ * metadata from the DataSource doc and deletes the `Data/published` doc.
1621
+ */
1622
+ async unpublishDataSource(dataSourceId) {
1623
+ const dataSource = await this.getDataSource(dataSourceId);
1624
+ if (!dataSource) {
1625
+ throw new Error(`data source not found: ${dataSourceId}`);
1626
+ }
1627
+ const dataSourceDocRef = this.db.doc(
1628
+ `Projects/${this.projectId}/DataSources/${dataSourceId}`
1629
+ );
1630
+ const dataDocRefDraft = this.db.doc(
1631
+ `Projects/${this.projectId}/DataSources/${dataSourceId}/Data/draft`
1632
+ );
1633
+ const dataDocRefPublished = this.db.doc(
1634
+ `Projects/${this.projectId}/DataSources/${dataSourceId}/Data/published`
1635
+ );
1636
+ const batch = this.db.batch();
1637
+ batch.update(dataSourceDocRef, {
1638
+ publishedAt: FieldValue2.delete(),
1639
+ publishedBy: FieldValue2.delete()
1640
+ });
1641
+ const draftSnapshot = await dataDocRefDraft.get();
1642
+ if (draftSnapshot.exists) {
1643
+ batch.update(dataDocRefDraft, {
1644
+ "dataSource.publishedAt": FieldValue2.delete(),
1645
+ "dataSource.publishedBy": FieldValue2.delete()
1646
+ });
1647
+ }
1648
+ batch.delete(dataDocRefPublished);
1649
+ await batch.commit();
1650
+ console.log(`unpublished data source: ${dataSourceId}`);
1651
+ }
1618
1652
  async publishDataSources(dataSourceIds, options) {
1619
1653
  const publishedBy = options?.publishedBy || "root-cms-client";
1620
1654
  const batch = options?.batch || this.db.batch();
@@ -1,7 +1,7 @@
1
1
  // package.json
2
2
  var package_default = {
3
3
  name: "@blinkk/root-cms",
4
- version: "2.5.15",
4
+ version: "2.5.17",
5
5
  author: "s@blinkk.com",
6
6
  license: "MIT",
7
7
  engines: {
@@ -169,7 +169,7 @@ var package_default = {
169
169
  yjs: "13.6.27"
170
170
  },
171
171
  peerDependencies: {
172
- "@blinkk/root": "2.5.15",
172
+ "@blinkk/root": "2.5.17",
173
173
  "firebase-admin": ">=11",
174
174
  "firebase-functions": ">=4",
175
175
  preact: ">=10",
@@ -222,6 +222,9 @@ function fieldType(field, options) {
222
222
  if (field.type === "multiselect") {
223
223
  return dom.type.array(dom.type.string);
224
224
  }
225
+ if (field.type === "number") {
226
+ return dom.type.number;
227
+ }
225
228
  if (field.type === "oneof") {
226
229
  const oneOf = dom.create.namedTypeReference("RootCMSOneOf");
227
230
  if (field.types && Array.isArray(field.types)) {
package/dist/cli.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  generateTypes
3
- } from "./chunk-KDXHFMIH.js";
3
+ } from "./chunk-XLX37FRL.js";
4
4
  import {
5
5
  RootCMSClient,
6
6
  getCmsPlugin,
7
7
  unmarshalData
8
- } from "./chunk-47KOES6P.js";
8
+ } from "./chunk-JUCNU5AP.js";
9
9
  import "./chunk-MLKGABMK.js";
10
10
 
11
11
  // cli/cli.ts
@@ -1,7 +1,7 @@
1
1
  import { RootConfig, Plugin, Request } from '@blinkk/root';
2
2
  import { App } from 'firebase-admin/app';
3
3
  import { Firestore, WriteBatch, Timestamp, Query } from 'firebase-admin/firestore';
4
- import { C as Collection } from './schema-D7MOj-YC.js';
4
+ import { C as Collection } from './schema-D4-RG0L4.js';
5
5
 
6
6
  /**
7
7
  * Supported Root AI models. Defaults to 'gemini-3-flash-preview'.
@@ -1026,6 +1026,11 @@ declare class RootCMSClient {
1026
1026
  publishDataSource(dataSourceId: string, options?: {
1027
1027
  publishedBy?: string;
1028
1028
  }): Promise<void>;
1029
+ /**
1030
+ * Unpublishes a data source. Removes the `publishedAt`/`publishedBy`
1031
+ * metadata from the DataSource doc and deletes the `Data/published` doc.
1032
+ */
1033
+ unpublishDataSource(dataSourceId: string): Promise<void>;
1029
1034
  publishDataSources(dataSourceIds: string[], options?: {
1030
1035
  publishedBy: string;
1031
1036
  batch?: WriteBatch;
package/dist/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import '@blinkk/root';
2
2
  import 'firebase-admin/app';
3
3
  import 'firebase-admin/firestore';
4
- export { A as Action, r as ArrayObject, F as BatchRequest, B as BatchRequestOptions, y as BatchRequestQuery, z as BatchRequestQueryOptions, I as BatchResponse, C as CronUnit, d as DataSource, c as DataSourceCron, e as DataSourceData, f as DataSourceMode, b as Doc, D as DocMode, j as GetCountOptions, G as GetDocOptions, H as HttpMethod, m as ListActionsOptions, i as ListDocsOptions, L as LoadTranslationsOptions, a as LocaleTranslations, l as Release, R as RootCMSClient, g as SaveDraftOptions, S as SetDocOptions, k as Translation, E as TranslationsDoc, T as TranslationsMap, h as UpdateDraftOptions, U as UserRole, o as getCmsPlugin, n as isRichTextData, s as marshalArray, p as marshalData, q as normalizeData, x as parseDocId, t as toArrayObject, w as translationsForLocale, v as unmarshalArray, u as unmarshalData } from './client-DUc18VW8.js';
5
- import './schema-D7MOj-YC.js';
4
+ export { A as Action, r as ArrayObject, F as BatchRequest, B as BatchRequestOptions, y as BatchRequestQuery, z as BatchRequestQueryOptions, I as BatchResponse, C as CronUnit, d as DataSource, c as DataSourceCron, e as DataSourceData, f as DataSourceMode, b as Doc, D as DocMode, j as GetCountOptions, G as GetDocOptions, H as HttpMethod, m as ListActionsOptions, i as ListDocsOptions, L as LoadTranslationsOptions, a as LocaleTranslations, l as Release, R as RootCMSClient, g as SaveDraftOptions, S as SetDocOptions, k as Translation, E as TranslationsDoc, T as TranslationsMap, h as UpdateDraftOptions, U as UserRole, o as getCmsPlugin, n as isRichTextData, s as marshalArray, p as marshalData, q as normalizeData, x as parseDocId, t as toArrayObject, w as translationsForLocale, v as unmarshalArray, u as unmarshalData } from './client-lQZoGxLC.js';
5
+ import './schema-D4-RG0L4.js';
package/dist/client.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  translationsForLocale,
13
13
  unmarshalArray,
14
14
  unmarshalData
15
- } from "./chunk-47KOES6P.js";
15
+ } from "./chunk-JUCNU5AP.js";
16
16
  import "./chunk-MLKGABMK.js";
17
17
  export {
18
18
  BatchRequest,
package/dist/core.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- import { R as RootCMSClient, D as DocMode, L as LoadTranslationsOptions, T as TranslationsMap, a as LocaleTranslations } from './client-DUc18VW8.js';
2
- export { A as Action, r as ArrayObject, F as BatchRequest, B as BatchRequestOptions, y as BatchRequestQuery, z as BatchRequestQueryOptions, I as BatchResponse, C as CronUnit, d as DataSource, c as DataSourceCron, e as DataSourceData, f as DataSourceMode, b as Doc, j as GetCountOptions, G as GetDocOptions, H as HttpMethod, m as ListActionsOptions, i as ListDocsOptions, J as Locale, Q as MultiLocaleTranslationsMap, l as Release, g as SaveDraftOptions, S as SetDocOptions, V as SingleLocaleTranslationsMap, K as SourceString, M as TranslatedString, k as Translation, E as TranslationsDoc, N as TranslationsDocMode, P as TranslationsLocaleDocEntry, O as TranslationsLocaleDocHashMap, W as TranslationsManager, h as UpdateDraftOptions, U as UserRole, X as buildTranslationsDbPath, Y as buildTranslationsLocaleDocDbPath, o as getCmsPlugin, n as isRichTextData, s as marshalArray, p as marshalData, q as normalizeData, x as parseDocId, t as toArrayObject, w as translationsForLocale, v as unmarshalArray, u as unmarshalData } from './client-DUc18VW8.js';
1
+ import { R as RootCMSClient, D as DocMode, L as LoadTranslationsOptions, T as TranslationsMap, a as LocaleTranslations } from './client-lQZoGxLC.js';
2
+ export { A as Action, r as ArrayObject, F as BatchRequest, B as BatchRequestOptions, y as BatchRequestQuery, z as BatchRequestQueryOptions, I as BatchResponse, C as CronUnit, d as DataSource, c as DataSourceCron, e as DataSourceData, f as DataSourceMode, b as Doc, j as GetCountOptions, G as GetDocOptions, H as HttpMethod, m as ListActionsOptions, i as ListDocsOptions, J as Locale, Q as MultiLocaleTranslationsMap, l as Release, g as SaveDraftOptions, S as SetDocOptions, V as SingleLocaleTranslationsMap, K as SourceString, M as TranslatedString, k as Translation, E as TranslationsDoc, N as TranslationsDocMode, P as TranslationsLocaleDocEntry, O as TranslationsLocaleDocHashMap, W as TranslationsManager, h as UpdateDraftOptions, U as UserRole, X as buildTranslationsDbPath, Y as buildTranslationsLocaleDocDbPath, o as getCmsPlugin, n as isRichTextData, s as marshalArray, p as marshalData, q as normalizeData, x as parseDocId, t as toArrayObject, w as translationsForLocale, v as unmarshalArray, u as unmarshalData } from './client-lQZoGxLC.js';
3
3
  import { Request, RootConfig, Response, RouteParams, GetStaticProps, GetStaticPaths } from '@blinkk/root';
4
4
  import { Query } from 'firebase-admin/firestore';
5
- export { s as schema } from './schema-D7MOj-YC.js';
5
+ export { s as schema } from './schema-D4-RG0L4.js';
6
6
  import 'firebase-admin/app';
7
7
 
8
8
  /**
package/dist/core.js CHANGED
@@ -16,7 +16,7 @@ import {
16
16
  translationsForLocale,
17
17
  unmarshalArray,
18
18
  unmarshalData
19
- } from "./chunk-47KOES6P.js";
19
+ } from "./chunk-JUCNU5AP.js";
20
20
  import {
21
21
  __export
22
22
  } from "./chunk-MLKGABMK.js";
package/dist/functions.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  runCronJobs
3
- } from "./chunk-5Y3VCZEZ.js";
4
- import "./chunk-47KOES6P.js";
3
+ } from "./chunk-DKM5LHW3.js";
4
+ import "./chunk-JUCNU5AP.js";
5
5
  import "./chunk-MLKGABMK.js";
6
6
 
7
7
  // core/functions.ts
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  generateSchemaDts,
3
3
  generateTypes
4
- } from "./chunk-KDXHFMIH.js";
4
+ } from "./chunk-XLX37FRL.js";
5
5
  import "./chunk-MLKGABMK.js";
6
6
  export {
7
7
  generateSchemaDts,
package/dist/plugin.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import '@blinkk/root';
2
2
  import 'firebase-admin/app';
3
3
  import 'firebase-admin/firestore';
4
- export { $ as CMSAIConfig, Z as CMSBuiltInSidebarTool, a4 as CMSCheck, a2 as CMSPlugin, a1 as CMSPluginOptions, a0 as CMSSidebarTool, aa as CMSTranslationService, _ as CMSUser, a6 as CheckContext, a5 as CheckResult, a7 as CheckStatus, ab as TranslationExportResult, ac as TranslationImportResult, ad as TranslationRow, ae as TranslationServiceContext, a9 as TranslationsCheckOptions, a3 as cmsPlugin, a8 as translationsCheck } from './client-DUc18VW8.js';
5
- import './schema-D7MOj-YC.js';
4
+ export { $ as CMSAIConfig, Z as CMSBuiltInSidebarTool, a4 as CMSCheck, a2 as CMSPlugin, a1 as CMSPluginOptions, a0 as CMSSidebarTool, aa as CMSTranslationService, _ as CMSUser, a6 as CheckContext, a5 as CheckResult, a7 as CheckStatus, ab as TranslationExportResult, ac as TranslationImportResult, ad as TranslationRow, ae as TranslationServiceContext, a9 as TranslationsCheckOptions, a3 as cmsPlugin, a8 as translationsCheck } from './client-lQZoGxLC.js';
5
+ import './schema-D4-RG0L4.js';
package/dist/plugin.js CHANGED
@@ -4,15 +4,15 @@ import {
4
4
  } from "./chunk-T5UK2H24.js";
5
5
  import {
6
6
  getServerVersion
7
- } from "./chunk-NMUXWSFO.js";
7
+ } from "./chunk-MVSVVVHN.js";
8
8
  import {
9
9
  runCronJobs
10
- } from "./chunk-5Y3VCZEZ.js";
10
+ } from "./chunk-DKM5LHW3.js";
11
11
  import {
12
12
  RootCMSClient,
13
13
  parseDocId,
14
14
  unmarshalData
15
- } from "./chunk-47KOES6P.js";
15
+ } from "./chunk-JUCNU5AP.js";
16
16
  import "./chunk-MLKGABMK.js";
17
17
 
18
18
  // core/plugin.ts
@@ -1294,7 +1294,7 @@ function cmsPlugin(options) {
1294
1294
  if (process.env.NODE_ENV === "development" && options.watch !== false) {
1295
1295
  plugin.onFileChange = (eventName, filepath) => {
1296
1296
  if (filepath.endsWith(".schema.ts")) {
1297
- import("./generate-types-MHWSSOWV.js").then((generateTypesModule) => {
1297
+ import("./generate-types-SPV7I3A5.js").then((generateTypesModule) => {
1298
1298
  const generateTypes = generateTypesModule.generateTypes;
1299
1299
  generateTypes();
1300
1300
  });
package/dist/project.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { S as Schema, C as Collection } from './schema-D7MOj-YC.js';
1
+ import { S as Schema, C as Collection } from './schema-D4-RG0L4.js';
2
2
 
3
3
  /**
4
4
  * Loads various files or configurations from the project.
@@ -27,5 +27,18 @@ declare function resolveOneOfPatterns(schemaObj: Schema): Schema;
27
27
  * `/collections/<id>.schema.ts`.
28
28
  */
29
29
  declare function getCollectionSchema(collectionId: string): Collection | null;
30
+ /**
31
+ * Converts all `oneof` field type definitions into a map keyed by the type
32
+ * name. The field definitions are replaced with an array of type names.
33
+ *
34
+ * String references (used for self-referencing schemas) are resolved from the
35
+ * project's schema modules. SchemaPatterns are resolved by matching file paths.
36
+ *
37
+ * Schemas pulled in via SchemaPattern or string-name reference are always
38
+ * deep-cloned before being walked. The walk rewrites `oneof` fields in place,
39
+ * and skipping the clone would mutate the shared entries in `SCHEMA_MODULES`
40
+ * and corrupt subsequent calls (e.g. when building multiple collections).
41
+ */
42
+ declare function convertOneOfTypes(collection: Collection, schemaModules?: Record<string, SchemaModule>): Collection;
30
43
 
31
- export { SCHEMA_MODULES, type SchemaModule, getCollectionSchema, getProjectSchemas, resolveOneOfPatterns };
44
+ export { SCHEMA_MODULES, type SchemaModule, convertOneOfTypes, getCollectionSchema, getProjectSchemas, resolveOneOfPatterns };
package/dist/project.js CHANGED
@@ -1,12 +1,14 @@
1
1
  import {
2
2
  SCHEMA_MODULES,
3
+ convertOneOfTypes,
3
4
  getCollectionSchema,
4
5
  getProjectSchemas,
5
6
  resolveOneOfPatterns
6
- } from "./chunk-MSJGHSR6.js";
7
+ } from "./chunk-HDIPAT3C.js";
7
8
  import "./chunk-MLKGABMK.js";
8
9
  export {
9
10
  SCHEMA_MODULES,
11
+ convertOneOfTypes,
10
12
  getCollectionSchema,
11
13
  getProjectSchemas,
12
14
  resolveOneOfPatterns
@@ -7,25 +7,36 @@ interface RichTextBlock {
7
7
  }
8
8
  interface RichTextData {
9
9
  [key: string]: any;
10
- blocks: any[];
10
+ blocks: RichTextBlock[];
11
11
  }
12
- type RichTextBlockComponent = FunctionalComponent<any>;
12
+ type RichTextComponent = FunctionalComponent<any>;
13
+ type RichTextBlockComponent = RichTextComponent;
14
+ type RichTextInlineComponent = RichTextComponent;
15
+ type RichTextComponentMap = Record<string, RichTextComponent>;
13
16
  interface RichTextContextProps {
14
- components?: Record<string, RichTextBlockComponent>;
17
+ /**
18
+ * Rich text components override for both inline and block level components.
19
+ */
20
+ components?: RichTextComponentMap;
21
+ /**
22
+ * Translator function override.
23
+ */
24
+ t?: (msg: string, params?: Record<string, string | number>) => string;
15
25
  }
16
26
  declare const RichTextContext: preact.Context<RichTextContextProps>;
17
27
  declare function useRichTextContext(): RichTextContextProps;
18
28
  interface RichTextProps {
19
- data: RichTextData;
29
+ data: RichTextData | undefined;
20
30
  components?: Record<string, RichTextBlockComponent>;
31
+ /** @deprecated */
32
+ translate?: boolean;
21
33
  }
22
34
  /** Renders data from the "richtext" field. */
23
- declare function RichText(props: RichTextProps): preact.JSX.Element;
35
+ declare function RichText(props: RichTextProps): preact.JSX.Element | null;
24
36
  declare namespace RichText {
37
+ var Block: (props: RichTextBlock) => preact.JSX.Element | null;
25
38
  var ParagraphBlock: (props: RichTextParagraphBlockProps) => preact.JSX.Element | null;
26
- var DelimiterBlock: () => preact.JSX.Element;
27
39
  var HeadingBlock: (props: RichTextHeadingBlockProps) => preact.JSX.Element | null;
28
- var QuoteBlock: (props: RichTextQuoteBlockProps) => preact.JSX.Element | null;
29
40
  var ListBlock: (props: RichTextListBlockProps) => preact.JSX.Element | null;
30
41
  var ImageBlock: (props: RichTextImageBlockProps) => preact.JSX.Element | null;
31
42
  var HtmlBlock: (props: RichTextHtmlBlockProps) => preact.JSX.Element | null;
@@ -35,12 +46,9 @@ interface RichTextParagraphBlockProps {
35
46
  type: 'paragraph';
36
47
  data?: {
37
48
  text?: string;
49
+ components?: Record<string, any>;
38
50
  };
39
51
  }
40
- interface RichTextDelimiterBlockProps {
41
- type: 'delimiter';
42
- data?: {};
43
- }
44
52
  interface RichTextHeadingBlockProps {
45
53
  type: 'heading';
46
54
  data?: {
@@ -48,15 +56,10 @@ interface RichTextHeadingBlockProps {
48
56
  text?: string;
49
57
  };
50
58
  }
51
- interface RichTextQuoteBlockProps {
52
- type: 'quote';
53
- data?: {
54
- text?: string;
55
- };
56
- }
57
59
  interface ListItem {
58
60
  content?: string;
59
61
  items?: ListItem[];
62
+ components?: Record<string, any>;
60
63
  }
61
64
  interface RichTextListBlockProps {
62
65
  type: 'orderedList' | 'unorderedList';
@@ -68,6 +71,8 @@ interface RichTextListBlockProps {
68
71
  interface RichTextImageBlockProps {
69
72
  type: 'image';
70
73
  data?: {
74
+ /** The caption entered into the CMS Image field. */
75
+ caption?: string;
71
76
  file?: {
72
77
  url: string;
73
78
  width: string | number;
@@ -93,5 +98,7 @@ interface RichTextTableBlockProps {
93
98
  }>;
94
99
  };
95
100
  }
101
+ /** Returns whether the rich text value is truthy. */
102
+ declare function testContent(data: RichTextData): boolean;
96
103
 
97
- export { RichText, type RichTextBlock, type RichTextBlockComponent, RichTextContext, type RichTextContextProps, type RichTextData, type RichTextDelimiterBlockProps, type RichTextHeadingBlockProps, type RichTextHtmlBlockProps, type RichTextImageBlockProps, type RichTextListBlockProps, type RichTextParagraphBlockProps, type RichTextProps, type RichTextQuoteBlockProps, type RichTextTableBlockProps, useRichTextContext };
104
+ export { RichText, type RichTextBlock, type RichTextBlockComponent, type RichTextComponent, type RichTextComponentMap, RichTextContext, type RichTextContextProps, type RichTextData, type RichTextHeadingBlockProps, type RichTextHtmlBlockProps, type RichTextImageBlockProps, type RichTextInlineComponent, type RichTextListBlockProps, type RichTextParagraphBlockProps, type RichTextProps, type RichTextTableBlockProps, testContent, useRichTextContext };