@nuasite/cms 0.3.0 → 0.5.0

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 (188) hide show
  1. package/dist/editor.js +35991 -0
  2. package/package.json +12 -11
  3. package/src/dev-middleware.ts +82 -2
  4. package/src/editor/components/block-editor.tsx +48 -57
  5. package/src/editor/components/outline.tsx +42 -35
  6. package/src/editor/components/toolbar.tsx +7 -4
  7. package/src/editor/hooks/useBlockEditorHandlers.ts +5 -5
  8. package/src/editor/hooks/useElementDetection.ts +2 -2
  9. package/src/editor/index.tsx +3 -2
  10. package/src/handlers/array-ops.ts +4 -4
  11. package/src/index.ts +54 -28
  12. package/dist/src/build-processor.d.ts +0 -20
  13. package/dist/src/build-processor.d.ts.map +0 -1
  14. package/dist/src/collection-scanner.d.ts +0 -6
  15. package/dist/src/collection-scanner.d.ts.map +0 -1
  16. package/dist/src/component-registry.d.ts +0 -67
  17. package/dist/src/component-registry.d.ts.map +0 -1
  18. package/dist/src/config.d.ts +0 -24
  19. package/dist/src/config.d.ts.map +0 -1
  20. package/dist/src/dev-middleware.d.ts +0 -20
  21. package/dist/src/dev-middleware.d.ts.map +0 -1
  22. package/dist/src/editor/ai.d.ts +0 -60
  23. package/dist/src/editor/ai.d.ts.map +0 -1
  24. package/dist/src/editor/api.d.ts +0 -154
  25. package/dist/src/editor/api.d.ts.map +0 -1
  26. package/dist/src/editor/color-utils.d.ts +0 -106
  27. package/dist/src/editor/color-utils.d.ts.map +0 -1
  28. package/dist/src/editor/components/ai-chat.d.ts +0 -11
  29. package/dist/src/editor/components/ai-chat.d.ts.map +0 -1
  30. package/dist/src/editor/components/ai-tooltip.d.ts +0 -12
  31. package/dist/src/editor/components/ai-tooltip.d.ts.map +0 -1
  32. package/dist/src/editor/components/attribute-editor.d.ts +0 -5
  33. package/dist/src/editor/components/attribute-editor.d.ts.map +0 -1
  34. package/dist/src/editor/components/block-editor.d.ts +0 -12
  35. package/dist/src/editor/components/block-editor.d.ts.map +0 -1
  36. package/dist/src/editor/components/collections-browser.d.ts +0 -2
  37. package/dist/src/editor/components/collections-browser.d.ts.map +0 -1
  38. package/dist/src/editor/components/color-toolbar.d.ts +0 -12
  39. package/dist/src/editor/components/color-toolbar.d.ts.map +0 -1
  40. package/dist/src/editor/components/confirm-dialog.d.ts +0 -2
  41. package/dist/src/editor/components/confirm-dialog.d.ts.map +0 -1
  42. package/dist/src/editor/components/create-page-modal.d.ts +0 -2
  43. package/dist/src/editor/components/create-page-modal.d.ts.map +0 -1
  44. package/dist/src/editor/components/editable-highlights.d.ts +0 -9
  45. package/dist/src/editor/components/editable-highlights.d.ts.map +0 -1
  46. package/dist/src/editor/components/error-boundary.d.ts +0 -32
  47. package/dist/src/editor/components/error-boundary.d.ts.map +0 -1
  48. package/dist/src/editor/components/fields.d.ts +0 -75
  49. package/dist/src/editor/components/fields.d.ts.map +0 -1
  50. package/dist/src/editor/components/frontmatter-fields.d.ts +0 -29
  51. package/dist/src/editor/components/frontmatter-fields.d.ts.map +0 -1
  52. package/dist/src/editor/components/highlight-overlay.d.ts +0 -64
  53. package/dist/src/editor/components/highlight-overlay.d.ts.map +0 -1
  54. package/dist/src/editor/components/image-overlay.d.ts +0 -12
  55. package/dist/src/editor/components/image-overlay.d.ts.map +0 -1
  56. package/dist/src/editor/components/markdown-editor-overlay.d.ts +0 -6
  57. package/dist/src/editor/components/markdown-editor-overlay.d.ts.map +0 -1
  58. package/dist/src/editor/components/markdown-inline-editor.d.ts +0 -10
  59. package/dist/src/editor/components/markdown-inline-editor.d.ts.map +0 -1
  60. package/dist/src/editor/components/media-library.d.ts +0 -2
  61. package/dist/src/editor/components/media-library.d.ts.map +0 -1
  62. package/dist/src/editor/components/outline.d.ts +0 -21
  63. package/dist/src/editor/components/outline.d.ts.map +0 -1
  64. package/dist/src/editor/components/redirect-countdown.d.ts +0 -2
  65. package/dist/src/editor/components/redirect-countdown.d.ts.map +0 -1
  66. package/dist/src/editor/components/seo-editor.d.ts +0 -2
  67. package/dist/src/editor/components/seo-editor.d.ts.map +0 -1
  68. package/dist/src/editor/components/text-style-toolbar.d.ts +0 -8
  69. package/dist/src/editor/components/text-style-toolbar.d.ts.map +0 -1
  70. package/dist/src/editor/components/toast/toast-container.d.ts +0 -7
  71. package/dist/src/editor/components/toast/toast-container.d.ts.map +0 -1
  72. package/dist/src/editor/components/toast/toast.d.ts +0 -7
  73. package/dist/src/editor/components/toast/toast.d.ts.map +0 -1
  74. package/dist/src/editor/components/toast/types.d.ts +0 -7
  75. package/dist/src/editor/components/toast/types.d.ts.map +0 -1
  76. package/dist/src/editor/components/toolbar.d.ts +0 -21
  77. package/dist/src/editor/components/toolbar.d.ts.map +0 -1
  78. package/dist/src/editor/config.d.ts +0 -4
  79. package/dist/src/editor/config.d.ts.map +0 -1
  80. package/dist/src/editor/constants.d.ts +0 -102
  81. package/dist/src/editor/constants.d.ts.map +0 -1
  82. package/dist/src/editor/context.d.ts +0 -14
  83. package/dist/src/editor/context.d.ts.map +0 -1
  84. package/dist/src/editor/dom.d.ts +0 -86
  85. package/dist/src/editor/dom.d.ts.map +0 -1
  86. package/dist/src/editor/editor.d.ts +0 -64
  87. package/dist/src/editor/editor.d.ts.map +0 -1
  88. package/dist/src/editor/history.d.ts +0 -20
  89. package/dist/src/editor/history.d.ts.map +0 -1
  90. package/dist/src/editor/hooks/index.d.ts +0 -14
  91. package/dist/src/editor/hooks/index.d.ts.map +0 -1
  92. package/dist/src/editor/hooks/useAIHandlers.d.ts +0 -22
  93. package/dist/src/editor/hooks/useAIHandlers.d.ts.map +0 -1
  94. package/dist/src/editor/hooks/useBlockEditorHandlers.d.ts +0 -18
  95. package/dist/src/editor/hooks/useBlockEditorHandlers.d.ts.map +0 -1
  96. package/dist/src/editor/hooks/useElementDetection.d.ts +0 -26
  97. package/dist/src/editor/hooks/useElementDetection.d.ts.map +0 -1
  98. package/dist/src/editor/hooks/useImageHoverDetection.d.ts +0 -12
  99. package/dist/src/editor/hooks/useImageHoverDetection.d.ts.map +0 -1
  100. package/dist/src/editor/hooks/useTextSelection.d.ts +0 -23
  101. package/dist/src/editor/hooks/useTextSelection.d.ts.map +0 -1
  102. package/dist/src/editor/hooks/useTooltipState.d.ts +0 -19
  103. package/dist/src/editor/hooks/useTooltipState.d.ts.map +0 -1
  104. package/dist/src/editor/hooks/utils.d.ts +0 -32
  105. package/dist/src/editor/hooks/utils.d.ts.map +0 -1
  106. package/dist/src/editor/index.d.ts +0 -12
  107. package/dist/src/editor/index.d.ts.map +0 -1
  108. package/dist/src/editor/lib/cn.d.ts +0 -3
  109. package/dist/src/editor/lib/cn.d.ts.map +0 -1
  110. package/dist/src/editor/manifest.d.ts +0 -19
  111. package/dist/src/editor/manifest.d.ts.map +0 -1
  112. package/dist/src/editor/markdown-api.d.ts +0 -36
  113. package/dist/src/editor/markdown-api.d.ts.map +0 -1
  114. package/dist/src/editor/signals.d.ts +0 -242
  115. package/dist/src/editor/signals.d.ts.map +0 -1
  116. package/dist/src/editor/storage.d.ts +0 -29
  117. package/dist/src/editor/storage.d.ts.map +0 -1
  118. package/dist/src/editor/text-styling.d.ts +0 -350
  119. package/dist/src/editor/text-styling.d.ts.map +0 -1
  120. package/dist/src/editor/themes.d.ts +0 -38
  121. package/dist/src/editor/themes.d.ts.map +0 -1
  122. package/dist/src/editor/types.d.ts +0 -454
  123. package/dist/src/editor/types.d.ts.map +0 -1
  124. package/dist/src/error-collector.d.ts +0 -56
  125. package/dist/src/error-collector.d.ts.map +0 -1
  126. package/dist/src/handlers/array-ops.d.ts +0 -59
  127. package/dist/src/handlers/array-ops.d.ts.map +0 -1
  128. package/dist/src/handlers/component-ops.d.ts +0 -60
  129. package/dist/src/handlers/component-ops.d.ts.map +0 -1
  130. package/dist/src/handlers/markdown-ops.d.ts +0 -41
  131. package/dist/src/handlers/markdown-ops.d.ts.map +0 -1
  132. package/dist/src/handlers/request-utils.d.ts +0 -20
  133. package/dist/src/handlers/request-utils.d.ts.map +0 -1
  134. package/dist/src/handlers/source-writer.d.ts +0 -51
  135. package/dist/src/handlers/source-writer.d.ts.map +0 -1
  136. package/dist/src/html-processor.d.ts +0 -63
  137. package/dist/src/html-processor.d.ts.map +0 -1
  138. package/dist/src/index.d.ts +0 -41
  139. package/dist/src/index.d.ts.map +0 -1
  140. package/dist/src/manifest-writer.d.ts +0 -111
  141. package/dist/src/manifest-writer.d.ts.map +0 -1
  142. package/dist/src/media/contember.d.ts +0 -15
  143. package/dist/src/media/contember.d.ts.map +0 -1
  144. package/dist/src/media/local.d.ts +0 -9
  145. package/dist/src/media/local.d.ts.map +0 -1
  146. package/dist/src/media/s3.d.ts +0 -12
  147. package/dist/src/media/s3.d.ts.map +0 -1
  148. package/dist/src/media/types.d.ts +0 -40
  149. package/dist/src/media/types.d.ts.map +0 -1
  150. package/dist/src/preview-generator.d.ts +0 -19
  151. package/dist/src/preview-generator.d.ts.map +0 -1
  152. package/dist/src/seo-processor.d.ts +0 -23
  153. package/dist/src/seo-processor.d.ts.map +0 -1
  154. package/dist/src/source-finder/ast-extractors.d.ts +0 -35
  155. package/dist/src/source-finder/ast-extractors.d.ts.map +0 -1
  156. package/dist/src/source-finder/ast-parser.d.ts +0 -18
  157. package/dist/src/source-finder/ast-parser.d.ts.map +0 -1
  158. package/dist/src/source-finder/cache.d.ts +0 -18
  159. package/dist/src/source-finder/cache.d.ts.map +0 -1
  160. package/dist/src/source-finder/collection-finder.d.ts +0 -29
  161. package/dist/src/source-finder/collection-finder.d.ts.map +0 -1
  162. package/dist/src/source-finder/cross-file-tracker.d.ts +0 -39
  163. package/dist/src/source-finder/cross-file-tracker.d.ts.map +0 -1
  164. package/dist/src/source-finder/element-finder.d.ts +0 -42
  165. package/dist/src/source-finder/element-finder.d.ts.map +0 -1
  166. package/dist/src/source-finder/image-finder.d.ts +0 -24
  167. package/dist/src/source-finder/image-finder.d.ts.map +0 -1
  168. package/dist/src/source-finder/index.d.ts +0 -9
  169. package/dist/src/source-finder/index.d.ts.map +0 -1
  170. package/dist/src/source-finder/search-index.d.ts +0 -27
  171. package/dist/src/source-finder/search-index.d.ts.map +0 -1
  172. package/dist/src/source-finder/snippet-utils.d.ts +0 -96
  173. package/dist/src/source-finder/snippet-utils.d.ts.map +0 -1
  174. package/dist/src/source-finder/source-lookup.d.ts +0 -16
  175. package/dist/src/source-finder/source-lookup.d.ts.map +0 -1
  176. package/dist/src/source-finder/types.d.ts +0 -167
  177. package/dist/src/source-finder/types.d.ts.map +0 -1
  178. package/dist/src/source-finder/variable-extraction.d.ts +0 -37
  179. package/dist/src/source-finder/variable-extraction.d.ts.map +0 -1
  180. package/dist/src/tailwind-colors.d.ts +0 -54
  181. package/dist/src/tailwind-colors.d.ts.map +0 -1
  182. package/dist/src/tsconfig.tsbuildinfo +0 -1
  183. package/dist/src/types.d.ts +0 -367
  184. package/dist/src/types.d.ts.map +0 -1
  185. package/dist/src/utils.d.ts +0 -61
  186. package/dist/src/utils.d.ts.map +0 -1
  187. package/dist/src/vite-plugin.d.ts +0 -14
  188. 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
