@kilivi/payloadcms-theme-management 0.5.9 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/README.md +531 -40
  2. package/dist/app/api/google-fonts/route.d.ts +31 -0
  3. package/dist/app/api/google-fonts/route.d.ts.map +1 -0
  4. package/dist/app/api/google-fonts/route.js +925 -0
  5. package/dist/app/api/google-fonts/route.js.map +1 -0
  6. package/dist/fields/ThemePreviewField.d.ts.map +1 -1
  7. package/dist/fields/ThemePreviewField.js +6 -2
  8. package/dist/fields/ThemePreviewField.js.map +1 -1
  9. package/dist/fields/themeConfigurationField.d.ts.map +1 -1
  10. package/dist/fields/themeConfigurationField.js +16 -8
  11. package/dist/fields/themeConfigurationField.js.map +1 -1
  12. package/dist/globals/ThemeSettings/FontPicker/FontPreview.d.ts +17 -0
  13. package/dist/globals/ThemeSettings/FontPicker/FontPreview.d.ts.map +1 -0
  14. package/dist/globals/ThemeSettings/FontPicker/FontPreview.js +229 -0
  15. package/dist/globals/ThemeSettings/FontPicker/FontPreview.js.map +1 -0
  16. package/dist/globals/ThemeSettings/FontPicker/PreviewContent.d.ts +20 -0
  17. package/dist/globals/ThemeSettings/FontPicker/PreviewContent.d.ts.map +1 -0
  18. package/dist/globals/ThemeSettings/FontPicker/PreviewContent.js +400 -0
  19. package/dist/globals/ThemeSettings/FontPicker/PreviewContent.js.map +1 -0
  20. package/dist/globals/ThemeSettings/FontPicker/index.d.ts +25 -0
  21. package/dist/globals/ThemeSettings/FontPicker/index.d.ts.map +1 -0
  22. package/dist/globals/ThemeSettings/FontPicker/index.js +483 -0
  23. package/dist/globals/ThemeSettings/FontPicker/index.js.map +1 -0
  24. package/dist/globals/ThemeSettings/FontPicker/styles.css +337 -0
  25. package/dist/globals/ThemeSettings/FontPicker/translations.d.ts +76 -0
  26. package/dist/globals/ThemeSettings/FontPicker/translations.d.ts.map +1 -0
  27. package/dist/globals/ThemeSettings/FontPicker/translations.js +147 -0
  28. package/dist/globals/ThemeSettings/FontPicker/translations.js.map +1 -0
  29. package/dist/globals/ThemeSettings/config.d.ts +10 -0
  30. package/dist/globals/ThemeSettings/config.d.ts.map +1 -0
  31. package/dist/globals/ThemeSettings/config.js +171 -0
  32. package/dist/globals/ThemeSettings/config.js.map +1 -0
  33. package/dist/globals/ThemeSettings/fields/FontLoadingGuideField.d.ts +5 -0
  34. package/dist/globals/ThemeSettings/fields/FontLoadingGuideField.d.ts.map +1 -0
  35. package/dist/globals/ThemeSettings/fields/FontLoadingGuideField.js +177 -0
  36. package/dist/globals/ThemeSettings/fields/FontLoadingGuideField.js.map +1 -0
  37. package/dist/globals/ThemeSettings/fields/TypographyInfoField.d.ts +5 -0
  38. package/dist/globals/ThemeSettings/fields/TypographyInfoField.d.ts.map +1 -0
  39. package/dist/globals/ThemeSettings/fields/TypographyInfoField.js +89 -0
  40. package/dist/globals/ThemeSettings/fields/TypographyInfoField.js.map +1 -0
  41. package/dist/globals/ThemeSettings/index.d.ts +4 -0
  42. package/dist/globals/ThemeSettings/index.d.ts.map +1 -0
  43. package/dist/globals/ThemeSettings/index.js +4 -0
  44. package/dist/globals/ThemeSettings/index.js.map +1 -0
  45. package/dist/index.d.ts.map +1 -1
  46. package/dist/index.js +119 -20
  47. package/dist/index.js.map +1 -1
  48. package/dist/types.d.ts +9 -1
  49. package/dist/types.d.ts.map +1 -1
  50. package/dist/types.js.map +1 -1
  51. package/dist/utilities/getThemeSettings.d.ts +34 -0
  52. package/dist/utilities/getThemeSettings.d.ts.map +1 -0
  53. package/dist/utilities/getThemeSettings.js +67 -0
  54. package/dist/utilities/getThemeSettings.js.map +1 -0
  55. package/package.json +24 -23
  56. package/LICENSE.MD +0 -9
