PluginProbe
Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor / 2.0.7
Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor v2.0.7
2.0.13 2.0.12 2.0.11 2.0.10 2.0.9 trunk 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8
blockenberg / blocks / media-kit / index.js

index.js in Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor 2.0.7, at blocks/media-kit/index.js

490 lines 31.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 ( function () {
2 var el = wp.element.createElement;
3 var Fragment = wp.element.Fragment;
4 var useState = wp.element.useState;
5 var __ = wp.i18n.__;
6 var registerBlockType = wp.blocks.registerBlockType;
7 var InspectorControls = wp.blockEditor.InspectorControls;
8 var MediaUpload = wp.blockEditor.MediaUpload;
9 var MediaUploadCheck = wp.blockEditor.MediaUploadCheck;
10 var useBlockProps = wp.blockEditor.useBlockProps;
11 var PanelColorSettings = wp.blockEditor.PanelColorSettings;
12 var PanelBody = wp.components.PanelBody;
13 var ToggleControl = wp.components.ToggleControl;
14 var RangeControl = wp.components.RangeControl;
15 var SelectControl = wp.components.SelectControl;
16 var TextControl = wp.components.TextControl;
17 var ColorPicker = wp.components.ColorPicker;
18 var Popover = wp.components.Popover;
19 var Button = wp.components.Button;
20
21 var _tc, _tv;
22 function getTypoControl() { return _tc || (_tc = window.bkbgTypographyControl); }
23 function getTypoCssVars() { return _tv || (_tv = window.bkbgTypoCssVars); }
24
25 /* ─── helpers ─── */
26 function updateItem(arr, idx, field, val) {
27 return arr.map(function (item, i) {
28 if (i !== idx) return item;
29 var p = {}; p[field] = val;
30 return Object.assign({}, item, p);
31 });
32 }
33
34 /* ─── MediaKitPreview ─── */
35 function MediaKitPreview(props) {
36 var a = props.attributes;
37
38 var wrapStyle = {
39 background: a.bgColor || '#f8fafc',
40 padding: (a.paddingTop || 40) + 'px 0 ' + (a.paddingBottom || 40) + 'px',
41 boxSizing: 'border-box'
42 };
43
44 var innerStyle = {
45 maxWidth: (a.maxWidth || 900) + 'px',
46 margin: '0 auto',
47 display: 'flex',
48 flexDirection: 'column',
49 gap: '24px'
50 };
51
52 var sectionStyle = {
53 background: a.sectionBg || '#fff',
54 border: '1px solid ' + (a.borderColor || '#e5e7eb'),
55 borderRadius: (a.sectionBorderRadius || 12) + 'px',
56 padding: '28px 32px'
57 };
58
59 var sectionTitleStyle = {
60 color: a.accentColor || '#6366f1',
61 marginBottom: '20px'
62 };
63
64 /* ── header ── */
65 var header = el('div', { style: Object.assign({}, sectionStyle, { textAlign: 'center', padding: '40px 32px' }) },
66 el('div', { className: 'bkbg-mkit-brand-name', style: { color: a.headingColor || '#111827', marginBottom: '8px' } }, a.brandName || 'Brand Name'),
67 a.brandTagline && el('div', { className: 'bkbg-mkit-brand-tagline', style: { color: a.textColor || '#374151', maxWidth: '480px', margin: '0 auto' } }, a.brandTagline)
68 );
69
70 /* ── logos ── */
71 var logoSection = a.showLogos && el('div', { style: sectionStyle },
72 el('div', { style: sectionTitleStyle }, __('Logo Variants', 'blockenberg')),
73 el('div', { style: { display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(200px, 1fr))', gap: '16px' } },
74 (a.logoVariants || []).map(function (lv, idx) {
75 return el('div', {
76 key: idx,
77 style: {
78 background: a.cardBg || '#f9fafb',
79 border: '1px solid ' + (a.borderColor || '#e5e7eb'),
80 borderRadius: '8px',
81 padding: '20px 16px',
82 display: 'flex',
83 flexDirection: 'column',
84 alignItems: 'center',
85 gap: '12px'
86 }
87 },
88 el('div', {
89 style: {
90 width: '100%',
91 height: '80px',
92 display: 'flex',
93 alignItems: 'center',
94 justifyContent: 'center',
95 background: lv.format === 'Dark' ? '#1f2937' : '#fff',
96 borderRadius: '6px',
97 overflow: 'hidden'
98 }
99 },
100 lv.url
101 ? el('img', { src: lv.url, alt: lv.label, style: { maxWidth: '100%', maxHeight: '72px', objectFit: 'contain' } })
102 : el('div', { style: { color: '#d1d5db', fontSize: '12px' } }, '[ ' + (lv.format || 'Logo') + ' ]')
103 ),
104 el('div', { style: { fontWeight: '600', fontSize: '13px', color: a.headingColor || '#111827' } }, lv.label || ''),
105 el('div', { style: { fontSize: '11px', color: a.labelColor || '#6b7280', fontWeight: '600' } }, lv.format || ''),
106 lv.downloadUrl && el('a', {
107 href: lv.downloadUrl,
108 style: {
109 fontSize: '11px',
110 color: a.accentColor || '#6366f1',
111 textDecoration: 'none',
112 fontWeight: '600'
113 }
114 }, '↓ Download')
115 );
116 })
117 )
118 );
119
120 /* ── colors ── */
121 var colsPerRow = a.colorsPerRow || 5;
122 var colorSection = a.showColors && el('div', { style: sectionStyle },
123 el('div', { style: sectionTitleStyle }, __('Brand Colors', 'blockenberg')),
124 el('div', { style: { display: 'grid', gridTemplateColumns: 'repeat(' + colsPerRow + ', 1fr)', gap: '12px' } },
125 (a.brandColors || []).map(function (color, idx) {
126 return el('div', { key: idx, style: { display: 'flex', flexDirection: 'column', alignItems: 'center', gap: '8px' } },
127 el('div', {
128 style: {
129 width: '100%',
130 paddingBottom: '100%',
131 background: color.hex || '#ccc',
132 borderRadius: '8px',
133 border: '1px solid rgba(0,0,0,0.07)',
134 position: 'relative'
135 }
136 }),
137 el('div', { style: { textAlign: 'center' } },
138 el('div', { style: { fontSize: '12px', fontWeight: '600', color: a.headingColor || '#111827' } }, color.name || ''),
139 el('div', { style: { fontSize: '11px', color: a.labelColor || '#6b7280', fontFamily: 'monospace' } }, color.hex || '')
140 )
141 );
142 })
143 )
144 );
145
146 /* ── fonts ── */
147 var fontSection = a.showFonts && el('div', { style: sectionStyle },
148 el('div', { style: sectionTitleStyle }, __('Typography', 'blockenberg')),
149 el('div', { style: { display: 'flex', flexDirection: 'column', gap: '20px' } },
150 (a.fonts || []).map(function (font, idx) {
151 return el('div', {
152 key: idx,
153 style: {
154 background: a.cardBg || '#f9fafb',
155 border: '1px solid ' + (a.borderColor || '#e5e7eb'),
156 borderRadius: '8px',
157 padding: '20px 24px'
158 }
159 },
160 el('div', { style: { display: 'flex', alignItems: 'baseline', gap: '12px', marginBottom: '12px' } },
161 el('div', { style: { fontWeight: '700', fontSize: '16px', color: a.headingColor || '#111827', fontFamily: font.name } }, font.name || 'Font'),
162 el('div', { style: { fontSize: '11px', fontWeight: '600', color: a.accentColor || '#6366f1', textTransform: 'uppercase', letterSpacing: '0.06em' } }, font.role || '')
163 ),
164 el('div', { style: { fontFamily: font.name || 'inherit', fontSize: '15px', color: a.textColor || '#374151', lineHeight: '1.6', fontStyle: 'italic' } },
165 font.previewText || 'The quick brown fox jumps over the lazy dog'
166 )
167 );
168 })
169 )
170 );
171
172 /* ── downloads ── */
173 var downloadSection = a.showDownloads && el('div', { style: sectionStyle },
174 el('div', { style: sectionTitleStyle }, __('Asset Downloads', 'blockenberg')),
175 el('div', { style: { display: 'flex', flexWrap: 'wrap', gap: '12px' } },
176 a.downloadAllUrl && el('a', {
177 href: a.downloadAllUrl,
178 style: {
179 display: 'inline-flex', alignItems: 'center', gap: '8px',
180 background: a.downloadBg || '#6366f1',
181 color: a.downloadColor || '#fff',
182 padding: '11px 22px',
183 borderRadius: '8px',
184 fontWeight: '600',
185 fontSize: '14px',
186 textDecoration: 'none',
187 transition: 'opacity 0.15s'
188 }
189 }, '' + (a.downloadAllLabel || 'Download All Assets (ZIP)')),
190 a.guidelinesDownloadUrl && el('a', {
191 href: a.guidelinesDownloadUrl,
192 style: {
193 display: 'inline-flex', alignItems: 'center', gap: '8px',
194 background: 'transparent',
195 color: a.accentColor || '#6366f1',
196 border: '2px solid ' + (a.accentColor || '#6366f1'),
197 padding: '9px 20px',
198 borderRadius: '8px',
199 fontWeight: '600',
200 fontSize: '14px',
201 textDecoration: 'none'
202 }
203 }, '📄 ' + (a.guidelinesLabel || 'Download Brand Guidelines'))
204 )
205 );
206
207 /* ── contact ── */
208 var contactSection = a.showContact && (a.pressEmail || a.websiteUrl) && el('div', { style: Object.assign({}, sectionStyle, { background: a.cardBg || '#f9fafb' }) },
209 el('div', { style: sectionTitleStyle }, __('Media Contact', 'blockenberg')),
210 el('div', { style: { display: 'flex', gap: '24px', flexWrap: 'wrap' } },
211 a.pressEmail && el('div', null,
212 el('div', { style: { fontSize: '11px', color: a.labelColor || '#6b7280', fontWeight: '600', marginBottom: '4px' } }, __('Press Inquiries', 'blockenberg')),
213 el('a', { href: 'mailto:' + a.pressEmail, style: { color: a.accentColor || '#6366f1', fontSize: '14px', textDecoration: 'none', fontWeight: '500' } }, a.pressEmail)
214 ),
215 a.websiteUrl && el('div', null,
216 el('div', { style: { fontSize: '11px', color: a.labelColor || '#6b7280', fontWeight: '600', marginBottom: '4px' } }, __('Website', 'blockenberg')),
217 el('a', { href: a.websiteUrl, target: '_blank', rel: 'noopener', style: { color: a.accentColor || '#6366f1', fontSize: '14px', textDecoration: 'none', fontWeight: '500' } }, a.websiteUrl)
218 )
219 )
220 );
221
222 return el('div', { style: wrapStyle },
223 el('div', { style: innerStyle },
224 header,
225 logoSection,
226 colorSection,
227 fontSection,
228 downloadSection,
229 contactSection
230 )
231 );
232 }
233
234 function BkbgColorSwatch(props) {
235 var st = useState(false); var isOpen = st[0]; var setIsOpen = st[1];
236 return el(Fragment, null,
237 el('div', { style: { display: 'flex', alignItems: 'center', gap: '8px', marginBottom: '6px' } },
238 el('span', { style: { fontSize: '11px', fontWeight: 500, textTransform: 'uppercase' } }, props.label),
239 el('button', { type: 'button', style: { width: 28, height: 28, borderRadius: 4, border: '1px solid #ccc', background: props.value || '#fff', cursor: 'pointer', padding: 0 }, onClick: function () { setIsOpen(!isOpen); } })
240 ),
241 isOpen && el(Popover, { onClose: function () { setIsOpen(false); } }, el('div', { style: { padding: '8px' } }, el(ColorPicker, { color: props.value, enableAlpha: true, onChange: props.onChange })))
242 );
243 }
244
245 /* ─── register ─── */
246 registerBlockType('blockenberg/media-kit', {
247 edit: function (props) {
248 var a = props.attributes;
249 var set = props.setAttributes;
250 var logIdxState = useState(-1);
251 var logIdx = logIdxState[0];
252 var setLogIdx = logIdxState[1];
253 var colIdxState = useState(-1);
254 var colIdx = colIdxState[0];
255 var setColIdx = colIdxState[1];
256 var fntIdxState = useState(-1);
257 var fntIdx = fntIdxState[0];
258 var setFntIdx = fntIdxState[1];
259
260 var blockProps = useBlockProps((function () {
261 var tv = getTypoCssVars();
262 var s = {};
263 Object.assign(s, tv(a.brandNameTypo, '--bkbg-mkit-bn-'));
264 Object.assign(s, tv(a.taglineTypo, '--bkbg-mkit-tl-'));
265 Object.assign(s, tv(a.sectionTitleTypo, '--bkbg-mkit-st-'));
266 Object.assign(s, tv(a.bodyTypo, '--bkbg-mkit-bd-'));
267 Object.assign(s, tv(a.labelTypo, '--bkbg-mkit-lb-'));
268 Object.assign(s, tv(a.metaTypo, '--bkbg-mkit-mt-'));
269 return { style: s };
270 })());
271
272 var inspector = el(InspectorControls, null,
273
274 /* Brand */
275 el(PanelBody, { title: __('Brand Info', 'blockenberg'), initialOpen: true },
276 el(TextControl, { label: __('Brand Name', 'blockenberg'), value: a.brandName, onChange: function (v) { set({ brandName: v }); }, __nextHasNoMarginBottom: true }),
277 el('div', { style: { marginTop: '8px' } },
278 el(TextControl, { label: __('Tagline', 'blockenberg'), value: a.brandTagline, onChange: function (v) { set({ brandTagline: v }); }, __nextHasNoMarginBottom: true })
279 )
280 ),
281
282 /* Logos */
283 el(PanelBody, { title: __('Logo Variants', 'blockenberg'), initialOpen: false },
284 (a.logoVariants || []).map(function (lv, idx) {
285 var isActive = idx === logIdx;
286 return el('div', {
287 key: idx,
288 style: { border: '1px solid ' + (isActive ? '#6366f1' : '#e5e7eb'), borderRadius: '6px', marginBottom: '6px', overflow: 'hidden' }
289 },
290 el('div', {
291 style: { padding: '8px', display: 'flex', alignItems: 'center', gap: '8px', cursor: 'pointer', background: isActive ? '#f0f0ff' : '#f9fafb' },
292 onClick: function () { setLogIdx(isActive ? -1 : idx); }
293 },
294 el('span', { style: { flex: 1, fontSize: '12px', fontWeight: '600' } }, lv.label || 'Logo ' + (idx + 1)),
295 el(Button, { icon: 'no-alt', isSmall: true, isDestructive: true, onClick: function (e) { e.stopPropagation(); var arr = (a.logoVariants || []).slice(); arr.splice(idx, 1); set({ logoVariants: arr }); setLogIdx(-1); } })
296 ),
297 isActive && el('div', { style: { padding: '10px', display: 'flex', flexDirection: 'column', gap: '8px' } },
298 el(TextControl, { label: __('Label', 'blockenberg'), value: lv.label || '', onChange: function (v) { set({ logoVariants: updateItem(a.logoVariants, idx, 'label', v) }); }, __nextHasNoMarginBottom: true }),
299 el(SelectControl, {
300 label: __('Format', 'blockenberg'),
301 value: lv.format || 'Full',
302 options: ['Full', 'Dark', 'Light', 'Icon', 'SVG', 'PNG'].map(function (f) { return { value: f, label: f }; }),
303 onChange: function (v) { set({ logoVariants: updateItem(a.logoVariants, idx, 'format', v) }); },
304 __nextHasNoMarginBottom: true
305 }),
306 el(TextControl, { label: __('Download URL', 'blockenberg'), value: lv.downloadUrl || '', onChange: function (v) { set({ logoVariants: updateItem(a.logoVariants, idx, 'downloadUrl', v) }); }, __nextHasNoMarginBottom: true }),
307 el(MediaUploadCheck, null,
308 el(MediaUpload, {
309 onSelect: function (media) { set({ logoVariants: updateItem(a.logoVariants, idx, 'url', media.url || '') }); },
310 allowedTypes: ['image'],
311 render: function (ref) {
312 return el(Button, { onClick: ref.open, variant: 'secondary', isSmall: true }, lv.url ? __('Replace Image', 'blockenberg') : __('Upload Image', 'blockenberg'));
313 }
314 })
315 )
316 )
317 );
318 }),
319 el(Button, {
320 variant: 'secondary',
321 style: { marginTop: '6px', width: '100%', justifyContent: 'center' },
322 onClick: function () { set({ logoVariants: (a.logoVariants || []).concat([{ label: 'New Logo', url: '', id: 0, format: 'Full', downloadUrl: '' }]) }); }
323 }, __('+ Add Logo Variant', 'blockenberg'))
324 ),
325
326 /* Colors */
327 el(PanelBody, { title: __('Brand Colors', 'blockenberg'), initialOpen: false },
328 (a.brandColors || []).map(function (col, idx) {
329 var isActive = idx === colIdx;
330 return el('div', {
331 key: idx,
332 style: { display: 'flex', alignItems: 'center', gap: '8px', marginBottom: '6px', padding: '6px 8px', border: '1px solid ' + (isActive ? '#6366f1' : '#e5e7eb'), borderRadius: '6px', cursor: 'pointer', background: isActive ? '#f0f0ff' : '#f9fafb' },
333 onClick: function () { setColIdx(isActive ? -1 : idx); }
334 },
335 el('div', { style: { width: '24px', height: '24px', borderRadius: '6px', background: col.hex || '#ccc', flexShrink: 0, border: '1px solid rgba(0,0,0,0.1)' } }),
336 el('div', { style: { flex: 1, fontSize: '12px', fontWeight: '600' } }, col.name || ''),
337 el('div', { style: { fontSize: '11px', color: '#9ca3af', fontFamily: 'monospace' } }, col.hex || ''),
338 el(Button, { icon: 'no-alt', isSmall: true, isDestructive: true, onClick: function (e) { e.stopPropagation(); var arr = (a.brandColors || []).slice(); arr.splice(idx, 1); set({ brandColors: arr }); setColIdx(-1); } }),
339 isActive && el('div', { style: { display: 'flex', flexDirection: 'column', gap: '6px', marginTop: '8px', padding: '8px 0', borderTop: '1px solid #e5e7eb', width: '100%' } },
340 el(TextControl, { label: __('Color Name', 'blockenberg'), value: col.name || '', onChange: function (v) { set({ brandColors: updateItem(a.brandColors, idx, 'name', v) }); }, __nextHasNoMarginBottom: true }),
341 el(BkbgColorSwatch, { label: __('Hex Value', 'blockenberg'), value: col.hex || '', onChange: function (v) { set({ brandColors: updateItem(a.brandColors, idx, 'hex', v) }); } })
342 )
343 );
344 }),
345 el(Button, {
346 variant: 'secondary',
347 style: { marginTop: '6px', width: '100%', justifyContent: 'center' },
348 onClick: function () { set({ brandColors: (a.brandColors || []).concat([{ name: 'New Color', hex: '#6366f1' }]) }); }
349 }, __('+ Add Color', 'blockenberg'))
350 ),
351
352 /* Text Sizes */
353 el(PanelBody, { title: __('Text Sizes', 'blockenberg'), initialOpen: false },
354 getTypoControl() && el(getTypoControl(), { label: 'Brand Name', value: a.brandNameTypo || {}, onChange: function (v) { set({ brandNameTypo: v }); } }),
355 getTypoControl() && el(getTypoControl(), { label: 'Tagline', value: a.taglineTypo || {}, onChange: function (v) { set({ taglineTypo: v }); } }),
356 getTypoControl() && el(getTypoControl(), { label: 'Section Title', value: a.sectionTitleTypo || {}, onChange: function (v) { set({ sectionTitleTypo: v }); } }),
357 getTypoControl() && el(getTypoControl(), { label: 'Body Text', value: a.bodyTypo || {}, onChange: function (v) { set({ bodyTypo: v }); } }),
358 getTypoControl() && el(getTypoControl(), { label: 'Label', value: a.labelTypo || {}, onChange: function (v) { set({ labelTypo: v }); } }),
359 getTypoControl() && el(getTypoControl(), { label: 'Meta', value: a.metaTypo || {}, onChange: function (v) { set({ metaTypo: v }); } })
360 ),
361
362 /* Fonts */
363 el(PanelBody, { title: __('Typography', 'blockenberg'), initialOpen: false },
364 (a.fonts || []).map(function (font, idx) {
365 var isActive = idx === fntIdx;
366 return el('div', {
367 key: idx,
368 style: { border: '1px solid ' + (isActive ? '#6366f1' : '#e5e7eb'), borderRadius: '6px', marginBottom: '6px', overflow: 'hidden' }
369 },
370 el('div', {
371 style: { padding: '8px', display: 'flex', alignItems: 'center', gap: '8px', cursor: 'pointer', background: isActive ? '#f0f0ff' : '#f9fafb' },
372 onClick: function () { setFntIdx(isActive ? -1 : idx); }
373 },
374 el('span', { style: { flex: 1, fontSize: '12px', fontWeight: '600' } }, font.name || 'Font'),
375 el('span', { style: { fontSize: '11px', color: '#9ca3af' } }, font.role || ''),
376 el(Button, { icon: 'no-alt', isSmall: true, isDestructive: true, onClick: function (e) { e.stopPropagation(); var arr = (a.fonts || []).slice(); arr.splice(idx, 1); set({ fonts: arr }); setFntIdx(-1); } })
377 ),
378 isActive && el('div', { style: { padding: '10px', display: 'flex', flexDirection: 'column', gap: '8px' } },
379 el(TextControl, { label: __('Font Name', 'blockenberg'), value: font.name || '', onChange: function (v) { set({ fonts: updateItem(a.fonts, idx, 'name', v) }); }, __nextHasNoMarginBottom: true }),
380 el(SelectControl, {
381 label: __('Role', 'blockenberg'),
382 value: font.role || 'Heading',
383 options: ['Heading', 'Body', 'Mono', 'Display', 'Caption'].map(function (r) { return { value: r, label: r }; }),
384 onChange: function (v) { set({ fonts: updateItem(a.fonts, idx, 'role', v) }); },
385 __nextHasNoMarginBottom: true
386 }),
387 el(TextControl, { label: __('Preview Text', 'blockenberg'), value: font.previewText || '', onChange: function (v) { set({ fonts: updateItem(a.fonts, idx, 'previewText', v) }); }, __nextHasNoMarginBottom: true }),
388 el(TextControl, { label: __('Google Font URL (optional)', 'blockenberg'), value: font.googleFontUrl || '', onChange: function (v) { set({ fonts: updateItem(a.fonts, idx, 'googleFontUrl', v) }); }, __nextHasNoMarginBottom: true })
389 )
390 );
391 }),
392 el(Button, {
393 variant: 'secondary',
394 style: { marginTop: '6px', width: '100%', justifyContent: 'center' },
395 onClick: function () { set({ fonts: (a.fonts || []).concat([{ name: 'New Font', role: 'Body', previewText: 'The quick brown fox', googleFontUrl: '' }]) }); }
396 }, __('+ Add Font', 'blockenberg'))
397 ),
398
399 /* Downloads */
400 el(PanelBody, { title: __('Downloads & Contact', 'blockenberg'), initialOpen: false },
401 el(TextControl, { label: __('Download All Label', 'blockenberg'), value: a.downloadAllLabel, onChange: function (v) { set({ downloadAllLabel: v }); }, __nextHasNoMarginBottom: true }),
402 el('div', { style: { marginTop: '8px' } },
403 el(TextControl, { label: __('Download All URL', 'blockenberg'), value: a.downloadAllUrl, onChange: function (v) { set({ downloadAllUrl: v }); }, __nextHasNoMarginBottom: true })
404 ),
405 el('div', { style: { marginTop: '8px' } },
406 el(TextControl, { label: __('Guidelines Label', 'blockenberg'), value: a.guidelinesLabel, onChange: function (v) { set({ guidelinesLabel: v }); }, __nextHasNoMarginBottom: true })
407 ),
408 el('div', { style: { marginTop: '8px' } },
409 el(TextControl, { label: __('Guidelines Download URL', 'blockenberg'), value: a.guidelinesDownloadUrl, onChange: function (v) { set({ guidelinesDownloadUrl: v }); }, __nextHasNoMarginBottom: true })
410 ),
411 el('div', { style: { marginTop: '8px' } },
412 el(TextControl, { label: __('Press Email', 'blockenberg'), value: a.pressEmail, onChange: function (v) { set({ pressEmail: v }); }, __nextHasNoMarginBottom: true })
413 ),
414 el('div', { style: { marginTop: '8px' } },
415 el(TextControl, { label: __('Website URL', 'blockenberg'), value: a.websiteUrl, onChange: function (v) { set({ websiteUrl: v }); }, __nextHasNoMarginBottom: true })
416 )
417 ),
418
419 /* Sections visibility */
420 el(PanelBody, { title: __('Sections', 'blockenberg'), initialOpen: false },
421 el(ToggleControl, { label: __('Show Logos', 'blockenberg'), checked: a.showLogos, onChange: function (v) { set({ showLogos: v }); }, __nextHasNoMarginBottom: true }),
422 el(ToggleControl, { label: __('Show Colors', 'blockenberg'), checked: a.showColors, onChange: function (v) { set({ showColors: v }); }, __nextHasNoMarginBottom: true }),
423 el(ToggleControl, { label: __('Show Typography', 'blockenberg'), checked: a.showFonts, onChange: function (v) { set({ showFonts: v }); }, __nextHasNoMarginBottom: true }),
424 el(ToggleControl, { label: __('Show Downloads', 'blockenberg'), checked: a.showDownloads, onChange: function (v) { set({ showDownloads: v }); }, __nextHasNoMarginBottom: true }),
425 el(ToggleControl, { label: __('Show Contact', 'blockenberg'), checked: a.showContact, onChange: function (v) { set({ showContact: v }); }, __nextHasNoMarginBottom: true })
426 ),
427
428 /* Appearance */
429 el(PanelBody, { title: __('Appearance', 'blockenberg'), initialOpen: false },
430 el(RangeControl, { label: __('Colors Per Row', 'blockenberg'), value: a.colorsPerRow, min: 2, max: 10, onChange: function (v) { set({ colorsPerRow: v }); }, __nextHasNoMarginBottom: true }),
431 el('div', { style: { marginTop: '8px' } },
432 el(RangeControl, { label: __('Max Width (px)', 'blockenberg'), value: a.maxWidth, min: 480, max: 1400, step: 20, onChange: function (v) { set({ maxWidth: v }); }, __nextHasNoMarginBottom: true })
433 ),
434 el('div', { style: { marginTop: '8px' } },
435 el(RangeControl, { label: __('Section Border Radius', 'blockenberg'), value: a.sectionBorderRadius, min: 0, max: 32, onChange: function (v) { set({ sectionBorderRadius: v }); }, __nextHasNoMarginBottom: true })
436 ),
437 el('div', { style: { marginTop: '8px' } },
438 el(RangeControl, { label: __('Padding Top', 'blockenberg'), value: a.paddingTop, min: 0, max: 160, step: 8, onChange: function (v) { set({ paddingTop: v }); }, __nextHasNoMarginBottom: true })
439 ),
440 el('div', { style: { marginTop: '8px' } },
441 el(RangeControl, { label: __('Padding Bottom', 'blockenberg'), value: a.paddingBottom, min: 0, max: 160, step: 8, onChange: function (v) { set({ paddingBottom: v }); }, __nextHasNoMarginBottom: true })
442 )
443 ),
444
445 /* Colors */
446 el(PanelColorSettings, {
447 title: __('Colors', 'blockenberg'),
448 initialOpen: false,
449 colorSettings: [
450 { value: a.bgColor, onChange: function (v) { set({ bgColor: v }); }, label: __('Page Background', 'blockenberg') },
451 { value: a.sectionBg, onChange: function (v) { set({ sectionBg: v }); }, label: __('Section Background', 'blockenberg') },
452 { value: a.cardBg, onChange: function (v) { set({ cardBg: v }); }, label: __('Card Background', 'blockenberg') },
453 { value: a.headingColor, onChange: function (v) { set({ headingColor: v }); }, label: __('Heading Text', 'blockenberg') },
454 { value: a.textColor, onChange: function (v) { set({ textColor: v }); }, label: __('Body Text', 'blockenberg') },
455 { value: a.labelColor, onChange: function (v) { set({ labelColor: v }); }, label: __('Label Text', 'blockenberg') },
456 { value: a.borderColor, onChange: function (v) { set({ borderColor: v }); }, label: __('Border', 'blockenberg') },
457 { value: a.accentColor, onChange: function (v) { set({ accentColor: v }); }, label: __('Accent', 'blockenberg') },
458 { value: a.downloadBg, onChange: function (v) { set({ downloadBg: v }); }, label: __('Download Button Background', 'blockenberg') },
459 { value: a.downloadColor, onChange: function (v) { set({ downloadColor: v }); }, label: __('Download Button Text', 'blockenberg') }
460 ]
461 })
462 );
463
464 return el(Fragment, null,
465 inspector,
466 el('div', blockProps,
467 el(MediaKitPreview, { attributes: a })
468 )
469 );
470 },
471
472 save: function (props) {
473 var a = props.attributes;
474 return el('div', useBlockProps.save((function () {
475 var tv = getTypoCssVars();
476 var s = {};
477 Object.assign(s, tv(a.brandNameTypo, '--bkbg-mkit-bn-'));
478 Object.assign(s, tv(a.taglineTypo, '--bkbg-mkit-tl-'));
479 Object.assign(s, tv(a.sectionTitleTypo, '--bkbg-mkit-st-'));
480 Object.assign(s, tv(a.bodyTypo, '--bkbg-mkit-bd-'));
481 Object.assign(s, tv(a.labelTypo, '--bkbg-mkit-lb-'));
482 Object.assign(s, tv(a.metaTypo, '--bkbg-mkit-mt-'));
483 return { style: s };
484 })()),
485 el('div', { className: 'bkbg-mkit-app', 'data-opts': JSON.stringify(a) })
486 );
487 }
488 });
489 }() );
490