@pramen/cms-editor 0.0.49 → 0.0.50

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/src/types.ts CHANGED
@@ -5,9 +5,32 @@
5
5
  /** Any JSON value — the wire form of everything the CMS stores. */
6
6
  export type JsonValue = string | number | boolean | null | JsonValue[] | { [key: string]: JsonValue };
7
7
 
8
+ /** A rich-text document — the editor's structured JSON. Mirrors `RichTextDoc` in
9
+ * @pramen/cms; a `richtext` field is this tree, never an HTML string. */
10
+ export interface RichTextDoc {
11
+ type: "doc";
12
+ content?: RichTextNode[];
13
+ }
14
+
15
+ /** One node in a {@link RichTextDoc}. */
16
+ export interface RichTextNode {
17
+ type: string;
18
+ content?: RichTextNode[];
19
+ text?: string;
20
+ marks?: RichTextMark[];
21
+ attrs?: Record<string, JsonValue>;
22
+ }
23
+
24
+ /** An inline mark on a text node. */
25
+ export interface RichTextMark {
26
+ type: string;
27
+ attrs?: Record<string, JsonValue>;
28
+ }
29
+
8
30
  /** One authored field value. Mirrors `FieldValue` in @pramen/cms: a `"media"` field
9
- * arrives resolved to a `Media`, and `group`/`repeater` fields nest further bags. */
10
- export type FieldValue = JsonValue | Media | FieldValues | FieldValue[];
31
+ * arrives resolved to a `Media`, a `"richtext"` field is a `RichTextDoc`, and
32
+ * `group`/`repeater` fields nest further bags. */
33
+ export type FieldValue = JsonValue | Media | RichTextDoc | FieldValues | FieldValue[];
11
34
 
12
35
  /** A block / collection / page `fields` bag — field name -> authored value. */
13
36
  export interface FieldValues {
@@ -103,8 +126,17 @@ export interface CollectionMeta {
103
126
  * from this to open/save/delete it. */
104
127
  idField: string;
105
128
  orderBy?: { column: string; dir?: "asc" | "desc" };
129
+ /** The workflow features the collection opted into server-side (`supports`), e.g.
130
+ * `["drafts", "scheduling"]`. Carried here so this mirror stays faithful to
131
+ * `CollectionMeta`. The editor renders the matching affordances (publish/unpublish, a
132
+ * schedule picker, a preview link, a revision list) in `CollectionWorkflow`; an empty
133
+ * list renders none of them. */
134
+ supports?: CollectionFeature[];
106
135
  }
107
136
 
137
+ /** Mirror of @pramen/cms `CollectionFeature`. */
138
+ export type CollectionFeature = "drafts" | "scheduling" | "revisions" | "preview";
139
+
108
140
  export interface Page {
109
141
  id: string;
110
142
  typeId: string;