@kilivi/payloadcms-theme-management 2.0.0 → 2.2.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 +346 -845
- package/dist/components/AppearanceSessionControls.d.ts +15 -0
- package/dist/components/AppearanceSessionControls.d.ts.map +1 -0
- package/dist/components/AppearanceSessionControls.js +152 -0
- package/dist/components/AppearanceSessionControls.js.map +1 -0
- package/dist/components/ColorModeToggle.css +42 -0
- package/dist/components/ColorModeToggle.d.ts +40 -0
- package/dist/components/ColorModeToggle.d.ts.map +1 -0
- package/dist/components/ColorModeToggle.js +111 -0
- package/dist/components/ColorModeToggle.js.map +1 -0
- package/dist/components/ServerThemeInjector.d.ts +13 -1
- package/dist/components/ServerThemeInjector.d.ts.map +1 -1
- package/dist/components/ServerThemeInjector.js +65 -15
- package/dist/components/ServerThemeInjector.js.map +1 -1
- package/dist/components/ThemeLivePreviewSync.d.ts +4 -0
- package/dist/components/ThemeLivePreviewSync.d.ts.map +1 -1
- package/dist/components/ThemeLivePreviewSync.js +28 -4
- package/dist/components/ThemeLivePreviewSync.js.map +1 -1
- package/dist/components/ThemeSwitcher.d.ts +36 -0
- package/dist/components/ThemeSwitcher.d.ts.map +1 -0
- package/dist/components/ThemeSwitcher.js +89 -0
- package/dist/components/ThemeSwitcher.js.map +1 -0
- package/dist/components/typographyPreviewUtils.d.ts +5 -0
- package/dist/components/typographyPreviewUtils.d.ts.map +1 -1
- package/dist/components/typographyPreviewUtils.js +24 -11
- package/dist/components/typographyPreviewUtils.js.map +1 -1
- package/dist/constants/devicePreviews.d.ts +35 -0
- package/dist/constants/devicePreviews.d.ts.map +1 -0
- package/dist/constants/devicePreviews.js +43 -0
- package/dist/constants/devicePreviews.js.map +1 -0
- package/dist/constants/themeFonts.d.ts +94 -168
- package/dist/constants/themeFonts.d.ts.map +1 -1
- package/dist/constants/themeFonts.js +260 -140
- package/dist/constants/themeFonts.js.map +1 -1
- package/dist/endpoints/themeFonts.d.ts +5 -0
- package/dist/endpoints/themeFonts.d.ts.map +1 -0
- package/dist/endpoints/themeFonts.js +138 -0
- package/dist/endpoints/themeFonts.js.map +1 -0
- package/dist/extended-presets.d.ts +0 -4
- package/dist/extended-presets.d.ts.map +1 -1
- package/dist/extended-presets.js +1 -18
- package/dist/extended-presets.js.map +1 -1
- package/dist/extended-themes.d.ts.map +1 -1
- package/dist/extended-themes.js +428 -0
- package/dist/extended-themes.js.map +1 -1
- package/dist/fields/AccessibilityAuditField.d.ts +2 -0
- package/dist/fields/AccessibilityAuditField.d.ts.map +1 -0
- package/dist/fields/AccessibilityAuditField.js +303 -0
- package/dist/fields/AccessibilityAuditField.js.map +1 -0
- package/dist/fields/AppearancePreviewField.d.ts +2 -0
- package/dist/fields/AppearancePreviewField.d.ts.map +1 -0
- package/dist/fields/AppearancePreviewField.js +826 -0
- package/dist/fields/AppearancePreviewField.js.map +1 -0
- package/dist/fields/ColorPickerField.d.ts.map +1 -1
- package/dist/fields/ColorPickerField.js +89 -85
- package/dist/fields/ColorPickerField.js.map +1 -1
- package/dist/fields/FontSelectField.css +155 -0
- package/dist/fields/FontSelectField.d.ts +8 -0
- package/dist/fields/FontSelectField.d.ts.map +1 -1
- package/dist/fields/FontSelectField.js +223 -188
- package/dist/fields/FontSelectField.js.map +1 -1
- package/dist/fields/PaletteGeneratorField.d.ts +7 -0
- package/dist/fields/PaletteGeneratorField.d.ts.map +1 -0
- package/dist/fields/PaletteGeneratorField.js +327 -0
- package/dist/fields/PaletteGeneratorField.js.map +1 -0
- package/dist/fields/StylePresetField.d.ts +3 -0
- package/dist/fields/StylePresetField.d.ts.map +1 -0
- package/dist/fields/StylePresetField.js +463 -0
- package/dist/fields/StylePresetField.js.map +1 -0
- package/dist/fields/ThemeColorPickerField.css +115 -35
- package/dist/fields/ThemeColorPickerField.d.ts.map +1 -1
- package/dist/fields/ThemeColorPickerField.js +204 -70
- package/dist/fields/ThemeColorPickerField.js.map +1 -1
- package/dist/fields/ThemeExportField.d.ts +6 -0
- package/dist/fields/ThemeExportField.d.ts.map +1 -0
- package/dist/fields/ThemeExportField.js +202 -0
- package/dist/fields/ThemeExportField.js.map +1 -0
- package/dist/fields/ThemePresetImportField.d.ts.map +1 -1
- package/dist/fields/ThemePresetImportField.js +56 -25
- package/dist/fields/ThemePresetImportField.js.map +1 -1
- package/dist/fields/ThemePreviewField.css +444 -5
- package/dist/fields/ThemePreviewField.d.ts.map +1 -1
- package/dist/fields/ThemePreviewField.js +265 -170
- package/dist/fields/ThemePreviewField.js.map +1 -1
- package/dist/fields/ThemeTokenSelectField.d.ts.map +1 -1
- package/dist/fields/ThemeTokenSelectField.js +278 -80
- package/dist/fields/ThemeTokenSelectField.js.map +1 -1
- package/dist/fields/colorFieldHelpers.d.ts +90 -0
- package/dist/fields/colorFieldHelpers.d.ts.map +1 -0
- package/dist/fields/colorFieldHelpers.js +133 -0
- package/dist/fields/colorFieldHelpers.js.map +1 -0
- package/dist/fields/colorModeFields.d.ts +1 -1
- package/dist/fields/colorModeFields.d.ts.map +1 -1
- package/dist/fields/colorModeFields.js +49 -7
- package/dist/fields/colorModeFields.js.map +1 -1
- package/dist/fields/themeConfigurationField.d.ts +8 -1
- package/dist/fields/themeConfigurationField.d.ts.map +1 -1
- package/dist/fields/themeConfigurationField.js +1209 -228
- package/dist/fields/themeConfigurationField.js.map +1 -1
- package/dist/globals/ThemeSettings/FontPicker/FontPreview.d.ts.map +1 -1
- package/dist/globals/ThemeSettings/FontPicker/FontPreview.js +8 -4
- package/dist/globals/ThemeSettings/FontPicker/FontPreview.js.map +1 -1
- package/dist/globals/ThemeSettings/FontPicker/index.d.ts.map +1 -1
- package/dist/globals/ThemeSettings/FontPicker/index.js +81 -26
- package/dist/globals/ThemeSettings/FontPicker/index.js.map +1 -1
- package/dist/globals/ThemeSettings/FontPicker/styles.css +98 -41
- package/dist/globals/ThemeSettings/FontPicker/translations.d.ts +6 -0
- package/dist/globals/ThemeSettings/FontPicker/translations.d.ts.map +1 -1
- package/dist/globals/ThemeSettings/FontPicker/translations.js +14 -2
- package/dist/globals/ThemeSettings/FontPicker/translations.js.map +1 -1
- package/dist/globals/ThemeSettings/config.d.ts.map +1 -1
- package/dist/globals/ThemeSettings/config.js +76 -79
- package/dist/globals/ThemeSettings/config.js.map +1 -1
- package/dist/globals/ThemeSettings/fields/FontLoadingGuideField.d.ts.map +1 -1
- package/dist/globals/ThemeSettings/fields/FontLoadingGuideField.js +63 -62
- package/dist/globals/ThemeSettings/fields/FontLoadingGuideField.js.map +1 -1
- package/dist/globals/ThemeSettings/fields/TypographyInfoField.d.ts.map +1 -1
- package/dist/globals/ThemeSettings/fields/TypographyInfoField.js +22 -25
- package/dist/globals/ThemeSettings/fields/TypographyInfoField.js.map +1 -1
- package/dist/hooks/useAppearanceSession.d.ts +50 -0
- package/dist/hooks/useAppearanceSession.d.ts.map +1 -0
- package/dist/hooks/useAppearanceSession.js +91 -0
- package/dist/hooks/useAppearanceSession.js.map +1 -0
- package/dist/hooks/useNativeLivePreview.d.ts +15 -0
- package/dist/hooks/useNativeLivePreview.d.ts.map +1 -0
- package/dist/hooks/useNativeLivePreview.js +18 -0
- package/dist/hooks/useNativeLivePreview.js.map +1 -0
- package/dist/hooks/useThemeFonts.d.ts +10 -0
- package/dist/hooks/useThemeFonts.d.ts.map +1 -0
- package/dist/hooks/useThemeFonts.js +36 -0
- package/dist/hooks/useThemeFonts.js.map +1 -0
- package/dist/hooks/useThemeTranslations.d.ts +13 -0
- package/dist/hooks/useThemeTranslations.d.ts.map +1 -0
- package/dist/hooks/useThemeTranslations.js +22 -0
- package/dist/hooks/useThemeTranslations.js.map +1 -0
- package/dist/i18n.d.ts +53 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/i18n.js +53 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.d.ts +13 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +59 -29
- package/dist/index.js.map +1 -1
- package/dist/next-fonts.d.ts +3 -0
- package/dist/next-fonts.d.ts.map +1 -0
- package/dist/next-fonts.js +360 -0
- package/dist/next-fonts.js.map +1 -0
- package/dist/payload-types.d.ts +34 -6
- package/dist/payload-types.d.ts.map +1 -1
- package/dist/payload-types.js.map +1 -1
- package/dist/presets.d.ts +14 -0
- package/dist/presets.d.ts.map +1 -1
- package/dist/presets.js.map +1 -1
- package/dist/providers/Theme/index.d.ts.map +1 -1
- package/dist/providers/Theme/index.js +75 -11
- package/dist/providers/Theme/index.js.map +1 -1
- package/dist/providers/Theme/themeConfig.d.ts.map +1 -1
- package/dist/providers/Theme/themeConfig.js +104 -0
- package/dist/providers/Theme/themeConfig.js.map +1 -1
- package/dist/providers/Theme/types.d.ts +1 -1
- package/dist/providers/Theme/types.d.ts.map +1 -1
- package/dist/providers/Theme/types.js +10 -1
- package/dist/providers/Theme/types.js.map +1 -1
- package/dist/style-presets.d.ts +75 -0
- package/dist/style-presets.d.ts.map +1 -0
- package/dist/style-presets.js +738 -0
- package/dist/style-presets.js.map +1 -0
- package/dist/translations.d.ts +164 -1
- package/dist/translations.d.ts.map +1 -1
- package/dist/translations.js +320 -9
- package/dist/translations.js.map +1 -1
- package/dist/tweakcn-special-themes.d.ts.map +1 -1
- package/dist/tweakcn-special-themes.js +585 -9
- package/dist/tweakcn-special-themes.js.map +1 -1
- package/dist/types/css.d.js +3 -0
- package/dist/types/css.d.js.map +1 -0
- package/dist/types.d.ts +26 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utilities/getThemeSettings.d.ts.map +1 -1
- package/dist/utilities/getThemeSettings.js +2 -14
- package/dist/utilities/getThemeSettings.js.map +1 -1
- package/dist/utils/contrast.d.ts +63 -0
- package/dist/utils/contrast.d.ts.map +1 -0
- package/dist/utils/contrast.js +158 -0
- package/dist/utils/contrast.js.map +1 -0
- package/dist/utils/exportTokens.d.ts +30 -0
- package/dist/utils/exportTokens.d.ts.map +1 -0
- package/dist/utils/exportTokens.js +183 -0
- package/dist/utils/exportTokens.js.map +1 -0
- package/dist/utils/generatePalette.d.ts +46 -0
- package/dist/utils/generatePalette.d.ts.map +1 -0
- package/dist/utils/generatePalette.js +127 -0
- package/dist/utils/generatePalette.js.map +1 -0
- package/dist/utils/generateThemeCSS.d.ts.map +1 -1
- package/dist/utils/generateThemeCSS.js +2 -40
- package/dist/utils/generateThemeCSS.js.map +1 -1
- package/dist/utils/livePreviewThemeRuntime.d.ts +22 -3
- package/dist/utils/livePreviewThemeRuntime.d.ts.map +1 -1
- package/dist/utils/livePreviewThemeRuntime.js +48 -15
- package/dist/utils/livePreviewThemeRuntime.js.map +1 -1
- package/dist/utils/localizedText.d.ts +8 -0
- package/dist/utils/localizedText.d.ts.map +1 -0
- package/dist/utils/localizedText.js +21 -0
- package/dist/utils/localizedText.js.map +1 -0
- package/dist/utils/resolveThemeConfiguration.d.ts +60 -1
- package/dist/utils/resolveThemeConfiguration.d.ts.map +1 -1
- package/dist/utils/resolveThemeConfiguration.js +53 -13
- package/dist/utils/resolveThemeConfiguration.js.map +1 -1
- package/dist/utils/themeColors.d.ts +3 -0
- package/dist/utils/themeColors.d.ts.map +1 -1
- package/dist/utils/themeColors.js +30 -1
- package/dist/utils/themeColors.js.map +1 -1
- package/dist/utils/themeHtmlAttributes.d.ts +32 -12
- package/dist/utils/themeHtmlAttributes.d.ts.map +1 -1
- package/dist/utils/themeHtmlAttributes.js +38 -5
- package/dist/utils/themeHtmlAttributes.js.map +1 -1
- package/dist/utils/themeUtils.d.ts +3 -5
- package/dist/utils/themeUtils.d.ts.map +1 -1
- package/dist/utils/themeUtils.js +474 -6
- package/dist/utils/themeUtils.js.map +1 -1
- package/dist/utils/tweakcnConverter.d.ts +1 -3
- package/dist/utils/tweakcnConverter.d.ts.map +1 -1
- package/dist/utils/tweakcnConverter.js +1 -3
- package/dist/utils/tweakcnConverter.js.map +1 -1
- package/package.json +15 -5
- package/dist/components/ThemePreview.d.ts +0 -3
- package/dist/components/ThemePreview.d.ts.map +0 -1
- package/dist/components/ThemePreview.js +0 -321
- package/dist/components/ThemePreview.js.map +0 -1
- package/dist/plugin.d.ts +0 -2
- package/dist/plugin.d.ts.map +0 -1
- package/dist/plugin.js +0 -3
- package/dist/plugin.js.map +0 -1
|
@@ -0,0 +1,826 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useFormFields } from '@payloadcms/ui';
|
|
4
|
+
import { ExternalLink, Monitor, Moon, Smartphone, Sparkles, Sun, Tablet } from 'lucide-react';
|
|
5
|
+
import { useId, useMemo, useState } from 'react';
|
|
6
|
+
import { DEFAULT_DEVICE_PREVIEW_ID, DEVICE_PREVIEWS, getDevicePreview } from '../constants/devicePreviews.js';
|
|
7
|
+
import { useThemeLanguage, useThemeTranslations } from '../hooks/useThemeTranslations.js';
|
|
8
|
+
import { resolveTypographyPreview } from '../components/typographyPreviewUtils.js';
|
|
9
|
+
import { useNativeLivePreview } from '../hooks/useNativeLivePreview.js';
|
|
10
|
+
import { useThemeFonts } from '../hooks/useThemeFonts.js';
|
|
11
|
+
import { borderRadiusPresets } from '../providers/Theme/themeConfig.js';
|
|
12
|
+
const DEVICE_ICONS = {
|
|
13
|
+
mobile: Smartphone,
|
|
14
|
+
tablet: Tablet,
|
|
15
|
+
desktop: Monitor
|
|
16
|
+
};
|
|
17
|
+
const SHADOW_MAP = {
|
|
18
|
+
none: 'none',
|
|
19
|
+
subtle: '0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04)',
|
|
20
|
+
medium: '0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1)',
|
|
21
|
+
strong: '0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1)',
|
|
22
|
+
dramatic: '0 25px 50px -12px rgba(0,0,0,0.25)'
|
|
23
|
+
};
|
|
24
|
+
const BLUR_PX_MAP = {
|
|
25
|
+
none: '0px',
|
|
26
|
+
slight: '4px',
|
|
27
|
+
medium: '8px',
|
|
28
|
+
strong: '16px',
|
|
29
|
+
heavy: '24px'
|
|
30
|
+
};
|
|
31
|
+
const BUTTON_SIZE_MAP = {
|
|
32
|
+
small: {
|
|
33
|
+
padding: '6px 12px',
|
|
34
|
+
fontSize: '12px'
|
|
35
|
+
},
|
|
36
|
+
medium: {
|
|
37
|
+
padding: '8px 16px',
|
|
38
|
+
fontSize: '13px'
|
|
39
|
+
},
|
|
40
|
+
large: {
|
|
41
|
+
padding: '10px 24px',
|
|
42
|
+
fontSize: '15px'
|
|
43
|
+
},
|
|
44
|
+
xl: {
|
|
45
|
+
padding: '14px 32px',
|
|
46
|
+
fontSize: '17px'
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
function radiusToPx(token) {
|
|
50
|
+
const preset = borderRadiusPresets[token ?? 'medium'];
|
|
51
|
+
const css = preset?.css;
|
|
52
|
+
return css?.['--radius-large'] ?? css?.['--radius-default'] ?? '0.75rem';
|
|
53
|
+
}
|
|
54
|
+
const SPACING_SCALE = {
|
|
55
|
+
compact: 0.75,
|
|
56
|
+
medium: 1,
|
|
57
|
+
comfortable: 1.5,
|
|
58
|
+
spacious: 1.5
|
|
59
|
+
};
|
|
60
|
+
const px = (value, c)=>`${Math.round(value * c.space)}px`;
|
|
61
|
+
function cardSurface(c, p, radius) {
|
|
62
|
+
const base = {
|
|
63
|
+
background: p.card,
|
|
64
|
+
color: p.cardForeground,
|
|
65
|
+
borderRadius: radius,
|
|
66
|
+
border: c.borderStyle === 'none' || c.borderWidth === '0px' ? 'none' : `${c.borderWidth} ${c.borderStyle} ${p.border}`,
|
|
67
|
+
padding: px(16, c),
|
|
68
|
+
transition: 'transform 200ms ease, box-shadow 200ms ease'
|
|
69
|
+
};
|
|
70
|
+
// Card style takes precedence for the structural look, effect style for depth.
|
|
71
|
+
if (c.cardStyle === 'bordered') {
|
|
72
|
+
return {
|
|
73
|
+
...base,
|
|
74
|
+
border: `2px solid ${p.foreground}`,
|
|
75
|
+
borderRadius: 0,
|
|
76
|
+
boxShadow: `4px 4px 0 ${p.foreground}`
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
if (c.cardStyle === 'gradient-border') {
|
|
80
|
+
return {
|
|
81
|
+
...base,
|
|
82
|
+
border: '2px solid transparent',
|
|
83
|
+
borderImage: `linear-gradient(135deg, ${p.gradientFrom}, ${p.gradientVia}, ${p.gradientTo}) 1`,
|
|
84
|
+
boxShadow: SHADOW_MAP[c.shadowIntensity] ?? SHADOW_MAP.medium
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
switch(c.effectStyle){
|
|
88
|
+
case 'glass':
|
|
89
|
+
return {
|
|
90
|
+
...base,
|
|
91
|
+
background: `color-mix(in srgb, ${p.card} ${c.glassOpacity}%, transparent)`,
|
|
92
|
+
backdropFilter: `blur(${BLUR_PX_MAP[c.backdropBlur] ?? '8px'}) saturate(150%)`,
|
|
93
|
+
border: `1px solid color-mix(in srgb, ${p.border} 50%, transparent)`,
|
|
94
|
+
boxShadow: '0 4px 24px rgba(0,0,0,0.10), inset 0 1px 0 rgba(255,255,255,0.15)'
|
|
95
|
+
};
|
|
96
|
+
case 'neumorphic':
|
|
97
|
+
return {
|
|
98
|
+
...base,
|
|
99
|
+
background: p.background,
|
|
100
|
+
border: 'none',
|
|
101
|
+
boxShadow: '6px 6px 12px rgba(0,0,0,0.12), -6px -6px 12px rgba(255,255,255,0.7)'
|
|
102
|
+
};
|
|
103
|
+
case 'clay':
|
|
104
|
+
return {
|
|
105
|
+
...base,
|
|
106
|
+
border: 'none',
|
|
107
|
+
boxShadow: '4px 4px 0 rgba(0,0,0,0.22), 0 8px 20px rgba(0,0,0,0.08)'
|
|
108
|
+
};
|
|
109
|
+
case 'elevated':
|
|
110
|
+
return {
|
|
111
|
+
...base,
|
|
112
|
+
border: 'none',
|
|
113
|
+
boxShadow: SHADOW_MAP[c.shadowIntensity] ?? SHADOW_MAP.medium
|
|
114
|
+
};
|
|
115
|
+
case 'flat':
|
|
116
|
+
default:
|
|
117
|
+
return {
|
|
118
|
+
...base,
|
|
119
|
+
boxShadow: 'none'
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function buttonStyle(c, p, radius) {
|
|
124
|
+
const size = BUTTON_SIZE_MAP[c.buttonSize] ?? BUTTON_SIZE_MAP.medium;
|
|
125
|
+
const base = {
|
|
126
|
+
...size,
|
|
127
|
+
fontWeight: 600,
|
|
128
|
+
cursor: 'pointer',
|
|
129
|
+
borderRadius: radius,
|
|
130
|
+
border: 'none',
|
|
131
|
+
transition: 'transform 120ms ease, box-shadow 120ms ease',
|
|
132
|
+
whiteSpace: 'nowrap'
|
|
133
|
+
};
|
|
134
|
+
switch(c.buttonVariant){
|
|
135
|
+
case 'outlined':
|
|
136
|
+
return {
|
|
137
|
+
...base,
|
|
138
|
+
background: 'transparent',
|
|
139
|
+
color: p.primary,
|
|
140
|
+
border: `1.5px solid ${p.primary}`
|
|
141
|
+
};
|
|
142
|
+
case 'ghost':
|
|
143
|
+
return {
|
|
144
|
+
...base,
|
|
145
|
+
background: 'transparent',
|
|
146
|
+
color: p.primary
|
|
147
|
+
};
|
|
148
|
+
case 'gradient':
|
|
149
|
+
return {
|
|
150
|
+
...base,
|
|
151
|
+
backgroundImage: `linear-gradient(135deg, ${p.gradientFrom}, ${p.gradientVia}, ${p.gradientTo})`,
|
|
152
|
+
color: p.primaryForeground
|
|
153
|
+
};
|
|
154
|
+
case 'pill':
|
|
155
|
+
return {
|
|
156
|
+
...base,
|
|
157
|
+
background: p.primary,
|
|
158
|
+
color: p.primaryForeground,
|
|
159
|
+
borderRadius: '9999px'
|
|
160
|
+
};
|
|
161
|
+
case 'brutal':
|
|
162
|
+
return {
|
|
163
|
+
...base,
|
|
164
|
+
background: p.card,
|
|
165
|
+
color: p.foreground,
|
|
166
|
+
border: `2px solid ${p.foreground}`,
|
|
167
|
+
borderRadius: 0,
|
|
168
|
+
boxShadow: `3px 3px 0 ${p.foreground}`
|
|
169
|
+
};
|
|
170
|
+
case 'filled':
|
|
171
|
+
default:
|
|
172
|
+
return {
|
|
173
|
+
...base,
|
|
174
|
+
background: p.primary,
|
|
175
|
+
color: p.primaryForeground
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
function navbarStyle(c, p) {
|
|
180
|
+
const base = {
|
|
181
|
+
display: 'flex',
|
|
182
|
+
alignItems: 'center',
|
|
183
|
+
justifyContent: 'space-between',
|
|
184
|
+
padding: `${px(10, c)} ${px(14, c)}`,
|
|
185
|
+
background: p.background,
|
|
186
|
+
color: p.foreground,
|
|
187
|
+
borderBottom: `1px solid ${p.border}`
|
|
188
|
+
};
|
|
189
|
+
switch(c.navbarStyle){
|
|
190
|
+
case 'transparent':
|
|
191
|
+
return {
|
|
192
|
+
...base,
|
|
193
|
+
background: 'transparent',
|
|
194
|
+
borderBottom: '1px solid transparent'
|
|
195
|
+
};
|
|
196
|
+
case 'blur':
|
|
197
|
+
return {
|
|
198
|
+
...base,
|
|
199
|
+
background: `color-mix(in srgb, ${p.background} 70%, transparent)`,
|
|
200
|
+
backdropFilter: 'blur(12px)'
|
|
201
|
+
};
|
|
202
|
+
case 'floating':
|
|
203
|
+
return {
|
|
204
|
+
...base,
|
|
205
|
+
margin: '8px',
|
|
206
|
+
borderRadius: radiusToPx(c.borderRadius),
|
|
207
|
+
border: `1px solid ${p.border}`,
|
|
208
|
+
boxShadow: '0 4px 24px rgba(0,0,0,0.10)'
|
|
209
|
+
};
|
|
210
|
+
case 'minimal':
|
|
211
|
+
return {
|
|
212
|
+
...base,
|
|
213
|
+
borderBottom: `1px solid ${p.border}`,
|
|
214
|
+
boxShadow: 'none'
|
|
215
|
+
};
|
|
216
|
+
case 'solid':
|
|
217
|
+
default:
|
|
218
|
+
return base;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
function linkStyle(c, p) {
|
|
222
|
+
switch(c.linkStyle){
|
|
223
|
+
case 'underline':
|
|
224
|
+
return {
|
|
225
|
+
color: p.primary,
|
|
226
|
+
textDecoration: 'underline',
|
|
227
|
+
textUnderlineOffset: '0.15em'
|
|
228
|
+
};
|
|
229
|
+
case 'none':
|
|
230
|
+
return {
|
|
231
|
+
color: p.primary,
|
|
232
|
+
textDecoration: 'none'
|
|
233
|
+
};
|
|
234
|
+
case 'highlight':
|
|
235
|
+
return {
|
|
236
|
+
color: p.foreground,
|
|
237
|
+
textDecoration: 'none',
|
|
238
|
+
backgroundImage: `linear-gradient(transparent 60%, color-mix(in srgb, ${p.primary} 28%, transparent) 0)`
|
|
239
|
+
};
|
|
240
|
+
case 'animated':
|
|
241
|
+
return {
|
|
242
|
+
color: p.primary,
|
|
243
|
+
textDecoration: 'none',
|
|
244
|
+
borderBottom: `2px solid ${p.primary}`,
|
|
245
|
+
paddingBottom: '1px'
|
|
246
|
+
};
|
|
247
|
+
case 'underline-hover':
|
|
248
|
+
default:
|
|
249
|
+
return {
|
|
250
|
+
color: p.primary,
|
|
251
|
+
textDecoration: 'none'
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
export default function AppearancePreviewField() {
|
|
256
|
+
const formFields = useFormFields(([state])=>state);
|
|
257
|
+
const lang = useThemeLanguage();
|
|
258
|
+
const translations = useThemeTranslations();
|
|
259
|
+
const t = translations.appearancePreview;
|
|
260
|
+
const site = translations.preview;
|
|
261
|
+
const [mode, setMode] = useState('light');
|
|
262
|
+
const [device, setDevice] = useState(DEFAULT_DEVICE_PREVIEW_ID);
|
|
263
|
+
const uid = useId().replace(/[:]/g, '');
|
|
264
|
+
const nativePreview = useNativeLivePreview();
|
|
265
|
+
const activeDevice = getDevicePreview(device);
|
|
266
|
+
// Fonts follow the Typography section (or the theme preset when set to "Use theme preset"),
|
|
267
|
+
// so this single preview shows colours, type and component styles together.
|
|
268
|
+
const typographyValue = (key)=>formFields?.[`themeConfiguration.typography.${key}`]?.value;
|
|
269
|
+
const typography = resolveTypographyPreview({
|
|
270
|
+
bodyFont: typographyValue('bodyFont'),
|
|
271
|
+
headingFont: typographyValue('headingFont'),
|
|
272
|
+
bodyFontCustom: typographyValue('bodyFontCustom'),
|
|
273
|
+
headingFontCustom: typographyValue('headingFontCustom'),
|
|
274
|
+
baseFontSize: typographyValue('baseFontSize'),
|
|
275
|
+
lineHeight: typographyValue('lineHeight'),
|
|
276
|
+
headingWeight: typographyValue('headingWeight'),
|
|
277
|
+
letterSpacing: typographyValue('letterSpacing')
|
|
278
|
+
}, formFields?.['themeConfiguration.theme']?.value);
|
|
279
|
+
useThemeFonts([
|
|
280
|
+
typographyValue('bodyFont'),
|
|
281
|
+
typographyValue('headingFont')
|
|
282
|
+
]);
|
|
283
|
+
const str = (key, fallback)=>{
|
|
284
|
+
const v = formFields?.[`themeConfiguration.${key}`]?.value;
|
|
285
|
+
return typeof v === 'string' && v.trim().length > 0 ? v : fallback;
|
|
286
|
+
};
|
|
287
|
+
const num = (key, fallback)=>{
|
|
288
|
+
const v = formFields?.[`themeConfiguration.${key}`]?.value;
|
|
289
|
+
return typeof v === 'number' ? v : fallback;
|
|
290
|
+
};
|
|
291
|
+
const choices = {
|
|
292
|
+
effectStyle: str('visualEffects.effectStyle', 'flat'),
|
|
293
|
+
shadowIntensity: str('visualEffects.shadowIntensity', 'medium'),
|
|
294
|
+
backdropBlur: str('visualEffects.backdropBlur', 'none'),
|
|
295
|
+
borderStyle: str('visualEffects.borderStyle', 'solid'),
|
|
296
|
+
borderWidth: str('visualEffects.borderWidth', '1px'),
|
|
297
|
+
glassOpacity: num('visualEffects.glassOpacity', 60),
|
|
298
|
+
buttonVariant: str('componentStyles.buttonVariant', 'filled'),
|
|
299
|
+
buttonSize: str('componentStyles.buttonSize', 'medium'),
|
|
300
|
+
cardStyle: str('componentStyles.cardStyle', 'elevated'),
|
|
301
|
+
cardHoverEffect: str('componentStyles.cardHoverEffect', 'lift'),
|
|
302
|
+
imageStyle: str('componentStyles.imageStyle', 'default'),
|
|
303
|
+
navbarStyle: str('componentStyles.navbarStyle', 'solid'),
|
|
304
|
+
footerStyle: str('componentStyles.footerStyle', 'standard'),
|
|
305
|
+
linkStyle: str('componentStyles.linkStyle', 'underline-hover'),
|
|
306
|
+
borderRadius: str('borderRadius', 'medium'),
|
|
307
|
+
space: SPACING_SCALE[str('spacing', 'medium')] ?? 1
|
|
308
|
+
};
|
|
309
|
+
const modeKey = mode === 'light' ? 'lightMode' : 'darkMode';
|
|
310
|
+
const fallback = mode === 'light' ? {
|
|
311
|
+
background: '#ffffff',
|
|
312
|
+
foreground: '#0a0a0a',
|
|
313
|
+
card: '#ffffff',
|
|
314
|
+
cardForeground: '#0a0a0a',
|
|
315
|
+
primary: '#9372f7',
|
|
316
|
+
primaryForeground: '#fafafa',
|
|
317
|
+
secondary: '#f4f4f5',
|
|
318
|
+
secondaryForeground: '#18181b',
|
|
319
|
+
muted: '#f4f4f5',
|
|
320
|
+
mutedForeground: '#71717a',
|
|
321
|
+
accent: '#f4f4f5',
|
|
322
|
+
accentForeground: '#18181b',
|
|
323
|
+
border: '#e4e4e7',
|
|
324
|
+
gradientFrom: '#9372f7',
|
|
325
|
+
gradientVia: '#7c6ff0',
|
|
326
|
+
gradientTo: '#22d3ee'
|
|
327
|
+
} : {
|
|
328
|
+
background: '#0a0a0a',
|
|
329
|
+
foreground: '#fafafa',
|
|
330
|
+
card: '#09090b',
|
|
331
|
+
cardForeground: '#fafafa',
|
|
332
|
+
primary: '#9372f7',
|
|
333
|
+
primaryForeground: '#09090b',
|
|
334
|
+
secondary: '#27272a',
|
|
335
|
+
secondaryForeground: '#fafafa',
|
|
336
|
+
muted: '#27272a',
|
|
337
|
+
mutedForeground: '#a1a1aa',
|
|
338
|
+
accent: '#27272a',
|
|
339
|
+
accentForeground: '#fafafa',
|
|
340
|
+
border: '#27272a',
|
|
341
|
+
gradientFrom: '#9372f7',
|
|
342
|
+
gradientVia: '#7c6ff0',
|
|
343
|
+
gradientTo: '#22d3ee'
|
|
344
|
+
};
|
|
345
|
+
const palette = useMemo(()=>{
|
|
346
|
+
const p = {
|
|
347
|
+
...fallback
|
|
348
|
+
};
|
|
349
|
+
Object.keys(fallback).forEach((key)=>{
|
|
350
|
+
p[key] = str(`${modeKey}.${key}`, fallback[key]);
|
|
351
|
+
});
|
|
352
|
+
// Same fallback as the site's --gradient-brand: primary → accent when no stops are set.
|
|
353
|
+
p.gradientFrom = str(`${modeKey}.gradientFrom`, p.primary);
|
|
354
|
+
p.gradientTo = str(`${modeKey}.gradientTo`, p.accent);
|
|
355
|
+
p.gradientVia = str(`${modeKey}.gradientVia`, p.gradientFrom);
|
|
356
|
+
return p;
|
|
357
|
+
}, [
|
|
358
|
+
formFields,
|
|
359
|
+
mode
|
|
360
|
+
]);
|
|
361
|
+
const radius = radiusToPx(choices.borderRadius);
|
|
362
|
+
const card = cardSurface(choices, palette, radius);
|
|
363
|
+
const btn = buttonStyle(choices, palette, radius);
|
|
364
|
+
const nav = navbarStyle(choices, palette);
|
|
365
|
+
// Hover effects can't be expressed inline, so emit a scoped style block.
|
|
366
|
+
const hoverCSS = (()=>{
|
|
367
|
+
const sel = `.${uid} .tm-prev-card`;
|
|
368
|
+
switch(choices.cardHoverEffect){
|
|
369
|
+
case 'lift':
|
|
370
|
+
return `${sel}:hover{transform:translateY(-6px);box-shadow:0 20px 40px rgba(0,0,0,0.14)}`;
|
|
371
|
+
case 'scale':
|
|
372
|
+
return `${sel}:hover{transform:scale(1.02)}`;
|
|
373
|
+
case 'glow':
|
|
374
|
+
return `${sel}:hover{box-shadow:0 0 0 3px color-mix(in srgb, ${palette.primary} 25%, transparent),0 8px 32px rgba(0,0,0,0.12)}`;
|
|
375
|
+
case 'shadow':
|
|
376
|
+
return `${sel}:hover{box-shadow:0 24px 50px -12px rgba(0,0,0,0.35)}`;
|
|
377
|
+
case 'tilt':
|
|
378
|
+
return `${sel}:hover{transform:perspective(800px) rotateX(3deg) rotateY(-3deg)}`;
|
|
379
|
+
default:
|
|
380
|
+
return '';
|
|
381
|
+
}
|
|
382
|
+
})();
|
|
383
|
+
const btnHoverCSS = `.${uid} .tm-prev-btn:hover{filter:brightness(1.05)}${choices.buttonVariant === 'brutal' ? `.${uid} .tm-prev-btn:hover{transform:translate(-2px,-2px);box-shadow:5px 5px 0 ${palette.foreground}}` : ''}`;
|
|
384
|
+
// Movement-based hover effects only run for users who haven't asked for reduced motion.
|
|
385
|
+
const previewCSS = `@media (prefers-reduced-motion: no-preference){${hoverCSS}${btnHoverCSS}}`;
|
|
386
|
+
// Content image treatment, mirroring the site's [data-img] rules.
|
|
387
|
+
const imageCss = (()=>{
|
|
388
|
+
const base = {
|
|
389
|
+
aspectRatio: '4 / 3',
|
|
390
|
+
borderRadius: 0,
|
|
391
|
+
backgroundImage: `radial-gradient(circle at 70% 30%, ${palette.accent} 0 18%, transparent 19%), linear-gradient(160deg, ${palette.gradientFrom}, ${palette.gradientTo})`
|
|
392
|
+
};
|
|
393
|
+
switch(choices.imageStyle){
|
|
394
|
+
case 'rounded':
|
|
395
|
+
return {
|
|
396
|
+
...base,
|
|
397
|
+
borderRadius: radius
|
|
398
|
+
};
|
|
399
|
+
case 'circle':
|
|
400
|
+
return {
|
|
401
|
+
...base,
|
|
402
|
+
aspectRatio: '1 / 1',
|
|
403
|
+
borderRadius: '9999px'
|
|
404
|
+
};
|
|
405
|
+
case 'grayscale':
|
|
406
|
+
return {
|
|
407
|
+
...base,
|
|
408
|
+
filter: 'grayscale(1)'
|
|
409
|
+
};
|
|
410
|
+
case 'duotone':
|
|
411
|
+
return {
|
|
412
|
+
...base,
|
|
413
|
+
filter: 'grayscale(1) contrast(1.05)',
|
|
414
|
+
mixBlendMode: 'luminosity'
|
|
415
|
+
};
|
|
416
|
+
case 'vignette':
|
|
417
|
+
return {
|
|
418
|
+
...base,
|
|
419
|
+
boxShadow: 'inset 0 0 40px rgba(0,0,0,0.45)'
|
|
420
|
+
};
|
|
421
|
+
case 'polaroid':
|
|
422
|
+
return {
|
|
423
|
+
...base,
|
|
424
|
+
border: '8px solid #fff',
|
|
425
|
+
borderBottomWidth: '24px',
|
|
426
|
+
boxShadow: '0 6px 16px rgba(0,0,0,0.18)',
|
|
427
|
+
borderRadius: '2px'
|
|
428
|
+
};
|
|
429
|
+
default:
|
|
430
|
+
return base;
|
|
431
|
+
}
|
|
432
|
+
})();
|
|
433
|
+
const headingStyle = {
|
|
434
|
+
fontFamily: typography.headingFont,
|
|
435
|
+
fontWeight: Number(typography.headingWeight) || 700,
|
|
436
|
+
letterSpacing: typography.headingLetterSpacing,
|
|
437
|
+
textTransform: typography.headingTransform,
|
|
438
|
+
lineHeight: 1.15,
|
|
439
|
+
margin: 0
|
|
440
|
+
};
|
|
441
|
+
const footerStyleCss = choices.footerStyle === 'dark' ? {
|
|
442
|
+
background: palette.foreground,
|
|
443
|
+
color: palette.background
|
|
444
|
+
} : choices.footerStyle === 'full-color' ? {
|
|
445
|
+
background: palette.primary,
|
|
446
|
+
color: palette.primaryForeground
|
|
447
|
+
} : choices.footerStyle === 'gradient-top' ? {
|
|
448
|
+
background: palette.background,
|
|
449
|
+
color: palette.mutedForeground,
|
|
450
|
+
borderTop: '3px solid transparent',
|
|
451
|
+
borderImage: `linear-gradient(135deg, ${palette.gradientFrom}, ${palette.gradientVia}, ${palette.gradientTo}) 1`
|
|
452
|
+
} : choices.footerStyle === 'minimal' ? {
|
|
453
|
+
background: 'transparent',
|
|
454
|
+
color: palette.mutedForeground,
|
|
455
|
+
borderTop: `1px solid ${palette.border}`
|
|
456
|
+
} : {
|
|
457
|
+
background: palette.muted,
|
|
458
|
+
color: palette.mutedForeground,
|
|
459
|
+
borderTop: `1px solid ${palette.border}`
|
|
460
|
+
};
|
|
461
|
+
// With Payload's native Live Preview the real site is the preview: no mock.
|
|
462
|
+
if (nativePreview.isEnabled) {
|
|
463
|
+
if (nativePreview.isOpen) return null;
|
|
464
|
+
return /*#__PURE__*/ _jsxs("div", {
|
|
465
|
+
className: "tm-native-preview-hint",
|
|
466
|
+
children: [
|
|
467
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
468
|
+
className: "tm-native-preview-hint__text",
|
|
469
|
+
children: [
|
|
470
|
+
/*#__PURE__*/ _jsxs("span", {
|
|
471
|
+
className: "tm-native-preview-hint__title",
|
|
472
|
+
children: [
|
|
473
|
+
/*#__PURE__*/ _jsx(Sparkles, {
|
|
474
|
+
size: 14,
|
|
475
|
+
"aria-hidden": true
|
|
476
|
+
}),
|
|
477
|
+
t.nativeTitle
|
|
478
|
+
]
|
|
479
|
+
}),
|
|
480
|
+
/*#__PURE__*/ _jsx("span", {
|
|
481
|
+
className: "tm-native-preview-hint__body",
|
|
482
|
+
children: t.nativeBody
|
|
483
|
+
})
|
|
484
|
+
]
|
|
485
|
+
}),
|
|
486
|
+
/*#__PURE__*/ _jsxs("button", {
|
|
487
|
+
type: "button",
|
|
488
|
+
className: "tm-native-preview-hint__action",
|
|
489
|
+
onClick: nativePreview.open,
|
|
490
|
+
children: [
|
|
491
|
+
/*#__PURE__*/ _jsx(ExternalLink, {
|
|
492
|
+
size: 14,
|
|
493
|
+
"aria-hidden": true
|
|
494
|
+
}),
|
|
495
|
+
t.nativeOpen
|
|
496
|
+
]
|
|
497
|
+
})
|
|
498
|
+
]
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
return(// The slot spans the whole right column of the Appearance tab on wide admins;
|
|
502
|
+
// its inner panel is sticky so the preview stays in view while editing.
|
|
503
|
+
/*#__PURE__*/ _jsx("div", {
|
|
504
|
+
className: `tm-live-preview-slot ${uid}`,
|
|
505
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
506
|
+
className: "tm-live-preview",
|
|
507
|
+
children: [
|
|
508
|
+
/*#__PURE__*/ _jsx("style", {
|
|
509
|
+
dangerouslySetInnerHTML: {
|
|
510
|
+
__html: previewCSS
|
|
511
|
+
}
|
|
512
|
+
}),
|
|
513
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
514
|
+
style: {
|
|
515
|
+
display: 'flex',
|
|
516
|
+
alignItems: 'center',
|
|
517
|
+
justifyContent: 'space-between',
|
|
518
|
+
marginBottom: '8px',
|
|
519
|
+
gap: '8px',
|
|
520
|
+
flexWrap: 'wrap'
|
|
521
|
+
},
|
|
522
|
+
children: [
|
|
523
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
524
|
+
children: [
|
|
525
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
526
|
+
style: {
|
|
527
|
+
display: 'inline-flex',
|
|
528
|
+
alignItems: 'center',
|
|
529
|
+
gap: '6px',
|
|
530
|
+
fontSize: '13px',
|
|
531
|
+
fontWeight: 600,
|
|
532
|
+
color: 'var(--theme-elevation-800)'
|
|
533
|
+
},
|
|
534
|
+
children: [
|
|
535
|
+
/*#__PURE__*/ _jsx(Sparkles, {
|
|
536
|
+
size: 14,
|
|
537
|
+
"aria-hidden": true
|
|
538
|
+
}),
|
|
539
|
+
t.title
|
|
540
|
+
]
|
|
541
|
+
}),
|
|
542
|
+
/*#__PURE__*/ _jsx("div", {
|
|
543
|
+
style: {
|
|
544
|
+
fontSize: '12px',
|
|
545
|
+
color: 'var(--theme-elevation-600)'
|
|
546
|
+
},
|
|
547
|
+
children: t.subtitle
|
|
548
|
+
})
|
|
549
|
+
]
|
|
550
|
+
}),
|
|
551
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
552
|
+
style: {
|
|
553
|
+
display: 'inline-flex',
|
|
554
|
+
gap: '8px',
|
|
555
|
+
flexWrap: 'wrap'
|
|
556
|
+
},
|
|
557
|
+
children: [
|
|
558
|
+
/*#__PURE__*/ _jsx("div", {
|
|
559
|
+
role: "group",
|
|
560
|
+
"aria-label": t.viewport,
|
|
561
|
+
style: {
|
|
562
|
+
display: 'inline-flex',
|
|
563
|
+
borderRadius: '8px',
|
|
564
|
+
overflow: 'hidden',
|
|
565
|
+
border: '1px solid var(--theme-elevation-200)'
|
|
566
|
+
},
|
|
567
|
+
children: DEVICE_PREVIEWS.map((d)=>{
|
|
568
|
+
const Icon = DEVICE_ICONS[d.id];
|
|
569
|
+
return /*#__PURE__*/ _jsxs("button", {
|
|
570
|
+
type: "button",
|
|
571
|
+
"aria-pressed": device === d.id,
|
|
572
|
+
onClick: ()=>setDevice(d.id),
|
|
573
|
+
title: `${lang === 'cs' ? d.labelCs : d.label} — ${d.width}×${d.height}`,
|
|
574
|
+
style: {
|
|
575
|
+
display: 'inline-flex',
|
|
576
|
+
alignItems: 'center',
|
|
577
|
+
gap: '5px',
|
|
578
|
+
minHeight: '28px',
|
|
579
|
+
padding: '5px 10px',
|
|
580
|
+
fontSize: '12px',
|
|
581
|
+
fontWeight: 600,
|
|
582
|
+
cursor: 'pointer',
|
|
583
|
+
border: 'none',
|
|
584
|
+
background: device === d.id ? 'var(--theme-elevation-800)' : 'transparent',
|
|
585
|
+
color: device === d.id ? 'var(--theme-elevation-0)' : 'var(--theme-elevation-600)'
|
|
586
|
+
},
|
|
587
|
+
children: [
|
|
588
|
+
/*#__PURE__*/ _jsx(Icon, {
|
|
589
|
+
size: 13,
|
|
590
|
+
"aria-hidden": true
|
|
591
|
+
}),
|
|
592
|
+
lang === 'cs' ? d.labelCs : d.label
|
|
593
|
+
]
|
|
594
|
+
}, d.id);
|
|
595
|
+
})
|
|
596
|
+
}),
|
|
597
|
+
/*#__PURE__*/ _jsx("div", {
|
|
598
|
+
role: "group",
|
|
599
|
+
"aria-label": `${t.light} / ${t.dark}`,
|
|
600
|
+
style: {
|
|
601
|
+
display: 'inline-flex',
|
|
602
|
+
borderRadius: '8px',
|
|
603
|
+
overflow: 'hidden',
|
|
604
|
+
border: '1px solid var(--theme-elevation-200)'
|
|
605
|
+
},
|
|
606
|
+
children: [
|
|
607
|
+
'light',
|
|
608
|
+
'dark'
|
|
609
|
+
].map((m)=>{
|
|
610
|
+
const Icon = m === 'light' ? Sun : Moon;
|
|
611
|
+
return /*#__PURE__*/ _jsxs("button", {
|
|
612
|
+
type: "button",
|
|
613
|
+
"aria-pressed": mode === m,
|
|
614
|
+
onClick: ()=>setMode(m),
|
|
615
|
+
style: {
|
|
616
|
+
display: 'inline-flex',
|
|
617
|
+
alignItems: 'center',
|
|
618
|
+
gap: '5px',
|
|
619
|
+
minHeight: '28px',
|
|
620
|
+
padding: '5px 12px',
|
|
621
|
+
fontSize: '12px',
|
|
622
|
+
fontWeight: 600,
|
|
623
|
+
cursor: 'pointer',
|
|
624
|
+
border: 'none',
|
|
625
|
+
background: mode === m ? 'var(--theme-elevation-800)' : 'transparent',
|
|
626
|
+
color: mode === m ? 'var(--theme-elevation-0)' : 'var(--theme-elevation-600)'
|
|
627
|
+
},
|
|
628
|
+
children: [
|
|
629
|
+
/*#__PURE__*/ _jsx(Icon, {
|
|
630
|
+
size: 13,
|
|
631
|
+
"aria-hidden": true
|
|
632
|
+
}),
|
|
633
|
+
m === 'light' ? t.light : t.dark
|
|
634
|
+
]
|
|
635
|
+
}, m);
|
|
636
|
+
})
|
|
637
|
+
})
|
|
638
|
+
]
|
|
639
|
+
})
|
|
640
|
+
]
|
|
641
|
+
}),
|
|
642
|
+
/*#__PURE__*/ _jsx("div", {
|
|
643
|
+
style: {
|
|
644
|
+
display: 'flex',
|
|
645
|
+
justifyContent: 'center',
|
|
646
|
+
background: 'var(--theme-elevation-50)',
|
|
647
|
+
borderRadius: '14px',
|
|
648
|
+
padding: device === 'desktop' ? '0' : '16px'
|
|
649
|
+
},
|
|
650
|
+
children: /*#__PURE__*/ _jsxs("div", {
|
|
651
|
+
ref: (el)=>el?.setAttribute('inert', ''),
|
|
652
|
+
style: {
|
|
653
|
+
width: '100%',
|
|
654
|
+
maxWidth: device === 'desktop' ? '100%' : `${activeDevice.width}px`,
|
|
655
|
+
borderRadius: '14px',
|
|
656
|
+
overflow: 'hidden',
|
|
657
|
+
border: '1px solid var(--theme-elevation-200)',
|
|
658
|
+
boxShadow: '0 8px 24px rgba(0,0,0,0.10)',
|
|
659
|
+
background: palette.background,
|
|
660
|
+
color: palette.foreground,
|
|
661
|
+
fontFamily: typography.bodyFont,
|
|
662
|
+
lineHeight: typography.lineHeight
|
|
663
|
+
},
|
|
664
|
+
children: [
|
|
665
|
+
/*#__PURE__*/ _jsxs("nav", {
|
|
666
|
+
style: nav,
|
|
667
|
+
children: [
|
|
668
|
+
/*#__PURE__*/ _jsx("span", {
|
|
669
|
+
style: {
|
|
670
|
+
fontWeight: 700,
|
|
671
|
+
fontSize: '13px'
|
|
672
|
+
},
|
|
673
|
+
children: site.siteTitle
|
|
674
|
+
}),
|
|
675
|
+
/*#__PURE__*/ _jsxs("span", {
|
|
676
|
+
style: {
|
|
677
|
+
display: 'flex',
|
|
678
|
+
gap: '14px',
|
|
679
|
+
fontSize: '12px',
|
|
680
|
+
opacity: 0.85
|
|
681
|
+
},
|
|
682
|
+
children: [
|
|
683
|
+
/*#__PURE__*/ _jsx("span", {
|
|
684
|
+
children: site.nav.home
|
|
685
|
+
}),
|
|
686
|
+
/*#__PURE__*/ _jsx("span", {
|
|
687
|
+
children: site.nav.about
|
|
688
|
+
}),
|
|
689
|
+
/*#__PURE__*/ _jsx("span", {
|
|
690
|
+
style: {
|
|
691
|
+
...linkStyle(choices, palette)
|
|
692
|
+
},
|
|
693
|
+
children: site.nav.services
|
|
694
|
+
})
|
|
695
|
+
]
|
|
696
|
+
})
|
|
697
|
+
]
|
|
698
|
+
}),
|
|
699
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
700
|
+
style: {
|
|
701
|
+
padding: px(20, choices),
|
|
702
|
+
display: 'grid',
|
|
703
|
+
gap: px(14, choices)
|
|
704
|
+
},
|
|
705
|
+
children: [
|
|
706
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
707
|
+
children: [
|
|
708
|
+
/*#__PURE__*/ _jsx("div", {
|
|
709
|
+
style: {
|
|
710
|
+
...headingStyle,
|
|
711
|
+
fontSize: '24px'
|
|
712
|
+
},
|
|
713
|
+
children: t.heading
|
|
714
|
+
}),
|
|
715
|
+
/*#__PURE__*/ _jsxs("p", {
|
|
716
|
+
style: {
|
|
717
|
+
margin: `${px(6, choices)} 0 0`,
|
|
718
|
+
fontSize: `calc(${typography.baseFontSize} * 0.8125)`,
|
|
719
|
+
lineHeight: typography.lineHeight,
|
|
720
|
+
color: palette.mutedForeground,
|
|
721
|
+
maxWidth: '60ch'
|
|
722
|
+
},
|
|
723
|
+
children: [
|
|
724
|
+
t.body,
|
|
725
|
+
/*#__PURE__*/ _jsx("a", {
|
|
726
|
+
style: linkStyle(choices, palette),
|
|
727
|
+
children: t.link
|
|
728
|
+
}),
|
|
729
|
+
"."
|
|
730
|
+
]
|
|
731
|
+
})
|
|
732
|
+
]
|
|
733
|
+
}),
|
|
734
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
735
|
+
style: {
|
|
736
|
+
display: 'grid',
|
|
737
|
+
gridTemplateColumns: device === 'mobile' ? '1fr' : 'minmax(0, 3fr) minmax(0, 2fr)',
|
|
738
|
+
gap: px(12, choices),
|
|
739
|
+
alignItems: 'start'
|
|
740
|
+
},
|
|
741
|
+
children: [
|
|
742
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
743
|
+
className: "tm-prev-card",
|
|
744
|
+
style: card,
|
|
745
|
+
children: [
|
|
746
|
+
/*#__PURE__*/ _jsx("div", {
|
|
747
|
+
style: {
|
|
748
|
+
...headingStyle,
|
|
749
|
+
fontSize: '15px',
|
|
750
|
+
marginBottom: px(6, choices)
|
|
751
|
+
},
|
|
752
|
+
children: t.cardTitle
|
|
753
|
+
}),
|
|
754
|
+
/*#__PURE__*/ _jsx("p", {
|
|
755
|
+
style: {
|
|
756
|
+
margin: `0 0 ${px(12, choices)}`,
|
|
757
|
+
fontSize: `calc(${typography.baseFontSize} * 0.75)`,
|
|
758
|
+
lineHeight: typography.lineHeight,
|
|
759
|
+
color: palette.cardForeground,
|
|
760
|
+
opacity: 0.8
|
|
761
|
+
},
|
|
762
|
+
children: t.cardBody
|
|
763
|
+
}),
|
|
764
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
765
|
+
style: {
|
|
766
|
+
display: 'flex',
|
|
767
|
+
gap: '8px',
|
|
768
|
+
alignItems: 'center',
|
|
769
|
+
flexWrap: 'wrap'
|
|
770
|
+
},
|
|
771
|
+
children: [
|
|
772
|
+
/*#__PURE__*/ _jsx("button", {
|
|
773
|
+
type: "button",
|
|
774
|
+
className: "tm-prev-btn",
|
|
775
|
+
style: btn,
|
|
776
|
+
children: t.primary
|
|
777
|
+
}),
|
|
778
|
+
/*#__PURE__*/ _jsx("button", {
|
|
779
|
+
type: "button",
|
|
780
|
+
style: {
|
|
781
|
+
...BUTTON_SIZE_MAP[choices.buttonSize] ?? BUTTON_SIZE_MAP.medium,
|
|
782
|
+
fontWeight: 600,
|
|
783
|
+
cursor: 'pointer',
|
|
784
|
+
borderRadius: choices.buttonVariant === 'pill' ? '9999px' : radius,
|
|
785
|
+
background: palette.secondary,
|
|
786
|
+
color: palette.secondaryForeground,
|
|
787
|
+
border: 'none'
|
|
788
|
+
},
|
|
789
|
+
children: t.secondary
|
|
790
|
+
})
|
|
791
|
+
]
|
|
792
|
+
})
|
|
793
|
+
]
|
|
794
|
+
}),
|
|
795
|
+
/*#__PURE__*/ _jsx("div", {
|
|
796
|
+
"aria-hidden": true,
|
|
797
|
+
style: imageCss
|
|
798
|
+
})
|
|
799
|
+
]
|
|
800
|
+
})
|
|
801
|
+
]
|
|
802
|
+
}),
|
|
803
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
804
|
+
style: {
|
|
805
|
+
padding: `${px(12, choices)} ${px(16, choices)}`,
|
|
806
|
+
fontSize: '11px',
|
|
807
|
+
...footerStyleCss
|
|
808
|
+
},
|
|
809
|
+
children: [
|
|
810
|
+
"© ",
|
|
811
|
+
new Date().getFullYear(),
|
|
812
|
+
" ",
|
|
813
|
+
site.siteTitle,
|
|
814
|
+
" — ",
|
|
815
|
+
t.footer
|
|
816
|
+
]
|
|
817
|
+
})
|
|
818
|
+
]
|
|
819
|
+
})
|
|
820
|
+
})
|
|
821
|
+
]
|
|
822
|
+
})
|
|
823
|
+
}));
|
|
824
|
+
}
|
|
825
|
+
|
|
826
|
+
//# sourceMappingURL=AppearancePreviewField.js.map
|