@@ -0,0 +1,229 @@
1
+ 'use client';
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import React, { useEffect, useRef } from 'react';
4
+ /**
5
+ * FontPreview component with Shadow DOM isolation
6
+ *
7
+ * This component renders font previews in an isolated Shadow DOM
8
+ * to prevent Payload CMS admin styles from affecting the preview.
9
+ */ export const FontPreview = ({ font, variant, text, onLoad })=>{
10
+ const shadowHostRef = useRef(null);
11
+ const shadowRootRef = useRef(null);
12
+ const fontLoadedRef = useRef(false);
13
+ useEffect(()=>{
14
+ if (!shadowHostRef.current) return;
15
+ // Create Shadow DOM if not already created
16
+ if (!shadowRootRef.current) {
17
+ shadowRootRef.current = shadowHostRef.current.attachShadow({
18
+ mode: 'open'
19
+ });
20
+ }
21
+ const shadowRoot = shadowRootRef.current;
22
+ // Get font weights
23
+ const weights = font.variants.filter((v)=>!v.includes('italic')).join(';');
24
+ const fontFamily = font.family;
25
+ // Load font CSS
26
+ const loadFont = async ()=>{
27
+ if (fontLoadedRef.current) return;
28
+ try {
29
+ // Create font face CSS
30
+ const fontUrl = `https://fonts.googleapis.com/css2?family=${encodeURIComponent(fontFamily)}:wght@${weights}&display=swap`;
31
+ // Check if font is already loaded
32
+ const link = document.createElement('link');
33
+ link.rel = 'stylesheet';
34
+ link.href = fontUrl;
35
+ // Wait for font to load
36
+ link.onload = ()=>{
37
+ fontLoadedRef.current = true;
38
+ onLoad?.();
39
+ };
40
+ // Add link to shadow root
41
+ shadowRoot.appendChild(link);
42
+ } catch (error) {
43
+ console.error('Error loading font:', error);
44
+ }
45
+ };
46
+ loadFont();
47
+ // Render preview based on variant
48
+ const renderPreview = ()=>{
49
+ const container = document.createElement('div');
50
+ container.style.cssText = `
51
+ font-family: '${fontFamily}', sans-serif;
52
+ color: inherit;
53
+ margin: 0;
54
+ padding: 0;
55
+ `;
56
+ let content;
57
+ switch(variant){
58
+ case 'h1':
59
+ content = document.createElement('h1');
60
+ content.style.cssText = `
61
+ font-size: 48px;
62
+ font-weight: 700;
63
+ line-height: 1.2;
64
+ margin: 0;
65
+ `;
66
+ content.textContent = text || font.family;
67
+ break;
68
+ case 'h2':
69
+ content = document.createElement('h2');
70
+ content.style.cssText = `
71
+ font-size: 36px;
72
+ font-weight: 600;
73
+ line-height: 1.3;
74
+ margin: 0;
75
+ `;
76
+ content.textContent = text || font.family;
77
+ break;
78
+ case 'h3':
79
+ content = document.createElement('h3');
80
+ content.style.cssText = `
81
+ font-size: 24px;
82
+ font-weight: 500;
83
+ line-height: 1.4;
84
+ margin: 0;
85
+ `;
86
+ content.textContent = text || font.family;
87
+ break;
88
+ case 'body':
89
+ content = document.createElement('p');
90
+ content.style.cssText = `
91
+ font-size: 16px;
92
+ font-weight: 400;
93
+ line-height: 1.6;
94
+ margin: 0;
95
+ `;
96
+ content.textContent = text || font.family;
97
+ break;
98
+ case 'small':
99
+ content = document.createElement('p');
100
+ content.style.cssText = `
101
+ font-size: 14px;
102
+ font-weight: 400;
103
+ line-height: 1.5;
104
+ margin: 0;
105
+ `;
106
+ content.textContent = text || font.family;
107
+ break;
108
+ case 'chars':
109
+ content = document.createElement('div');
110
+ content.style.cssText = `
111
+ font-size: 18px;
112
+ font-weight: 400;
113
+ line-height: 1.5;
114
+ margin: 0;
115
+ `;
116
+ content.textContent = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz 0123456789';
117
+ break;
118
+ case 'weights':
119
+ content = document.createElement('div');
120
+ content.style.cssText = `margin: 0;`;
121
+ const availableWeights = font.variants.filter((v)=>!v.includes('italic')).map((v)=>parseInt(v)).filter((w)=>!isNaN(w)).sort((a, b)=>a - b);
122
+ availableWeights.forEach((weight)=>{
123
+ const line = document.createElement('div');
124
+ line.style.cssText = `
125
+ font-size: 16px;
126
+ font-weight: ${weight};
127
+ line-height: 1.8;
128
+ margin: 4px 0;
129
+ `;
130
+ line.textContent = `${weight} - The quick brown fox jumps over the lazy dog`;
131
+ content.appendChild(line);
132
+ });
133
+ break;
134
+ case 'card':
135
+ content = document.createElement('div');
136
+ content.style.cssText = `
137
+ padding: 16px;
138
+ background: var(--theme-bg, #ffffff);
139
+ border: 1px solid var(--theme-border, #e5e7eb);
140
+ border-radius: 8px;
141
+ margin: 0;
142
+ `;
143
+ const title = document.createElement('h3');
144
+ title.style.cssText = `
145
+ font-size: 20px;
146
+ font-weight: 600;
147
+ margin: 0 0 8px 0;
148
+ `;
149
+ title.textContent = font.family;
150
+ const description = document.createElement('p');
151
+ description.style.cssText = `
152
+ font-size: 14px;
153
+ font-weight: 400;
154
+ line-height: 1.5;
155
+ margin: 0;
156
+ color: var(--theme-text-secondary, #6b7280);
157
+ `;
158
+ description.textContent = text || 'The quick brown fox jumps over the lazy dog';
159
+ content.appendChild(title);
160
+ content.appendChild(description);
161
+ break;
162
+ case 'row':
163
+ content = document.createElement('div');
164
+ content.style.cssText = `
165
+ display: flex;
166
+ align-items: center;
167
+ gap: 16px;
168
+ padding: 12px 16px;
169
+ margin: 0;
170
+ `;
171
+ const nameSpan = document.createElement('span');
172
+ nameSpan.style.cssText = `
173
+ font-size: 16px;
174
+ font-weight: 500;
175
+ min-width: 150px;
176
+ `;
177
+ nameSpan.textContent = font.family;
178
+ const sampleSpan = document.createElement('span');
179
+ sampleSpan.style.cssText = `
180
+ font-size: 16px;
181
+ font-weight: 400;
182
+ flex: 1;
183
+ opacity: 0.7;
184
+ `;
185
+ sampleSpan.textContent = text || 'The quick brown fox jumps over the lazy dog';
186
+ content.appendChild(nameSpan);
187
+ content.appendChild(sampleSpan);
188
+ break;
189
+ case 'name':
190
+ default:
191
+ content = document.createElement('span');
192
+ content.style.cssText = `
193
+ font-size: 16px;
194
+ font-weight: 500;
195
+ margin: 0;
196
+ `;
197
+ content.textContent = font.family;
198
+ break;
199
+ }
200
+ container.appendChild(content);
201
+ return container;
202
+ };
203
+ // Clear previous content
204
+ shadowRoot.innerHTML = '';
205
+ // Render preview
206
+ const preview = renderPreview();
207
+ shadowRoot.appendChild(preview);
208
+ // Cleanup
209
+ return ()=>{
210
+ if (shadowRoot) {
211
+ shadowRoot.innerHTML = '';
212
+ }
213
+ };
214
+ }, [
215
+ font,
216
+ variant,
217
+ text,
218
+ onLoad
219
+ ]);
220
+ return /*#__PURE__*/ _jsx("div", {
221
+ ref: shadowHostRef,
222
+ style: {
223
+ width: '100%',
224
+ minHeight: '20px'
225
+ }
226
+ });
227
+ };
228
+
229
+ //# sourceMappingURL=FontPreview.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/globals/ThemeSettings/FontPicker/FontPreview.tsx"],"sourcesContent":["'use client'\n\nimport React, { useEffect, useRef } from 'react'\nimport type { GoogleFont } from '../../../app/api/google-fonts/route'\n\nexport type PreviewVariant =\n | 'h1'\n | 'h2'\n | 'h3'\n | 'body'\n | 'small'\n | 'chars'\n | 'weights'\n | 'card'\n | 'row'\n | 'name'\n\nexport interface FontPreviewProps {\n font: GoogleFont\n variant: PreviewVariant\n text?: string\n onLoad?: () => void\n}\n\n/**\n * FontPreview component with Shadow DOM isolation\n *\n * This component renders font previews in an isolated Shadow DOM\n * to prevent Payload CMS admin styles from affecting the preview.\n */\nexport const FontPreview: React.FC<FontPreviewProps> = ({ font, variant, text, onLoad }) => {\n const shadowHostRef = useRef<HTMLDivElement>(null)\n const shadowRootRef = useRef<ShadowRoot | null>(null)\n const fontLoadedRef = useRef(false)\n\n useEffect(() => {\n if (!shadowHostRef.current) return\n\n // Create Shadow DOM if not already created\n if (!shadowRootRef.current) {\n shadowRootRef.current = shadowHostRef.current.attachShadow({ mode: 'open' })\n }\n\n const shadowRoot = shadowRootRef.current\n\n // Get font weights\n const weights = font.variants.filter((v) => !v.includes('italic')).join(';')\n const fontFamily = font.family\n\n // Load font CSS\n const loadFont = async () => {\n if (fontLoadedRef.current) return\n\n try {\n // Create font face CSS\n const fontUrl = `https://fonts.googleapis.com/css2?family=${encodeURIComponent(\n fontFamily,\n )}:wght@${weights}&display=swap`\n\n // Check if font is already loaded\n const link = document.createElement('link')\n link.rel = 'stylesheet'\n link.href = fontUrl\n\n // Wait for font to load\n link.onload = () => {\n fontLoadedRef.current = true\n onLoad?.()\n }\n\n // Add link to shadow root\n shadowRoot.appendChild(link)\n } catch (error) {\n console.error('Error loading font:', error)\n }\n }\n\n loadFont()\n\n // Render preview based on variant\n const renderPreview = () => {\n const container = document.createElement('div')\n container.style.cssText = `\n font-family: '${fontFamily}', sans-serif;\n color: inherit;\n margin: 0;\n padding: 0;\n `\n\n let content: HTMLElement\n\n switch (variant) {\n case 'h1':\n content = document.createElement('h1')\n content.style.cssText = `\n font-size: 48px;\n font-weight: 700;\n line-height: 1.2;\n margin: 0;\n `\n content.textContent = text || font.family\n break\n\n case 'h2':\n content = document.createElement('h2')\n content.style.cssText = `\n font-size: 36px;\n font-weight: 600;\n line-height: 1.3;\n margin: 0;\n `\n content.textContent = text || font.family\n break\n\n case 'h3':\n content = document.createElement('h3')\n content.style.cssText = `\n font-size: 24px;\n font-weight: 500;\n line-height: 1.4;\n margin: 0;\n `\n content.textContent = text || font.family\n break\n\n case 'body':\n content = document.createElement('p')\n content.style.cssText = `\n font-size: 16px;\n font-weight: 400;\n line-height: 1.6;\n margin: 0;\n `\n content.textContent = text || font.family\n break\n\n case 'small':\n content = document.createElement('p')\n content.style.cssText = `\n font-size: 14px;\n font-weight: 400;\n line-height: 1.5;\n margin: 0;\n `\n content.textContent = text || font.family\n break\n\n case 'chars':\n content = document.createElement('div')\n content.style.cssText = `\n font-size: 18px;\n font-weight: 400;\n line-height: 1.5;\n margin: 0;\n `\n content.textContent = 'AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz 0123456789'\n break\n\n case 'weights':\n content = document.createElement('div')\n content.style.cssText = `margin: 0;`\n const availableWeights = font.variants\n .filter((v) => !v.includes('italic'))\n .map((v) => parseInt(v))\n .filter((w) => !isNaN(w))\n .sort((a, b) => a - b)\n\n availableWeights.forEach((weight) => {\n const line = document.createElement('div')\n line.style.cssText = `\n font-size: 16px;\n font-weight: ${weight};\n line-height: 1.8;\n margin: 4px 0;\n `\n line.textContent = `${weight} - The quick brown fox jumps over the lazy dog`\n content.appendChild(line)\n })\n break\n\n case 'card':\n content = document.createElement('div')\n content.style.cssText = `\n padding: 16px;\n background: var(--theme-bg, #ffffff);\n border: 1px solid var(--theme-border, #e5e7eb);\n border-radius: 8px;\n margin: 0;\n `\n const title = document.createElement('h3')\n title.style.cssText = `\n font-size: 20px;\n font-weight: 600;\n margin: 0 0 8px 0;\n `\n title.textContent = font.family\n const description = document.createElement('p')\n description.style.cssText = `\n font-size: 14px;\n font-weight: 400;\n line-height: 1.5;\n margin: 0;\n color: var(--theme-text-secondary, #6b7280);\n `\n description.textContent = text || 'The quick brown fox jumps over the lazy dog'\n content.appendChild(title)\n content.appendChild(description)\n break\n\n case 'row':\n content = document.createElement('div')\n content.style.cssText = `\n display: flex;\n align-items: center;\n gap: 16px;\n padding: 12px 16px;\n margin: 0;\n `\n const nameSpan = document.createElement('span')\n nameSpan.style.cssText = `\n font-size: 16px;\n font-weight: 500;\n min-width: 150px;\n `\n nameSpan.textContent = font.family\n const sampleSpan = document.createElement('span')\n sampleSpan.style.cssText = `\n font-size: 16px;\n font-weight: 400;\n flex: 1;\n opacity: 0.7;\n `\n sampleSpan.textContent = text || 'The quick brown fox jumps over the lazy dog'\n content.appendChild(nameSpan)\n content.appendChild(sampleSpan)\n break\n\n case 'name':\n default:\n content = document.createElement('span')\n content.style.cssText = `\n font-size: 16px;\n font-weight: 500;\n margin: 0;\n `\n content.textContent = font.family\n break\n }\n\n container.appendChild(content)\n return container\n }\n\n // Clear previous content\n shadowRoot.innerHTML = ''\n\n // Render preview\n const preview = renderPreview()\n shadowRoot.appendChild(preview)\n\n // Cleanup\n return () => {\n if (shadowRoot) {\n shadowRoot.innerHTML = ''\n }\n }\n }, [font, variant, text, onLoad])\n\n return <div ref={shadowHostRef} style={{ width: '100%', minHeight: '20px' }} />\n}\n"],"names":["React","useEffect","useRef","FontPreview","font","variant","text","onLoad","shadowHostRef","shadowRootRef","fontLoadedRef","current","attachShadow","mode","shadowRoot","weights","variants","filter","v","includes","join","fontFamily","family","loadFont","fontUrl","encodeURIComponent","link","document","createElement","rel","href","onload","appendChild","error","console","renderPreview","container","style","cssText","content","textContent","availableWeights","map","parseInt","w","isNaN","sort","a","b","forEach","weight","line","title","description","nameSpan","sampleSpan","innerHTML","preview","div","ref","width","minHeight"],"mappings":"AAAA;;AAEA,OAAOA,SAASC,SAAS,EAAEC,MAAM,QAAQ,QAAO;AAsBhD;;;;;CAKC,GACD,OAAO,MAAMC,cAA0C,CAAC,EAAEC,IAAI,EAAEC,OAAO,EAAEC,IAAI,EAAEC,MAAM,EAAE;IACrF,MAAMC,gBAAgBN,OAAuB;IAC7C,MAAMO,gBAAgBP,OAA0B;IAChD,MAAMQ,gBAAgBR,OAAO;IAE7BD,UAAU;QACR,IAAI,CAACO,cAAcG,OAAO,EAAE;QAE5B,2CAA2C;QAC3C,IAAI,CAACF,cAAcE,OAAO,EAAE;YAC1BF,cAAcE,OAAO,GAAGH,cAAcG,OAAO,CAACC,YAAY,CAAC;gBAAEC,MAAM;YAAO;QAC5E;QAEA,MAAMC,aAAaL,cAAcE,OAAO;QAExC,mBAAmB;QACnB,MAAMI,UAAUX,KAAKY,QAAQ,CAACC,MAAM,CAAC,CAACC,IAAM,CAACA,EAAEC,QAAQ,CAAC,WAAWC,IAAI,CAAC;QACxE,MAAMC,aAAajB,KAAKkB,MAAM;QAE9B,gBAAgB;QAChB,MAAMC,WAAW;YACf,IAAIb,cAAcC,OAAO,EAAE;YAE3B,IAAI;gBACF,uBAAuB;gBACvB,MAAMa,UAAU,CAAC,yCAAyC,EAAEC,mBAC1DJ,YACA,MAAM,EAAEN,QAAQ,aAAa,CAAC;gBAEhC,kCAAkC;gBAClC,MAAMW,OAAOC,SAASC,aAAa,CAAC;gBACpCF,KAAKG,GAAG,GAAG;gBACXH,KAAKI,IAAI,GAAGN;gBAEZ,wBAAwB;gBACxBE,KAAKK,MAAM,GAAG;oBACZrB,cAAcC,OAAO,GAAG;oBACxBJ;gBACF;gBAEA,0BAA0B;gBAC1BO,WAAWkB,WAAW,CAACN;YACzB,EAAE,OAA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a,CAAC;oBACxC0B,SAASjB,KAAK,CAACC,OAAO,GAAG,CAAC;;;;UAI1B,CAAC;oBACDgB,SAASd,WAAW,GAAGpC,KAAKkB,MAAM;oBAClC,MAAMiC,aAAa5B,SAASC,aAAa,CAAC;oBAC1C2B,WAAWlB,KAAK,CAACC,OAAO,GAAG,CAAC;;;;;UAK5B,CAAC;oBACDiB,WAAWf,WAAW,GAAGlC,QAAQ;oBACjCiC,QAAQP,WAAW,CAACsB;oBACpBf,QAAQP,WAAW,CAACuB;oBACpB;gBAEF,KAAK;gBACL;oBACEhB,UAAUZ,SAASC,aAAa,CAAC;oBACjCW,QAAQF,KAAK,CAACC,OAAO,GAAG,CAAC;;;;UAIzB,CAAC;oBACDC,QAAQC,WAAW,GAAGpC,KAAKkB,MAAM;oBACjC;YACJ;YAEAc,UAAUJ,WAAW,CAACO;YACtB,OAAOH;QACT;QAEA,yBAAyB;QACzBtB,WAAW0C,SAAS,GAAG;QAEvB,iBAAiB;QACjB,MAAMC,UAAUtB;QAChBrB,WAAWkB,WAAW,CAACyB;QAEvB,UAAU;QACV,OAAO;YACL,IAAI3C,YAAY;gBACdA,WAAW0C,SAAS,GAAG;YACzB;QACF;IACF,GAAG;QAACpD;QAAMC;QAASC;QAAMC;KAAO;IAEhC,qBAAO,KAACmD;QAAIC,KAAKnD;QAAe6B,OAAO;YAAEuB,OAAO;YAAQC,WAAW;QAAO;;AAC5E,EAAC"}
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import type { GoogleFont } from '../../../app/api/google-fonts/route';
3
+ import type { Translations } from './translations';
4
+ export type PreviewTab = 'typography' | 'blog' | 'landing' | 'ui';
5
+ export interface PreviewContentProps {
6
+ font: GoogleFont | null;
7
+ activeTab: PreviewTab;
8
+ translations: Translations;
9
+ }
10
+ /**
11
+ * PreviewContent component
12
+ *
13
+ * Displays different preview modes for the selected font:
14
+ * - Typography: Headers and body text with different weights
15
+ * - Blog Post: Simulated blog post layout
16
+ * - Landing Page: Hero section with CTA
17
+ * - UI Elements: Buttons, inputs, and links
18
+ */
19
+ export declare const PreviewContent: React.FC<PreviewContentProps>;
20
+ //# sourceMappingURL=PreviewContent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PreviewContent.d.ts","sourceRoot":"","sources":["../../../../src/globals/ThemeSettings/FontPicker/PreviewContent.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAA;AAErE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD,MAAM,MAAM,UAAU,GAAG,YAAY,GAAG,MAAM,GAAG,SAAS,GAAG,IAAI,CAAA;AAEjE,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,UAAU,GAAG,IAAI,CAAA;IACvB,SAAS,EAAE,UAAU,CAAA;IACrB,YAAY,EAAE,YAAY,CAAA;CAC3B;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,EAAE,KAAK,CAAC,EAAE,CAAC,mBAAmB,CAuRxD,CAAA"}
@@ -0,0 +1,400 @@
1
+ 'use client';
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import React from 'react';
4
+ import { FontPreview } from './FontPreview';
5
+ /**
6
+ * PreviewContent component
7
+ *
8
+ * Displays different preview modes for the selected font:
9
+ * - Typography: Headers and body text with different weights
10
+ * - Blog Post: Simulated blog post layout
11
+ * - Landing Page: Hero section with CTA
12
+ * - UI Elements: Buttons, inputs, and links
13
+ */ export const PreviewContent = ({ font, activeTab, translations })=>{
14
+ if (!font) {
15
+ return /*#__PURE__*/ _jsx("div", {
16
+ style: {
17
+ padding: '40px',
18
+ textAlign: 'center',
19
+ color: 'var(--theme-elevation-400)'
20
+ },
21
+ children: translations.selectFont
22
+ });
23
+ }
24
+ const renderTypography = ()=>/*#__PURE__*/ _jsxs("div", {
25
+ style: {
26
+ padding: '24px'
27
+ },
28
+ children: [
29
+ /*#__PURE__*/ _jsxs("div", {
30
+ style: {
31
+ marginBottom: '32px'
32
+ },
33
+ children: [
34
+ /*#__PURE__*/ _jsxs("div", {
35
+ style: {
36
+ fontSize: '12px',
37
+ fontWeight: 600,
38
+ textTransform: 'uppercase',
39
+ letterSpacing: '0.05em',
40
+ color: 'var(--theme-elevation-500)',
41
+ marginBottom: '8px'
42
+ },
43
+ children: [
44
+ translations.typography.h1.split(' ')[0],
45
+ " (H1)"
46
+ ]
47
+ }),
48
+ /*#__PURE__*/ _jsx(FontPreview, {
49
+ font: font,
50
+ variant: "h1",
51
+ text: translations.typography.h1
52
+ })
53
+ ]
54
+ }),
55
+ /*#__PURE__*/ _jsxs("div", {
56
+ style: {
57
+ marginBottom: '32px'
58
+ },
59
+ children: [
60
+ /*#__PURE__*/ _jsxs("div", {
61
+ style: {
62
+ fontSize: '12px',
63
+ fontWeight: 600,
64
+ textTransform: 'uppercase',
65
+ letterSpacing: '0.05em',
66
+ color: 'var(--theme-elevation-500)',
67
+ marginBottom: '8px'
68
+ },
69
+ children: [
70
+ translations.typography.h2.split(' ')[0],
71
+ " (H2)"
72
+ ]
73
+ }),
74
+ /*#__PURE__*/ _jsx(FontPreview, {
75
+ font: font,
76
+ variant: "h2",
77
+ text: translations.typography.h2
78
+ })
79
+ ]
80
+ }),
81
+ /*#__PURE__*/ _jsxs("div", {
82
+ style: {
83
+ marginBottom: '32px'
84
+ },
85
+ children: [
86
+ /*#__PURE__*/ _jsxs("div", {
87
+ style: {
88
+ fontSize: '12px',
89
+ fontWeight: 600,
90
+ textTransform: 'uppercase',
91
+ letterSpacing: '0.05em',
92
+ color: 'var(--theme-elevation-500)',
93
+ marginBottom: '8px'
94
+ },
95
+ children: [
96
+ translations.typography.h3.split(' ')[0],
97
+ " (H3)"
98
+ ]
99
+ }),
100
+ /*#__PURE__*/ _jsx(FontPreview, {
101
+ font: font,
102
+ variant: "h3",
103
+ text: translations.typography.h3
104
+ })
105
+ ]
106
+ }),
107
+ /*#__PURE__*/ _jsxs("div", {
108
+ style: {
109
+ marginBottom: '32px'
110
+ },
111
+ children: [
112
+ /*#__PURE__*/ _jsx("div", {
113
+ style: {
114
+ fontSize: '12px',
115
+ fontWeight: 600,
116
+ textTransform: 'uppercase',
117
+ letterSpacing: '0.05em',
118
+ color: 'var(--theme-elevation-500)',
119
+ marginBottom: '8px'
120
+ },
121
+ children: "Body"
122
+ }),
123
+ /*#__PURE__*/ _jsx(FontPreview, {
124
+ font: font,
125
+ variant: "body",
126
+ text: translations.typography.body
127
+ })
128
+ ]
129
+ }),
130
+ /*#__PURE__*/ _jsxs("div", {
131
+ style: {
132
+ marginBottom: '32px'
133
+ },
134
+ children: [
135
+ /*#__PURE__*/ _jsx("div", {
136
+ style: {
137
+ fontSize: '12px',
138
+ fontWeight: 600,
139
+ textTransform: 'uppercase',
140
+ letterSpacing: '0.05em',
141
+ color: 'var(--theme-elevation-500)',
142
+ marginBottom: '8px'
143
+ },
144
+ children: "Small"
145
+ }),
146
+ /*#__PURE__*/ _jsx(FontPreview, {
147
+ font: font,
148
+ variant: "small",
149
+ text: translations.typography.small
150
+ })
151
+ ]
152
+ }),
153
+ /*#__PURE__*/ _jsxs("div", {
154
+ children: [
155
+ /*#__PURE__*/ _jsx("div", {
156
+ style: {
157
+ fontSize: '12px',
158
+ fontWeight: 600,
159
+ textTransform: 'uppercase',
160
+ letterSpacing: '0.05em',
161
+ color: 'var(--theme-elevation-500)',
162
+ marginBottom: '8px'
163
+ },
164
+ children: "Characters"
165
+ }),
166
+ /*#__PURE__*/ _jsx(FontPreview, {
167
+ font: font,
168
+ variant: "chars"
169
+ })
170
+ ]
171
+ })
172
+ ]
173
+ });
174
+ const renderBlog = ()=>/*#__PURE__*/ _jsxs("div", {
175
+ style: {
176
+ padding: '24px',
177
+ maxWidth: '700px',
178
+ margin: '0 auto'
179
+ },
180
+ children: [
181
+ /*#__PURE__*/ _jsx("div", {
182
+ style: {
183
+ marginBottom: '24px'
184
+ },
185
+ children: /*#__PURE__*/ _jsx(FontPreview, {
186
+ font: font,
187
+ variant: "h1",
188
+ text: translations.blog.title
189
+ })
190
+ }),
191
+ /*#__PURE__*/ _jsx("div", {
192
+ style: {
193
+ marginBottom: '24px',
194
+ opacity: 0.7
195
+ },
196
+ children: /*#__PURE__*/ _jsx(FontPreview, {
197
+ font: font,
198
+ variant: "h3",
199
+ text: translations.blog.subtitle
200
+ })
201
+ }),
202
+ /*#__PURE__*/ _jsx("div", {
203
+ style: {
204
+ marginBottom: '16px'
205
+ },
206
+ children: /*#__PURE__*/ _jsx(FontPreview, {
207
+ font: font,
208
+ variant: "body",
209
+ text: translations.blog.body
210
+ })
211
+ }),
212
+ /*#__PURE__*/ _jsx("div", {
213
+ style: {
214
+ marginBottom: '16px'
215
+ },
216
+ children: /*#__PURE__*/ _jsx(FontPreview, {
217
+ font: font,
218
+ variant: "body",
219
+ text: translations.blog.body.split('.')[1] + '.'
220
+ })
221
+ })
222
+ ]
223
+ });
224
+ const renderLanding = ()=>/*#__PURE__*/ _jsxs("div", {
225
+ style: {
226
+ padding: '48px 24px',
227
+ textAlign: 'center',
228
+ background: 'linear-gradient(135deg, var(--theme-elevation-50) 0%, var(--theme-elevation-100) 100%)',
229
+ minHeight: '400px',
230
+ display: 'flex',
231
+ flexDirection: 'column',
232
+ justifyContent: 'center',
233
+ alignItems: 'center',
234
+ gap: '24px'
235
+ },
236
+ children: [
237
+ /*#__PURE__*/ _jsx("div", {
238
+ style: {
239
+ maxWidth: '800px'
240
+ },
241
+ children: /*#__PURE__*/ _jsx(FontPreview, {
242
+ font: font,
243
+ variant: "h1",
244
+ text: translations.landing.hero
245
+ })
246
+ }),
247
+ /*#__PURE__*/ _jsx("div", {
248
+ style: {
249
+ maxWidth: '600px',
250
+ opacity: 0.8
251
+ },
252
+ children: /*#__PURE__*/ _jsx(FontPreview, {
253
+ font: font,
254
+ variant: "h3",
255
+ text: translations.landing.subheading
256
+ })
257
+ }),
258
+ /*#__PURE__*/ _jsx("div", {
259
+ style: {
260
+ marginTop: '16px'
261
+ },
262
+ children: /*#__PURE__*/ _jsx("div", {
263
+ style: {
264
+ display: 'inline-block',
265
+ padding: '12px 32px',
266
+ background: 'var(--theme-elevation-900)',
267
+ color: 'var(--theme-elevation-0)',
268
+ borderRadius: '8px',
269
+ fontSize: '18px',
270
+ fontWeight: 600,
271
+ cursor: 'pointer'
272
+ },
273
+ children: /*#__PURE__*/ _jsx(FontPreview, {
274
+ font: font,
275
+ variant: "body",
276
+ text: translations.landing.cta
277
+ })
278
+ })
279
+ })
280
+ ]
281
+ });
282
+ const renderUI = ()=>/*#__PURE__*/ _jsxs("div", {
283
+ style: {
284
+ padding: '24px'
285
+ },
286
+ children: [
287
+ /*#__PURE__*/ _jsxs("div", {
288
+ style: {
289
+ marginBottom: '32px'
290
+ },
291
+ children: [
292
+ /*#__PURE__*/ _jsx("div", {
293
+ style: {
294
+ fontSize: '12px',
295
+ fontWeight: 600,
296
+ textTransform: 'uppercase',
297
+ letterSpacing: '0.05em',
298
+ color: 'var(--theme-elevation-500)',
299
+ marginBottom: '12px'
300
+ },
301
+ children: "Button"
302
+ }),
303
+ /*#__PURE__*/ _jsx("div", {
304
+ style: {
305
+ display: 'inline-block',
306
+ padding: '10px 24px',
307
+ background: 'var(--theme-elevation-900)',
308
+ color: 'var(--theme-elevation-0)',
309
+ borderRadius: '6px',
310
+ fontSize: '16px',
311
+ fontWeight: 500,
312
+ cursor: 'pointer'
313
+ },
314
+ children: /*#__PURE__*/ _jsx(FontPreview, {
315
+ font: font,
316
+ variant: "body",
317
+ text: translations.ui.button
318
+ })
319
+ })
320
+ ]
321
+ }),
322
+ /*#__PURE__*/ _jsxs("div", {
323
+ style: {
324
+ marginBottom: '32px'
325
+ },
326
+ children: [
327
+ /*#__PURE__*/ _jsx("div", {
328
+ style: {
329
+ fontSize: '12px',
330
+ fontWeight: 600,
331
+ textTransform: 'uppercase',
332
+ letterSpacing: '0.05em',
333
+ color: 'var(--theme-elevation-500)',
334
+ marginBottom: '12px'
335
+ },
336
+ children: "Input"
337
+ }),
338
+ /*#__PURE__*/ _jsx("div", {
339
+ style: {
340
+ width: '100%',
341
+ maxWidth: '400px',
342
+ padding: '10px 16px',
343
+ background: 'var(--theme-elevation-0)',
344
+ border: '1px solid var(--theme-elevation-300)',
345
+ borderRadius: '6px',
346
+ fontSize: '16px'
347
+ },
348
+ children: /*#__PURE__*/ _jsx(FontPreview, {
349
+ font: font,
350
+ variant: "body",
351
+ text: translations.ui.input
352
+ })
353
+ })
354
+ ]
355
+ }),
356
+ /*#__PURE__*/ _jsxs("div", {
357
+ children: [
358
+ /*#__PURE__*/ _jsx("div", {
359
+ style: {
360
+ fontSize: '12px',
361
+ fontWeight: 600,
362
+ textTransform: 'uppercase',
363
+ letterSpacing: '0.05em',
364
+ color: 'var(--theme-elevation-500)',
365
+ marginBottom: '12px'
366
+ },
367
+ children: "Link"
368
+ }),
369
+ /*#__PURE__*/ _jsx("div", {
370
+ style: {
371
+ color: 'var(--theme-elevation-700)',
372
+ fontSize: '16px',
373
+ textDecoration: 'underline',
374
+ cursor: 'pointer'
375
+ },
376
+ children: /*#__PURE__*/ _jsx(FontPreview, {
377
+ font: font,
378
+ variant: "body",
379
+ text: translations.ui.link
380
+ })
381
+ })
382
+ ]
383
+ })
384
+ ]
385
+ });
386
+ switch(activeTab){
387
+ case 'typography':
388
+ return renderTypography();
389
+ case 'blog':
390
+ return renderBlog();
391
+ case 'landing':
392
+ return renderLanding();
393
+ case 'ui':
394
+ return renderUI();
395
+ default:
396
+ return null;
397
+ }
398
+ };
399
+
400
+ //# sourceMappingURL=PreviewContent.js.map