| @@ -20,11 +20,22 @@ | ||
| 20 | 20 | var ColorPicker = wp.components.ColorPicker; |
| 21 | 21 | var Popover = wp.components.Popover; |
| 22 | 22 | var __ = wp.i18n.__; |
| 23 | 23 | |
| 24 | - var _tc, _tvf; | |
| 25 | - Object.defineProperty(window, '_tc', { get: function () { return _tc || (_tc = window.bkbgTypographyControl); } }); | |
| 26 | - Object.defineProperty(window, '_tvf', { get: function () { return _tvf || (_tvf = window.bkbgTypoCssVars); } }); | |
| 24 | + // Resolve the shared components lazily without defining globals for each block. | |
| 25 | + function _tc(label, key, attrs, setA) { | |
| 26 | + var Control = window.bkbgTypographyControl; | |
| 27 | + return Control ? el(Control, { | |
| 28 | + label: label, | |
| 29 | + value: attrs[key] || {}, | |
| 30 | + onChange: function (value) { var update = {}; update[key] = value; setA(update); } | |
| 31 | + }) : null; | |
| 32 | + } | |
| 33 | + function _tvf(vars, key, attrs, prefix) { | |
| 34 | + var cssVars = window.bkbgTypoCssVars; | |
| 35 | + if (cssVars) Object.assign(vars, cssVars(attrs[key] || {}, prefix)); | |
| 36 | + return vars; | |
| 37 | + } | |
| 27 | 38 | function getTypoControl(label, key, attrs, setA) { return _tc(label, key, attrs, setA); } |
| 28 | 39 | function getTypoCssVars(attrs) { |
| 29 | 40 | var v = {}; |
| 30 | 41 | _tvf(v, 'titleTypo', attrs, '--bkusec-tt-'); |