@rimelight/cms 0.0.3 → 0.0.5

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 (66) hide show
  1. package/dist/bylines-Csggkl-g.d.mts +405 -0
  2. package/dist/index.d.mts +724 -0
  3. package/dist/index.mjs +2382 -0
  4. package/dist/integration.d.mts +33 -0
  5. package/dist/integration.mjs +161 -0
  6. package/dist/schema/index.d.mts +2063 -0
  7. package/dist/schema/index.mjs +176 -0
  8. package/dist/schema/sqlite.d.mts +2132 -0
  9. package/dist/schema/sqlite.mjs +137 -0
  10. package/dist/storage/index.d.mts +59 -0
  11. package/dist/storage/index.mjs +133 -0
  12. package/package.json +35 -14
  13. package/src/admin/api/media-file.ts +1 -1
  14. package/src/admin/api/media.ts +28 -3
  15. package/src/admin/layouts/CMSDashboardLayout.astro +16 -3
  16. package/src/admin/pages/assets.astro +11 -11
  17. package/src/admin/pages/pages-edit.astro +3 -3
  18. package/src/admin/pages/pages-index.astro +2 -2
  19. package/src/admin/pages/pages-preview.astro +3 -3
  20. package/src/admin/pages/pages-review.astro +2 -2
  21. package/src/admin/pages/templates-edit.astro +1 -1
  22. package/src/admin/pages/templates-index.astro +1 -1
  23. package/src/astro/BlockRenderer.astro +1 -1
  24. package/src/astro/PageRenderer.astro +4 -4
  25. package/src/astro/blocks/CalloutBlock.astro +1 -1
  26. package/src/astro/blocks/OrderedListBlock.astro +2 -2
  27. package/src/astro/blocks/ParagraphBlock.astro +1 -1
  28. package/src/astro/blocks/TabsBlock.astro +5 -5
  29. package/src/astro/blocks/UnorderedListBlock.astro +2 -2
  30. package/src/auth/editor-guards.ts +1 -1
  31. package/src/cache/purge.ts +2 -2
  32. package/src/client/components/RimelightBlock.tsx +1 -1
  33. package/src/client/components/RimelightBlockPicker.tsx +1 -1
  34. package/src/client/components/RimelightPreview.tsx +27 -27
  35. package/src/client/components/RimelightPropertiesPanel.tsx +4 -4
  36. package/src/client/components/RimelightTemplateEditor.tsx +9 -5
  37. package/src/client/components/editors/CalloutEditor.tsx +10 -10
  38. package/src/client/components/editors/CardEditor.tsx +5 -5
  39. package/src/client/components/editors/CardsEditor.tsx +2 -2
  40. package/src/client/components/editors/CodeEditor.tsx +5 -5
  41. package/src/client/components/editors/DialogueEditor.tsx +6 -6
  42. package/src/client/components/editors/FileTreeEditor.tsx +1 -1
  43. package/src/client/components/editors/ImageEditor.tsx +9 -9
  44. package/src/client/components/editors/ParagraphEditor.tsx +1 -1
  45. package/src/client/components/editors/SceneEditor.tsx +9 -9
  46. package/src/client/components/editors/ScriptEditor.tsx +8 -8
  47. package/src/client/components/editors/SectionEditor.tsx +3 -3
  48. package/src/client/components/editors/StepItemEditor.tsx +6 -5
  49. package/src/client/components/editors/StepsEditor.tsx +1 -1
  50. package/src/client/components/editors/TabItemEditor.tsx +3 -3
  51. package/src/client/components/editors/TableEditor.tsx +4 -4
  52. package/src/client/components/editors/TabsEditor.tsx +1 -1
  53. package/src/client/state/editor-store.ts +23 -23
  54. package/src/client/utils/sortable.ts +13 -12
  55. package/src/client/utils/tree-sanitizer.ts +1 -1
  56. package/src/core/excerpt.ts +16 -16
  57. package/src/core/page-definitions.ts +2 -2
  58. package/src/docs/agent.ts +1 -1
  59. package/src/docs/routing.ts +2 -2
  60. package/src/env.d.ts +6 -0
  61. package/src/index.ts +17 -4
  62. package/src/integration.ts +54 -0
  63. package/src/loader/live.ts +1 -1
  64. package/src/markdown/serializer.ts +26 -26
  65. package/src/schema/sqlite.ts +344 -0
  66. package/src/storage/index.ts +4 -1