- const __dirname = dirname(fileURLToPath(import.meta.url))
163
-
164
- vitePlugins.push({
165
- name: 'nuasite-cms-editor',
166
- resolveId(id: string) {
167
- if (id === VIRTUAL_CMS_PATH) {
168
- return join(__dirname, 'editor/index.tsx')
169
- }
170
- },
171
- })
172
-
173
- // Prepend @jsxImportSource pragma for editor .tsx files
174
- // so Vite's esbuild uses Preact's h function
175
- vitePlugins.push({
176
- name: 'nuasite-cms-preact-jsx',
177
- transform(code: string, id: string) {
178
- if (id.includes('/src/editor/') && id.endsWith('.tsx') && !code.includes('@jsxImportSource')) {
179
- return `/** @jsxImportSource preact */\n${code}`
180
- }
181
- },
182
- })
183
-
184
- // Add Tailwind CSS Vite plugin for editor styles
185
- vitePlugins.push(tailwindcss())
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: !src
227
+ resolve: needsAliases
202
228
  ? {
203
229
  alias: {
204
230
  'react': 'preact/compat',
@@ -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"}
@@ -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
@@ -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"}
@@ -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,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,cAAc,EAAE,MAAM,CAAA;IACtB,OAAO,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,mBAAmB;IACnC,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,EAAE,MAAM,CAAA;IACrB,KAAK,EAAE,aAAa,EAAE,CAAA;IACtB,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACtC,OAAO,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,iBAA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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"}
@@ -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":"api.d.ts","sourceRoot":"","sources":["../../../src/editor/api.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACX,WAAW,EACX,wBAAwB,EACxB,wBAAwB,EACxB,gBAAgB,EAChB,iBAAiB,EACjB,yBAAyB,EACzB,0BAA0B,EAC1B,MAAM,SAAS,CAAA;AAEhB;;GAEG;AACH,MAAM,WAAW,0BAA0B;IAC1C,OAAO,EAAE,MAAM,CAAA;IACf,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACpC,QAAQ,EAAE,MAAM,CAAA;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAA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GAAG,MAAM,CAAA;IACnC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,mBAAmB;IACnC,QAAQ,EAAE,kBAAkB,EAAE,CAAA;IAC9B,OAAO,EAAE,OAAO,CAAA;CAChB;AAED;;GAEG;AACH,wBAAsB,cAAc,CACnC,OAAO,EAAE,MAAM,EACf,KAAK,SAAK,GACR,OAAO,CAAC,mBAAmB,CAAC,CAY9B;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACxC,OAAO,EAAE,MAAM,GACb,OAAO,CAAC,wBAAwB,CAAC,CAYnC;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACvC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC,0BAA0B,GAAG,IAAI,CAAC,CAkB5C;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACvC,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,yBAAyB,GAChC,OAAO,CAAC,0BAA0B,CAAC,CAgBrC"}
@@ -1,106 +0,0 @@
1
- import type { Attribute, AvailableColors } from './types';
2
- /**
3
- * Default Tailwind CSS v4 color names.
4
- */
5
- export declare const DEFAULT_TAILWIND_COLORS: readonly ["slate", "gray", "zinc", "neutral", "stone", "red", "orange", "amber", "yellow", "lime", "green", "emerald", "teal", "cyan", "sky", "blue", "indigo", "violet", "purple", "fuchsia", "pink", "rose"];
6
- /**
7
- * Standard Tailwind color shades.
8
- */
9
- export declare const STANDARD_SHADES: readonly ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900", "950"];
10
- /**
11
- * Special color values that don't have shades.
12
- */
13
- export declare const SPECIAL_COLORS: readonly ["transparent", "current", "inherit", "white", "black"];
14
- /**
15
- * Map of Tailwind color names to their CSS color values for preview.
16
- * Uses the 500 shade as the representative color.
17
- * This is a fallback when availableColors is not loaded yet.
18
- */
19
- export declare const COLOR_PREVIEW_MAP: Record<string, string>;
20
- /**
21
- * Map of shade numbers to their relative lightness.
22
- * Used to generate preview colors for different shades.
23
- */
24
- export declare const SHADE_LIGHTNESS: Record<string, number>;
25
- /**
26
- * Regex patterns to match Tailwind color classes.
27
- */
28
- declare const COLOR_CLASS_PATTERNS: {
29
- bg: RegExp;
30
- text: RegExp;
31
- border: RegExp;
32
- hoverBg: RegExp;
33
- hoverText: RegExp;
34
- };
35
- /**
36
- * Parse a color class into its components.
37
- */
38
- export declare function parseColorClass(colorClass: string): {
39
- prefix: string;
40
- colorName: string;
41
- shade?: string;
42
- isHover: boolean;
43
- } | undefined;
44
- /**
45
- * Build a color class from components.
46
- */
47
- export declare function buildColorClass(prefix: string, colorName: string, shade?: string): string;
48
- /**
49
- * Get the color type from a color class.
50
- */
51
- export declare function getColorType(colorClass: string): keyof typeof COLOR_CLASS_PATTERNS | undefined;
52
- /**
53
- * Check if a class is a color class.
54
- */
55
- export declare function isColorClass(className: string): boolean;
56
- /**
57
- * Get a preview CSS color for a Tailwind color.
58
- */
59
- export declare function getColorPreview(colorName: string, shade?: string): string;
60
- /**
61
- * Resolve a color to its CSS value using availableColors from the manifest.
62
- */
63
- export declare function resolveColorValue(colorName: string, shade: string | undefined, availableColors: AvailableColors | undefined): string | undefined;
64
- /**
65
- * Replace a color class in an element's class list.
66
- * Returns the old class that was replaced, or undefined if not found.
67
- */
68
- export declare function replaceColorClass(element: HTMLElement, colorType: 'bg' | 'text' | 'border' | 'hoverBg' | 'hoverText', newColorName: string, newShade?: string): {
69
- oldClass: string;
70
- newClass: string;
71
- } | undefined;
72
- /**
73
- * Get the current color classes from an element as Record<string, Attribute>.
74
- */
75
- export declare function getElementColorClasses(element: HTMLElement): Record<string, Attribute>;
76
- /**
77
- * Apply a color change to an element.
78
- * Updates the DOM immediately with both class and inline style for preview.
79
- * The inline style ensures the color is visible even if Tailwind hasn't compiled the class.
80
- */
81
- export declare function applyColorChange(element: HTMLElement, colorType: 'bg' | 'text' | 'border' | 'hoverBg' | 'hoverText', newColorName: string, newShade: string | undefined, availableColors: AvailableColors | undefined): {
82
- oldClass: string;
83
- newClass: string;
84
- } | undefined;
85
- /**
86
- * Get popular colors for quick selection.
87
- * Returns a curated list of commonly used colors.
88
- */
89
- export declare function getPopularColors(): Array<{
90
- name: string;
91
- shade: string;
92
- preview: string;
93
- }>;
94
- /**
95
- * Get all available colors with their shades from manifest.
96
- */
97
- export declare function getAllColorsWithShades(availableColors: AvailableColors | undefined): Array<{
98
- name: string;
99
- shades: Array<{
100
- shade: string;
101
- preview: string;
102
- }>;
103
- isSpecial: boolean;
104
- }>;
105
- export {};
106
- //# sourceMappingURL=color-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"color-utils.d.ts","sourceRoot":"","sources":["../../../src/editor/color-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAiB,MAAM,SAAS,CAAA;AAExE;;GAEG;AACH,eAAO,MAAM,uBAAuB,gNAuB1B,CAAA;AAEV;;GAEG;AACH,eAAO,MAAM,eAAe,uFAAwF,CAAA;AAEpH;;GAEG;AACH,eAAO,MAAM,cAAc,kEAAmE,CAAA;AAE9F;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAkCpD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAYlD,CAAA;AAyBD;;GAEG;AACH,QAAA,MAAM,oBAAoB;;;;;;CAMzB,CAAA;AAYD;;GAEG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,GAAG;IACpD,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,OAAO,CAAA;CAChB,GAAG,SAAS,CA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,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAoEpD;AAED;;;GAGG;AACH,wBAAgB,gBAAgB,IAAI,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAuB1F;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,eAAe,EAAE,eAAe,GAAG,SAAS,GAAG,KAAK,CAAC;IAC3F,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;IACjD,SAAS,EAAE,OAAO,CAAA;CAClB,CAAC,CAkDD"}
@@ -1,11 +0,0 @@
1
- export interface AIChatCallbacks {
2
- onSend: (message: string, elementId?: string) => void;
3
- onClose: () => void;
4
- onCancel: () => void;
5
- onApplyToElement: (content: string, elementId: string) => void;
6
- }
7
- export interface AIChatProps {
8
- callbacks: AIChatCallbacks;
9
- }
10
- export declare const AIChat: ({ callbacks }: AIChatProps) => import("preact").JSX.Element | null;
11
- //# sourceMappingURL=ai-chat.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ai-chat.d.ts","sourceRoot":"","sources":["../../../../src/editor/components/ai-chat.tsx"],"names":[],"mappings":"AAwDA,MAAM,WAAW,eAAe;IAC/B,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IACrD,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB,gBAAgB,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;CAC9D;AAED,MAAM,WAAW,WAAW;IAC3B,SAAS,EAAE,eAAe,CAAA;CAC1B;AAcD,eAAO,MAAM,MAAM,GAAI,eAAe,WAAW,wCAqbhD,CAAA"}
@@ -1,12 +0,0 @@
1
- export interface AITooltipCallbacks {
2
- onPromptSubmit: (prompt: string, elementId: string) => void;
3
- }
4
- export interface AITooltipProps {
5
- callbacks: AITooltipCallbacks;
6
- visible: boolean;
7
- elementId: string | null;
8
- rect: DOMRect | null;
9
- processing: boolean;
10
- }
11
- export declare function AITooltip({ callbacks, visible, elementId, rect, processing }: AITooltipProps): import("preact").JSX.Element | null;
12
- //# sourceMappingURL=ai-tooltip.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ai-tooltip.d.ts","sourceRoot":"","sources":["../../../../src/editor/components/ai-tooltip.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IAClC,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;CAC3D;AAED,MAAM,WAAW,cAAc;IAC9B,SAAS,EAAE,kBAAkB,CAAA;IAC7B,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,IAAI,EAAE,OAAO,GAAG,IAAI,CAAA;IACpB,UAAU,EAAE,OAAO,CAAA;CACnB;AAED,wBAAgB,SAAS,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,cAAc,uCAoK5F"}