| 1 |
( function () { |
| 2 |
var el = wp.element.createElement; |
| 3 |
var Fragment = wp.element.Fragment; |
| 4 |
var registerBlockType = wp.blocks.registerBlockType; |
| 5 |
var InspectorControls = wp.blockEditor.InspectorControls; |
| 6 |
var useBlockProps = wp.blockEditor.useBlockProps; |
| 7 |
var PanelBody = wp.components.PanelBody; |
| 8 |
var PanelColorSettings = wp.blockEditor.PanelColorSettings; |
| 9 |
var ToggleControl = wp.components.ToggleControl; |
| 10 |
var RangeControl = wp.components.RangeControl; |
| 11 |
var SelectControl = wp.components.SelectControl; |
| 12 |
var TextControl = wp.components.TextControl; |
| 13 |
var TextareaControl = wp.components.TextareaControl; |
| 14 |
var Button = wp.components.Button; |
| 15 |
|
| 16 |
// Resolve the shared components lazily without defining globals for each block. |
| 17 |
function _tc(props, key, label) { |
| 18 |
var Control = window.bkbgTypographyControl; |
| 19 |
return Control ? el(Control, { |
| 20 |
label: label, |
| 21 |
value: props.attributes[key] || {}, |
| 22 |
onChange: function (value) { var update = {}; update[key] = value; props.setAttributes(update); } |
| 23 |
}) : null; |
| 24 |
} |
| 25 |
function _tvf(typo, prefix) { |
| 26 |
var cssVars = window.bkbgTypoCssVars; |
| 27 |
return cssVars ? cssVars(typo || {}, prefix) : {}; |
| 28 |
} |
| 29 |
function getTypoControl(p, key, label) { return _tc ? _tc(p, key, label) : null; } |
| 30 |
function getTypoCssVars(a) { |
| 31 |
if (!_tvf) return {}; |
| 32 |
var v = {}; |
| 33 |
Object.assign(v, _tvf(a.titleTypo || {}, '--bktc-tt-')); |
| 34 |
Object.assign(v, _tvf(a.bodyTypo || {}, '--bktc-bt-')); |
| 35 |
return v; |
| 36 |
} |
| 37 |
|
| 38 |
// ── helpers ─────────────────────────────────────────────────── |
| 39 |
function upd(arr, idx, field, val) { |
| 40 |
return arr.map(function (e, i) { |
| 41 |
if (i !== idx) return e; |
| 42 |
var u = {}; u[field] = val; |
| 43 |
return Object.assign({}, e, u); |
| 44 |
}); |
| 45 |
} |
| 46 |
|
| 47 |
var difficultyOptions = [ |
| 48 |
{ label: '🟢 Beginner', value: 'beginner' }, |
| 49 |
{ label: '🟡 Intermediate', value: 'intermediate' }, |
| 50 |
{ label: '🔴 Advanced', value: 'advanced' } |
| 51 |
]; |
| 52 |
|
| 53 |
function difficultyInfo(d) { |
| 54 |
if (d === 'beginner') return { label: '🟢 Beginner', bg: '#dcfce7', color: '#14532d' }; |
| 55 |
if (d === 'advanced') return { label: '🔴 Advanced', bg: '#fee2e2', color: '#991b1b' }; |
| 56 |
return { label: '🟡 Intermediate', bg: '#fef9c3', color: '#854d0e' }; |
| 57 |
} |
| 58 |
|
| 59 |
function sectionHead(label, a) { |
| 60 |
return el('div', { style: { display: 'flex', alignItems: 'center', gap: 8, marginBottom: 12 } }, |
| 61 |
el('span', { style: { fontWeight: 700, fontSize: 11, textTransform: 'uppercase', letterSpacing: '0.07em', color: a.accentColor } }, label), |
| 62 |
el('div', { style: { flex: 1, height: 1, background: a.borderColor } }) |
| 63 |
); |
| 64 |
} |
| 65 |
|
| 66 |
registerBlockType('blockenberg/tutorial-card', { |
| 67 |
edit: function (props) { |
| 68 |
var a = props.attributes; |
| 69 |
var set = props.setAttributes; |
| 70 |
var blockProps = useBlockProps((function () { |
| 71 |
var _tv = getTypoCssVars(a); |
| 72 |
var s = {}; |
| 73 |
Object.assign(s, _tv); |
| 74 |
return { className: 'bkbg-tc-editor-wrap', style: s }; |
| 75 |
})()); |
| 76 |
var diff = difficultyInfo(a.difficulty); |
| 77 |
|
| 78 |
// ── preview ─────────────────────────────────────────── |
| 79 |
var preview = el('div', { style: { border: '1px solid ' + a.borderColor, borderRadius: a.borderRadius + 'px', overflow: 'hidden', background: a.bgColor } }, |
| 80 |
// Header |
| 81 |
el('div', { style: { background: a.headerBg, color: a.headerColor, padding: '20px 24px' } }, |
| 82 |
el('div', { style: { display: 'flex', flexWrap: 'wrap', gap: 6, alignItems: 'center', marginBottom: 10 } }, |
| 83 |
el('span', { style: { background: diff.bg, color: diff.color, padding: '3px 10px', borderRadius: 100, fontSize: (a.subtitleSize || 11), fontWeight: 700 } }, diff.label), |
| 84 |
a.showDuration && a.duration && el('span', { style: { fontSize: 12, opacity: .8 } }, '⏱ ' + a.duration), |
| 85 |
a.showAuthor && a.author && el('span', { style: { fontSize: (a.authorSize || 12), opacity: .8 } }, '✍️ ' + a.author) |
| 86 |
), |
| 87 |
el('h2', { className: 'bkbg-tc-title', style: { margin: '0 0 6px', color: a.headerColor, lineHeight: 1.25 } }, a.tutorialTitle), |
| 88 |
a.subtitle && el('p', { className: 'bkbg-tc-subtitle', style: { margin: 0, opacity: .8, color: a.headerColor } }, a.subtitle), |
| 89 |
a.showProgress && el('div', { style: { marginTop: 14 } }, |
| 90 |
el('div', { style: { display: 'flex', justifyContent: 'space-between', fontSize: 11, marginBottom: 4, opacity: .8 } }, |
| 91 |
el('span', null, 'Progress'), |
| 92 |
el('span', null, a.completionRate + '%') |
| 93 |
), |
| 94 |
el('div', { style: { background: 'rgba(255,255,255,.2)', borderRadius: 100, height: 6 } }, |
| 95 |
el('div', { style: { background: a.progressFill, borderRadius: 100, height: '100%', width: a.completionRate + '%' } }) |
| 96 |
) |
| 97 |
) |
| 98 |
), |
| 99 |
// Body |
| 100 |
el('div', { style: { padding: '20px 24px' } }, |
| 101 |
// Outcomes |
| 102 |
a.showOutcomes && a.outcomes.length > 0 && el('div', { style: { marginBottom: 18 } }, |
| 103 |
sectionHead(a.outcomesLabel || "What you'll learn", a), |
| 104 |
el('ul', { style: { margin: 0, padding: 0, listStyle: 'none' } }, |
| 105 |
a.outcomes.map(function (item, i) { |
| 106 |
return el('li', { key: i, style: { display: 'flex', gap: 8, alignItems: 'flex-start', marginBottom: 5 } }, |
| 107 |
el('span', { style: { background: a.outcomeBg, color: a.outcomeColor, borderRadius: '50%', width: 18, height: 18, display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: 10, fontWeight: 700, flexShrink: 0, marginTop: 2 } }, '✓'), |
| 108 |
el('span', { className: 'bkbg-tc-body-text', style: { color: '#374151' } }, item.text) |
| 109 |
); |
| 110 |
}) |
| 111 |
) |
| 112 |
), |
| 113 |
// Prerequisites & Materials row |
| 114 |
(a.showPrerequisites || a.showMaterials) && el('div', { style: { display: 'flex', gap: 16, flexWrap: 'wrap', marginBottom: 18 } }, |
| 115 |
a.showPrerequisites && a.prerequisites.length > 0 && el('div', { style: { flex: '1 1 200px' } }, |
| 116 |
sectionHead(a.prerequisitesLabel || 'Prerequisites', a), |
| 117 |
el('ul', { style: { margin: 0, padding: 0, listStyle: 'none' } }, |
| 118 |
a.prerequisites.map(function (item, i) { |
| 119 |
return el('li', { key: i, style: { background: a.prerequisiteBg, color: a.prerequisiteColor, padding: '4px 10px', borderRadius: 6, marginBottom: 4 } }, '→ ' + item.text); |
| 120 |
}) |
| 121 |
) |
| 122 |
), |
| 123 |
a.showMaterials && a.materials.length > 0 && el('div', { style: { flex: '1 1 200px' } }, |
| 124 |
sectionHead(a.materialsLabel || "What you'll need", a), |
| 125 |
el('ul', { style: { margin: 0, padding: 0, listStyle: 'none' } }, |
| 126 |
a.materials.map(function (item, i) { |
| 127 |
return el('li', { key: i, style: { background: a.materialBg, color: a.materialColor, padding: '4px 10px', borderRadius: 6, marginBottom: 4 } }, '◈ ' + item.text); |
| 128 |
}) |
| 129 |
) |
| 130 |
) |
| 131 |
), |
| 132 |
// Steps |
| 133 |
a.showSteps && a.steps.length > 0 && el('div', null, |
| 134 |
sectionHead(a.stepsLabel || 'Steps', a), |
| 135 |
a.steps.map(function (step, i) { |
| 136 |
return el('div', { key: i, style: { display: 'flex', gap: 14, marginBottom: 16, paddingBottom: 16, borderBottom: i < a.steps.length - 1 ? '1px solid ' + a.stepBorderColor : 'none' } }, |
| 137 |
// Step number circle |
| 138 |
el('div', { style: { background: a.stepNumberBg, color: a.stepNumberColor, width: 30, height: 30, borderRadius: '50%', display: 'flex', alignItems: 'center', justifyContent: 'center', fontWeight: 700, fontSize: 13, flexShrink: 0 } }, i + 1), |
| 139 |
el('div', { style: { flex: 1 } }, |
| 140 |
el('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'baseline', gap: 8, marginBottom: 4 } }, |
| 141 |
el('strong', { className: 'bkbg-tc-step-title', style: { color: '#0f172a' } }, step.title || 'Step ' + (i + 1)), |
| 142 |
a.showStepDurations && step.duration && el('span', { style: { fontSize: 11, color: '#6b7280', whiteSpace: 'nowrap' } }, '⏱ ' + step.duration) |
| 143 |
), |
| 144 |
el('p', { className: 'bkbg-tc-step-content', style: { margin: '0 0 8px', color: '#374151' } }, step.content), |
| 145 |
a.showTips && step.tip && el('div', { style: { background: a.stepTipBg, color: a.stepTipColor, borderLeft: '3px solid ' + a.stepTipBorderColor, padding: '6px 10px', borderRadius: '0 6px 6px 0' } }, |
| 146 |
el('strong', null, '💡 Tip: '), step.tip |
| 147 |
) |
| 148 |
) |
| 149 |
); |
| 150 |
}) |
| 151 |
) |
| 152 |
) |
| 153 |
); |
| 154 |
|
| 155 |
// ── Inspector ───────────────────────────────────────── |
| 156 |
return el(Fragment, null, |
| 157 |
el('div', blockProps, preview), |
| 158 |
el(InspectorControls, null, |
| 159 |
// Tutorial Info |
| 160 |
el(PanelBody, { title: 'Tutorial Info', initialOpen: true }, |
| 161 |
el(TextControl, { label: 'Title', value: a.tutorialTitle, __nextHasNoMarginBottom: true, onChange: function (v) { set({ tutorialTitle: v }); } }), |
| 162 |
el('div', { style: { marginTop: 8 } }, |
| 163 |
el(TextControl, { label: 'Subtitle', value: a.subtitle, __nextHasNoMarginBottom: true, onChange: function (v) { set({ subtitle: v }); } }) |
| 164 |
), |
| 165 |
el('div', { style: { marginTop: 8 } }, |
| 166 |
el(TextControl, { label: 'Author', value: a.author, __nextHasNoMarginBottom: true, onChange: function (v) { set({ author: v }); } }) |
| 167 |
), |
| 168 |
el('div', { style: { marginTop: 8 } }, |
| 169 |
el(TextControl, { label: 'Duration', value: a.duration, __nextHasNoMarginBottom: true, onChange: function (v) { set({ duration: v }); } }) |
| 170 |
), |
| 171 |
el('div', { style: { marginTop: 8 } }, |
| 172 |
el(SelectControl, { label: 'Difficulty', value: a.difficulty, options: difficultyOptions, __nextHasNoMarginBottom: true, onChange: function (v) { set({ difficulty: v }); } }) |
| 173 |
), |
| 174 |
el('div', { style: { marginTop: 8, display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 4 } }, |
| 175 |
el(ToggleControl, { label: 'Show Author', checked: a.showAuthor, __nextHasNoMarginBottom: true, onChange: function (v) { set({ showAuthor: v }); } }), |
| 176 |
el(ToggleControl, { label: 'Show Duration', checked: a.showDuration, __nextHasNoMarginBottom: true, onChange: function (v) { set({ showDuration: v }); } }), |
| 177 |
el(ToggleControl, { label: 'Show Progress', checked: a.showProgress, __nextHasNoMarginBottom: true, onChange: function (v) { set({ showProgress: v }); } }) |
| 178 |
), |
| 179 |
a.showProgress && el('div', { style: { marginTop: 8 } }, |
| 180 |
el(RangeControl, { label: 'Completion (%)', value: a.completionRate, min: 0, max: 100, __nextHasNoMarginBottom: true, onChange: function (v) { set({ completionRate: v }); } }) |
| 181 |
) |
| 182 |
), |
| 183 |
// Learning Outcomes |
| 184 |
el(PanelBody, { title: 'Learning Outcomes', initialOpen: false }, |
| 185 |
el(ToggleControl, { label: 'Show Outcomes', checked: a.showOutcomes, __nextHasNoMarginBottom: true, onChange: function (v) { set({ showOutcomes: v }); } }), |
| 186 |
el('div', { style: { marginTop: 8 } }, |
| 187 |
el(TextControl, { label: 'Section Label', value: a.outcomesLabel, __nextHasNoMarginBottom: true, onChange: function (v) { set({ outcomesLabel: v }); } }) |
| 188 |
), |
| 189 |
a.outcomes.map(function (item, i) { |
| 190 |
return el('div', { key: i, style: { display: 'flex', gap: 4, alignItems: 'center', marginTop: 8 } }, |
| 191 |
el('div', { style: { flex: 1 } }, |
| 192 |
el(TextControl, { value: item.text, __nextHasNoMarginBottom: true, onChange: function (v) { set({ outcomes: upd(a.outcomes, i, 'text', v) }); } }) |
| 193 |
), |
| 194 |
el(Button, { isDestructive: true, variant: 'link', style: { fontSize: 11 }, onClick: function () { set({ outcomes: a.outcomes.filter(function (_, j) { return j !== i; }) }); } }, '✕') |
| 195 |
); |
| 196 |
}), |
| 197 |
el(Button, { variant: 'secondary', style: { marginTop: 8 }, onClick: function () { set({ outcomes: a.outcomes.concat([{ text: 'New learning outcome' }]) }); } }, '+ Add Outcome') |
| 198 |
), |
| 199 |
// Prerequisites |
| 200 |
el(PanelBody, { title: 'Prerequisites', initialOpen: false }, |
| 201 |
el(ToggleControl, { label: 'Show Prerequisites', checked: a.showPrerequisites, __nextHasNoMarginBottom: true, onChange: function (v) { set({ showPrerequisites: v }); } }), |
| 202 |
el('div', { style: { marginTop: 8 } }, |
| 203 |
el(TextControl, { label: 'Section Label', value: a.prerequisitesLabel, __nextHasNoMarginBottom: true, onChange: function (v) { set({ prerequisitesLabel: v }); } }) |
| 204 |
), |
| 205 |
a.prerequisites.map(function (item, i) { |
| 206 |
return el('div', { key: i, style: { display: 'flex', gap: 4, alignItems: 'center', marginTop: 8 } }, |
| 207 |
el('div', { style: { flex: 1 } }, |
| 208 |
el(TextControl, { value: item.text, __nextHasNoMarginBottom: true, onChange: function (v) { set({ prerequisites: upd(a.prerequisites, i, 'text', v) }); } }) |
| 209 |
), |
| 210 |
el(Button, { isDestructive: true, variant: 'link', style: { fontSize: 11 }, onClick: function () { set({ prerequisites: a.prerequisites.filter(function (_, j) { return j !== i; }) }); } }, '✕') |
| 211 |
); |
| 212 |
}), |
| 213 |
el(Button, { variant: 'secondary', style: { marginTop: 8 }, onClick: function () { set({ prerequisites: a.prerequisites.concat([{ text: 'New prerequisite' }]) }); } }, '+ Add Prerequisite') |
| 214 |
), |
| 215 |
// Materials |
| 216 |
el(PanelBody, { title: 'Materials', initialOpen: false }, |
| 217 |
el(ToggleControl, { label: 'Show Materials', checked: a.showMaterials, __nextHasNoMarginBottom: true, onChange: function (v) { set({ showMaterials: v }); } }), |
| 218 |
el('div', { style: { marginTop: 8 } }, |
| 219 |
el(TextControl, { label: 'Section Label', value: a.materialsLabel, __nextHasNoMarginBottom: true, onChange: function (v) { set({ materialsLabel: v }); } }) |
| 220 |
), |
| 221 |
a.materials.map(function (item, i) { |
| 222 |
return el('div', { key: i, style: { display: 'flex', gap: 4, alignItems: 'center', marginTop: 8 } }, |
| 223 |
el('div', { style: { flex: 1 } }, |
| 224 |
el(TextControl, { value: item.text, __nextHasNoMarginBottom: true, onChange: function (v) { set({ materials: upd(a.materials, i, 'text', v) }); } }) |
| 225 |
), |
| 226 |
el(Button, { isDestructive: true, variant: 'link', style: { fontSize: 11 }, onClick: function () { set({ materials: a.materials.filter(function (_, j) { return j !== i; }) }); } }, '✕') |
| 227 |
); |
| 228 |
}), |
| 229 |
el(Button, { variant: 'secondary', style: { marginTop: 8 }, onClick: function () { set({ materials: a.materials.concat([{ text: 'New material' }]) }); } }, '+ Add Material') |
| 230 |
), |
| 231 |
// Steps |
| 232 |
el(PanelBody, { title: 'Steps', initialOpen: false }, |
| 233 |
el(ToggleControl, { label: 'Show Steps', checked: a.showSteps, __nextHasNoMarginBottom: true, onChange: function (v) { set({ showSteps: v }); } }), |
| 234 |
el('div', { style: { marginTop: 8, display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 4 } }, |
| 235 |
el(ToggleControl, { label: 'Show Durations', checked: a.showStepDurations, __nextHasNoMarginBottom: true, onChange: function (v) { set({ showStepDurations: v }); } }), |
| 236 |
el(ToggleControl, { label: 'Show Tips', checked: a.showTips, __nextHasNoMarginBottom: true, onChange: function (v) { set({ showTips: v }); } }) |
| 237 |
), |
| 238 |
el('div', { style: { marginTop: 8 } }, |
| 239 |
el(TextControl, { label: 'Section Label', value: a.stepsLabel, __nextHasNoMarginBottom: true, onChange: function (v) { set({ stepsLabel: v }); } }) |
| 240 |
), |
| 241 |
a.steps.map(function (step, i) { |
| 242 |
return el('div', { key: i, style: { marginTop: 14, padding: '12px', background: '#f8fafc', borderRadius: 6, border: '1px solid #e5e7eb' } }, |
| 243 |
el('div', { style: { display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 8 } }, |
| 244 |
el('strong', { style: { fontSize: 12, color: '#374151' } }, 'Step ' + (i + 1)), |
| 245 |
el(Button, { isDestructive: true, variant: 'link', style: { fontSize: 11 }, onClick: function () { set({ steps: a.steps.filter(function (_, j) { return j !== i; }) }); } }, '✕ Remove') |
| 246 |
), |
| 247 |
el(TextControl, { label: 'Title', value: step.title, __nextHasNoMarginBottom: true, onChange: function (v) { set({ steps: upd(a.steps, i, 'title', v) }); } }), |
| 248 |
el('div', { style: { marginTop: 8 } }, |
| 249 |
el(TextareaControl, { label: 'Content', value: step.content, rows: 3, __nextHasNoMarginBottom: true, onChange: function (v) { set({ steps: upd(a.steps, i, 'content', v) }); } }) |
| 250 |
), |
| 251 |
el('div', { style: { marginTop: 8, display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 8 } }, |
| 252 |
el(TextControl, { label: 'Duration', value: step.duration, __nextHasNoMarginBottom: true, onChange: function (v) { set({ steps: upd(a.steps, i, 'duration', v) }); } }), |
| 253 |
el(TextControl, { label: 'Tip (optional)', value: step.tip, __nextHasNoMarginBottom: true, onChange: function (v) { set({ steps: upd(a.steps, i, 'tip', v) }); } }) |
| 254 |
) |
| 255 |
); |
| 256 |
}), |
| 257 |
el(Button, { variant: 'secondary', style: { marginTop: 10 }, onClick: function () { set({ steps: a.steps.concat([{ title: 'New Step', content: 'Describe this step...', duration: '5 min', tip: '' }]) }); } }, '+ Add Step') |
| 258 |
), |
| 259 |
// Typography |
| 260 |
el(PanelBody, { title: 'Typography', initialOpen: false }, |
| 261 |
getTypoControl(props, 'titleTypo', 'Title'), |
| 262 |
getTypoControl(props, 'bodyTypo', 'Body'), |
| 263 |
el('div', { style: { marginTop: 8 } }, |
| 264 |
el(RangeControl, { label: 'Badge Size (px)', value: a.subtitleSize, min: 10, max: 24, __nextHasNoMarginBottom: true, onChange: function (v) { set({ subtitleSize: v }); } }) |
| 265 |
), |
| 266 |
el('div', { style: { marginTop: 8 } }, |
| 267 |
el(RangeControl, { label: 'Author Size (px)', value: a.authorSize, min: 8, max: 20, __nextHasNoMarginBottom: true, onChange: function (v) { set({ authorSize: v }); } }) |
| 268 |
) |
| 269 |
), |
| 270 |
// Colors: Header & Structure |
| 271 |
el(PanelBody, { title: 'Spacing', initialOpen: false }, |
| 272 |
el(RangeControl, { label: 'Border Radius (px)', value: a.borderRadius, min: 0, max: 24, __nextHasNoMarginBottom: true, onChange: function (v) { set({ borderRadius: v }); } }) |
| 273 |
), |
| 274 |
el(PanelColorSettings, { |
| 275 |
title: 'Header & Structure Colors', |
| 276 |
initialOpen: false, |
| 277 |
colorSettings: [ |
| 278 |
{ label: 'Block Background', value: a.bgColor, onChange: function (v) { set({ bgColor: v || '#ffffff' }); } }, |
| 279 |
{ label: 'Border', value: a.borderColor, onChange: function (v) { set({ borderColor: v || '#e5e7eb' }); } }, |
| 280 |
{ label: 'Header Background',value: a.headerBg, onChange: function (v) { set({ headerBg: v || '#0f172a' }); } }, |
| 281 |
{ label: 'Header Text', value: a.headerColor, onChange: function (v) { set({ headerColor: v || '#ffffff' }); } }, |
| 282 |
{ label: 'Accent Color', value: a.accentColor, onChange: function (v) { set({ accentColor: v || '#3b82f6' }); } }, |
| 283 |
{ label: 'Progress Fill', value: a.progressFill, onChange: function (v) { set({ progressFill: v || '#3b82f6' }); } } |
| 284 |
] |
| 285 |
}), |
| 286 |
// Colors: Steps |
| 287 |
el(PanelColorSettings, { |
| 288 |
title: 'Step Colors', |
| 289 |
initialOpen: false, |
| 290 |
colorSettings: [ |
| 291 |
{ label: 'Step Number BG', value: a.stepNumberBg, onChange: function (v) { set({ stepNumberBg: v || '#3b82f6' }); } }, |
| 292 |
{ label: 'Step Number Text', value: a.stepNumberColor, onChange: function (v) { set({ stepNumberColor: v || '#ffffff' }); } }, |
| 293 |
{ label: 'Step Divider', value: a.stepBorderColor, onChange: function (v) { set({ stepBorderColor: v || '#e5e7eb' }); } }, |
| 294 |
{ label: 'Tip Background', value: a.stepTipBg, onChange: function (v) { set({ stepTipBg: v || '#fffbeb' }); } }, |
| 295 |
{ label: 'Tip Text', value: a.stepTipColor, onChange: function (v) { set({ stepTipColor: v || '#92400e' }); } }, |
| 296 |
{ label: 'Tip Border', value: a.stepTipBorderColor, onChange: function (v) { set({ stepTipBorderColor: v || '#fcd34d' }); } } |
| 297 |
] |
| 298 |
}), |
| 299 |
// Colors: Lists |
| 300 |
el(PanelColorSettings, { |
| 301 |
title: 'List Item Colors', |
| 302 |
initialOpen: false, |
| 303 |
colorSettings: [ |
| 304 |
{ label: 'Prerequisite BG', value: a.prerequisiteBg, onChange: function (v) { set({ prerequisiteBg: v || '#f1f5f9' }); } }, |
| 305 |
{ label: 'Prerequisite Text', value: a.prerequisiteColor, onChange: function (v) { set({ prerequisiteColor: v || '#334155' }); } }, |
| 306 |
{ label: 'Material BG', value: a.materialBg, onChange: function (v) { set({ materialBg: v || '#f0f9ff' }); } }, |
| 307 |
{ label: 'Material Text', value: a.materialColor, onChange: function (v) { set({ materialColor: v || '#0c4a6e' }); } }, |
| 308 |
{ label: 'Outcome BG', value: a.outcomeBg, onChange: function (v) { set({ outcomeBg: v || '#f0fdf4' }); } }, |
| 309 |
{ label: 'Outcome Text', value: a.outcomeColor, onChange: function (v) { set({ outcomeColor: v || '#14532d' }); } } |
| 310 |
] |
| 311 |
}) |
| 312 |
) |
| 313 |
); |
| 314 |
}, |
| 315 |
|
| 316 |
save: function (props) { |
| 317 |
var useBlockProps = wp.blockEditor.useBlockProps; |
| 318 |
var a = props.attributes; |
| 319 |
var bp = useBlockProps.save((function () { |
| 320 |
var _tv = getTypoCssVars(a); |
| 321 |
var s = {}; |
| 322 |
Object.assign(s, _tv); |
| 323 |
return { style: s }; |
| 324 |
})()); |
| 325 |
return wp.element.createElement('div', bp, |
| 326 |
wp.element.createElement('div', { |
| 327 |
className: 'bkbg-tutorial-card-app', |
| 328 |
'data-opts': JSON.stringify(a) |
| 329 |
}) |
| 330 |
); |
| 331 |
} |
| 332 |
}); |
| 333 |
}() ); |
| 334 |
|