@@ -0,0 +1,405 @@
1
+ //#region src/core/types/inline.d.ts
2
+ type InlineNodeType = "text" | "page_mention" | "user_mention" | "link" | "emoji";
3
+ interface TextInlineNode {
4
+ type: "text";
5
+ text: string;
6
+ marks?: Array<"bold" | "italic" | "underline" | "strikethrough" | "code">;
7
+ }
8
+ interface PageMentionNode {
9
+ type: "page_mention";
10
+ pageId: string;
11
+ pageSlug: string;
12
+ displayTitle?: string;
13
+ }
14
+ interface LinkInlineNode {
15
+ type: "link";
16
+ url: string;
17
+ children: TextInlineNode[];
18
+ openInNewTab?: boolean;
19
+ }
20
+ type InlineNode = TextInlineNode | PageMentionNode | LinkInlineNode;
21
+ //#endregion
22
+ //#region src/core/types/media.d.ts
23
+ interface MediaValue {
24
+ id: string;
25
+ src: string;
26
+ alt: string;
27
+ width?: number;
28
+ height?: number;
29
+ format?: string;
30
+ size?: number;
31
+ blurhash?: string;
32
+ previewUrl?: string;
33
+ provider: "r2" | "external" | "local";
34
+ meta?: Record<string, unknown>;
35
+ }
36
+ //#endregion
37
+ //#region src/core/types/blocks.d.ts
38
+ type BlockType = "SectionBlock" | "ParagraphBlock" | "CalloutBlock" | "ImageBlock" | "ScriptBlock" | "SceneBlock" | "DialogueBlock" | "CodeBlock" | "TableBlock" | "TabsBlock" | "TabItemBlock" | "StepsBlock" | "StepItemBlock" | "CardsBlock" | "CardBlock" | "FileTreeBlock" | "ComponentShowcaseBlock" | "ApiDocumentationBlock" | "LivePreviewBlock" | (string & {});
39
+ type TimeOfDay = "MORNING" | "NOON" | "AFTERNOON" | "EVENING" | "NIGHT" | "OTHER";
40
+ type Setting = "INTERIOR" | "EXTERIOR" | "OTHER";
41
+ type Transition = "CUT_TO" | "CUT_BACK_TO" | "FADE_TO" | "NONE";
42
+ interface ScriptBlockProps {
43
+ title: string;
44
+ synopsis: string;
45
+ characters: string[];
46
+ aPlot: string;
47
+ bPlot: string;
48
+ cPlot: string;
49
+ stinger: string;
50
+ }
51
+ interface SceneBlockProps {
52
+ location: string;
53
+ timeOfDay: TimeOfDay;
54
+ setting: Setting;
55
+ transition: Transition;
56
+ description: string;
57
+ }
58
+ interface DialogueBlockProps {
59
+ character: string;
60
+ parenthetical?: string;
61
+ line: string;
62
+ }
63
+ interface BaseBlock {
64
+ /**
65
+ * Unique UUID v4 identifier
66
+ */
67
+ id: string;
68
+ type: BlockType;
69
+ /**
70
+ * Structural Template Lock: If true, this block is a permanent template anchor and can NEVER be
71
+ * deleted, reordered, or removed.
72
+ */
73
+ isTemplated?: boolean;
74
+ /**
75
+ * Property Content Lock: Controls whether block prop content can be edited. - boolean true: ALL
76
+ * properties of this block are locked from editing. - string[]: Specific property keys locked
77
+ * from editing (e.g. ["title", "disclaimer"]).
78
+ */
79
+ templatedProps?: boolean | string[];
80
+ allowedRoles?: string[];
81
+ requiredPermission?: string;
82
+ props: Record<string, any>;
83
+ children?: BaseBlock[];
84
+ }
85
+ type HeadingLevel = 2 | 3 | 4 | 5 | 6;
86
+ declare const MIN_SECTION_HEADING_LEVEL: HeadingLevel;
87
+ declare const MAX_SECTION_HEADING_LEVEL: HeadingLevel;
88
+ declare const MAX_SECTION_DEPTH = 4;
89
+ declare function calculateHeadingLevel(sectionDepth: number): HeadingLevel;
90
+ type CalloutVariant = "info" | "success" | "warning" | "error" | "commentary" | "ideation" | "source";
91
+ interface SectionBlockProps {
92
+ title: string;
93
+ description?: string;
94
+ level?: HeadingLevel;
95
+ mainArticleSlug?: string;
96
+ children: BaseBlock[];
97
+ }
98
+ interface ParagraphBlockProps {
99
+ /**
100
+ * Stored as an InlineNode array (structured AST). Fallback: { en: string } or plain string.
101
+ */
102
+ text: InlineNode[] | {
103
+ en: string;
104
+ } | string;
105
+ }
106
+ interface CalloutBlockProps {
107
+ variant: CalloutVariant;
108
+ to?: string;
109
+ target?: string;
110
+ children: BaseBlock[];
111
+ }
112
+ interface ImageBlockProps {
113
+ src: string | MediaValue;
114
+ alt: string;
115
+ caption?: string;
116
+ width?: number;
117
+ height?: number;
118
+ aspectRatio?: string;
119
+ }
120
+ interface CodeBlockProps {
121
+ code: string;
122
+ language: string;
123
+ caption?: string;
124
+ title?: string;
125
+ filename?: string;
126
+ showLineNumbers?: boolean;
127
+ highlightLines?: number[];
128
+ }
129
+ interface TableColumnDef {
130
+ key: string;
131
+ header: string;
132
+ align?: "left" | "center" | "right";
133
+ }
134
+ interface TableBlockProps {
135
+ columns: TableColumnDef[];
136
+ rows: Record<string, string>[];
137
+ caption?: string;
138
+ }
139
+ interface TabItemBlockProps {
140
+ label: string;
141
+ value?: string;
142
+ icon?: string;
143
+ children: BaseBlock[];
144
+ }
145
+ interface TabsBlockProps {
146
+ defaultValue?: string;
147
+ children: BaseBlock[];
148
+ }
149
+ interface StepItemBlockProps {
150
+ title: string;
151
+ description?: string;
152
+ children: BaseBlock[];
153
+ }
154
+ interface StepsBlockProps {
155
+ children: BaseBlock[];
156
+ }
157
+ interface CardBlockProps {
158
+ title: string;
159
+ description?: string;
160
+ icon?: string;
161
+ href?: string;
162
+ badge?: string;
163
+ }
164
+ interface CardsBlockProps {
165
+ columns?: 1 | 2 | 3 | 4;
166
+ children: BaseBlock[];
167
+ }
168
+ interface FileTreeNode {
169
+ name: string;
170
+ isDir?: boolean;
171
+ children?: FileTreeNode[];
172
+ comment?: string;
173
+ }
174
+ interface FileTreeBlockProps {
175
+ tree: FileTreeNode[];
176
+ }
177
+ interface ComponentShowcaseBlockProps {
178
+ componentName: string;
179
+ componentPath: string;
180
+ framework: "astro" | "vue" | "solid";
181
+ defaultProps: Record<string, any>;
182
+ propsConfig: Record<string, string[]>;
183
+ togglingPattern: "icon" | "select-option" | "tab-segmented" | "pill-toggle";
184
+ codeExamples: {
185
+ astro?: string;
186
+ vue?: string;
187
+ solid?: string;
188
+ };
189
+ playgroundUrl: string | undefined;
190
+ }
191
+ interface ApiDocumentationBlockProps {
192
+ componentName: string;
193
+ sections: {
194
+ props?: boolean;
195
+ slots?: boolean;
196
+ emits?: boolean;
197
+ theme?: boolean;
198
+ changelog?: boolean;
199
+ };
200
+ hide?: string[];
201
+ show?: string[];
202
+ }
203
+ interface LivePreviewBlockProps {
204
+ componentCode: string;
205
+ framework: "astro" | "vue" | "solid";
206
+ height?: string;
207
+ width?: string;
208
+ editable?: boolean;
209
+ }
210
+ interface TypedScriptBlockProps extends ScriptBlockProps {
211
+ children: BaseBlock[];
212
+ }
213
+ interface TypedSceneBlockProps extends SceneBlockProps {
214
+ children: BaseBlock[];
215
+ }
216
+ interface SectionBlock extends BaseBlock {
217
+ type: "SectionBlock";
218
+ props: SectionBlockProps;
219
+ }
220
+ interface ParagraphBlock extends BaseBlock {
221
+ type: "ParagraphBlock";
222
+ props: ParagraphBlockProps;
223
+ }
224
+ interface CalloutBlock extends BaseBlock {
225
+ type: "CalloutBlock";
226
+ props: CalloutBlockProps;
227
+ }
228
+ interface ImageBlock extends BaseBlock {
229
+ type: "ImageBlock";
230
+ props: ImageBlockProps;
231
+ }
232
+ interface ScriptBlock extends BaseBlock {
233
+ type: "ScriptBlock";
234
+ props: TypedScriptBlockProps;
235
+ }
236
+ interface SceneBlock extends BaseBlock {
237
+ type: "SceneBlock";
238
+ props: TypedSceneBlockProps;
239
+ }
240
+ interface DialogueBlock extends BaseBlock {
241
+ type: "DialogueBlock";
242
+ props: DialogueBlockProps;
243
+ }
244
+ interface CodeBlock extends BaseBlock {
245
+ type: "CodeBlock";
246
+ props: CodeBlockProps;
247
+ }
248
+ interface TableBlock extends BaseBlock {
249
+ type: "TableBlock";
250
+ props: TableBlockProps;
251
+ }
252
+ interface TabsBlock extends BaseBlock {
253
+ type: "TabsBlock";
254
+ props: TabsBlockProps;
255
+ }
256
+ interface TabItemBlock extends BaseBlock {
257
+ type: "TabItemBlock";
258
+ props: TabItemBlockProps;
259
+ }
260
+ interface StepsBlock extends BaseBlock {
261
+ type: "StepsBlock";
262
+ props: StepsBlockProps;
263
+ }
264
+ interface StepItemBlock extends BaseBlock {
265
+ type: "StepItemBlock";
266
+ props: StepItemBlockProps;
267
+ }
268
+ interface CardsBlock extends BaseBlock {
269
+ type: "CardsBlock";
270
+ props: CardsBlockProps;
271
+ }
272
+ interface CardBlock extends BaseBlock {
273
+ type: "CardBlock";
274
+ props: CardBlockProps;
275
+ }
276
+ interface FileTreeBlock extends BaseBlock {
277
+ type: "FileTreeBlock";
278
+ props: FileTreeBlockProps;
279
+ }
280
+ interface ComponentShowcaseBlock extends BaseBlock {
281
+ type: "ComponentShowcaseBlock";
282
+ props: ComponentShowcaseBlockProps;
283
+ }
284
+ interface ApiDocumentationBlock extends BaseBlock {
285
+ type: "ApiDocumentationBlock";
286
+ props: ApiDocumentationBlockProps;
287
+ }
288
+ interface LivePreviewBlock extends BaseBlock {
289
+ type: "LivePreviewBlock";
290
+ props: LivePreviewBlockProps;
291
+ }
292
+ type TypedBlock = SectionBlock | ParagraphBlock | CalloutBlock | ImageBlock | ScriptBlock | SceneBlock | DialogueBlock | CodeBlock | TableBlock | TabsBlock | TabItemBlock | StepsBlock | StepItemBlock | CardsBlock | CardBlock | FileTreeBlock | ComponentShowcaseBlock | ApiDocumentationBlock | LivePreviewBlock;
293
+ declare const ALLOWED_CHILDREN_MAP: Record<string, BlockType[]>;
294
+ //#endregion
295
+ //#region src/core/types/pages.d.ts
296
+ type Localized<T = string> = Record<string, T>;
297
+ type PageType = "wiki" | "article" | "doc" | "announcement" | "landing" | (string & {});
298
+ interface RegisterPageTypes {
299
+ wiki: Record<string, any>;
300
+ article: Record<string, any>;
301
+ doc: Record<string, any>;
302
+ announcement: Record<string, any>;
303
+ landing: Record<string, any>;
304
+ [key: string]: Record<string, any>;
305
+ }
306
+ interface PageMetadata {
307
+ id: string;
308
+ slug: string;
309
+ type: PageType;
310
+ templateId?: string | null;
311
+ templateVersion?: number;
312
+ title: Localized;
313
+ description?: Localized;
314
+ tags?: Localized[];
315
+ authorIds?: string[];
316
+ publishedVersionId?: string | null;
317
+ postedAt?: Date | null;
318
+ createdAt?: Date;
319
+ updatedAt?: Date;
320
+ deletedAt?: Date | null;
321
+ }
322
+ interface PageContent<P = Record<string, any>> {
323
+ blocks: BaseBlock[];
324
+ properties: P;
325
+ }
326
+ //#endregion
327
+ //#region src/core/types/templates.d.ts
328
+ interface TemplateApprovalRules {
329
+ minApprovals?: number;
330
+ allowSelfApproval?: boolean;
331
+ requiredRolesForApproval?: string[];
332
+ }
333
+ interface TemplateRolePermissions {
334
+ whoCanCreate?: string[];
335
+ whoCanEdit?: string[];
336
+ whoCanReview?: string[];
337
+ whoCanView?: string[];
338
+ }
339
+ interface PageTemplate {
340
+ id: string;
341
+ slug: string;
342
+ title: Localized;
343
+ description?: Localized;
344
+ pageType: PageType;
345
+ version: number;
346
+ allowedRoles: string[];
347
+ rolePermissions?: TemplateRolePermissions;
348
+ requiredPermission?: string | null;
349
+ approvalRules: TemplateApprovalRules;
350
+ defaultProperties: Record<string, any>;
351
+ initialBlocks: BaseBlock[];
352
+ createdAt?: Date;
353
+ updatedAt?: Date;
354
+ }
355
+ //#endregion
356
+ //#region src/core/types/versioning.d.ts
357
+ type PageVersionStatus = "pending" | "approved" | "rejected" | "published";
358
+ interface PageVersion {
359
+ id: string;
360
+ pageId: string;
361
+ versionNumber: number;
362
+ status: PageVersionStatus;
363
+ slug: string;
364
+ type: PageType;
365
+ title: Localized;
366
+ description?: Localized;
367
+ tags?: Localized[];
368
+ authorIds?: string[];
369
+ content: {
370
+ blocks: BaseBlock[];
371
+ properties: Record<string, any>;
372
+ };
373
+ createdBy: string;
374
+ approvedBy: string[];
375
+ approvedAt?: Date | null;
376
+ changeSummary?: string | null;
377
+ createdAt?: Date;
378
+ }
379
+ interface PageVersionComment {
380
+ id: string;
381
+ versionId: string;
382
+ userId: string;
383
+ userRole: string;
384
+ content: string;
385
+ blockId?: string | null;
386
+ createdAt?: Date;
387
+ }
388
+ interface PageVersionApproval {
389
+ id: string;
390
+ versionId: string;
391
+ userId: string;
392
+ userRole: string;
393
+ approvedAt?: Date;
394
+ }
395
+ //#endregion
396
+ //#region src/core/types/bylines.d.ts
397
+ type BylineRole = "written_by" | "reviewed_by" | "edited_by" | "illustrated_by" | "translated_by" | "curated_by";
398
+ interface BylineCredit {
399
+ userId: string;
400
+ role: BylineRole;
401
+ customTitle?: string;
402
+ displayOrder?: number;
403
+ }
404
+ //#endregion
405
+ export { StepItemBlock as $, ComponentShowcaseBlockProps as A, LivePreviewBlockProps as B, CardBlock as C, CodeBlock as D, CardsBlockProps as E, FileTreeNode as F, ParagraphBlockProps as G, MAX_SECTION_HEADING_LEVEL as H, HeadingLevel as I, ScriptBlock as J, SceneBlock as K, ImageBlock as L, DialogueBlockProps as M, FileTreeBlock as N, CodeBlockProps as O, FileTreeBlockProps as P, Setting as Q, ImageBlockProps as R, CalloutVariant as S, CardsBlock as T, MIN_SECTION_HEADING_LEVEL as U, MAX_SECTION_DEPTH as V, ParagraphBlock as W, SectionBlock as X, ScriptBlockProps as Y, SectionBlockProps as Z, ApiDocumentationBlockProps as _, InlineNode as _t, PageVersionComment as a, TableBlock as at, CalloutBlock as b, PageMentionNode as bt, TemplateApprovalRules as c, TabsBlock as ct, PageContent as d, Transition as dt, StepItemBlockProps as et, PageMetadata as f, TypedBlock as ft, ApiDocumentationBlock as g, MediaValue as gt, ALLOWED_CHILDREN_MAP as h, calculateHeadingLevel as ht, PageVersionApproval as i, TabItemBlockProps as it, DialogueBlock as j, ComponentShowcaseBlock as k, TemplateRolePermissions as l, TabsBlockProps as lt, RegisterPageTypes as m, TypedScriptBlockProps as mt, BylineRole as n, StepsBlockProps as nt, PageVersionStatus as o, TableBlockProps as ot, PageType as p, TypedSceneBlockProps as pt, SceneBlockProps as q, PageVersion as r, TabItemBlock as rt, PageTemplate as s, TableColumnDef as st, BylineCredit as t, StepsBlock as tt, Localized as u, TimeOfDay as ut, BaseBlock as v, InlineNodeType as vt, CardBlockProps as w, CalloutBlockProps as x, TextInlineNode as xt, BlockType as y, LinkInlineNode as yt, LivePreviewBlock as z };