@nuasite/cms 0.1.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.
- package/README.md +237 -0
- package/dist/src/build-processor.d.ts +20 -0
- package/dist/src/build-processor.d.ts.map +1 -0
- package/dist/src/collection-scanner.d.ts +6 -0
- package/dist/src/collection-scanner.d.ts.map +1 -0
- package/dist/src/component-registry.d.ts +63 -0
- package/dist/src/component-registry.d.ts.map +1 -0
- package/dist/src/config.d.ts +24 -0
- package/dist/src/config.d.ts.map +1 -0
- package/dist/src/dev-middleware.d.ts +20 -0
- package/dist/src/dev-middleware.d.ts.map +1 -0
- package/dist/src/editor/ai.d.ts +60 -0
- package/dist/src/editor/ai.d.ts.map +1 -0
- package/dist/src/editor/api.d.ts +140 -0
- package/dist/src/editor/api.d.ts.map +1 -0
- package/dist/src/editor/color-utils.d.ts +106 -0
- package/dist/src/editor/color-utils.d.ts.map +1 -0
- package/dist/src/editor/components/ai-chat.d.ts +11 -0
- package/dist/src/editor/components/ai-chat.d.ts.map +1 -0
- package/dist/src/editor/components/ai-tooltip.d.ts +12 -0
- package/dist/src/editor/components/ai-tooltip.d.ts.map +1 -0
- package/dist/src/editor/components/attribute-editor.d.ts +5 -0
- package/dist/src/editor/components/attribute-editor.d.ts.map +1 -0
- package/dist/src/editor/components/block-editor.d.ts +12 -0
- package/dist/src/editor/components/block-editor.d.ts.map +1 -0
- package/dist/src/editor/components/collections-browser.d.ts +2 -0
- package/dist/src/editor/components/collections-browser.d.ts.map +1 -0
- package/dist/src/editor/components/color-toolbar.d.ts +12 -0
- package/dist/src/editor/components/color-toolbar.d.ts.map +1 -0
- package/dist/src/editor/components/confirm-dialog.d.ts +2 -0
- package/dist/src/editor/components/confirm-dialog.d.ts.map +1 -0
- package/dist/src/editor/components/create-page-modal.d.ts +2 -0
- package/dist/src/editor/components/create-page-modal.d.ts.map +1 -0
- package/dist/src/editor/components/editable-highlights.d.ts +9 -0
- package/dist/src/editor/components/editable-highlights.d.ts.map +1 -0
- package/dist/src/editor/components/error-boundary.d.ts +32 -0
- package/dist/src/editor/components/error-boundary.d.ts.map +1 -0
- package/dist/src/editor/components/fields.d.ts +75 -0
- package/dist/src/editor/components/fields.d.ts.map +1 -0
- package/dist/src/editor/components/frontmatter-fields.d.ts +29 -0
- package/dist/src/editor/components/frontmatter-fields.d.ts.map +1 -0
- package/dist/src/editor/components/highlight-overlay.d.ts +64 -0
- package/dist/src/editor/components/highlight-overlay.d.ts.map +1 -0
- package/dist/src/editor/components/image-overlay.d.ts +12 -0
- package/dist/src/editor/components/image-overlay.d.ts.map +1 -0
- package/dist/src/editor/components/markdown-editor-overlay.d.ts +6 -0
- package/dist/src/editor/components/markdown-editor-overlay.d.ts.map +1 -0
- package/dist/src/editor/components/markdown-inline-editor.d.ts +10 -0
- package/dist/src/editor/components/markdown-inline-editor.d.ts.map +1 -0
- package/dist/src/editor/components/media-library.d.ts +2 -0
- package/dist/src/editor/components/media-library.d.ts.map +1 -0
- package/dist/src/editor/components/outline.d.ts +21 -0
- package/dist/src/editor/components/outline.d.ts.map +1 -0
- package/dist/src/editor/components/redirect-countdown.d.ts +2 -0
- package/dist/src/editor/components/redirect-countdown.d.ts.map +1 -0
- package/dist/src/editor/components/seo-editor.d.ts +2 -0
- package/dist/src/editor/components/seo-editor.d.ts.map +1 -0
- package/dist/src/editor/components/text-style-toolbar.d.ts +8 -0
- package/dist/src/editor/components/text-style-toolbar.d.ts.map +1 -0
- package/dist/src/editor/components/toast/toast-container.d.ts +7 -0
- package/dist/src/editor/components/toast/toast-container.d.ts.map +1 -0
- package/dist/src/editor/components/toast/toast.d.ts +7 -0
- package/dist/src/editor/components/toast/toast.d.ts.map +1 -0
- package/dist/src/editor/components/toast/types.d.ts +7 -0
- package/dist/src/editor/components/toast/types.d.ts.map +1 -0
- package/dist/src/editor/components/toolbar.d.ts +21 -0
- package/dist/src/editor/components/toolbar.d.ts.map +1 -0
- package/dist/src/editor/config.d.ts +4 -0
- package/dist/src/editor/config.d.ts.map +1 -0
- package/dist/src/editor/constants.d.ts +101 -0
- package/dist/src/editor/constants.d.ts.map +1 -0
- package/dist/src/editor/context.d.ts +14 -0
- package/dist/src/editor/context.d.ts.map +1 -0
- package/dist/src/editor/dom.d.ts +77 -0
- package/dist/src/editor/dom.d.ts.map +1 -0
- package/dist/src/editor/editor.d.ts +64 -0
- package/dist/src/editor/editor.d.ts.map +1 -0
- package/dist/src/editor/history.d.ts +20 -0
- package/dist/src/editor/history.d.ts.map +1 -0
- package/dist/src/editor/hooks/index.d.ts +14 -0
- package/dist/src/editor/hooks/index.d.ts.map +1 -0
- package/dist/src/editor/hooks/useAIHandlers.d.ts +22 -0
- package/dist/src/editor/hooks/useAIHandlers.d.ts.map +1 -0
- package/dist/src/editor/hooks/useBlockEditorHandlers.d.ts +18 -0
- package/dist/src/editor/hooks/useBlockEditorHandlers.d.ts.map +1 -0
- package/dist/src/editor/hooks/useElementDetection.d.ts +26 -0
- package/dist/src/editor/hooks/useElementDetection.d.ts.map +1 -0
- package/dist/src/editor/hooks/useImageHoverDetection.d.ts +12 -0
- package/dist/src/editor/hooks/useImageHoverDetection.d.ts.map +1 -0
- package/dist/src/editor/hooks/useTextSelection.d.ts +23 -0
- package/dist/src/editor/hooks/useTextSelection.d.ts.map +1 -0
- package/dist/src/editor/hooks/useTooltipState.d.ts +19 -0
- package/dist/src/editor/hooks/useTooltipState.d.ts.map +1 -0
- package/dist/src/editor/hooks/utils.d.ts +32 -0
- package/dist/src/editor/hooks/utils.d.ts.map +1 -0
- package/dist/src/editor/index.d.ts +12 -0
- package/dist/src/editor/index.d.ts.map +1 -0
- package/dist/src/editor/lib/cn.d.ts +3 -0
- package/dist/src/editor/lib/cn.d.ts.map +1 -0
- package/dist/src/editor/manifest.d.ts +19 -0
- package/dist/src/editor/manifest.d.ts.map +1 -0
- package/dist/src/editor/markdown-api.d.ts +36 -0
- package/dist/src/editor/markdown-api.d.ts.map +1 -0
- package/dist/src/editor/signals.d.ts +242 -0
- package/dist/src/editor/signals.d.ts.map +1 -0
- package/dist/src/editor/storage.d.ts +27 -0
- package/dist/src/editor/storage.d.ts.map +1 -0
- package/dist/src/editor/text-styling.d.ts +350 -0
- package/dist/src/editor/text-styling.d.ts.map +1 -0
- package/dist/src/editor/themes.d.ts +38 -0
- package/dist/src/editor/themes.d.ts.map +1 -0
- package/dist/src/editor/types.d.ts +454 -0
- package/dist/src/editor/types.d.ts.map +1 -0
- package/dist/src/error-collector.d.ts +56 -0
- package/dist/src/error-collector.d.ts.map +1 -0
- package/dist/src/handlers/component-ops.d.ts +34 -0
- package/dist/src/handlers/component-ops.d.ts.map +1 -0
- package/dist/src/handlers/markdown-ops.d.ts +41 -0
- package/dist/src/handlers/markdown-ops.d.ts.map +1 -0
- package/dist/src/handlers/request-utils.d.ts +20 -0
- package/dist/src/handlers/request-utils.d.ts.map +1 -0
- package/dist/src/handlers/source-writer.d.ts +51 -0
- package/dist/src/handlers/source-writer.d.ts.map +1 -0
- package/dist/src/html-processor.d.ts +63 -0
- package/dist/src/html-processor.d.ts.map +1 -0
- package/dist/src/index.d.ts +41 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/manifest-writer.d.ts +111 -0
- package/dist/src/manifest-writer.d.ts.map +1 -0
- package/dist/src/media/contember.d.ts +15 -0
- package/dist/src/media/contember.d.ts.map +1 -0
- package/dist/src/media/local.d.ts +9 -0
- package/dist/src/media/local.d.ts.map +1 -0
- package/dist/src/media/s3.d.ts +12 -0
- package/dist/src/media/s3.d.ts.map +1 -0
- package/dist/src/media/types.d.ts +40 -0
- package/dist/src/media/types.d.ts.map +1 -0
- package/dist/src/preview-generator.d.ts +19 -0
- package/dist/src/preview-generator.d.ts.map +1 -0
- package/dist/src/seo-processor.d.ts +23 -0
- package/dist/src/seo-processor.d.ts.map +1 -0
- package/dist/src/source-finder/ast-extractors.d.ts +35 -0
- package/dist/src/source-finder/ast-extractors.d.ts.map +1 -0
- package/dist/src/source-finder/ast-parser.d.ts +16 -0
- package/dist/src/source-finder/ast-parser.d.ts.map +1 -0
- package/dist/src/source-finder/cache.d.ts +18 -0
- package/dist/src/source-finder/cache.d.ts.map +1 -0
- package/dist/src/source-finder/collection-finder.d.ts +29 -0
- package/dist/src/source-finder/collection-finder.d.ts.map +1 -0
- package/dist/src/source-finder/cross-file-tracker.d.ts +39 -0
- package/dist/src/source-finder/cross-file-tracker.d.ts.map +1 -0
- package/dist/src/source-finder/element-finder.d.ts +42 -0
- package/dist/src/source-finder/element-finder.d.ts.map +1 -0
- package/dist/src/source-finder/image-finder.d.ts +24 -0
- package/dist/src/source-finder/image-finder.d.ts.map +1 -0
- package/dist/src/source-finder/index.d.ts +9 -0
- package/dist/src/source-finder/index.d.ts.map +1 -0
- package/dist/src/source-finder/search-index.d.ts +27 -0
- package/dist/src/source-finder/search-index.d.ts.map +1 -0
- package/dist/src/source-finder/snippet-utils.d.ts +90 -0
- package/dist/src/source-finder/snippet-utils.d.ts.map +1 -0
- package/dist/src/source-finder/source-lookup.d.ts +16 -0
- package/dist/src/source-finder/source-lookup.d.ts.map +1 -0
- package/dist/src/source-finder/types.d.ts +167 -0
- package/dist/src/source-finder/types.d.ts.map +1 -0
- package/dist/src/source-finder/variable-extraction.d.ts +37 -0
- package/dist/src/source-finder/variable-extraction.d.ts.map +1 -0
- package/dist/src/tailwind-colors.d.ts +54 -0
- package/dist/src/tailwind-colors.d.ts.map +1 -0
- package/dist/src/tsconfig.tsbuildinfo +1 -0
- package/dist/src/types.d.ts +367 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/utils.d.ts +61 -0
- package/dist/src/utils.d.ts.map +1 -0
- package/dist/src/vite-plugin.d.ts +14 -0
- package/dist/src/vite-plugin.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -0
- package/package.json +80 -0
- package/src/build-processor.ts +784 -0
- package/src/collection-scanner.ts +304 -0
- package/src/component-registry.ts +393 -0
- package/src/config.ts +74 -0
- package/src/dev-middleware.ts +525 -0
- package/src/dist/src/tsconfig.tsbuildinfo +1 -0
- package/src/editor/ai.ts +185 -0
- package/src/editor/api.ts +513 -0
- package/src/editor/color-utils.ts +556 -0
- package/src/editor/components/ai-chat.tsx +632 -0
- package/src/editor/components/ai-tooltip.tsx +179 -0
- package/src/editor/components/attribute-editor.tsx +596 -0
- package/src/editor/components/block-editor.tsx +546 -0
- package/src/editor/components/collections-browser.tsx +248 -0
- package/src/editor/components/color-toolbar.tsx +314 -0
- package/src/editor/components/confirm-dialog.tsx +69 -0
- package/src/editor/components/create-page-modal.tsx +163 -0
- package/src/editor/components/editable-highlights.tsx +260 -0
- package/src/editor/components/error-boundary.tsx +87 -0
- package/src/editor/components/fields.tsx +387 -0
- package/src/editor/components/frontmatter-fields.tsx +469 -0
- package/src/editor/components/highlight-overlay.ts +229 -0
- package/src/editor/components/image-overlay.tsx +230 -0
- package/src/editor/components/markdown-editor-overlay.tsx +505 -0
- package/src/editor/components/markdown-inline-editor.tsx +780 -0
- package/src/editor/components/media-library.tsx +297 -0
- package/src/editor/components/outline.tsx +402 -0
- package/src/editor/components/redirect-countdown.tsx +45 -0
- package/src/editor/components/seo-editor.tsx +498 -0
- package/src/editor/components/text-style-toolbar.tsx +362 -0
- package/src/editor/components/toast/toast-container.tsx +15 -0
- package/src/editor/components/toast/toast.tsx +49 -0
- package/src/editor/components/toast/types.ts +7 -0
- package/src/editor/components/toolbar.tsx +366 -0
- package/src/editor/config.ts +12 -0
- package/src/editor/constants.ts +106 -0
- package/src/editor/context.tsx +38 -0
- package/src/editor/dom.ts +357 -0
- package/src/editor/editor.ts +1510 -0
- package/src/editor/env.d.ts +4 -0
- package/src/editor/history.ts +355 -0
- package/src/editor/hooks/index.ts +19 -0
- package/src/editor/hooks/useAIHandlers.ts +345 -0
- package/src/editor/hooks/useBlockEditorHandlers.ts +206 -0
- package/src/editor/hooks/useElementDetection.ts +284 -0
- package/src/editor/hooks/useImageHoverDetection.ts +102 -0
- package/src/editor/hooks/useTextSelection.ts +187 -0
- package/src/editor/hooks/useTooltipState.ts +126 -0
- package/src/editor/hooks/utils.ts +101 -0
- package/src/editor/index.tsx +481 -0
- package/src/editor/lib/cn.ts +4 -0
- package/src/editor/manifest.ts +25 -0
- package/src/editor/markdown-api.ts +209 -0
- package/src/editor/signals.ts +1351 -0
- package/src/editor/storage.ts +266 -0
- package/src/editor/styles.css +465 -0
- package/src/editor/text-styling.ts +773 -0
- package/src/editor/themes.ts +210 -0
- package/src/editor/types.ts +591 -0
- package/src/error-collector.ts +106 -0
- package/src/handlers/component-ops.ts +463 -0
- package/src/handlers/markdown-ops.ts +202 -0
- package/src/handlers/request-utils.ts +151 -0
- package/src/handlers/source-writer.ts +649 -0
- package/src/html-processor.ts +1108 -0
- package/src/index.ts +284 -0
- package/src/manifest-writer.ts +371 -0
- package/src/media/contember.ts +84 -0
- package/src/media/local.ts +114 -0
- package/src/media/s3.ts +133 -0
- package/src/media/types.ts +33 -0
- package/src/preview-generator.ts +293 -0
- package/src/seo-processor.ts +567 -0
- package/src/source-finder/ast-extractors.ts +185 -0
- package/src/source-finder/ast-parser.ts +150 -0
- package/src/source-finder/cache.ts +76 -0
- package/src/source-finder/collection-finder.ts +335 -0
- package/src/source-finder/cross-file-tracker.ts +741 -0
- package/src/source-finder/element-finder.ts +387 -0
- package/src/source-finder/image-finder.ts +283 -0
- package/src/source-finder/index.ts +37 -0
- package/src/source-finder/search-index.ts +525 -0
- package/src/source-finder/snippet-utils.ts +668 -0
- package/src/source-finder/source-lookup.ts +200 -0
- package/src/source-finder/types.ts +210 -0
- package/src/source-finder/variable-extraction.ts +406 -0
- package/src/tailwind-colors.ts +874 -0
- package/src/tsconfig.json +25 -0
- package/src/types.ts +406 -0
- package/src/utils.ts +186 -0
- package/src/vite-plugin.ts +42 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import type { CmsConfig, CmsThemeConfig, CmsThemePreset } from './types'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Theme presets for CMS UI
|
|
5
|
+
*/
|
|
6
|
+
export const THEME_PRESETS: Record<CmsThemePreset, CmsThemeConfig> = {
|
|
7
|
+
soft: {
|
|
8
|
+
primary: '#DFFF40',
|
|
9
|
+
secondary: '#1A1A1A',
|
|
10
|
+
background: '#E8E8E8',
|
|
11
|
+
card: '#FFFFFF',
|
|
12
|
+
borderRadius: 'rounded',
|
|
13
|
+
shadowStyle: 'soft',
|
|
14
|
+
},
|
|
15
|
+
brutalist: {
|
|
16
|
+
primary: '#005AE0',
|
|
17
|
+
secondary: '#005AE0',
|
|
18
|
+
background: '#FFFFFF',
|
|
19
|
+
card: '#FFFFFF',
|
|
20
|
+
borderRadius: 'sharp',
|
|
21
|
+
shadowStyle: 'brutalist',
|
|
22
|
+
},
|
|
23
|
+
minimal: {
|
|
24
|
+
primary: '#1A1A1A',
|
|
25
|
+
secondary: '#666666',
|
|
26
|
+
background: '#FAFAFA',
|
|
27
|
+
card: '#FFFFFF',
|
|
28
|
+
borderRadius: 'soft',
|
|
29
|
+
shadowStyle: 'none',
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Resolved theme with all values computed from preset + overrides
|
|
35
|
+
*/
|
|
36
|
+
export interface ResolvedTheme {
|
|
37
|
+
// Colors
|
|
38
|
+
primary: string
|
|
39
|
+
primaryHover: string
|
|
40
|
+
primaryText: string
|
|
41
|
+
secondary: string
|
|
42
|
+
secondaryHover: string
|
|
43
|
+
background: string
|
|
44
|
+
card: string
|
|
45
|
+
text: string
|
|
46
|
+
textMuted: string
|
|
47
|
+
border: string
|
|
48
|
+
|
|
49
|
+
// Radii
|
|
50
|
+
radiusSm: string
|
|
51
|
+
radiusMd: string
|
|
52
|
+
radiusLg: string
|
|
53
|
+
radiusXl: string
|
|
54
|
+
radiusPill: string
|
|
55
|
+
|
|
56
|
+
// Shadows
|
|
57
|
+
shadowSm: string
|
|
58
|
+
shadowMd: string
|
|
59
|
+
shadowLg: string
|
|
60
|
+
|
|
61
|
+
// Preset info
|
|
62
|
+
preset: CmsThemePreset
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Darken a hex color by a percentage
|
|
67
|
+
*/
|
|
68
|
+
function darkenColor(hex: string, percent: number): string {
|
|
69
|
+
const num = Number.parseInt(hex.replace('#', ''), 16)
|
|
70
|
+
const amt = Math.round(2.55 * percent)
|
|
71
|
+
const R = Math.max(0, (num >> 16) - amt)
|
|
72
|
+
const G = Math.max(0, ((num >> 8) & 0x00ff) - amt)
|
|
73
|
+
const B = Math.max(0, (num & 0x0000ff) - amt)
|
|
74
|
+
return `#${((1 << 24) | (R << 16) | (G << 8) | B).toString(16).slice(1)}`
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Get contrasting text color for a background
|
|
79
|
+
*/
|
|
80
|
+
function getContrastText(hex: string): string {
|
|
81
|
+
const num = Number.parseInt(hex.replace('#', ''), 16)
|
|
82
|
+
const r = num >> 16
|
|
83
|
+
const g = (num >> 8) & 0x00ff
|
|
84
|
+
const b = num & 0x0000ff
|
|
85
|
+
// Using relative luminance formula
|
|
86
|
+
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255
|
|
87
|
+
return luminance > 0.5 ? '#1A1A1A' : '#FFFFFF'
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Get border radius values based on style preset
|
|
92
|
+
*/
|
|
93
|
+
function getRadii(style: 'sharp' | 'soft' | 'rounded'): Pick<ResolvedTheme, 'radiusSm' | 'radiusMd' | 'radiusLg' | 'radiusXl' | 'radiusPill'> {
|
|
94
|
+
switch (style) {
|
|
95
|
+
case 'sharp':
|
|
96
|
+
return {
|
|
97
|
+
radiusSm: '0px',
|
|
98
|
+
radiusMd: '0px',
|
|
99
|
+
radiusLg: '0px',
|
|
100
|
+
radiusXl: '0px',
|
|
101
|
+
radiusPill: '0px',
|
|
102
|
+
}
|
|
103
|
+
case 'soft':
|
|
104
|
+
return {
|
|
105
|
+
radiusSm: '4px',
|
|
106
|
+
radiusMd: '8px',
|
|
107
|
+
radiusLg: '12px',
|
|
108
|
+
radiusXl: '16px',
|
|
109
|
+
radiusPill: '9999px',
|
|
110
|
+
}
|
|
111
|
+
default:
|
|
112
|
+
return {
|
|
113
|
+
radiusSm: '8px',
|
|
114
|
+
radiusMd: '16px',
|
|
115
|
+
radiusLg: '24px',
|
|
116
|
+
radiusXl: '32px',
|
|
117
|
+
radiusPill: '9999px',
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Get shadow values based on style preset
|
|
124
|
+
*/
|
|
125
|
+
function getShadows(style: 'none' | 'soft' | 'brutalist'): Pick<ResolvedTheme, 'shadowSm' | 'shadowMd' | 'shadowLg'> {
|
|
126
|
+
switch (style) {
|
|
127
|
+
case 'none':
|
|
128
|
+
return {
|
|
129
|
+
shadowSm: 'none',
|
|
130
|
+
shadowMd: 'none',
|
|
131
|
+
shadowLg: 'none',
|
|
132
|
+
}
|
|
133
|
+
case 'brutalist':
|
|
134
|
+
return {
|
|
135
|
+
shadowSm: '4px 4px 0px 0px rgba(0, 0, 0, 1)',
|
|
136
|
+
shadowMd: '6px 6px 0px 0px rgba(0, 0, 0, 1)',
|
|
137
|
+
shadowLg: '8px 8px 0px 0px rgba(0, 0, 0, 1)',
|
|
138
|
+
}
|
|
139
|
+
default:
|
|
140
|
+
return {
|
|
141
|
+
shadowSm: '0 2px 8px rgba(0,0,0,0.04)',
|
|
142
|
+
shadowMd: '0 4px 16px rgba(0,0,0,0.06)',
|
|
143
|
+
shadowLg: '0 10px 40px rgba(0,0,0,0.08)',
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Resolve theme from config (preset + overrides)
|
|
150
|
+
*/
|
|
151
|
+
export function resolveTheme(config: CmsConfig): ResolvedTheme {
|
|
152
|
+
const presetName = config.themePreset || 'soft'
|
|
153
|
+
const preset = THEME_PRESETS[presetName]
|
|
154
|
+
const overrides = config.theme || {}
|
|
155
|
+
|
|
156
|
+
// Merge preset with overrides
|
|
157
|
+
const primary = overrides.primary || preset.primary || '#DFFF40'
|
|
158
|
+
const secondary = overrides.secondary || preset.secondary || '#9BB5FC'
|
|
159
|
+
const background = overrides.background || preset.background || '#E6E6E6'
|
|
160
|
+
const card = overrides.card || preset.card || '#FFFFFF'
|
|
161
|
+
const borderRadius = overrides.borderRadius || preset.borderRadius || 'rounded'
|
|
162
|
+
const shadowStyle = overrides.shadowStyle || preset.shadowStyle || 'soft'
|
|
163
|
+
|
|
164
|
+
return {
|
|
165
|
+
primary,
|
|
166
|
+
primaryHover: darkenColor(primary, 5),
|
|
167
|
+
primaryText: getContrastText(primary),
|
|
168
|
+
secondary,
|
|
169
|
+
secondaryHover: darkenColor(secondary, 10),
|
|
170
|
+
background,
|
|
171
|
+
card,
|
|
172
|
+
text: '#1A1A1A',
|
|
173
|
+
textMuted: '#666666',
|
|
174
|
+
border: 'rgba(0, 0, 0, 0.1)',
|
|
175
|
+
...getRadii(borderRadius),
|
|
176
|
+
...getShadows(shadowStyle),
|
|
177
|
+
preset: presetName,
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Generate CSS variable overrides from resolved theme
|
|
183
|
+
*/
|
|
184
|
+
export function generateCSSVariables(theme: ResolvedTheme): string {
|
|
185
|
+
return `
|
|
186
|
+
--color-cms-bg: ${theme.background};
|
|
187
|
+
--color-cms-card: ${theme.card};
|
|
188
|
+
--color-cms-primary: ${theme.primary};
|
|
189
|
+
--color-cms-primary-hover: ${theme.primaryHover};
|
|
190
|
+
--color-cms-primary-text: ${theme.primaryText};
|
|
191
|
+
--color-cms-secondary: ${theme.secondary};
|
|
192
|
+
--color-cms-secondary-hover: ${theme.secondaryHover};
|
|
193
|
+
--color-cms-dark: #1A1A1A;
|
|
194
|
+
--color-cms-dark-hover: #333333;
|
|
195
|
+
--color-cms-text: ${theme.text};
|
|
196
|
+
--color-cms-text-muted: ${theme.textMuted};
|
|
197
|
+
--color-cms-border: ${theme.border};
|
|
198
|
+
--radius-cms-sm: ${theme.radiusSm};
|
|
199
|
+
--radius-cms-md: ${theme.radiusMd};
|
|
200
|
+
--radius-cms-lg: ${theme.radiusLg};
|
|
201
|
+
--radius-cms-xl: ${theme.radiusXl};
|
|
202
|
+
--radius-cms-pill: ${theme.radiusPill};
|
|
203
|
+
--shadow-cms-sm: ${theme.shadowSm};
|
|
204
|
+
--shadow-cms-md: ${theme.shadowMd};
|
|
205
|
+
--shadow-cms-lg: ${theme.shadowLg};
|
|
206
|
+
--shadow-brutalist-sm: ${theme.shadowMd};
|
|
207
|
+
--shadow-brutalist-md: ${theme.shadowLg};
|
|
208
|
+
--color-blue-bold: ${theme.secondary};
|
|
209
|
+
`.trim()
|
|
210
|
+
}
|