@rimelight/cms 0.0.2 → 0.0.3
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/LICENSE +21 -0
- package/package.json +16 -14
- package/src/admin/api/media-file.ts +39 -0
- package/src/admin/api/media.ts +199 -0
- package/src/admin/layouts/CMSDashboardLayout.astro +178 -0
- package/src/admin/layouts/DefaultParentLayout.astro +50 -0
- package/src/admin/pages/assets.astro +424 -0
- package/src/admin/pages/byline-schema.astro +62 -0
- package/src/admin/pages/bylines.astro +16 -0
- package/src/admin/pages/categories.astro +21 -0
- package/src/admin/pages/content-types.astro +55 -0
- package/src/admin/pages/dashboard.astro +61 -0
- package/src/admin/pages/pages-edit.astro +595 -0
- package/src/admin/pages/pages-index.astro +146 -0
- package/src/admin/pages/pages-new.astro +130 -0
- package/src/admin/pages/pages-preview.astro +111 -0
- package/src/admin/pages/pages-review.astro +236 -0
- package/src/admin/pages/settings.astro +203 -0
- package/src/admin/pages/tags.astro +21 -0
- package/src/admin/pages/templates-edit.astro +234 -0
- package/src/admin/pages/templates-index.astro +95 -0
- package/src/admin/pages/templates-new.astro +193 -0
- package/src/admin/pages/users.astro +74 -0
- package/src/admin/pages/versions.astro +74 -0
- package/src/astro/BlockRenderer.astro +44 -102
- package/src/astro/PageRenderer.astro +9 -2
- package/src/astro/blocks/CalloutBlock.astro +7 -7
- package/src/astro/blocks/CardBlock.astro +5 -5
- package/src/astro/blocks/CodeBlock.astro +2 -2
- package/src/astro/blocks/FileTreeBlock.astro +7 -7
- package/src/astro/blocks/ImageBlock.astro +2 -2
- package/src/astro/blocks/OrderedListBlock.astro +2 -2
- package/src/astro/blocks/ParagraphBlock.astro +3 -3
- package/src/astro/blocks/SectionBlock.astro +6 -6
- package/src/astro/blocks/StepItemBlock.astro +3 -3
- package/src/astro/blocks/StepsBlock.astro +1 -1
- package/src/astro/blocks/TableBlock.astro +6 -6
- package/src/astro/blocks/TabsBlock.astro +9 -9
- package/src/astro/blocks/UnorderedListBlock.astro +2 -2
- package/src/astro/blocks/index.ts +35 -0
- package/src/client/components/RimelightBlock.tsx +19 -19
- package/src/client/components/RimelightBlockPicker.tsx +9 -13
- package/src/client/components/RimelightBylinesManager.tsx +438 -0
- package/src/client/components/RimelightEditor.tsx +3 -3
- package/src/client/components/RimelightPreview.tsx +37 -45
- package/src/client/components/RimelightPropertiesPanel.tsx +368 -26
- package/src/client/components/RimelightTaxonomyManager.tsx +369 -0
- package/src/client/components/RimelightTaxonomyMasterDetail.tsx +412 -0
- package/src/client/components/RimelightTemplateEditor.tsx +6 -8
- package/src/client/components/editors/CalloutEditor.tsx +2 -4
- package/src/client/components/editors/CardsEditor.tsx +2 -4
- package/src/client/components/editors/CodeEditor.tsx +1 -3
- package/src/client/components/editors/FileTreeEditor.tsx +2 -4
- package/src/client/components/editors/ImageEditor.tsx +3 -3
- package/src/client/components/editors/ParagraphEditor.tsx +2 -2
- package/src/client/components/editors/SceneEditor.tsx +6 -12
- package/src/client/components/editors/ScriptEditor.tsx +8 -16
- package/src/client/components/editors/SectionEditor.tsx +4 -4
- package/src/client/components/editors/StepItemEditor.tsx +2 -2
- package/src/client/components/editors/StepsEditor.tsx +2 -4
- package/src/client/components/editors/TabItemEditor.tsx +3 -3
- package/src/client/components/editors/TableEditor.tsx +5 -5
- package/src/client/components/editors/TabsEditor.tsx +2 -4
- package/src/client/components/index.ts +3 -0
- package/src/client/loader.ts +3 -0
- package/src/core/diff.ts +145 -0
- package/src/core/excerpt.ts +159 -0
- package/src/core/preview.ts +87 -0
- package/src/core/registry.ts +0 -86
- package/src/core/types/blocks.ts +6 -1
- package/src/core/types/bylines.ts +14 -0
- package/src/core/types/media.ts +13 -0
- package/src/core/types/taxonomies.ts +20 -0
- package/src/cron/scheduled.ts +57 -0
- package/src/docs/agent.ts +116 -0
- package/src/docs/config.ts +25 -0
- package/src/docs/index.ts +5 -0
- package/src/docs/routing.ts +104 -0
- package/src/docs/sidebar.ts +251 -0
- package/src/docs/toc.ts +47 -0
- package/src/env.d.ts +13 -0
- package/src/index.ts +40 -8
- package/src/integration.ts +196 -0
- package/src/loader/live.ts +254 -0
- package/src/markdown/index.ts +0 -1
- package/src/mcp/index.ts +228 -0
- package/src/schema/bylines.ts +23 -0
- package/src/schema/index.ts +3 -4
- package/src/schema/page_versions.ts +2 -0
- package/src/schema/pages.ts +2 -0
- package/src/schema/site_settings.ts +41 -0
- package/src/schema/taxonomies.ts +49 -0
- package/src/services/bylines.ts +74 -0
- package/src/services/search-indexer.ts +61 -0
- package/src/services/site-settings.ts +108 -0
- package/src/services/taxonomies.ts +276 -0
- package/src/storage/index.ts +253 -0
- package/src/astro/blocks/ApiDocumentationBlock.astro +0 -350
- package/src/astro/blocks/DialogueBlock.astro +0 -23
- package/src/astro/blocks/LivePreviewBlock.astro +0 -27
- package/src/astro/blocks/SceneBlock.astro +0 -65
- package/src/astro/blocks/ScriptBlock.astro +0 -59
- package/src/core/template-sync.ts +0 -75
- package/src/markdown/parser.ts +0 -347
- package/src/migration-tools.ts +0 -334
- package/src/migration.ts +0 -155
- package/src/schema/component_dependencies.ts +0 -21
- package/src/schema/component_metadata.ts +0 -31
- package/src/schema/component_metadata_cache.ts +0 -15
- package/src/schema/component_versions.ts +0 -19
- package/src/search/sync.ts +0 -32
- package/src/services/component-metadata.ts +0 -134
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
import { eq, desc } from "drizzle-orm"
|
|
2
|
-
import type {
|
|
3
|
-
NewComponentMetadata
|
|
4
|
-
} from "../schema/index.ts"
|
|
5
|
-
|
|
6
|
-
export interface ComponentMeta {
|
|
7
|
-
componentName: string
|
|
8
|
-
version: string
|
|
9
|
-
framework: string
|
|
10
|
-
filePath: string
|
|
11
|
-
props: Record<string, any>
|
|
12
|
-
slots: Record<string, any>
|
|
13
|
-
emits: Record<string, any>
|
|
14
|
-
theme?: Record<string, any>
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export interface ComponentDependencyRecord {
|
|
18
|
-
sourceComponent: string
|
|
19
|
-
targetComponent: string
|
|
20
|
-
dependencyType: "uses" | "extends" | "related"
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export class ComponentMetadataService {
|
|
24
|
-
constructor(private db: any) {}
|
|
25
|
-
|
|
26
|
-
async extractMetadata(componentPath: string): Promise<ComponentMeta> {
|
|
27
|
-
const props: Record<string, any> = {}
|
|
28
|
-
const slots: Record<string, any> = {}
|
|
29
|
-
const emits: Record<string, any> = {}
|
|
30
|
-
|
|
31
|
-
try {
|
|
32
|
-
const content = await this.readComponentFile(componentPath)
|
|
33
|
-
props.raw = content
|
|
34
|
-
props.extractedAt = new Date().toISOString()
|
|
35
|
-
} catch (e) {
|
|
36
|
-
console.warn(`Failed to read component file: ${componentPath}`, e)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
componentName: componentPath.split("/").pop()?.replace(/\.[^/.]+$/, "") || "unknown",
|
|
41
|
-
version: "latest",
|
|
42
|
-
framework: "astro",
|
|
43
|
-
filePath: componentPath,
|
|
44
|
-
props,
|
|
45
|
-
slots,
|
|
46
|
-
emits
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
async storeMetadata(metadata: ComponentMeta): Promise<void> {
|
|
51
|
-
const record: NewComponentMetadata = {
|
|
52
|
-
componentName: metadata.componentName,
|
|
53
|
-
version: metadata.version,
|
|
54
|
-
framework: metadata.framework,
|
|
55
|
-
filePath: metadata.filePath,
|
|
56
|
-
props: metadata.props,
|
|
57
|
-
slots: metadata.slots,
|
|
58
|
-
emits: metadata.emits,
|
|
59
|
-
theme: metadata.theme || {}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
await this.db.insert(this.db.componentMetadata).values(record).onConflictDoUpdate({
|
|
63
|
-
target: [this.db.componentMetadata.componentName, this.db.componentMetadata.version],
|
|
64
|
-
set: {
|
|
65
|
-
framework: record.framework,
|
|
66
|
-
filePath: record.filePath,
|
|
67
|
-
props: record.props,
|
|
68
|
-
slots: record.slots,
|
|
69
|
-
emits: record.emits,
|
|
70
|
-
theme: record.theme,
|
|
71
|
-
updatedAt: new Date()
|
|
72
|
-
}
|
|
73
|
-
})
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
async getMetadata(componentName: string): Promise<ComponentMeta | null> {
|
|
77
|
-
const result = await this.db
|
|
78
|
-
.select()
|
|
79
|
-
.from(this.db.componentMetadata)
|
|
80
|
-
.where(eq(this.db.componentMetadata.componentName, componentName))
|
|
81
|
-
.orderBy(desc(this.db.componentMetadata.extractedAt))
|
|
82
|
-
.limit(1)
|
|
83
|
-
|
|
84
|
-
if (!result[0]) return null
|
|
85
|
-
|
|
86
|
-
const row = result[0]
|
|
87
|
-
return {
|
|
88
|
-
componentName: row.componentName,
|
|
89
|
-
version: row.version,
|
|
90
|
-
framework: row.framework,
|
|
91
|
-
filePath: row.filePath,
|
|
92
|
-
props: row.props,
|
|
93
|
-
slots: row.slots,
|
|
94
|
-
emits: row.emits,
|
|
95
|
-
theme: row.theme
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
async updateMetadata(componentName: string): Promise<void> {
|
|
100
|
-
const metadata = await this.getMetadata(componentName)
|
|
101
|
-
if (!metadata) return
|
|
102
|
-
|
|
103
|
-
const freshMeta = await this.extractMetadata(metadata.filePath)
|
|
104
|
-
await this.storeMetadata(freshMeta)
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
async getDependencies(componentName: string): Promise<ComponentDependencyRecord[]> {
|
|
108
|
-
const result = await this.db
|
|
109
|
-
.select()
|
|
110
|
-
.from(this.db.componentDependencies)
|
|
111
|
-
.where(eq(this.db.componentDependencies.sourceComponent, componentName))
|
|
112
|
-
|
|
113
|
-
return result.map((row: any) => ({
|
|
114
|
-
sourceComponent: row.sourceComponent,
|
|
115
|
-
targetComponent: row.targetComponent,
|
|
116
|
-
dependencyType: row.dependencyType as "uses" | "extends" | "related"
|
|
117
|
-
}))
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
async invalidateCache(componentName: string): Promise<void> {
|
|
121
|
-
await this.db
|
|
122
|
-
.delete(this.db.componentMetadataCache)
|
|
123
|
-
.where(eq(this.db.componentMetadataCache.componentName, componentName))
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
private async readComponentFile(path: string): Promise<string> {
|
|
127
|
-
try {
|
|
128
|
-
const fs = await import("fs")
|
|
129
|
-
return fs.readFileSync(path, "utf-8")
|
|
130
|
-
} catch {
|
|
131
|
-
return ""
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|