PluginProbe
Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor / 2.0.14
Blockenberg — 600+ Advanced Gutenberg Blocks & AI Agent for WordPress Block Editor v2.0.14
2.0.14 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
← All changes | blocks/toggle/index.js +16 -6 2.0.8 → 2.0.14 View file →
@@ -13,12 +13,22 @@
13 13 var RangeControl = wp.components.RangeControl;
14 14 var SelectControl = wp.components.SelectControl;
15 15 var TextControl = wp.components.TextControl;
16 16
17 - var _tc, _tvf;
18 - Object.defineProperty(window, '_bkbgTypoCtrlCache', { get: function () { if (!_tc) { _tc = window.bkbgTypographyControl; } return _tc; } });
19 - Object.defineProperty(window, '_bkbgTypoVarsCache', { get: function () { if (!_tvf) { _tvf = window.bkbgTypoCssVars; } return _tvf; } });
20 - function getTypoControl(props, attrName, label) { return window._bkbgTypoCtrlCache(props, attrName, label); }
17 + // Resolve the shared components lazily without defining globals for each block.
18 + function _tc(props, key, label) {
19 + var Control = window.bkbgTypographyControl;
20 + return Control ? el(Control, {
21 + label: label,
22 + value: props.attributes[key] || {},
23 + onChange: function (value) { var update = {}; update[key] = value; props.setAttributes(update); }
24 + }) : null;
25 + }
26 + function _tvf(typo, prefix) {
27 + var cssVars = window.bkbgTypoCssVars;
28 + return cssVars ? cssVars(typo || {}, prefix) : {};
29 + }
30 + function getTypoControl(props, attrName, label) { return _tc(props, attrName, label); }
21 31
22 32 var icons = {
23 33 chevron: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"/></svg>',
24 34 plus: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><line x1="12" y1="5" x2="12" y2="19"/><line x1="5" y1="12" x2="19" y2="12"/></svg>',
@@ -83,9 +93,9 @@
83 93 '--bkbg-tgl-icon-active-color': a.iconActiveColor,
84 94 '--bkbg-tgl-border-color': a.borderColor,
85 95 '--bkbg-tgl-divider-color': a.dividerColor
86 96 };
87 - Object.assign(wrapStyle, window._bkbgTypoVarsCache(a.titleTypo, '--bktgl-tt-'), window._bkbgTypoVarsCache(a.contentTypo, '--bktgl-ct-'));
97 + Object.assign(wrapStyle, _tvf(a.titleTypo, '--bktgl-tt-'), _tvf(a.contentTypo, '--bktgl-ct-'));
88 98
89 99 var blockProps = useBlockProps({
90 100 className: 'bkbg-tgl-wrap bkbg-tgl-editor' + (isOpen ? ' is-open' : ''),
91 101 style: wrapStyle,
@@ -242,9 +252,9 @@
242 252 '--bkbg-tgl-icon-active-color:' + a.iconActiveColor,
243 253 '--bkbg-tgl-border-color:' + a.borderColor,
244 254 '--bkbg-tgl-divider-color:' + a.dividerColor
245 255 ];
246 - var tv = Object.assign({}, window._bkbgTypoVarsCache(a.titleTypo, '--bktgl-tt-'), window._bkbgTypoVarsCache(a.contentTypo, '--bktgl-ct-'));
256 + var tv = Object.assign({}, _tvf(a.titleTypo, '--bktgl-tt-'), _tvf(a.contentTypo, '--bktgl-ct-'));
247 257 Object.keys(tv).forEach(function (k) { wrapParts.push(k + ':' + tv[k]); });
248 258 var wrapStyle = wrapParts.join(';');
249 259
250 260 var iconSvgs = {