@nuasite/cms 0.3.1 → 0.5.1
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/editor.js +36007 -0
- package/package.json +12 -11
- package/src/dev-middleware.ts +82 -2
- package/src/editor/components/block-editor.tsx +47 -56
- package/src/editor/components/outline.tsx +42 -35
- package/src/editor/components/toolbar.tsx +7 -4
- package/src/editor/dom.ts +16 -5
- package/src/editor/editor.ts +18 -0
- package/src/editor/hooks/useBlockEditorHandlers.ts +5 -5
- package/src/editor/hooks/useElementDetection.ts +2 -2
- package/src/editor/index.tsx +3 -2
- package/src/index.ts +54 -28
- package/src/source-finder/snippet-utils.ts +62 -1
- package/dist/src/build-processor.d.ts +0 -20
- package/dist/src/build-processor.d.ts.map +0 -1
- package/dist/src/collection-scanner.d.ts +0 -6
- package/dist/src/collection-scanner.d.ts.map +0 -1
- package/dist/src/component-registry.d.ts +0 -67
- package/dist/src/component-registry.d.ts.map +0 -1
- package/dist/src/config.d.ts +0 -24
- package/dist/src/config.d.ts.map +0 -1
- package/dist/src/dev-middleware.d.ts +0 -20
- package/dist/src/dev-middleware.d.ts.map +0 -1
- package/dist/src/editor/ai.d.ts +0 -60
- package/dist/src/editor/ai.d.ts.map +0 -1
- package/dist/src/editor/api.d.ts +0 -154
- package/dist/src/editor/api.d.ts.map +0 -1
- package/dist/src/editor/color-utils.d.ts +0 -106
- package/dist/src/editor/color-utils.d.ts.map +0 -1
- package/dist/src/editor/components/ai-chat.d.ts +0 -11
- package/dist/src/editor/components/ai-chat.d.ts.map +0 -1
- package/dist/src/editor/components/ai-tooltip.d.ts +0 -12
- package/dist/src/editor/components/ai-tooltip.d.ts.map +0 -1
- package/dist/src/editor/components/attribute-editor.d.ts +0 -5
- package/dist/src/editor/components/attribute-editor.d.ts.map +0 -1
- package/dist/src/editor/components/block-editor.d.ts +0 -12
- package/dist/src/editor/components/block-editor.d.ts.map +0 -1
- package/dist/src/editor/components/collections-browser.d.ts +0 -2
- package/dist/src/editor/components/collections-browser.d.ts.map +0 -1
- package/dist/src/editor/components/color-toolbar.d.ts +0 -12
- package/dist/src/editor/components/color-toolbar.d.ts.map +0 -1
- package/dist/src/editor/components/confirm-dialog.d.ts +0 -2
- package/dist/src/editor/components/confirm-dialog.d.ts.map +0 -1
- package/dist/src/editor/components/create-page-modal.d.ts +0 -2
- package/dist/src/editor/components/create-page-modal.d.ts.map +0 -1
- package/dist/src/editor/components/editable-highlights.d.ts +0 -9
- package/dist/src/editor/components/editable-highlights.d.ts.map +0 -1
- package/dist/src/editor/components/error-boundary.d.ts +0 -32
- package/dist/src/editor/components/error-boundary.d.ts.map +0 -1
- package/dist/src/editor/components/fields.d.ts +0 -75
- package/dist/src/editor/components/fields.d.ts.map +0 -1
- package/dist/src/editor/components/frontmatter-fields.d.ts +0 -29
- package/dist/src/editor/components/frontmatter-fields.d.ts.map +0 -1
- package/dist/src/editor/components/highlight-overlay.d.ts +0 -64
- package/dist/src/editor/components/highlight-overlay.d.ts.map +0 -1
- package/dist/src/editor/components/image-overlay.d.ts +0 -12
- package/dist/src/editor/components/image-overlay.d.ts.map +0 -1
- package/dist/src/editor/components/markdown-editor-overlay.d.ts +0 -6
- package/dist/src/editor/components/markdown-editor-overlay.d.ts.map +0 -1
- package/dist/src/editor/components/markdown-inline-editor.d.ts +0 -10
- package/dist/src/editor/components/markdown-inline-editor.d.ts.map +0 -1
- package/dist/src/editor/components/media-library.d.ts +0 -2
- package/dist/src/editor/components/media-library.d.ts.map +0 -1
- package/dist/src/editor/components/outline.d.ts +0 -21
- package/dist/src/editor/components/outline.d.ts.map +0 -1
- package/dist/src/editor/components/redirect-countdown.d.ts +0 -2
- package/dist/src/editor/components/redirect-countdown.d.ts.map +0 -1
- package/dist/src/editor/components/seo-editor.d.ts +0 -2
- package/dist/src/editor/components/seo-editor.d.ts.map +0 -1
- package/dist/src/editor/components/text-style-toolbar.d.ts +0 -8
- package/dist/src/editor/components/text-style-toolbar.d.ts.map +0 -1
- package/dist/src/editor/components/toast/toast-container.d.ts +0 -7
- package/dist/src/editor/components/toast/toast-container.d.ts.map +0 -1
- package/dist/src/editor/components/toast/toast.d.ts +0 -7
- package/dist/src/editor/components/toast/toast.d.ts.map +0 -1
- package/dist/src/editor/components/toast/types.d.ts +0 -7
- package/dist/src/editor/components/toast/types.d.ts.map +0 -1
- package/dist/src/editor/components/toolbar.d.ts +0 -21
- package/dist/src/editor/components/toolbar.d.ts.map +0 -1
- package/dist/src/editor/config.d.ts +0 -4
- package/dist/src/editor/config.d.ts.map +0 -1
- package/dist/src/editor/constants.d.ts +0 -102
- package/dist/src/editor/constants.d.ts.map +0 -1
- package/dist/src/editor/context.d.ts +0 -14
- package/dist/src/editor/context.d.ts.map +0 -1
- package/dist/src/editor/dom.d.ts +0 -86
- package/dist/src/editor/dom.d.ts.map +0 -1
- package/dist/src/editor/editor.d.ts +0 -64
- package/dist/src/editor/editor.d.ts.map +0 -1
- package/dist/src/editor/history.d.ts +0 -20
- package/dist/src/editor/history.d.ts.map +0 -1
- package/dist/src/editor/hooks/index.d.ts +0 -14
- package/dist/src/editor/hooks/index.d.ts.map +0 -1
- package/dist/src/editor/hooks/useAIHandlers.d.ts +0 -22
- package/dist/src/editor/hooks/useAIHandlers.d.ts.map +0 -1
- package/dist/src/editor/hooks/useBlockEditorHandlers.d.ts +0 -18
- package/dist/src/editor/hooks/useBlockEditorHandlers.d.ts.map +0 -1
- package/dist/src/editor/hooks/useElementDetection.d.ts +0 -26
- package/dist/src/editor/hooks/useElementDetection.d.ts.map +0 -1
- package/dist/src/editor/hooks/useImageHoverDetection.d.ts +0 -12
- package/dist/src/editor/hooks/useImageHoverDetection.d.ts.map +0 -1
- package/dist/src/editor/hooks/useTextSelection.d.ts +0 -23
- package/dist/src/editor/hooks/useTextSelection.d.ts.map +0 -1
- package/dist/src/editor/hooks/useTooltipState.d.ts +0 -19
- package/dist/src/editor/hooks/useTooltipState.d.ts.map +0 -1
- package/dist/src/editor/hooks/utils.d.ts +0 -32
- package/dist/src/editor/hooks/utils.d.ts.map +0 -1
- package/dist/src/editor/index.d.ts +0 -12
- package/dist/src/editor/index.d.ts.map +0 -1
- package/dist/src/editor/lib/cn.d.ts +0 -3
- package/dist/src/editor/lib/cn.d.ts.map +0 -1
- package/dist/src/editor/manifest.d.ts +0 -19
- package/dist/src/editor/manifest.d.ts.map +0 -1
- package/dist/src/editor/markdown-api.d.ts +0 -36
- package/dist/src/editor/markdown-api.d.ts.map +0 -1
- package/dist/src/editor/signals.d.ts +0 -242
- package/dist/src/editor/signals.d.ts.map +0 -1
- package/dist/src/editor/storage.d.ts +0 -29
- package/dist/src/editor/storage.d.ts.map +0 -1
- package/dist/src/editor/text-styling.d.ts +0 -350
- package/dist/src/editor/text-styling.d.ts.map +0 -1
- package/dist/src/editor/themes.d.ts +0 -38
- package/dist/src/editor/themes.d.ts.map +0 -1
- package/dist/src/editor/types.d.ts +0 -454
- package/dist/src/editor/types.d.ts.map +0 -1
- package/dist/src/error-collector.d.ts +0 -56
- package/dist/src/error-collector.d.ts.map +0 -1
- package/dist/src/handlers/array-ops.d.ts +0 -59
- package/dist/src/handlers/array-ops.d.ts.map +0 -1
- package/dist/src/handlers/component-ops.d.ts +0 -60
- package/dist/src/handlers/component-ops.d.ts.map +0 -1
- package/dist/src/handlers/markdown-ops.d.ts +0 -41
- package/dist/src/handlers/markdown-ops.d.ts.map +0 -1
- package/dist/src/handlers/request-utils.d.ts +0 -20
- package/dist/src/handlers/request-utils.d.ts.map +0 -1
- package/dist/src/handlers/source-writer.d.ts +0 -51
- package/dist/src/handlers/source-writer.d.ts.map +0 -1
- package/dist/src/html-processor.d.ts +0 -63
- package/dist/src/html-processor.d.ts.map +0 -1
- package/dist/src/index.d.ts +0 -41
- package/dist/src/index.d.ts.map +0 -1
- package/dist/src/manifest-writer.d.ts +0 -111
- package/dist/src/manifest-writer.d.ts.map +0 -1
- package/dist/src/media/contember.d.ts +0 -15
- package/dist/src/media/contember.d.ts.map +0 -1
- package/dist/src/media/local.d.ts +0 -9
- package/dist/src/media/local.d.ts.map +0 -1
- package/dist/src/media/s3.d.ts +0 -12
- package/dist/src/media/s3.d.ts.map +0 -1
- package/dist/src/media/types.d.ts +0 -40
- package/dist/src/media/types.d.ts.map +0 -1
- package/dist/src/preview-generator.d.ts +0 -19
- package/dist/src/preview-generator.d.ts.map +0 -1
- package/dist/src/seo-processor.d.ts +0 -23
- package/dist/src/seo-processor.d.ts.map +0 -1
- package/dist/src/source-finder/ast-extractors.d.ts +0 -35
- package/dist/src/source-finder/ast-extractors.d.ts.map +0 -1
- package/dist/src/source-finder/ast-parser.d.ts +0 -18
- package/dist/src/source-finder/ast-parser.d.ts.map +0 -1
- package/dist/src/source-finder/cache.d.ts +0 -18
- package/dist/src/source-finder/cache.d.ts.map +0 -1
- package/dist/src/source-finder/collection-finder.d.ts +0 -29
- package/dist/src/source-finder/collection-finder.d.ts.map +0 -1
- package/dist/src/source-finder/cross-file-tracker.d.ts +0 -39
- package/dist/src/source-finder/cross-file-tracker.d.ts.map +0 -1
- package/dist/src/source-finder/element-finder.d.ts +0 -42
- package/dist/src/source-finder/element-finder.d.ts.map +0 -1
- package/dist/src/source-finder/image-finder.d.ts +0 -24
- package/dist/src/source-finder/image-finder.d.ts.map +0 -1
- package/dist/src/source-finder/index.d.ts +0 -9
- package/dist/src/source-finder/index.d.ts.map +0 -1
- package/dist/src/source-finder/search-index.d.ts +0 -27
- package/dist/src/source-finder/search-index.d.ts.map +0 -1
- package/dist/src/source-finder/snippet-utils.d.ts +0 -96
- package/dist/src/source-finder/snippet-utils.d.ts.map +0 -1
- package/dist/src/source-finder/source-lookup.d.ts +0 -16
- package/dist/src/source-finder/source-lookup.d.ts.map +0 -1
- package/dist/src/source-finder/types.d.ts +0 -167
- package/dist/src/source-finder/types.d.ts.map +0 -1
- package/dist/src/source-finder/variable-extraction.d.ts +0 -37
- package/dist/src/source-finder/variable-extraction.d.ts.map +0 -1
- package/dist/src/tailwind-colors.d.ts +0 -54
- package/dist/src/tailwind-colors.d.ts.map +0 -1
- package/dist/src/tsconfig.tsbuildinfo +0 -1
- package/dist/src/types.d.ts +0 -367
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/utils.d.ts +0 -61
- package/dist/src/utils.d.ts.map +0 -1
- package/dist/src/vite-plugin.d.ts +0 -14
- package/dist/src/vite-plugin.d.ts.map +0 -1
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import tailwindcss from '@tailwindcss/vite'
|
|
2
1
|
import type { AstroIntegration } from 'astro'
|
|
2
|
+
import { existsSync, readFileSync } from 'node:fs'
|
|
3
3
|
import { dirname, join } from 'node:path'
|
|
4
4
|
import { fileURLToPath } from 'node:url'
|
|
5
5
|
|
|
@@ -133,6 +133,11 @@ export default function nuaCms(options: NuaCmsOptions = {}): AstroIntegration {
|
|
|
133
133
|
}
|
|
134
134
|
|
|
135
135
|
const vitePlugins: any[] = [...(createVitePlugin(pluginContext) as any)]
|
|
136
|
+
const cmsDir = !src ? dirname(fileURLToPath(import.meta.url)) : undefined
|
|
137
|
+
|
|
138
|
+
// Detect pre-built editor bundle (present when installed from npm)
|
|
139
|
+
const editorBundlePath = cmsDir ? join(cmsDir, '../dist/editor.js') : undefined
|
|
140
|
+
const hasPrebuiltBundle = editorBundlePath ? existsSync(editorBundlePath) : false
|
|
136
141
|
|
|
137
142
|
// --- CMS Editor setup (dev only) ---
|
|
138
143
|
if (command === 'dev') {
|
|
@@ -156,33 +161,51 @@ export default function nuaCms(options: NuaCmsOptions = {}): AstroIntegration {
|
|
|
156
161
|
`,
|
|
157
162
|
)
|
|
158
163
|
|
|
159
|
-
// Resolve the virtual CMS editor path to the actual source file.
|
|
160
|
-
// Vite's dev server transforms the TSX, resolves imports, and serves it.
|
|
161
164
|
if (!src) {
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
165
|
+
if (hasPrebuiltBundle) {
|
|
166
|
+
// Pre-built bundle exists (npm install case):
|
|
167
|
+
// Serve it via a virtual module — no JSX pragma, Tailwind, or aliases needed.
|
|
168
|
+
const bundleContent = readFileSync(editorBundlePath!, 'utf-8')
|
|
169
|
+
vitePlugins.push({
|
|
170
|
+
name: 'nuasite-cms-editor',
|
|
171
|
+
resolveId(id: string) {
|
|
172
|
+
if (id === VIRTUAL_CMS_PATH) {
|
|
173
|
+
return VIRTUAL_CMS_PATH
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
load(id: string) {
|
|
177
|
+
if (id === VIRTUAL_CMS_PATH) {
|
|
178
|
+
return bundleContent
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
})
|
|
182
|
+
} else {
|
|
183
|
+
// No pre-built bundle (monorepo dev case):
|
|
184
|
+
// Serve source files directly — Vite transforms TSX, resolves imports, HMR works.
|
|
185
|
+
vitePlugins.push({
|
|
186
|
+
name: 'nuasite-cms-editor',
|
|
187
|
+
resolveId(id: string) {
|
|
188
|
+
if (id === VIRTUAL_CMS_PATH) {
|
|
189
|
+
return join(cmsDir!, 'editor/index.tsx')
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
// Prepend @jsxImportSource pragma for editor .tsx files
|
|
195
|
+
// so Vite's esbuild uses Preact's h function
|
|
196
|
+
vitePlugins.push({
|
|
197
|
+
name: 'nuasite-cms-preact-jsx',
|
|
198
|
+
transform(code: string, id: string) {
|
|
199
|
+
if (id.includes('/src/editor/') && id.endsWith('.tsx') && !code.includes('@jsxImportSource')) {
|
|
200
|
+
return `/** @jsxImportSource preact */\n${code}`
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
})
|
|
204
|
+
|
|
205
|
+
// Add Tailwind CSS Vite plugin for editor styles
|
|
206
|
+
const tailwindcss = (await import('@tailwindcss/vite')).default
|
|
207
|
+
vitePlugins.push(tailwindcss())
|
|
208
|
+
}
|
|
186
209
|
}
|
|
187
210
|
}
|
|
188
211
|
|
|
@@ -195,10 +218,13 @@ export default function nuaCms(options: NuaCmsOptions = {}): AstroIntegration {
|
|
|
195
218
|
}
|
|
196
219
|
}
|
|
197
220
|
|
|
221
|
+
// Only add react->preact aliases when serving source files (not pre-built bundle)
|
|
222
|
+
const needsAliases = !src && !hasPrebuiltBundle
|
|
223
|
+
|
|
198
224
|
updateConfig({
|
|
199
225
|
vite: {
|
|
200
226
|
plugins: vitePlugins,
|
|
201
|
-
resolve:
|
|
227
|
+
resolve: needsAliases
|
|
202
228
|
? {
|
|
203
229
|
alias: {
|
|
204
230
|
'react': 'preact/compat',
|
|
@@ -6,7 +6,7 @@ import type { Attribute, ManifestEntry } from '../types'
|
|
|
6
6
|
import { escapeRegex, generateSourceHash } from '../utils'
|
|
7
7
|
import { buildDefinitionPath } from './ast-extractors'
|
|
8
8
|
import { getCachedParsedFile } from './ast-parser'
|
|
9
|
-
import { findAttributeSourceLocation } from './cross-file-tracker'
|
|
9
|
+
import { findAttributeSourceLocation, searchForExpressionProp, searchForPropInParents } from './cross-file-tracker'
|
|
10
10
|
import { findImageElementNearLine, findImageSourceLocation } from './image-finder'
|
|
11
11
|
|
|
12
12
|
// ============================================================================
|
|
@@ -640,6 +640,67 @@ export async function enhanceManifestWithSourceSnippets(
|
|
|
640
640
|
sourceHash,
|
|
641
641
|
}] as const
|
|
642
642
|
}
|
|
643
|
+
|
|
644
|
+
// Cross-file search for prop-driven dynamic text
|
|
645
|
+
// When text comes from a prop (e.g., {title} where title = Astro.props.title),
|
|
646
|
+
// trace it to where the prop value is actually defined in a parent component
|
|
647
|
+
if (cached) {
|
|
648
|
+
// Extract expression variables from the snippet to find props
|
|
649
|
+
const exprPattern = /\{(\w+(?:\.\w+|\[\d+\])*)\}/g
|
|
650
|
+
let exprMatch: RegExpExecArray | null
|
|
651
|
+
while ((exprMatch = exprPattern.exec(sourceSnippet)) !== null) {
|
|
652
|
+
const exprPath = exprMatch[1]!
|
|
653
|
+
const baseVar = exprPath.match(/^(\w+)/)?.[1]
|
|
654
|
+
if (baseVar && cached.propAliases.has(baseVar)) {
|
|
655
|
+
const propName = cached.propAliases.get(baseVar)!
|
|
656
|
+
const componentFileName = path.basename(filePath)
|
|
657
|
+
const result = await searchForExpressionProp(
|
|
658
|
+
componentFileName, propName, exprPath, entry.text!,
|
|
659
|
+
)
|
|
660
|
+
if (result) {
|
|
661
|
+
const propSnippet = result.snippet ?? trimmedText
|
|
662
|
+
const propSourceHash = generateSourceHash(propSnippet)
|
|
663
|
+
return [id, {
|
|
664
|
+
...entry,
|
|
665
|
+
sourcePath: result.file,
|
|
666
|
+
sourceLine: result.line,
|
|
667
|
+
sourceSnippet: propSnippet,
|
|
668
|
+
variableName: result.variableName,
|
|
669
|
+
attributes,
|
|
670
|
+
colorClasses,
|
|
671
|
+
sourceHash: propSourceHash,
|
|
672
|
+
}] as const
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
// Search for quoted prop values in parent components
|
|
678
|
+
// (handles <Component title="literal text" />)
|
|
679
|
+
const srcDir = path.join(getProjectRoot(), 'src')
|
|
680
|
+
for (const searchDir of ['pages', 'components', 'layouts']) {
|
|
681
|
+
try {
|
|
682
|
+
const result = await searchForPropInParents(
|
|
683
|
+
path.join(srcDir, searchDir), trimmedText,
|
|
684
|
+
)
|
|
685
|
+
if (result) {
|
|
686
|
+
const parentSnippet = result.snippet ?? trimmedText
|
|
687
|
+
const propSourceHash = generateSourceHash(parentSnippet)
|
|
688
|
+
return [id, {
|
|
689
|
+
...entry,
|
|
690
|
+
sourcePath: result.file,
|
|
691
|
+
sourceLine: result.line,
|
|
692
|
+
sourceSnippet: parentSnippet,
|
|
693
|
+
variableName: result.variableName,
|
|
694
|
+
attributes,
|
|
695
|
+
colorClasses,
|
|
696
|
+
sourceHash: propSourceHash,
|
|
697
|
+
}] as const
|
|
698
|
+
}
|
|
699
|
+
} catch {
|
|
700
|
+
// Directory doesn't exist
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}
|
|
643
704
|
}
|
|
644
705
|
|
|
645
706
|
// Original static content path
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { AstroIntegrationLogger } from 'astro';
|
|
2
|
-
import type { ManifestWriter } from './manifest-writer';
|
|
3
|
-
import type { CmsMarkerOptions } from './types';
|
|
4
|
-
/**
|
|
5
|
-
* Cluster entries from the same source file into separate component instances.
|
|
6
|
-
* When a component is used multiple times on a page, its entries are in different
|
|
7
|
-
* subtrees. We partition by finding which direct child of the LCA each entry belongs to.
|
|
8
|
-
*/
|
|
9
|
-
export declare function clusterComponentEntries<T>(elements: T[], entryIds: string[], findLCA: (els: T[]) => T | null): Array<{
|
|
10
|
-
clusterEntryIds: string[];
|
|
11
|
-
clusterElements: T[];
|
|
12
|
-
}>;
|
|
13
|
-
/**
|
|
14
|
-
* Process build output - processes all HTML files in parallel.
|
|
15
|
-
* Uses error aggregation to continue processing even if some files fail.
|
|
16
|
-
*/
|
|
17
|
-
export declare function processBuildOutput(dir: URL, config: Required<CmsMarkerOptions>, manifestWriter: ManifestWriter, idCounter: {
|
|
18
|
-
value: number;
|
|
19
|
-
}, logger?: AstroIntegrationLogger): Promise<void>;
|
|
20
|
-
//# sourceMappingURL=build-processor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build-processor.d.ts","sourceRoot":"","sources":["../../src/build-processor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAA;AAQnD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAcvD,OAAO,KAAK,EAAE,gBAAgB,EAAmB,MAAM,SAAS,CAAA;AA6BhE;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,CAAC,EACxC,QAAQ,EAAE,CAAC,EAAE,EACb,QAAQ,EAAE,MAAM,EAAE,EAClB,OAAO,EAAE,CAAC,GAAG,EAAE,CAAC,EAAE,KAAK,CAAC,GAAG,IAAI,GAC7B,KAAK,CAAC;IAAE,eAAe,EAAE,MAAM,EAAE,CAAC;IAAC,eAAe,EAAE,CAAC,EAAE,CAAA;CAAE,CAAC,CAkD5D;AAkmBD;;;GAGG;AACH,wBAAsB,kBAAkB,CACvC,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC,EAClC,cAAc,EAAE,cAAc,EAC9B,SAAS,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EAC5B,MAAM,CAAC,EAAE,sBAAsB,GAC7B,OAAO,CAAC,IAAI,CAAC,CAyDf"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { CollectionDefinition } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Scan all collections in the content directory
|
|
4
|
-
*/
|
|
5
|
-
export declare function scanCollections(contentDir?: string): Promise<Record<string, CollectionDefinition>>;
|
|
6
|
-
//# sourceMappingURL=collection-scanner.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collection-scanner.d.ts","sourceRoot":"","sources":["../../src/collection-scanner.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAmD,MAAM,SAAS,CAAA;AA+QpG;;GAEG;AACH,wBAAsB,eAAe,CAAC,UAAU,GAAE,MAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC,CAyBvH"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import type { ComponentDefinition } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Scans Astro component files and extracts their definitions including props
|
|
4
|
-
*/
|
|
5
|
-
export declare class ComponentRegistry {
|
|
6
|
-
private components;
|
|
7
|
-
private componentDirs;
|
|
8
|
-
constructor(componentDirs?: string[]);
|
|
9
|
-
/**
|
|
10
|
-
* Scan all component directories and build the registry
|
|
11
|
-
*/
|
|
12
|
-
scan(): Promise<void>;
|
|
13
|
-
/**
|
|
14
|
-
* Get all registered components
|
|
15
|
-
*/
|
|
16
|
-
getComponents(): Record<string, ComponentDefinition>;
|
|
17
|
-
/**
|
|
18
|
-
* Get a specific component by name
|
|
19
|
-
*/
|
|
20
|
-
getComponent(name: string): ComponentDefinition | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* Scan a directory recursively for .astro files
|
|
23
|
-
*/
|
|
24
|
-
private scanDirectory;
|
|
25
|
-
/**
|
|
26
|
-
* Parse a single Astro component file
|
|
27
|
-
*/
|
|
28
|
-
private parseComponent;
|
|
29
|
-
/**
|
|
30
|
-
* Parse Props content using @babel/parser AST for correct TypeScript handling.
|
|
31
|
-
* Wraps the content in a synthetic interface and walks TSPropertySignature nodes.
|
|
32
|
-
*/
|
|
33
|
-
private parsePropsContent;
|
|
34
|
-
/**
|
|
35
|
-
* Fallback: convert a Babel TSType node to a human-readable string
|
|
36
|
-
*/
|
|
37
|
-
private typeAnnotationToString;
|
|
38
|
-
/**
|
|
39
|
-
* Extract content between balanced braces after a pattern match
|
|
40
|
-
* Properly handles nested objects
|
|
41
|
-
*/
|
|
42
|
-
private extractBalancedBraces;
|
|
43
|
-
/**
|
|
44
|
-
* Extract props from component frontmatter
|
|
45
|
-
*/
|
|
46
|
-
private extractProps;
|
|
47
|
-
/**
|
|
48
|
-
* Extract slot names from template
|
|
49
|
-
*/
|
|
50
|
-
private extractSlots;
|
|
51
|
-
/**
|
|
52
|
-
* Extract component description from JSDoc comment
|
|
53
|
-
*/
|
|
54
|
-
private extractDescription;
|
|
55
|
-
/**
|
|
56
|
-
* Extract @previewWidth value from JSDoc comment
|
|
57
|
-
*/
|
|
58
|
-
private extractPreviewWidth;
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Parse component usage in an Astro file to extract prop values
|
|
62
|
-
*/
|
|
63
|
-
export declare function parseComponentUsage(content: string, componentName: string): Array<{
|
|
64
|
-
line: number;
|
|
65
|
-
props: Record<string, string>;
|
|
66
|
-
}>;
|
|
67
|
-
//# sourceMappingURL=component-registry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"component-registry.d.ts","sourceRoot":"","sources":["../../src/component-registry.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,mBAAmB,EAAiB,MAAM,SAAS,CAAA;AAEjE;;GAEG;AACH,qBAAa,iBAAiB;IAC7B,OAAO,CAAC,UAAU,CAA8C;IAChE,OAAO,CAAC,aAAa,CAAU;gBAEnB,aAAa,GAAE,MAAM,EAAuB;IAIxD;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAW3B;;OAEG;IACH,aAAa,IAAI,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC;IAIpD;;OAEG;IACH,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS;IAI3D;;OAEG;YACW,aAAa;IAe3B;;OAEG;YACW,cAAc;IAuB5B;;;OAGG;IACH,OAAO,CAAC,iBAAiB;IA+FzB;;OAEG;IACH,OAAO,CAAC,sBAAsB;IAyC9B;;;OAGG;IACH,OAAO,CAAC,qBAAqB;IAyB7B;;OAEG;YACW,YAAY;IA2C1B;;OAEG;IACH,OAAO,CAAC,YAAY;IA2BpB;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAa1B;;OAEG;IACH,OAAO,CAAC,mBAAmB;CAU3B;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAClC,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,GACnB,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAAE,CAAC,CA0BxD"}
|
package/dist/src/config.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Global configuration for cms-marker.
|
|
3
|
-
* This allows overriding the project root for testing.
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* Get the current project root directory.
|
|
7
|
-
* Returns the override if set, otherwise process.cwd().
|
|
8
|
-
*/
|
|
9
|
-
export declare function getProjectRoot(): string;
|
|
10
|
-
/**
|
|
11
|
-
* Set the project root directory override.
|
|
12
|
-
* Call this to use a specific directory instead of process.cwd().
|
|
13
|
-
*/
|
|
14
|
-
export declare function setProjectRoot(root: string): void;
|
|
15
|
-
/**
|
|
16
|
-
* Reset the project root to use process.cwd() again.
|
|
17
|
-
*/
|
|
18
|
-
export declare function resetProjectRoot(): void;
|
|
19
|
-
export declare function getValidationRoot(): string;
|
|
20
|
-
/**
|
|
21
|
-
* Reset the cached validation root (call when project root changes).
|
|
22
|
-
*/
|
|
23
|
-
export declare function resetValidationRoot(): void;
|
|
24
|
-
//# sourceMappingURL=config.d.ts.map
|
package/dist/src/config.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAOH;;;GAGG;AACH,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAEjD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAEvC;AASD,wBAAgB,iBAAiB,IAAI,MAAM,CAK1C;AAED;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
2
|
-
import type { ManifestWriter } from './manifest-writer';
|
|
3
|
-
import type { MediaStorageAdapter } from './media/types';
|
|
4
|
-
import type { CmsMarkerOptions, ComponentDefinition } from './types';
|
|
5
|
-
/** Minimal ViteDevServer interface to avoid version conflicts between Astro's bundled Vite and root Vite */
|
|
6
|
-
interface ViteDevServerLike {
|
|
7
|
-
middlewares: {
|
|
8
|
-
use: (middleware: (req: IncomingMessage, res: ServerResponse, next: () => void) => void) => void;
|
|
9
|
-
};
|
|
10
|
-
transformIndexHtml: (url: string, html: string) => Promise<string>;
|
|
11
|
-
}
|
|
12
|
-
export interface DevMiddlewareOptions {
|
|
13
|
-
enableCmsApi?: boolean;
|
|
14
|
-
mediaAdapter?: MediaStorageAdapter;
|
|
15
|
-
}
|
|
16
|
-
export declare function createDevMiddleware(server: ViteDevServerLike, config: Required<CmsMarkerOptions>, manifestWriter: ManifestWriter, componentDefinitions: Record<string, ComponentDefinition>, idCounter: {
|
|
17
|
-
value: number;
|
|
18
|
-
}, options?: DevMiddlewareOptions): void;
|
|
19
|
-
export {};
|
|
20
|
-
//# sourceMappingURL=dev-middleware.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dev-middleware.d.ts","sourceRoot":"","sources":["../../src/dev-middleware.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAgBhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AACvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAA;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAmB,mBAAmB,EAAe,MAAM,SAAS,CAAA;AAGlG,4GAA4G;AAC5G,UAAU,iBAAiB;IAC1B,WAAW,EAAE;QACZ,GAAG,EAAE,CAAC,UAAU,EAAE,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,IAAI,KAAK,IAAI,KAAK,IAAI,CAAA;KAChG,CAAA;IACD,kBAAkB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;CAClE;AAED,MAAM,WAAW,oBAAoB;IACpC,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,YAAY,CAAC,EAAE,mBAAmB,CAAA;CAClC;AAED,wBAAgB,mBAAmB,CAClC,MAAM,EAAE,iBAAiB,EACzB,MAAM,EAAE,QAAQ,CAAC,gBAAgB,CAAC,EAClC,cAAc,EAAE,cAAc,EAC9B,oBAAoB,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,EACzD,SAAS,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EAC5B,OAAO,GAAE,oBAAyB,QAsMlC"}
|
package/dist/src/editor/ai.d.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { type CmsAiAction } from './api';
|
|
2
|
-
import type { CmsConfig, ComponentProp } from './types';
|
|
3
|
-
export type { CmsAiAction };
|
|
4
|
-
export interface AIRequest {
|
|
5
|
-
prompt: string;
|
|
6
|
-
elementId: string;
|
|
7
|
-
currentContent: string;
|
|
8
|
-
context?: string;
|
|
9
|
-
}
|
|
10
|
-
export interface AIBlockPropsRequest {
|
|
11
|
-
prompt: string;
|
|
12
|
-
componentName: string;
|
|
13
|
-
props: ComponentProp[];
|
|
14
|
-
currentValues: Record<string, unknown>;
|
|
15
|
-
context?: string;
|
|
16
|
-
}
|
|
17
|
-
export interface AIStreamCallbacks {
|
|
18
|
-
onStart?: () => void;
|
|
19
|
-
onToken?: (token: string, fullText: string) => void;
|
|
20
|
-
onComplete?: (finalText: string) => void;
|
|
21
|
-
onError?: (error: Error) => void;
|
|
22
|
-
/** Called when AI provides status updates (thinking, coding, building, deploying) */
|
|
23
|
-
onStatus?: (status: string, message?: string) => void;
|
|
24
|
-
/** Called when AI requests an action (refresh page, show preview, apply edit) */
|
|
25
|
-
onAction?: (action: CmsAiAction) => void;
|
|
26
|
-
}
|
|
27
|
-
export interface AIConfig {
|
|
28
|
-
endpoint: string;
|
|
29
|
-
headers?: Record<string, string>;
|
|
30
|
-
}
|
|
31
|
-
export declare function getAIConfig(config: CmsConfig): AIConfig;
|
|
32
|
-
export declare class AIService {
|
|
33
|
-
private config;
|
|
34
|
-
private aiConfig;
|
|
35
|
-
private abortController;
|
|
36
|
-
constructor(config: CmsConfig);
|
|
37
|
-
/**
|
|
38
|
-
* Stream AI chat request using rich SSE events
|
|
39
|
-
* Supports status updates, actions (refresh, preview), and streaming text
|
|
40
|
-
*/
|
|
41
|
-
streamRequest(request: AIRequest, callbacks: AIStreamCallbacks): Promise<void>;
|
|
42
|
-
abort(): void;
|
|
43
|
-
isStreaming(): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Generate prop values for a component using AI
|
|
46
|
-
*/
|
|
47
|
-
generateBlockProps(request: AIBlockPropsRequest): Promise<Record<string, unknown>>;
|
|
48
|
-
/**
|
|
49
|
-
* Suggest the best component to use based on user intent
|
|
50
|
-
*/
|
|
51
|
-
suggestComponent(prompt: string, availableComponents: Array<{
|
|
52
|
-
name: string;
|
|
53
|
-
description?: string;
|
|
54
|
-
props: ComponentProp[];
|
|
55
|
-
}>): Promise<{
|
|
56
|
-
componentName: string;
|
|
57
|
-
suggestedProps: Record<string, unknown>;
|
|
58
|
-
} | null>;
|
|
59
|
-
}
|
|
60
|
-
//# sourceMappingURL=ai.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../../src/editor/ai.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAkE,MAAM,OAAO,CAAA;AAExG,OAAO,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAGvD,YAAY,EAAE,WAAW,EAAE,CAAA;AAE3B,MAAM,WAAW,SAAS;IACzB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EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC;IAmDpF,KAAK,IAAI,IAAI;IAOb,WAAW,IAAI,OAAO;IAItB;;OAEG;IACG,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IA4BxF;;OAEG;IACG,gBAAgB,CACrB,MAAM,EAAE,MAAM,EACd,mBAAmB,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,aAAa,EAAE,CAAA;KAAE,CAAC,GACxF,OAAO,CAAC;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;KAAE,GAAG,IAAI,CAAC;CAwBrF"}
|
package/dist/src/editor/api.d.ts
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
import type { CmsManifest, ComponentInsertOperation, DeploymentStatusResponse, SaveBatchRequest, SaveBatchResponse, UpdateMarkdownPageRequest, UpdateMarkdownPageResponse } from './types';
|
|
2
|
-
/**
|
|
3
|
-
* Response from fetching markdown content
|
|
4
|
-
*/
|
|
5
|
-
export interface GetMarkdownContentResponse {
|
|
6
|
-
content: string;
|
|
7
|
-
frontmatter: Record<string, unknown>;
|
|
8
|
-
filePath: string;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Types for CMS AI chat communication (SSE events)
|
|
12
|
-
*/
|
|
13
|
-
export interface CmsAiChatRequest {
|
|
14
|
-
prompt: string;
|
|
15
|
-
elementId?: string;
|
|
16
|
-
currentContent?: string;
|
|
17
|
-
pageUrl: string;
|
|
18
|
-
/** Source file context for the element being edited */
|
|
19
|
-
context?: string;
|
|
20
|
-
sessionId?: string;
|
|
21
|
-
}
|
|
22
|
-
export type CmsAiEvent = CmsAiTokenEvent | CmsAiStatusEvent | CmsAiActionEvent | CmsAiErrorEvent | CmsAiDoneEvent;
|
|
23
|
-
export interface CmsAiTokenEvent {
|
|
24
|
-
type: 'token';
|
|
25
|
-
token: string;
|
|
26
|
-
fullText: string;
|
|
27
|
-
}
|
|
28
|
-
export interface CmsAiStatusEvent {
|
|
29
|
-
type: 'status';
|
|
30
|
-
status: 'thinking' | 'coding' | 'building' | 'deploying' | 'complete';
|
|
31
|
-
message?: string;
|
|
32
|
-
}
|
|
33
|
-
export interface CmsAiActionEvent {
|
|
34
|
-
type: 'action';
|
|
35
|
-
action: CmsAiAction;
|
|
36
|
-
}
|
|
37
|
-
export type CmsAiAction = {
|
|
38
|
-
name: 'refresh';
|
|
39
|
-
} | {
|
|
40
|
-
name: 'preview';
|
|
41
|
-
url: string;
|
|
42
|
-
} | {
|
|
43
|
-
name: 'commit';
|
|
44
|
-
sha: string;
|
|
45
|
-
message: string;
|
|
46
|
-
} | {
|
|
47
|
-
name: 'apply-edit';
|
|
48
|
-
elementId: string;
|
|
49
|
-
content: string;
|
|
50
|
-
htmlContent?: string;
|
|
51
|
-
};
|
|
52
|
-
export interface CmsAiErrorEvent {
|
|
53
|
-
type: 'error';
|
|
54
|
-
error: string;
|
|
55
|
-
code?: string;
|
|
56
|
-
}
|
|
57
|
-
export interface CmsAiDoneEvent {
|
|
58
|
-
type: 'done';
|
|
59
|
-
summary?: string;
|
|
60
|
-
}
|
|
61
|
-
export interface CmsAiStreamCallbacks {
|
|
62
|
-
onToken?: (token: string, fullText: string) => void;
|
|
63
|
-
onStatus?: (status: CmsAiStatusEvent['status'], message?: string) => void;
|
|
64
|
-
onAction?: (action: CmsAiAction) => void;
|
|
65
|
-
onError?: (error: string, code?: string) => void;
|
|
66
|
-
onDone?: (summary?: string) => void;
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Get the manifest URL for the current page
|
|
70
|
-
* For example: /about -> /about.json
|
|
71
|
-
* / -> /index.json
|
|
72
|
-
* /blog/post -> /blog/post.json
|
|
73
|
-
*/
|
|
74
|
-
export declare function getPageManifestUrl(pathname: string): string;
|
|
75
|
-
/**
|
|
76
|
-
* Fetch manifest by combining page-specific and global manifests:
|
|
77
|
-
* 1. Per-page manifest (/{page}.json) - contains entries, components for this page
|
|
78
|
-
* 2. Global manifest (/cms-manifest.json) - contains componentDefinitions, availableColors
|
|
79
|
-
*/
|
|
80
|
-
export declare function fetchManifest(): Promise<CmsManifest>;
|
|
81
|
-
export declare function saveBatchChanges(apiBase: string, request: SaveBatchRequest): Promise<SaveBatchResponse>;
|
|
82
|
-
export interface InsertComponentResponse {
|
|
83
|
-
success: boolean;
|
|
84
|
-
message?: string;
|
|
85
|
-
sourceFile?: string;
|
|
86
|
-
commit?: string | null;
|
|
87
|
-
commitMessage?: string;
|
|
88
|
-
error?: string;
|
|
89
|
-
}
|
|
90
|
-
export declare function insertComponent(apiBase: string, operation: ComponentInsertOperation): Promise<InsertComponentResponse>;
|
|
91
|
-
export interface RemoveComponentResponse {
|
|
92
|
-
success: boolean;
|
|
93
|
-
message?: string;
|
|
94
|
-
sourceFile?: string;
|
|
95
|
-
commit?: string | null;
|
|
96
|
-
commitMessage?: string;
|
|
97
|
-
error?: string;
|
|
98
|
-
}
|
|
99
|
-
export interface AddArrayItemResponse {
|
|
100
|
-
success: boolean;
|
|
101
|
-
message?: string;
|
|
102
|
-
sourceFile?: string;
|
|
103
|
-
error?: string;
|
|
104
|
-
}
|
|
105
|
-
export declare function addArrayItem(apiBase: string, referenceComponentId: string, position: 'before' | 'after', props: Record<string, unknown>): Promise<AddArrayItemResponse>;
|
|
106
|
-
export interface RemoveArrayItemResponse {
|
|
107
|
-
success: boolean;
|
|
108
|
-
message?: string;
|
|
109
|
-
sourceFile?: string;
|
|
110
|
-
error?: string;
|
|
111
|
-
}
|
|
112
|
-
export declare function removeArrayItem(apiBase: string, componentId: string): Promise<RemoveArrayItemResponse>;
|
|
113
|
-
export declare function removeComponent(apiBase: string, componentId: string): Promise<RemoveComponentResponse>;
|
|
114
|
-
/**
|
|
115
|
-
* Parse SSE data line to event
|
|
116
|
-
*/
|
|
117
|
-
export declare function parseSseEvent(data: string): CmsAiEvent | null;
|
|
118
|
-
/**
|
|
119
|
-
* Stream AI chat response from the server using SSE
|
|
120
|
-
* Provides rich events including status updates, actions (refresh, preview), and streaming tokens
|
|
121
|
-
*/
|
|
122
|
-
export declare function streamAiChat(apiBase: string, request: CmsAiChatRequest, callbacks: CmsAiStreamCallbacks, abortSignal?: AbortSignal): Promise<void>;
|
|
123
|
-
/**
|
|
124
|
-
* Chat message type from history endpoint
|
|
125
|
-
*/
|
|
126
|
-
export interface ChatHistoryMessage {
|
|
127
|
-
id: string;
|
|
128
|
-
role: 'user' | 'assistant' | 'tool';
|
|
129
|
-
content: string | null;
|
|
130
|
-
created_at: string;
|
|
131
|
-
channel?: string;
|
|
132
|
-
identifier?: string;
|
|
133
|
-
}
|
|
134
|
-
export interface ChatHistoryResponse {
|
|
135
|
-
messages: ChatHistoryMessage[];
|
|
136
|
-
hasMore: boolean;
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* Fetch AI chat history for the current project
|
|
140
|
-
*/
|
|
141
|
-
export declare function getChatHistory(apiBase: string, limit?: number): Promise<ChatHistoryResponse>;
|
|
142
|
-
/**
|
|
143
|
-
* Fetch deployment status for the current project
|
|
144
|
-
*/
|
|
145
|
-
export declare function getDeploymentStatus(apiBase: string): Promise<DeploymentStatusResponse>;
|
|
146
|
-
/**
|
|
147
|
-
* Fetch markdown content from a file
|
|
148
|
-
*/
|
|
149
|
-
export declare function getMarkdownContent(apiBase: string, filePath: string): Promise<GetMarkdownContentResponse | null>;
|
|
150
|
-
/**
|
|
151
|
-
* Update markdown page content
|
|
152
|
-
*/
|
|
153
|
-
export declare function updateMarkdownPage(apiBase: string, request: UpdateMarkdownPageRequest): Promise<UpdateMarkdownPageResponse>;
|
|
154
|
-
//# sourceMappingURL=api.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":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