| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 (function() { 2 var wp; 3 (wp ||= {}).customizeWidgets = (() => { 4 var __create = Object.create; 5 var __defProp = Object.defineProperty; 6 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 7 var __getOwnPropNames = Object.getOwnPropertyNames; 8 var __getProtoOf = Object.getPrototypeOf; 9 var __hasOwnProp = Object.prototype.hasOwnProperty; 10 var __commonJS = (cb, mod) => function __require() { 11 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 12 }; 13 var __export = (target, all) => { 14 for (var name in all) 15 __defProp(target, name, { get: all[name], enumerable: true }); 16 }; 17 var __copyProps = (to, from, except, desc) => { 18 if (from && typeof from === "object" || typeof from === "function") { 19 for (let key of __getOwnPropNames(from)) 20 if (!__hasOwnProp.call(to, key) && key !== except) 21 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 22 } 23 return to; 24 }; 25 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 26 // If the importer is in node compatibility mode or this is not an ESM 27 // file that has been converted to a CommonJS file using a Babel- 28 // compatible transform (i.e. "__esModule" has not been set), then set 29 // "default" to the CommonJS "module.exports" for node compatibility. 30 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 31 mod 32 )); 33 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); 34 35 // package-external:@wordpress/element 36 var require_element = __commonJS({ 37 "package-external:@wordpress/element"(exports, module) { 38 module.exports = window.wp.element; 39 } 40 }); 41 42 // package-external:@wordpress/block-library 43 var require_block_library = __commonJS({ 44 "package-external:@wordpress/block-library"(exports, module) { 45 module.exports = window.wp.blockLibrary; 46 } 47 }); 48 49 // package-external:@wordpress/widgets 50 var require_widgets = __commonJS({ 51 "package-external:@wordpress/widgets"(exports, module) { 52 module.exports = window.wp.widgets; 53 } 54 }); 55 56 // package-external:@wordpress/blocks 57 var require_blocks = __commonJS({ 58 "package-external:@wordpress/blocks"(exports, module) { 59 module.exports = window.wp.blocks; 60 } 61 }); 62 63 // package-external:@wordpress/data 64 var require_data = __commonJS({ 65 "package-external:@wordpress/data"(exports, module) { 66 module.exports = window.wp.data; 67 } 68 }); 69 70 // package-external:@wordpress/preferences 71 var require_preferences = __commonJS({ 72 "package-external:@wordpress/preferences"(exports, module) { 73 module.exports = window.wp.preferences; 74 } 75 }); 76 77 // package-external:@wordpress/i18n 78 var require_i18n = __commonJS({ 79 "package-external:@wordpress/i18n"(exports, module) { 80 module.exports = window.wp.i18n; 81 } 82 }); 83 84 // vendor-external:react 85 var require_react = __commonJS({ 86 "vendor-external:react"(exports, module) { 87 module.exports = window.React; 88 } 89 }); 90 91 // vendor-external:react/jsx-runtime 92 var require_jsx_runtime = __commonJS({ 93 "vendor-external:react/jsx-runtime"(exports, module) { 94 module.exports = window.ReactJSXRuntime; 95 } 96 }); 97 98 // package-external:@wordpress/primitives 99 var require_primitives = __commonJS({ 100 "package-external:@wordpress/primitives"(exports, module) { 101 module.exports = window.wp.primitives; 102 } 103 }); 104 105 // package-external:@wordpress/compose 106 var require_compose = __commonJS({ 107 "package-external:@wordpress/compose"(exports, module) { 108 module.exports = window.wp.compose; 109 } 110 }); 111 112 // package-external:@wordpress/theme 113 var require_theme = __commonJS({ 114 "package-external:@wordpress/theme"(exports, module) { 115 module.exports = window.wp.theme; 116 } 117 }); 118 119 // package-external:@wordpress/private-apis 120 var require_private_apis = __commonJS({ 121 "package-external:@wordpress/private-apis"(exports, module) { 122 module.exports = window.wp.privateApis; 123 } 124 }); 125 126 // package-external:@wordpress/components 127 var require_components = __commonJS({ 128 "package-external:@wordpress/components"(exports, module) { 129 module.exports = window.wp.components; 130 } 131 }); 132 133 // package-external:@wordpress/block-editor 134 var require_block_editor = __commonJS({ 135 "package-external:@wordpress/block-editor"(exports, module) { 136 module.exports = window.wp.blockEditor; 137 } 138 }); 139 140 // package-external:@wordpress/hooks 141 var require_hooks = __commonJS({ 142 "package-external:@wordpress/hooks"(exports, module) { 143 module.exports = window.wp.hooks; 144 } 145 }); 146 147 // package-external:@wordpress/core-data 148 var require_core_data = __commonJS({ 149 "package-external:@wordpress/core-data"(exports, module) { 150 module.exports = window.wp.coreData; 151 } 152 }); 153 154 // package-external:@wordpress/media-utils 155 var require_media_utils = __commonJS({ 156 "package-external:@wordpress/media-utils"(exports, module) { 157 module.exports = window.wp.mediaUtils; 158 } 159 }); 160 161 // package-external:@wordpress/keycodes 162 var require_keycodes = __commonJS({ 163 "package-external:@wordpress/keycodes"(exports, module) { 164 module.exports = window.wp.keycodes; 165 } 166 }); 167 168 // package-external:@wordpress/keyboard-shortcuts 169 var require_keyboard_shortcuts = __commonJS({ 170 "package-external:@wordpress/keyboard-shortcuts"(exports, module) { 171 module.exports = window.wp.keyboardShortcuts; 172 } 173 }); 174 175 // node_modules/fast-deep-equal/es6/index.js 176 var require_es6 = __commonJS({ 177 "node_modules/fast-deep-equal/es6/index.js"(exports, module) { 178 "use strict"; 179 module.exports = function equal(a, b) { 180 if (a === b) return true; 181 if (a && b && typeof a == "object" && typeof b == "object") { 182 if (a.constructor !== b.constructor) return false; 183 var length, i, keys; 184 if (Array.isArray(a)) { 185 length = a.length; 186 if (length != b.length) return false; 187 for (i = length; i-- !== 0; ) 188 if (!equal(a[i], b[i])) return false; 189 return true; 190 } 191 if (a instanceof Map && b instanceof Map) { 192 if (a.size !== b.size) return false; 193 for (i of a.entries()) 194 if (!b.has(i[0])) return false; 195 for (i of a.entries()) 196 if (!equal(i[1], b.get(i[0]))) return false; 197 return true; 198 } 199 if (a instanceof Set && b instanceof Set) { 200 if (a.size !== b.size) return false; 201 for (i of a.entries()) 202 if (!b.has(i[0])) return false; 203 return true; 204 } 205 if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { 206 length = a.length; 207 if (length != b.length) return false; 208 for (i = length; i-- !== 0; ) 209 if (a[i] !== b[i]) return false; 210 return true; 211 } 212 if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; 213 if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); 214 if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); 215 keys = Object.keys(a); 216 length = keys.length; 217 if (length !== Object.keys(b).length) return false; 218 for (i = length; i-- !== 0; ) 219 if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; 220 for (i = length; i-- !== 0; ) { 221 var key = keys[i]; 222 if (!equal(a[key], b[key])) return false; 223 } 224 return true; 225 } 226 return a !== a && b !== b; 227 }; 228 } 229 }); 230 231 // package-external:@wordpress/is-shallow-equal 232 var require_is_shallow_equal = __commonJS({ 233 "package-external:@wordpress/is-shallow-equal"(exports, module) { 234 module.exports = window.wp.isShallowEqual; 235 } 236 }); 237 238 // package-external:@wordpress/dom 239 var require_dom = __commonJS({ 240 "package-external:@wordpress/dom"(exports, module) { 241 module.exports = window.wp.dom; 242 } 243 }); 244 245 // packages/customize-widgets/build-module/index.mjs 246 var index_exports = {}; 247 __export(index_exports, { 248 initialize: () => initialize, 249 store: () => store 250 }); 251 var import_element18 = __toESM(require_element(), 1); 252 var import_block_library2 = __toESM(require_block_library(), 1); 253 var import_widgets5 = __toESM(require_widgets(), 1); 254 var import_blocks2 = __toESM(require_blocks(), 1); 255 var import_data17 = __toESM(require_data(), 1); 256 var import_preferences4 = __toESM(require_preferences(), 1); 257 258 // node_modules/clsx/dist/clsx.mjs 259 function r(e) { 260 var t, f, n = ""; 261 if ("string" == typeof e || "number" == typeof e) n += e; 262 else if ("object" == typeof e) if (Array.isArray(e)) { 263 var o = e.length; 264 for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f); 265 } else for (f in e) e[f] && (n && (n += " "), n += f); 266 return n; 267 } 268 function clsx() { 269 for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t); 270 return n; 271 } 272 var clsx_default = clsx; 273 274 // node_modules/@base-ui/utils/useRefWithInit.mjs 275 var React = __toESM(require_react(), 1); 276 var UNINITIALIZED = {}; 277 function useRefWithInit(init, initArg) { 278 const ref = React.useRef(UNINITIALIZED); 279 if (ref.current === UNINITIALIZED) { 280 ref.current = init(initArg); 281 } 282 return ref; 283 } 284 285 // node_modules/@base-ui/utils/warn.mjs 286 var set; 287 if (true) { 288 set = /* @__PURE__ */ new Set(); 289 } 290 function warn(...messages) { 291 if (true) { 292 const messageKey = messages.join(" "); 293 if (!set.has(messageKey)) { 294 set.add(messageKey); 295 console.warn(`Base UI: $messageKey}`); 296 } 297 } 298 } 299 300 // node_modules/@base-ui/react/internals/useRenderElement.mjs 301 var React4 = __toESM(require_react(), 1); 302 303 // node_modules/@base-ui/utils/useMergedRefs.mjs 304 function useMergedRefs(a, b, c, d) { 305 const forkRef = useRefWithInit(createForkRef).current; 306 if (didChange(forkRef, a, b, c, d)) { 307 update(forkRef, [a, b, c, d]); 308 } 309 return forkRef.callback; 310 } 311 function useMergedRefsN(refs) { 312 const forkRef = useRefWithInit(createForkRef).current; 313 if (didChangeN(forkRef, refs)) { 314 update(forkRef, refs); 315 } 316 return forkRef.callback; 317 } 318 function createForkRef() { 319 return { 320 callback: null, 321 cleanup: null, 322 refs: [] 323 }; 324 } 325 function didChange(forkRef, a, b, c, d) { 326 return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d; 327 } 328 function didChangeN(forkRef, newRefs) { 329 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]); 330 } 331 function update(forkRef, refs) { 332 forkRef.refs = refs; 333 if (refs.every((ref) => ref == null)) { 334 forkRef.callback = null; 335 return; 336 } 337 forkRef.callback = (instance) => { 338 if (forkRef.cleanup) { 339 forkRef.cleanup(); 340 forkRef.cleanup = null; 341 } 342 if (instance != null) { 343 const cleanupCallbacks = Array(refs.length).fill(null); 344 for (let i = 0; i < refs.length; i += 1) { 345 const ref = refs[i]; 346 if (ref == null) { 347 continue; 348 } 349 switch (typeof ref) { 350 case "function": { 351 const refCleanup = ref(instance); 352 if (typeof refCleanup === "function") { 353 cleanupCallbacks[i] = refCleanup; 354 } 355 break; 356 } 357 case "object": { 358 ref.current = instance; 359 break; 360 } 361 default: 362 } 363 } 364 forkRef.cleanup = () => { 365 for (let i = 0; i < refs.length; i += 1) { 366 const ref = refs[i]; 367 if (ref == null) { 368 continue; 369 } 370 switch (typeof ref) { 371 case "function": { 372 const cleanupCallback = cleanupCallbacks[i]; 373 if (typeof cleanupCallback === "function") { 374 cleanupCallback(); 375 } else { 376 ref(null); 377 } 378 break; 379 } 380 case "object": { 381 ref.current = null; 382 break; 383 } 384 default: 385 } 386 } 387 }; 388 } 389 }; 390 } 391 392 // node_modules/@base-ui/utils/getReactElementRef.mjs 393 var React3 = __toESM(require_react(), 1); 394 395 // node_modules/@base-ui/utils/reactVersion.mjs 396 var React2 = __toESM(require_react(), 1); 397 var majorVersion = parseInt(React2.version, 10); 398 function isReactVersionAtLeast(reactVersionToCheck) { 399 return majorVersion >= reactVersionToCheck; 400 } 401 402 // node_modules/@base-ui/utils/getReactElementRef.mjs 403 function getReactElementRef(element) { 404 if (!/* @__PURE__ */ React3.isValidElement(element)) { 405 return null; 406 } 407 const reactElement = element; 408 const propsWithRef = reactElement.props; 409 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; 410 } 411 412 // node_modules/@base-ui/utils/mergeObjects.mjs 413 function mergeObjects(a, b) { 414 if (a && !b) { 415 return a; 416 } 417 if (!a && b) { 418 return b; 419 } 420 if (a || b) { 421 return { 422 ...a, 423 ...b 424 }; 425 } 426 return void 0; 427 } 428 429 // node_modules/@base-ui/utils/empty.mjs 430 var EMPTY_ARRAY = Object.freeze([]); 431 var EMPTY_OBJECT = Object.freeze({}); 432 433 // node_modules/@base-ui/react/internals/getStateAttributesProps.mjs 434 function getStateAttributesProps(state, customMapping) { 435 const props = {}; 436 for (const key in state) { 437 const value = state[key]; 438 if (customMapping?.hasOwnProperty(key)) { 439 const customProps = customMapping[key](value); 440 if (customProps != null) { 441 Object.assign(props, customProps); 442 } 443 continue; 444 } 445 if (value === true) { 446 props[`data-$key.toLowerCase()}`] = ""; 447 } else if (value) { 448 props[`data-$key.toLowerCase()}`] = value.toString(); 449 } 450 } 451 return props; 452 } 453 454 // node_modules/@base-ui/react/utils/resolveClassName.mjs 455 function resolveClassName(className, state) { 456 return typeof className === "function" ? className(state) : className; 457 } 458 459 // node_modules/@base-ui/react/utils/resolveStyle.mjs 460 function resolveStyle(style, state) { 461 return typeof style === "function" ? style(state) : style; 462 } 463 464 // node_modules/@base-ui/react/merge-props/mergeProps.mjs 465 var EMPTY_PROPS = {}; 466 function mergeProps(a, b, c, d, e) { 467 if (!c && !d && !e && !a) { 468 return createInitialMergedProps(b); 469 } 470 let merged = createInitialMergedProps(a); 471 if (b) { 472 merged = mergeInto(merged, b); 473 } 474 if (c) { 475 merged = mergeInto(merged, c); 476 } 477 if (d) { 478 merged = mergeInto(merged, d); 479 } 480 if (e) { 481 merged = mergeInto(merged, e); 482 } 483 return merged; 484 } 485 function mergePropsN(props) { 486 if (props.length === 0) { 487 return EMPTY_PROPS; 488 } 489 if (props.length === 1) { 490 return createInitialMergedProps(props[0]); 491 } 492 let merged = createInitialMergedProps(props[0]); 493 for (let i = 1; i < props.length; i += 1) { 494 merged = mergeInto(merged, props[i]); 495 } 496 return merged; 497 } 498 function createInitialMergedProps(inputProps) { 499 if (isPropsGetter(inputProps)) { 500 return { 501 ...resolvePropsGetter(inputProps, EMPTY_PROPS) 502 }; 503 } 504 return copyInitialProps(inputProps); 505 } 506 function mergeInto(merged, inputProps) { 507 if (isPropsGetter(inputProps)) { 508 return resolvePropsGetter(inputProps, merged); 509 } 510 return mutablyMergeInto(merged, inputProps); 511 } 512 function copyInitialProps(inputProps) { 513 const copiedProps = { 514 ...inputProps 515 }; 516 for (const propName in copiedProps) { 517 const propValue = copiedProps[propName]; 518 if (isEventHandler(propName, propValue)) { 519 copiedProps[propName] = wrapEventHandler(propValue); 520 } 521 } 522 return copiedProps; 523 } 524 function mutablyMergeInto(mergedProps, externalProps) { 525 if (!externalProps) { 526 return mergedProps; 527 } 528 for (const propName in externalProps) { 529 const externalPropValue = externalProps[propName]; 530 switch (propName) { 531 case "style": { 532 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue); 533 break; 534 } 535 case "className": { 536 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue); 537 break; 538 } 539 default: { 540 if (isEventHandler(propName, externalPropValue)) { 541 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue); 542 } else { 543 mergedProps[propName] = externalPropValue; 544 } 545 } 546 } 547 } 548 return mergedProps; 549 } 550 function isEventHandler(key, value) { 551 const code0 = key.charCodeAt(0); 552 const code1 = key.charCodeAt(1); 553 const code2 = key.charCodeAt(2); 554 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined"); 555 } 556 function isPropsGetter(inputProps) { 557 return typeof inputProps === "function"; 558 } 559 function resolvePropsGetter(inputProps, previousProps) { 560 if (isPropsGetter(inputProps)) { 561 return inputProps(previousProps); 562 } 563 return inputProps ?? EMPTY_PROPS; 564 } 565 function mergeEventHandlers(ourHandler, theirHandler) { 566 if (!theirHandler) { 567 return ourHandler; 568 } 569 if (!ourHandler) { 570 return wrapEventHandler(theirHandler); 571 } 572 return (...args) => { 573 const event = args[0]; 574 if (isSyntheticEvent(event)) { 575 const baseUIEvent = event; 576 makeEventPreventable(baseUIEvent); 577 const result2 = theirHandler(...args); 578 if (!baseUIEvent.baseUIHandlerPrevented) { 579 ourHandler?.(...args); 580 } 581 return result2; 582 } 583 const result = theirHandler(...args); 584 ourHandler?.(...args); 585 return result; 586 }; 587 } 588 function wrapEventHandler(handler) { 589 if (!handler) { 590 return handler; 591 } 592 return (...args) => { 593 const event = args[0]; 594 if (isSyntheticEvent(event)) { 595 makeEventPreventable(event); 596 } 597 return handler(...args); 598 }; 599 } 600 function makeEventPreventable(event) { 601 event.preventBaseUIHandler = () => { 602 event.baseUIHandlerPrevented = true; 603 }; 604 return event; 605 } 606 function mergeClassNames(ourClassName, theirClassName) { 607 if (theirClassName) { 608 if (ourClassName) { 609 return theirClassName + " " + ourClassName; 610 } 611 return theirClassName; 612 } 613 return ourClassName; 614 } 615 function isSyntheticEvent(event) { 616 return event != null && typeof event === "object" && "nativeEvent" in event; 617 } 618 619 // node_modules/@base-ui/react/internals/useRenderElement.mjs 620 var import_react = __toESM(require_react(), 1); 621 function useRenderElement(element, componentProps, params = {}) { 622 const renderProp = componentProps.render; 623 const outProps = useRenderElementProps(componentProps, params); 624 if (params.enabled === false) { 625 return null; 626 } 627 const state = params.state ?? EMPTY_OBJECT; 628 return evaluateRenderProp(element, renderProp, outProps, state); 629 } 630 function useRenderElementProps(componentProps, params = {}) { 631 const { 632 className: classNameProp, 633 style: styleProp, 634 render: renderProp 635 } = componentProps; 636 const { 637 state = EMPTY_OBJECT, 638 ref, 639 props, 640 stateAttributesMapping, 641 enabled = true 642 } = params; 643 const className = enabled ? resolveClassName(classNameProp, state) : void 0; 644 const style = enabled ? resolveStyle(styleProp, state) : void 0; 645 const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT; 646 const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0; 647 const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT; 648 if (typeof document !== "undefined") { 649 if (!enabled) { 650 useMergedRefs(null, null); 651 } else if (Array.isArray(ref)) { 652 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); 653 } else { 654 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); 655 } 656 } 657 if (!enabled) { 658 return EMPTY_OBJECT; 659 } 660 if (className !== void 0) { 661 outProps.className = mergeClassNames(outProps.className, className); 662 } 663 if (style !== void 0) { 664 outProps.style = mergeObjects(outProps.style, style); 665 } 666 return outProps; 667 } 668 function resolveRenderFunctionProps(props) { 669 if (Array.isArray(props)) { 670 return mergePropsN(props); 671 } 672 return mergeProps(void 0, props); 673 } 674 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); 675 var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/; 676 var LOWERCASE_CHARACTER_PATTERN = /[a-z]/; 677 function evaluateRenderProp(element, render, props, state) { 678 if (render) { 679 if (typeof render === "function") { 680 if (true) { 681 warnIfRenderPropLooksLikeComponent(render); 682 } 683 return render(props, state); 684 } 685 const mergedProps = mergeProps(props, render.props); 686 mergedProps.ref = props.ref; 687 let newElement = render; 688 if (newElement?.$$typeof === REACT_LAZY_TYPE) { 689 const children = React4.Children.toArray(render); 690 newElement = children[0]; 691 } 692 if (true) { 693 if (!/* @__PURE__ */ React4.isValidElement(newElement)) { 694 throw new Error(["Base UI: The `render` prop was provided an invalid React element as `React.isValidElement(render)` is `false`.", "A valid React element must be provided to the `render` prop because it is cloned with props to replace the default element.", "https://base-ui.com/r/invalid-render-prop"].join("\n")); 695 } 696 } 697 return /* @__PURE__ */ React4.cloneElement(newElement, mergedProps); 698 } 699 if (element) { 700 if (typeof element === "string") { 701 return renderTag(element, props); 702 } 703 } 704 throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8)); 705 } 706 function warnIfRenderPropLooksLikeComponent(renderFn) { 707 const functionName = renderFn.name; 708 if (functionName.length === 0) { 709 return; 710 } 711 if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) { 712 return; 713 } 714 if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) { 715 return; 716 } 717 warn(`The \`render\` prop received a function named \`$functionName}\` that starts with an uppercase letter.`, "This usually means a React component was passed directly as `render={Component}`.", "Base UI calls `render` as a plain function, which can break the Rules of Hooks during reconciliation.", "If this is an intentional render callback, rename it to start with a lowercase letter.", "Use `render={<Component />}` or `render={(props) => <Component {...props} />}` instead.", "https://base-ui.com/r/invalid-render-prop"); 718 } 719 function renderTag(Tag, props) { 720 if (Tag === "button") { 721 return /* @__PURE__ */ (0, import_react.createElement)("button", { 722 type: "button", 723 ...props, 724 key: props.key 725 }); 726 } 727 if (Tag === "img") { 728 return /* @__PURE__ */ (0, import_react.createElement)("img", { 729 alt: "", 730 ...props, 731 key: props.key 732 }); 733 } 734 return /* @__PURE__ */ React4.createElement(Tag, props); 735 } 736 737 // node_modules/@base-ui/react/use-render/useRender.mjs 738 function useRender(params) { 739 return useRenderElement(params.defaultTagName ?? "div", params, params); 740 } 741 742 // packages/icons/build-module/library/close-small.mjs 743 var import_primitives = __toESM(require_primitives(), 1); 744 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); 745 var close_small_default = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_primitives.Path, { d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z" }) }); 746 747 // packages/icons/build-module/library/external.mjs 748 var import_primitives2 = __toESM(require_primitives(), 1); 749 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); 750 var external_default = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_primitives2.Path, { d: "M19.5 4.5h-7V6h4.44l-5.97 5.97 1.06 1.06L18 7.06v4.44h1.5v-7Zm-13 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-3H17v3a.5.5 0 0 1-.5.5h-10a.5.5 0 0 1-.5-.5v-10a.5.5 0 0 1 .5-.5h3V5.5h-3Z" }) }); 751 752 // packages/icons/build-module/library/more-vertical.mjs 753 var import_primitives3 = __toESM(require_primitives(), 1); 754 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); 755 var more_vertical_default = /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_primitives3.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) }); 756 757 // packages/icons/build-module/library/plus.mjs 758 var import_primitives4 = __toESM(require_primitives(), 1); 759 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); 760 var plus_default = /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_primitives4.Path, { d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" }) }); 761 762 // packages/icons/build-module/library/redo.mjs 763 var import_primitives5 = __toESM(require_primitives(), 1); 764 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); 765 var redo_default = /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_primitives5.Path, { d: "M15.6 6.5l-1.1 1 2.9 3.3H8c-.9 0-1.7.3-2.3.9-1.4 1.5-1.4 4.2-1.4 5.6v.2h1.5v-.3c0-1.1 0-3.5 1-4.5.3-.3.7-.5 1.3-.5h9.2L14.5 15l1.1 1.1 4.6-4.6-4.6-5z" }) }); 766 767 // packages/icons/build-module/library/undo.mjs 768 var import_primitives6 = __toESM(require_primitives(), 1); 769 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); 770 var undo_default = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_primitives6.Path, { d: "M18.3 11.7c-.6-.6-1.4-.9-2.3-.9H6.7l2.9-3.3-1.1-1-4.5 5L8.5 16l1-1-2.7-2.7H16c.5 0 .9.2 1.3.5 1 1 1 3.4 1 4.5v.3h1.5v-.2c0-1.5 0-4.3-1.5-5.7z" }) }); 771 772 // packages/ui/build-module/visually-hidden/visually-hidden.mjs 773 var import_element = __toESM(require_element(), 1); 774 var STYLE_HASH_ATTRIBUTE = "data-wp-hash"; 775 function getRuntime() { 776 const globalScope = globalThis; 777 if (globalScope.__wpStyleRuntime) { 778 return globalScope.__wpStyleRuntime; 779 } 780 globalScope.__wpStyleRuntime = { 781 documents: /* @__PURE__ */ new Map(), 782 styles: /* @__PURE__ */ new Map(), 783 injectedStyles: /* @__PURE__ */ new WeakMap() 784 }; 785 if (typeof document !== "undefined") { 786 registerDocument(document); 787 } 788 return globalScope.__wpStyleRuntime; 789 } 790 function documentContainsStyleHash(targetDocument, hash) { 791 if (!targetDocument.head) { 792 return false; 793 } 794 for (const style of targetDocument.head.querySelectorAll( 795 `style[$STYLE_HASH_ATTRIBUTE}]` 796 )) { 797 if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) { 798 return true; 799 } 800 } 801 return false; 802 } 803 function injectStyle(targetDocument, hash, css) { 804 if (!targetDocument.head) { 805 return; 806 } 807 const runtime = getRuntime(); 808 let injectedStyles = runtime.injectedStyles.get(targetDocument); 809 if (!injectedStyles) { 810 injectedStyles = /* @__PURE__ */ new Set(); 811 runtime.injectedStyles.set(targetDocument, injectedStyles); 812 } 813 if (injectedStyles.has(hash)) { 814 return; 815 } 816 if (documentContainsStyleHash(targetDocument, hash)) { 817 injectedStyles.add(hash); 818 return; 819 } 820 const style = targetDocument.createElement("style"); 821 style.setAttribute(STYLE_HASH_ATTRIBUTE, hash); 822 style.appendChild(targetDocument.createTextNode(css)); 823 targetDocument.head.appendChild(style); 824 injectedStyles.add(hash); 825 } 826 function registerDocument(targetDocument) { 827 const runtime = getRuntime(); 828 runtime.documents.set( 829 targetDocument, 830 (runtime.documents.get(targetDocument) ?? 0) + 1 831 ); 832 for (const [hash, css] of runtime.styles) { 833 injectStyle(targetDocument, hash, css); 834 } 835 return () => { 836 const count = runtime.documents.get(targetDocument); 837 if (count === void 0) { 838 return; 839 } 840 if (count <= 1) { 841 runtime.documents.delete(targetDocument); 842 return; 843 } 844 runtime.documents.set(targetDocument, count - 1); 845 }; 846 } 847 function registerStyle(hash, css) { 848 const runtime = getRuntime(); 849 runtime.styles.set(hash, css); 850 for (const targetDocument of runtime.documents.keys()) { 851 injectStyle(targetDocument, hash, css); 852 } 853 } 854 if (typeof process === "undefined" || true) { 855 registerStyle("fa606a57ae", "@layer wp-ui{@layer utilities, components, compositions, overrides;@layer components{.f37b9e2e191ebd66__visually-hidden{word-wrap:normal;border:0;clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;width:1px;word-break:normal}}}"); 856 } 857 var style_default = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" }; 858 var VisuallyHidden = (0, import_element.forwardRef)( 859 function VisuallyHidden2({ render, ...restProps }, ref) { 860 const element = useRender({ 861 render, 862 ref, 863 props: mergeProps( 864 { className: style_default["visually-hidden"] }, 865 restProps, 866 { 867 // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it. 868 "data-visually-hidden": "" 869 } 870 ) 871 }); 872 return element; 873 } 874 ); 875 876 // packages/admin-ui/build-module/admin-theme-colors/index.mjs 877 var DEFAULT_THEME_COLORS = { 878 primary: "#3858e9", 879 background: "#222524" 880 }; 881 var ADMIN_THEME_COLORS = /* @__PURE__ */ new Map([ 882 ["modern", DEFAULT_THEME_COLORS], 883 ["fresh", { primary: "#3858e9", background: "#25292b" }], 884 ["midnight", { primary: "#cf4339", background: "#3d4042" }], 885 ["coffee", { primary: "#916745", background: "#5b534d" }], 886 ["ocean", { primary: "#567958", background: "#5f787f" }], 887 ["blue", { primary: "#437aa8", background: "#3876a8" }], 888 ["ectoplasm", { primary: "#646c3e", background: "#4f386e" }], 889 ["sunrise", { primary: "#ad631e", background: "#cc4541" }], 890 ["light", { primary: "#007cba", background: "#eaeeed" }] 891 ]); 892 function getAdminThemeColors() { 893 const scheme = document.body.className.match(/admin-color-([\w-]+)/)?.[1] ?? "modern"; 894 return ADMIN_THEME_COLORS.get(scheme) ?? DEFAULT_THEME_COLORS; 895 } 896 897 // packages/customize-widgets/build-module/components/customize-widgets/index.mjs 898 var import_element17 = __toESM(require_element(), 1); 899 var import_components8 = __toESM(require_components(), 1); 900 var import_theme = __toESM(require_theme(), 1); 901 902 // packages/customize-widgets/build-module/components/error-boundary/index.mjs 903 var import_element2 = __toESM(require_element(), 1); 904 var import_i18n = __toESM(require_i18n(), 1); 905 var import_components = __toESM(require_components(), 1); 906 var import_block_editor = __toESM(require_block_editor(), 1); 907 var import_compose = __toESM(require_compose(), 1); 908 var import_hooks = __toESM(require_hooks(), 1); 909 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); 910 function CopyButton({ text, children }) { 911 const ref = (0, import_compose.useCopyToClipboard)(text); 912 return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_components.Button, { size: "compact", variant: "secondary", ref, children }); 913 } 914 var ErrorBoundary = class extends import_element2.Component { 915 constructor() { 916 super(...arguments); 917 this.state = { 918 error: null 919 }; 920 } 921 componentDidCatch(error) { 922 this.setState({ error }); 923 (0, import_hooks.doAction)("editor.ErrorBoundary.errorLogged", error); 924 } 925 render() { 926 const { error } = this.state; 927 if (!error) { 928 return this.props.children; 929 } 930 return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)( 931 import_block_editor.Warning, 932 { 933 className: "customize-widgets-error-boundary", 934 actions: [ 935 /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CopyButton, { text: error.stack, children: (0, import_i18n.__)("Copy Error") }, "copy-error") 936 ], 937 children: (0, import_i18n.__)("The editor has encountered an unexpected error.") 938 } 939 ); 940 } 941 }; 942 943 // packages/customize-widgets/build-module/components/sidebar-block-editor/index.mjs 944 var import_compose3 = __toESM(require_compose(), 1); 945 var import_core_data = __toESM(require_core_data(), 1); 946 var import_data12 = __toESM(require_data(), 1); 947 var import_element14 = __toESM(require_element(), 1); 948 var import_block_editor9 = __toESM(require_block_editor(), 1); 949 var import_media_utils = __toESM(require_media_utils(), 1); 950 var import_preferences3 = __toESM(require_preferences(), 1); 951 var import_block_library = __toESM(require_block_library(), 1); 952 953 // packages/customize-widgets/build-module/components/block-inspector-button/index.mjs 954 var import_element3 = __toESM(require_element(), 1); 955 var import_i18n2 = __toESM(require_i18n(), 1); 956 var import_components2 = __toESM(require_components(), 1); 957 var import_data = __toESM(require_data(), 1); 958 var import_block_editor2 = __toESM(require_block_editor(), 1); 959 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); 960 function BlockInspectorButton({ inspector, closeMenu, ...props }) { 961 const selectedBlockClientId = (0, import_data.useSelect)( 962 (select) => select(import_block_editor2.store).getSelectedBlockClientId(), 963 [] 964 ); 965 const selectedBlock = (0, import_element3.useMemo)( 966 () => document.getElementById(`block-$selectedBlockClientId}`), 967 [selectedBlockClientId] 968 ); 969 return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)( 970 import_components2.MenuItem, 971 { 972 onClick: () => { 973 inspector.open({ 974 returnFocusWhenClose: selectedBlock 975 }); 976 closeMenu(); 977 }, 978 ...props, 979 children: (0, import_i18n2.__)("Show more settings") 980 } 981 ); 982 } 983 var block_inspector_button_default = BlockInspectorButton; 984 985 // packages/customize-widgets/build-module/components/header/index.mjs 986 var import_components6 = __toESM(require_components(), 1); 987 var import_block_editor4 = __toESM(require_block_editor(), 1); 988 var import_element7 = __toESM(require_element(), 1); 989 var import_keycodes3 = __toESM(require_keycodes(), 1); 990 var import_i18n7 = __toESM(require_i18n(), 1); 991 992 // packages/customize-widgets/build-module/components/inserter/index.mjs 993 var import_i18n3 = __toESM(require_i18n(), 1); 994 var import_block_editor3 = __toESM(require_block_editor(), 1); 995 var import_components3 = __toESM(require_components(), 1); 996 var import_compose2 = __toESM(require_compose(), 1); 997 var import_data4 = __toESM(require_data(), 1); 998 999 // packages/customize-widgets/build-module/store/index.mjs 1000 var import_data3 = __toESM(require_data(), 1); 1001 1002 // packages/customize-widgets/build-module/store/reducer.mjs 1003 var import_data2 = __toESM(require_data(), 1); 1004 function blockInserterPanel(state = false, action) { 1005 switch (action.type) { 1006 case "SET_IS_INSERTER_OPENED": 1007 return action.value; 1008 } 1009 return state; 1010 } 1011 var reducer_default = (0, import_data2.combineReducers)({ 1012 blockInserterPanel 1013 }); 1014 1015 // packages/customize-widgets/build-module/store/selectors.mjs 1016 var selectors_exports = {}; 1017 __export(selectors_exports, { 1018 __experimentalGetInsertionPoint: () => __experimentalGetInsertionPoint, 1019 isInserterOpened: () => isInserterOpened 1020 }); 1021 var EMPTY_INSERTION_POINT = { 1022 rootClientId: void 0, 1023 insertionIndex: void 0 1024 }; 1025 function isInserterOpened(state) { 1026 return !!state.blockInserterPanel; 1027 } 1028 function __experimentalGetInsertionPoint(state) { 1029 if (typeof state.blockInserterPanel === "boolean") { 1030 return EMPTY_INSERTION_POINT; 1031 } 1032 return state.blockInserterPanel; 1033 } 1034 1035 // packages/customize-widgets/build-module/store/actions.mjs 1036 var actions_exports = {}; 1037 __export(actions_exports, { 1038 setIsInserterOpened: () => setIsInserterOpened 1039 }); 1040 function setIsInserterOpened(value) { 1041 return { 1042 type: "SET_IS_INSERTER_OPENED", 1043 value 1044 }; 1045 } 1046 1047 // packages/customize-widgets/build-module/store/constants.mjs 1048 var STORE_NAME = "core/customize-widgets"; 1049 1050 // packages/customize-widgets/build-module/store/index.mjs 1051 var storeConfig = { 1052 reducer: reducer_default, 1053 selectors: selectors_exports, 1054 actions: actions_exports 1055 }; 1056 var store = (0, import_data3.createReduxStore)(STORE_NAME, storeConfig); 1057 (0, import_data3.register)(store); 1058 1059 // packages/customize-widgets/build-module/components/inserter/index.mjs 1060 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); 1061 function Inserter({ setIsOpened }) { 1062 const inserterTitleId = (0, import_compose2.useInstanceId)( 1063 Inserter, 1064 "customize-widget-layout__inserter-panel-title" 1065 ); 1066 const insertionPoint = (0, import_data4.useSelect)( 1067 (select) => select(store).__experimentalGetInsertionPoint(), 1068 [] 1069 ); 1070 return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)( 1071 "div", 1072 { 1073 className: "customize-widgets-layout__inserter-panel", 1074 "aria-labelledby": inserterTitleId, 1075 children: [ 1076 /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "customize-widgets-layout__inserter-panel-header", children: [ 1077 /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( 1078 "h2", 1079 { 1080 id: inserterTitleId, 1081 className: "customize-widgets-layout__inserter-panel-header-title", 1082 children: (0, import_i18n3.__)("Add a block") 1083 } 1084 ), 1085 /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( 1086 import_components3.Button, 1087 { 1088 size: "small", 1089 icon: close_small_default, 1090 onClick: () => setIsOpened(false), 1091 "aria-label": (0, import_i18n3.__)("Close inserter") 1092 } 1093 ) 1094 ] }), 1095 /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "customize-widgets-layout__inserter-panel-content", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)( 1096 import_block_editor3.__experimentalLibrary, 1097 { 1098 rootClientId: insertionPoint.rootClientId, 1099 __experimentalInsertionIndex: insertionPoint.insertionIndex, 1100 showInserterHelpPanel: true, 1101 onSelect: () => setIsOpened(false) 1102 } 1103 ) }) 1104 ] 1105 } 1106 ); 1107 } 1108 var inserter_default = Inserter; 1109 1110 // packages/customize-widgets/build-module/components/more-menu/index.mjs 1111 var import_components5 = __toESM(require_components(), 1); 1112 var import_element6 = __toESM(require_element(), 1); 1113 var import_i18n6 = __toESM(require_i18n(), 1); 1114 var import_keycodes2 = __toESM(require_keycodes(), 1); 1115 var import_keyboard_shortcuts3 = __toESM(require_keyboard_shortcuts(), 1); 1116 var import_preferences = __toESM(require_preferences(), 1); 1117 1118 // packages/customize-widgets/build-module/components/keyboard-shortcut-help-modal/index.mjs 1119 var import_components4 = __toESM(require_components(), 1); 1120 var import_i18n5 = __toESM(require_i18n(), 1); 1121 var import_keyboard_shortcuts2 = __toESM(require_keyboard_shortcuts(), 1); 1122 var import_data6 = __toESM(require_data(), 1); 1123 var import_element5 = __toESM(require_element(), 1); 1124 1125 // packages/customize-widgets/build-module/components/keyboard-shortcut-help-modal/config.mjs 1126 var import_i18n4 = __toESM(require_i18n(), 1); 1127 var textFormattingShortcuts = [ 1128 { 1129 keyCombination: { modifier: "primary", character: "b" }, 1130 description: (0, import_i18n4.__)("Make the selected text bold.") 1131 }, 1132 { 1133 keyCombination: { modifier: "primary", character: "i" }, 1134 description: (0, import_i18n4.__)("Make the selected text italic.") 1135 }, 1136 { 1137 keyCombination: { modifier: "primary", character: "k" }, 1138 description: (0, import_i18n4.__)("Convert the selected text into a link.") 1139 }, 1140 { 1141 keyCombination: { modifier: "primaryShift", character: "k" }, 1142 description: (0, import_i18n4.__)("Remove a link.") 1143 }, 1144 { 1145 keyCombination: { character: "[[" }, 1146 description: (0, import_i18n4.__)("Insert a link to a post or page.") 1147 }, 1148 { 1149 keyCombination: { modifier: "primary", character: "u" }, 1150 description: (0, import_i18n4.__)("Underline the selected text.") 1151 }, 1152 { 1153 keyCombination: { modifier: "access", character: "d" }, 1154 description: (0, import_i18n4.__)("Strikethrough the selected text.") 1155 }, 1156 { 1157 keyCombination: { modifier: "access", character: "x" }, 1158 description: (0, import_i18n4.__)("Make the selected text inline code.") 1159 }, 1160 { 1161 keyCombination: { 1162 modifier: "access", 1163 character: "0" 1164 }, 1165 aliases: [ 1166 { 1167 modifier: "access", 1168 character: "7" 1169 } 1170 ], 1171 description: (0, import_i18n4.__)("Convert the current heading to a paragraph.") 1172 }, 1173 { 1174 keyCombination: { modifier: "access", character: "1-6" }, 1175 description: (0, import_i18n4.__)( 1176 "Convert the current paragraph or heading to a heading of level 1 to 6." 1177 ) 1178 }, 1179 { 1180 keyCombination: { modifier: "primaryShift", character: "SPACE" }, 1181 description: (0, import_i18n4.__)("Add non breaking space.") 1182 } 1183 ]; 1184 1185 // packages/customize-widgets/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs 1186 var import_element4 = __toESM(require_element(), 1); 1187 var import_keycodes = __toESM(require_keycodes(), 1); 1188 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); 1189 function KeyCombination({ keyCombination, forceAriaLabel }) { 1190 const shortcut = keyCombination.modifier ? import_keycodes.displayShortcutList[keyCombination.modifier]( 1191 keyCombination.character 1192 ) : keyCombination.character; 1193 const ariaLabel = keyCombination.modifier ? import_keycodes.shortcutAriaLabel[keyCombination.modifier]( 1194 keyCombination.character 1195 ) : keyCombination.character; 1196 return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)( 1197 "kbd", 1198 { 1199 className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-key-combination", 1200 "aria-label": forceAriaLabel || ariaLabel, 1201 children: (Array.isArray(shortcut) ? shortcut : [shortcut]).map( 1202 (character, index) => { 1203 if (character === "+") { 1204 return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_element4.Fragment, { children: character }, index); 1205 } 1206 return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)( 1207 "kbd", 1208 { 1209 className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-key", 1210 children: character 1211 }, 1212 index 1213 ); 1214 } 1215 ) 1216 } 1217 ); 1218 } 1219 function Shortcut({ description, keyCombination, aliases = [], ariaLabel }) { 1220 return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_jsx_runtime10.Fragment, { children: [ 1221 /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-description", children: description }), 1222 /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-term", children: [ 1223 /* @__PURE__ */ (0, import_jsx_runtime10.jsx)( 1224 KeyCombination, 1225 { 1226 keyCombination, 1227 forceAriaLabel: ariaLabel 1228 } 1229 ), 1230 aliases.map((alias, index) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)( 1231 KeyCombination, 1232 { 1233 keyCombination: alias, 1234 forceAriaLabel: ariaLabel 1235 }, 1236 index 1237 )) 1238 ] }) 1239 ] }); 1240 } 1241 var shortcut_default = Shortcut; 1242 1243 // packages/customize-widgets/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.mjs 1244 var import_data5 = __toESM(require_data(), 1); 1245 var import_keyboard_shortcuts = __toESM(require_keyboard_shortcuts(), 1); 1246 var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); 1247 function DynamicShortcut({ name }) { 1248 const { keyCombination, description, aliases } = (0, import_data5.useSelect)( 1249 (select) => { 1250 const { 1251 getShortcutKeyCombination, 1252 getShortcutDescription, 1253 getShortcutAliases 1254 } = select(import_keyboard_shortcuts.store); 1255 return { 1256 keyCombination: getShortcutKeyCombination(name), 1257 aliases: getShortcutAliases(name), 1258 description: getShortcutDescription(name) 1259 }; 1260 }, 1261 [name] 1262 ); 1263 if (!keyCombination) { 1264 return null; 1265 } 1266 return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)( 1267 shortcut_default, 1268 { 1269 keyCombination, 1270 description, 1271 aliases 1272 } 1273 ); 1274 } 1275 var dynamic_shortcut_default = DynamicShortcut; 1276 1277 // packages/customize-widgets/build-module/components/keyboard-shortcut-help-modal/index.mjs 1278 var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); 1279 var ShortcutList = ({ shortcuts }) => ( 1280 /* 1281 * Disable reason: The `list` ARIA role is redundant but 1282 * Safari+VoiceOver won't announce the list otherwise. 1283 */ 1284 /* eslint-disable jsx-a11y/no-redundant-roles */ 1285 /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 1286 "ul", 1287 { 1288 className: "customize-widgets-keyboard-shortcut-help-modal__shortcut-list", 1289 role: "list", 1290 children: shortcuts.map((shortcut, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 1291 "li", 1292 { 1293 className: "customize-widgets-keyboard-shortcut-help-modal__shortcut", 1294 children: typeof shortcut === "string" ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(dynamic_shortcut_default, { name: shortcut }) : /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(shortcut_default, { ...shortcut }) 1295 }, 1296 index 1297 )) 1298 } 1299 ) 1300 ); 1301 var ShortcutSection = ({ title, shortcuts, className }) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)( 1302 "section", 1303 { 1304 className: clsx_default( 1305 "customize-widgets-keyboard-shortcut-help-modal__section", 1306 className 1307 ), 1308 children: [ 1309 !!title && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("h2", { className: "customize-widgets-keyboard-shortcut-help-modal__section-title", children: title }), 1310 /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ShortcutList, { shortcuts }) 1311 ] 1312 } 1313 ); 1314 var ShortcutCategorySection = ({ 1315 title, 1316 categoryName, 1317 additionalShortcuts = [] 1318 }) => { 1319 const categoryShortcuts = (0, import_data6.useSelect)( 1320 (select) => { 1321 return select(import_keyboard_shortcuts2.store).getCategoryShortcuts( 1322 categoryName 1323 ); 1324 }, 1325 [categoryName] 1326 ); 1327 return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 1328 ShortcutSection, 1329 { 1330 title, 1331 shortcuts: categoryShortcuts.concat(additionalShortcuts) 1332 } 1333 ); 1334 }; 1335 function KeyboardShortcutHelpModal({ 1336 isModalActive, 1337 toggleModal 1338 }) { 1339 const { registerShortcut } = (0, import_data6.useDispatch)(import_keyboard_shortcuts2.store); 1340 (0, import_element5.useEffect)(() => { 1341 registerShortcut({ 1342 name: "core/customize-widgets/keyboard-shortcuts", 1343 category: "main", 1344 description: (0, import_i18n5.__)("Display these keyboard shortcuts."), 1345 keyCombination: { 1346 modifier: "access", 1347 character: "h" 1348 } 1349 }); 1350 }, [registerShortcut]); 1351 (0, import_keyboard_shortcuts2.useShortcut)("core/customize-widgets/keyboard-shortcuts", toggleModal); 1352 if (!isModalActive) { 1353 return null; 1354 } 1355 return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)( 1356 import_components4.Modal, 1357 { 1358 className: "customize-widgets-keyboard-shortcut-help-modal", 1359 title: (0, import_i18n5.__)("Keyboard shortcuts"), 1360 onRequestClose: toggleModal, 1361 children: [ 1362 /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 1363 ShortcutSection, 1364 { 1365 className: "customize-widgets-keyboard-shortcut-help-modal__main-shortcuts", 1366 shortcuts: ["core/customize-widgets/keyboard-shortcuts"] 1367 } 1368 ), 1369 /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 1370 ShortcutCategorySection, 1371 { 1372 title: (0, import_i18n5.__)("Global shortcuts"), 1373 categoryName: "global" 1374 } 1375 ), 1376 /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 1377 ShortcutCategorySection, 1378 { 1379 title: (0, import_i18n5.__)("Selection shortcuts"), 1380 categoryName: "selection" 1381 } 1382 ), 1383 /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 1384 ShortcutCategorySection, 1385 { 1386 title: (0, import_i18n5.__)("Block shortcuts"), 1387 categoryName: "block", 1388 additionalShortcuts: [ 1389 { 1390 keyCombination: { character: "/" }, 1391 description: (0, import_i18n5.__)( 1392 "Change the block type after adding a new paragraph." 1393 ), 1394 /* translators: The forward-slash character. e.g. '/'. */ 1395 ariaLabel: (0, import_i18n5.__)("Forward-slash") 1396 } 1397 ] 1398 } 1399 ), 1400 /* @__PURE__ */ (0, import_jsx_runtime12.jsx)( 1401 ShortcutSection, 1402 { 1403 title: (0, import_i18n5.__)("Text formatting"), 1404 shortcuts: textFormattingShortcuts 1405 } 1406 ) 1407 ] 1408 } 1409 ); 1410 } 1411 1412 // packages/customize-widgets/build-module/components/more-menu/index.mjs 1413 var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); 1414 function MoreMenu() { 1415 const [ 1416 isKeyboardShortcutsModalActive, 1417 setIsKeyboardShortcutsModalVisible 1418 ] = (0, import_element6.useState)(false); 1419 const toggleKeyboardShortcutsModal = () => setIsKeyboardShortcutsModalVisible(!isKeyboardShortcutsModalActive); 1420 (0, import_keyboard_shortcuts3.useShortcut)( 1421 "core/customize-widgets/keyboard-shortcuts", 1422 toggleKeyboardShortcutsModal 1423 ); 1424 return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [ 1425 /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( 1426 import_components5.ToolbarDropdownMenu, 1427 { 1428 icon: more_vertical_default, 1429 label: (0, import_i18n6.__)("Options"), 1430 popoverProps: { 1431 placement: "bottom-end", 1432 className: "more-menu-dropdown__content" 1433 }, 1434 toggleProps: { 1435 tooltipPosition: "bottom", 1436 size: "compact" 1437 }, 1438 children: () => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [ 1439 /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_components5.MenuGroup, { label: (0, import_i18n6._x)("View", "noun"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( 1440 import_preferences.PreferenceToggleMenuItem, 1441 { 1442 scope: "core/customize-widgets", 1443 name: "fixedToolbar", 1444 label: (0, import_i18n6.__)("Top toolbar"), 1445 info: (0, import_i18n6.__)( 1446 "Access all block and document tools in a single place" 1447 ), 1448 messageActivated: (0, import_i18n6.__)( 1449 "Top toolbar activated" 1450 ), 1451 messageDeactivated: (0, import_i18n6.__)( 1452 "Top toolbar deactivated" 1453 ) 1454 } 1455 ) }), 1456 /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_components5.MenuGroup, { label: (0, import_i18n6.__)("Tools"), children: [ 1457 /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( 1458 import_components5.MenuItem, 1459 { 1460 onClick: () => { 1461 setIsKeyboardShortcutsModalVisible(true); 1462 }, 1463 shortcut: import_keycodes2.displayShortcut.access("h"), 1464 children: (0, import_i18n6.__)("Keyboard shortcuts") 1465 } 1466 ), 1467 /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( 1468 import_preferences.PreferenceToggleMenuItem, 1469 { 1470 scope: "core/customize-widgets", 1471 name: "welcomeGuide", 1472 label: (0, import_i18n6.__)("Welcome Guide") 1473 } 1474 ), 1475 /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)( 1476 import_components5.MenuItem, 1477 { 1478 role: "menuitem", 1479 icon: external_default, 1480 href: (0, import_i18n6.__)( 1481 "https://wordpress.org/documentation/article/block-based-widgets-editor/" 1482 ), 1483 target: "_blank", 1484 rel: "noopener", 1485 children: [ 1486 (0, import_i18n6.__)("Help"), 1487 /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(VisuallyHidden, { 1488 render: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", {}), 1489 /* translators: accessibility text */ 1490 children: (0, import_i18n6.__)("(opens in a new tab)") 1491 }) 1492 ] 1493 } 1494 ) 1495 ] }), 1496 /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_components5.MenuGroup, { label: (0, import_i18n6.__)("Preferences"), children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( 1497 import_preferences.PreferenceToggleMenuItem, 1498 { 1499 scope: "core/customize-widgets", 1500 name: "keepCaretInsideBlock", 1501 label: (0, import_i18n6.__)( 1502 "Contain text cursor inside block" 1503 ), 1504 info: (0, import_i18n6.__)( 1505 "Aids screen readers by stopping text caret from leaving blocks." 1506 ), 1507 messageActivated: (0, import_i18n6.__)( 1508 "Contain text cursor inside block activated" 1509 ), 1510 messageDeactivated: (0, import_i18n6.__)( 1511 "Contain text cursor inside block deactivated" 1512 ) 1513 } 1514 ) }) 1515 ] }) 1516 } 1517 ), 1518 /* @__PURE__ */ (0, import_jsx_runtime13.jsx)( 1519 KeyboardShortcutHelpModal, 1520 { 1521 isModalActive: isKeyboardShortcutsModalActive, 1522 toggleModal: toggleKeyboardShortcutsModal 1523 } 1524 ) 1525 ] }); 1526 } 1527 1528 // packages/customize-widgets/build-module/components/header/index.mjs 1529 var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); 1530 function Header({ 1531 sidebar, 1532 inserter, 1533 isInserterOpened: isInserterOpened2, 1534 setIsInserterOpened: setIsInserterOpened2, 1535 isFixedToolbarActive 1536 }) { 1537 const [[hasUndo, hasRedo], setUndoRedo] = (0, import_element7.useState)([ 1538 sidebar.hasUndo(), 1539 sidebar.hasRedo() 1540 ]); 1541 const shortcut = (0, import_keycodes3.isAppleOS)() ? import_keycodes3.displayShortcut.primaryShift("z") : import_keycodes3.displayShortcut.primary("y"); 1542 (0, import_element7.useEffect)(() => { 1543 return sidebar.subscribeHistory(() => { 1544 setUndoRedo([sidebar.hasUndo(), sidebar.hasRedo()]); 1545 }); 1546 }, [sidebar]); 1547 return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [ 1548 /* @__PURE__ */ (0, import_jsx_runtime14.jsx)( 1549 "div", 1550 { 1551 className: clsx_default("customize-widgets-header", { 1552 "is-fixed-toolbar-active": isFixedToolbarActive 1553 }), 1554 children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)( 1555 import_block_editor4.NavigableToolbar, 1556 { 1557 className: "customize-widgets-header-toolbar", 1558 "aria-label": (0, import_i18n7.__)("Document tools"), 1559 children: [ 1560 /* @__PURE__ */ (0, import_jsx_runtime14.jsx)( 1561 import_components6.ToolbarButton, 1562 { 1563 icon: !(0, import_i18n7.isRTL)() ? undo_default : redo_default, 1564 label: (0, import_i18n7.__)("Undo"), 1565 shortcut: import_keycodes3.displayShortcut.primary("z"), 1566 disabled: !hasUndo, 1567 onClick: sidebar.undo, 1568 className: "customize-widgets-editor-history-button undo-button" 1569 } 1570 ), 1571 /* @__PURE__ */ (0, import_jsx_runtime14.jsx)( 1572 import_components6.ToolbarButton, 1573 { 1574 icon: !(0, import_i18n7.isRTL)() ? redo_default : undo_default, 1575 label: (0, import_i18n7.__)("Redo"), 1576 shortcut, 1577 disabled: !hasRedo, 1578 onClick: sidebar.redo, 1579 className: "customize-widgets-editor-history-button redo-button" 1580 } 1581 ), 1582 /* @__PURE__ */ (0, import_jsx_runtime14.jsx)( 1583 import_components6.ToolbarButton, 1584 { 1585 className: "customize-widgets-header-toolbar__inserter-toggle", 1586 isPressed: isInserterOpened2, 1587 variant: "primary", 1588 icon: plus_default, 1589 label: (0, import_i18n7._x)( 1590 "Add block", 1591 "Generic label for block inserter button" 1592 ), 1593 onClick: () => { 1594 setIsInserterOpened2((isOpen) => !isOpen); 1595 } 1596 } 1597 ), 1598 /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MoreMenu, {}) 1599 ] 1600 } 1601 ) 1602 } 1603 ), 1604 (0, import_element7.createPortal)( 1605 /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(inserter_default, { setIsOpened: setIsInserterOpened2 }), 1606 inserter.contentContainer[0] 1607 ) 1608 ] }); 1609 } 1610 var header_default = Header; 1611 1612 // packages/customize-widgets/build-module/components/inserter/use-inserter.mjs 1613 var import_element8 = __toESM(require_element(), 1); 1614 var import_data7 = __toESM(require_data(), 1); 1615 function useInserter(inserter) { 1616 const isInserterOpened2 = (0, import_data7.useSelect)( 1617 (select) => select(store).isInserterOpened(), 1618 [] 1619 ); 1620 const { setIsInserterOpened: setIsInserterOpened2 } = (0, import_data7.useDispatch)(store); 1621 (0, import_element8.useEffect)(() => { 1622 if (isInserterOpened2) { 1623 inserter.open(); 1624 } else { 1625 inserter.close(); 1626 } 1627 }, [inserter, isInserterOpened2]); 1628 return [ 1629 isInserterOpened2, 1630 (0, import_element8.useCallback)( 1631 (updater) => { 1632 let isOpen = updater; 1633 if (typeof updater === "function") { 1634 isOpen = updater( 1635 (0, import_data7.select)(store).isInserterOpened() 1636 ); 1637 } 1638 setIsInserterOpened2(isOpen); 1639 }, 1640 [setIsInserterOpened2] 1641 ) 1642 ]; 1643 } 1644 1645 // packages/customize-widgets/build-module/components/sidebar-block-editor/sidebar-editor-provider.mjs 1646 var import_block_editor6 = __toESM(require_block_editor(), 1); 1647 1648 // packages/customize-widgets/build-module/components/sidebar-block-editor/use-sidebar-block-editor.mjs 1649 var import_es6 = __toESM(require_es6(), 1); 1650 var import_element9 = __toESM(require_element(), 1); 1651 var import_is_shallow_equal = __toESM(require_is_shallow_equal(), 1); 1652 var import_widgets2 = __toESM(require_widgets(), 1); 1653 1654 // packages/customize-widgets/build-module/utils.mjs 1655 var import_blocks = __toESM(require_blocks(), 1); 1656 var import_widgets = __toESM(require_widgets(), 1); 1657 function settingIdToWidgetId(settingId) { 1658 const matches = settingId.match(/^widget_(.+)(?:\[(\d+)\])$/); 1659 if (matches) { 1660 const idBase = matches[1]; 1661 const number = parseInt(matches[2], 10); 1662 return `$idBase}-$number}`; 1663 } 1664 return settingId; 1665 } 1666 function blockToWidget(block, existingWidget = null) { 1667 let widget; 1668 const isValidLegacyWidgetBlock = block.name === "core/legacy-widget" && (block.attributes.id || block.attributes.instance); 1669 if (isValidLegacyWidgetBlock) { 1670 if (block.attributes.id) { 1671 widget = { 1672 id: block.attributes.id 1673 }; 1674 } else { 1675 const { encoded, hash, raw, ...rest } = block.attributes.instance; 1676 widget = { 1677 idBase: block.attributes.idBase, 1678 instance: { 1679 ...existingWidget?.instance, 1680 // Required only for the customizer. 1681 is_widget_customizer_js_value: true, 1682 encoded_serialized_instance: encoded, 1683 instance_hash_key: hash, 1684 raw_instance: raw, 1685 ...rest 1686 } 1687 }; 1688 } 1689 } else { 1690 const instance = { 1691 content: (0, import_blocks.serialize)(block) 1692 }; 1693 widget = { 1694 idBase: "block", 1695 widgetClass: "WP_Widget_Block", 1696 instance: { 1697 raw_instance: instance 1698 } 1699 }; 1700 } 1701 const { form, rendered, ...restExistingWidget } = existingWidget || {}; 1702 return { 1703 ...restExistingWidget, 1704 ...widget 1705 }; 1706 } 1707 function widgetToBlock({ id, idBase, number, instance }) { 1708 let block; 1709 const { 1710 encoded_serialized_instance: encoded, 1711 instance_hash_key: hash, 1712 raw_instance: raw, 1713 ...rest 1714 } = instance; 1715 if (idBase === "block") { 1716 const parsedBlocks = (0, import_blocks.parse)(raw.content ?? "", { 1717 __unstableSkipAutop: true 1718 }); 1719 block = parsedBlocks.length ? parsedBlocks[0] : (0, import_blocks.createBlock)("core/paragraph", {}); 1720 } else if (number) { 1721 block = (0, import_blocks.createBlock)("core/legacy-widget", { 1722 idBase, 1723 instance: { 1724 encoded, 1725 hash, 1726 raw, 1727 ...rest 1728 } 1729 }); 1730 } else { 1731 block = (0, import_blocks.createBlock)("core/legacy-widget", { 1732 id 1733 }); 1734 } 1735 return (0, import_widgets.addWidgetIdToBlock)(block, id); 1736 } 1737 1738 // packages/customize-widgets/build-module/components/sidebar-block-editor/use-sidebar-block-editor.mjs 1739 function widgetsToBlocks(widgets) { 1740 return widgets.map((widget) => widgetToBlock(widget)); 1741 } 1742 function useSidebarBlockEditor(sidebar) { 1743 const [blocks, setBlocks] = (0, import_element9.useState)( 1744 () => widgetsToBlocks(sidebar.getWidgets()) 1745 ); 1746 (0, import_element9.useEffect)(() => { 1747 return sidebar.subscribe((prevWidgets, nextWidgets) => { 1748 setBlocks((prevBlocks) => { 1749 const prevWidgetsMap = new Map( 1750 prevWidgets.map((widget) => [widget.id, widget]) 1751 ); 1752 const prevBlocksMap = new Map( 1753 prevBlocks.map((block) => [ 1754 (0, import_widgets2.getWidgetIdFromBlock)(block), 1755 block 1756 ]) 1757 ); 1758 const nextBlocks = nextWidgets.map((nextWidget) => { 1759 const prevWidget = prevWidgetsMap.get(nextWidget.id); 1760 if (prevWidget && prevWidget === nextWidget) { 1761 return prevBlocksMap.get(nextWidget.id); 1762 } 1763 return widgetToBlock(nextWidget); 1764 }); 1765 if ((0, import_is_shallow_equal.isShallowEqual)(prevBlocks, nextBlocks)) { 1766 return prevBlocks; 1767 } 1768 return nextBlocks; 1769 }); 1770 }); 1771 }, [sidebar]); 1772 const onChangeBlocks = (0, import_element9.useCallback)( 1773 (nextBlocks) => { 1774 setBlocks((prevBlocks) => { 1775 if ((0, import_is_shallow_equal.isShallowEqual)(prevBlocks, nextBlocks)) { 1776 return prevBlocks; 1777 } 1778 const prevBlocksMap = new Map( 1779 prevBlocks.map((block) => [ 1780 (0, import_widgets2.getWidgetIdFromBlock)(block), 1781 block 1782 ]) 1783 ); 1784 const nextWidgets = nextBlocks.map((nextBlock) => { 1785 const widgetId = (0, import_widgets2.getWidgetIdFromBlock)(nextBlock); 1786 if (widgetId && prevBlocksMap.has(widgetId)) { 1787 const prevBlock = prevBlocksMap.get(widgetId); 1788 const prevWidget = sidebar.getWidget(widgetId); 1789 if ((0, import_es6.default)(nextBlock, prevBlock) && prevWidget) { 1790 return prevWidget; 1791 } 1792 return blockToWidget(nextBlock, prevWidget); 1793 } 1794 return blockToWidget(nextBlock); 1795 }); 1796 if ((0, import_is_shallow_equal.isShallowEqual)(sidebar.getWidgets(), nextWidgets)) { 1797 return prevBlocks; 1798 } 1799 const addedWidgetIds = sidebar.setWidgets(nextWidgets); 1800 return nextBlocks.reduce( 1801 (updatedNextBlocks, nextBlock, index) => { 1802 const addedWidgetId = addedWidgetIds[index]; 1803 if (addedWidgetId !== null) { 1804 if (updatedNextBlocks === nextBlocks) { 1805 updatedNextBlocks = nextBlocks.slice(); 1806 } 1807 updatedNextBlocks[index] = (0, import_widgets2.addWidgetIdToBlock)( 1808 nextBlock, 1809 addedWidgetId 1810 ); 1811 } 1812 return updatedNextBlocks; 1813 }, 1814 nextBlocks 1815 ); 1816 }); 1817 }, 1818 [sidebar] 1819 ); 1820 return [blocks, onChangeBlocks, onChangeBlocks]; 1821 } 1822 1823 // packages/customize-widgets/build-module/components/focus-control/use-blocks-focus-control.mjs 1824 var import_element11 = __toESM(require_element(), 1); 1825 var import_data8 = __toESM(require_data(), 1); 1826 var import_block_editor5 = __toESM(require_block_editor(), 1); 1827 var import_widgets3 = __toESM(require_widgets(), 1); 1828 1829 // packages/customize-widgets/build-module/components/focus-control/index.mjs 1830 var import_element10 = __toESM(require_element(), 1); 1831 var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); 1832 var FocusControlContext = (0, import_element10.createContext)(); 1833 FocusControlContext.displayName = "FocusControlContext"; 1834 function FocusControl({ api, sidebarControls, children }) { 1835 const [focusedWidgetIdRef, setFocusedWidgetIdRef] = (0, import_element10.useState)({ 1836 current: null 1837 }); 1838 const focusWidget = (0, import_element10.useCallback)( 1839 (widgetId) => { 1840 for (const sidebarControl of sidebarControls) { 1841 const widgets = sidebarControl.setting.get(); 1842 if (widgets.includes(widgetId)) { 1843 sidebarControl.sectionInstance.expand({ 1844 // Schedule it after the complete callback so that 1845 // it won't be overridden by the "Back" button focus. 1846 completeCallback() { 1847 setFocusedWidgetIdRef({ current: widgetId }); 1848 } 1849 }); 1850 break; 1851 } 1852 } 1853 }, 1854 [sidebarControls] 1855 ); 1856 (0, import_element10.useEffect)(() => { 1857 function handleFocus(settingId) { 1858 const widgetId = settingIdToWidgetId(settingId); 1859 focusWidget(widgetId); 1860 } 1861 let previewBound = false; 1862 function handleReady() { 1863 api.previewer.preview.bind( 1864 "focus-control-for-setting", 1865 handleFocus 1866 ); 1867 previewBound = true; 1868 } 1869 api.previewer.bind("ready", handleReady); 1870 return () => { 1871 api.previewer.unbind("ready", handleReady); 1872 if (previewBound) { 1873 api.previewer.preview.unbind( 1874 "focus-control-for-setting", 1875 handleFocus 1876 ); 1877 } 1878 }; 1879 }, [api, focusWidget]); 1880 const context = (0, import_element10.useMemo)( 1881 () => [focusedWidgetIdRef, focusWidget], 1882 [focusedWidgetIdRef, focusWidget] 1883 ); 1884 return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(FocusControlContext.Provider, { value: context, children }); 1885 } 1886 var useFocusControl = () => (0, import_element10.useContext)(FocusControlContext); 1887 1888 // packages/customize-widgets/build-module/components/focus-control/use-blocks-focus-control.mjs 1889 function useBlocksFocusControl(blocks) { 1890 const { selectBlock } = (0, import_data8.useDispatch)(import_block_editor5.store); 1891 const [focusedWidgetIdRef] = useFocusControl(); 1892 const blocksRef = (0, import_element11.useRef)(blocks); 1893 (0, import_element11.useEffect)(() => { 1894 blocksRef.current = blocks; 1895 }, [blocks]); 1896 (0, import_element11.useEffect)(() => { 1897 if (focusedWidgetIdRef.current) { 1898 const focusedBlock = blocksRef.current.find( 1899 (block) => (0, import_widgets3.getWidgetIdFromBlock)(block) === focusedWidgetIdRef.current 1900 ); 1901 if (focusedBlock) { 1902 selectBlock(focusedBlock.clientId); 1903 const blockNode = document.querySelector( 1904 `[data-block="$focusedBlock.clientId}"]` 1905 ); 1906 blockNode?.focus(); 1907 } 1908 } 1909 }, [focusedWidgetIdRef, selectBlock]); 1910 } 1911 1912 // packages/customize-widgets/build-module/lock-unlock.mjs 1913 var import_private_apis = __toESM(require_private_apis(), 1); 1914 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 1915 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 1916 "@wordpress/customize-widgets" 1917 ); 1918 1919 // packages/customize-widgets/build-module/components/sidebar-block-editor/sidebar-editor-provider.mjs 1920 var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); 1921 var { ExperimentalBlockEditorProvider } = unlock(import_block_editor6.privateApis); 1922 function SidebarEditorProvider({ 1923 sidebar, 1924 settings, 1925 children 1926 }) { 1927 const [blocks, onInput, onChange] = useSidebarBlockEditor(sidebar); 1928 useBlocksFocusControl(blocks); 1929 return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)( 1930 ExperimentalBlockEditorProvider, 1931 { 1932 value: blocks, 1933 onInput, 1934 onChange, 1935 settings, 1936 useSubRegistry: false, 1937 children 1938 } 1939 ); 1940 } 1941 1942 // packages/customize-widgets/build-module/components/welcome-guide/index.mjs 1943 var import_i18n8 = __toESM(require_i18n(), 1); 1944 var import_components7 = __toESM(require_components(), 1); 1945 var import_data9 = __toESM(require_data(), 1); 1946 var import_preferences2 = __toESM(require_preferences(), 1); 1947 var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); 1948 function WelcomeGuide({ sidebar }) { 1949 const { toggle } = (0, import_data9.useDispatch)(import_preferences2.store); 1950 const isEntirelyBlockWidgets = sidebar.getWidgets().every((widget) => widget.id.startsWith("block-")); 1951 return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "customize-widgets-welcome-guide", children: [ 1952 /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "customize-widgets-welcome-guide__image__wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("picture", { children: [ 1953 /* @__PURE__ */ (0, import_jsx_runtime17.jsx)( 1954 "source", 1955 { 1956 srcSet: "https://s.w.org/images/block-editor/welcome-editor.svg", 1957 media: "(prefers-reduced-motion: reduce)" 1958 } 1959 ), 1960 /* @__PURE__ */ (0, import_jsx_runtime17.jsx)( 1961 "img", 1962 { 1963 className: "customize-widgets-welcome-guide__image", 1964 src: "https://s.w.org/images/block-editor/welcome-editor.gif", 1965 width: "312", 1966 height: "240", 1967 alt: "" 1968 } 1969 ) 1970 ] }) }), 1971 /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("h1", { className: "customize-widgets-welcome-guide__heading", children: (0, import_i18n8.__)("Welcome to block Widgets") }), 1972 /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("p", { className: "customize-widgets-welcome-guide__text", children: isEntirelyBlockWidgets ? (0, import_i18n8.__)( 1973 "Your theme provides different \u201Cblock\u201D areas for you to add and edit content.\xA0Try adding a search bar, social icons, or other types of blocks here and see how they\u2019ll look on your site." 1974 ) : (0, import_i18n8.__)( 1975 "You can now add any block to your site\u2019s widget areas. Don\u2019t worry, all of your favorite widgets still work flawlessly." 1976 ) }), 1977 /* @__PURE__ */ (0, import_jsx_runtime17.jsx)( 1978 import_components7.Button, 1979 { 1980 size: "compact", 1981 variant: "primary", 1982 onClick: () => toggle("core/customize-widgets", "welcomeGuide"), 1983 children: (0, import_i18n8.__)("Got it") 1984 } 1985 ), 1986 /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("hr", { className: "customize-widgets-welcome-guide__separator" }), 1987 !isEntirelyBlockWidgets && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { className: "customize-widgets-welcome-guide__more-info", children: [ 1988 (0, import_i18n8.__)("Want to stick with the old widgets?"), 1989 /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("br", {}), 1990 /* @__PURE__ */ (0, import_jsx_runtime17.jsx)( 1991 import_components7.ExternalLink, 1992 { 1993 href: (0, import_i18n8.__)( 1994 "https://wordpress.org/plugins/classic-widgets/" 1995 ), 1996 children: (0, import_i18n8.__)("Get the Classic Widgets plugin.") 1997 } 1998 ) 1999 ] }), 2000 /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("p", { className: "customize-widgets-welcome-guide__more-info", children: [ 2001 (0, import_i18n8.__)("New to the block editor?"), 2002 /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("br", {}), 2003 /* @__PURE__ */ (0, import_jsx_runtime17.jsx)( 2004 import_components7.ExternalLink, 2005 { 2006 href: (0, import_i18n8.__)( 2007 "https://wordpress.org/documentation/article/wordpress-block-editor/" 2008 ), 2009 children: (0, import_i18n8.__)("Here's a detailed guide.") 2010 } 2011 ) 2012 ] }) 2013 ] }); 2014 } 2015 2016 // packages/customize-widgets/build-module/components/keyboard-shortcuts/index.mjs 2017 var import_element12 = __toESM(require_element(), 1); 2018 var import_keyboard_shortcuts4 = __toESM(require_keyboard_shortcuts(), 1); 2019 var import_keycodes4 = __toESM(require_keycodes(), 1); 2020 var import_data10 = __toESM(require_data(), 1); 2021 var import_i18n9 = __toESM(require_i18n(), 1); 2022 var import_block_editor7 = __toESM(require_block_editor(), 1); 2023 var { usesNativeUndo } = unlock(import_block_editor7.privateApis); 2024 function KeyboardShortcuts({ undo, redo, save }) { 2025 (0, import_keyboard_shortcuts4.useShortcut)("core/customize-widgets/undo", (event) => { 2026 if (usesNativeUndo(event)) { 2027 return; 2028 } 2029 undo(); 2030 event.preventDefault(); 2031 }); 2032 (0, import_keyboard_shortcuts4.useShortcut)("core/customize-widgets/redo", (event) => { 2033 if (usesNativeUndo(event)) { 2034 return; 2035 } 2036 redo(); 2037 event.preventDefault(); 2038 }); 2039 (0, import_keyboard_shortcuts4.useShortcut)("core/customize-widgets/save", (event) => { 2040 event.preventDefault(); 2041 save(); 2042 }); 2043 return null; 2044 } 2045 function KeyboardShortcutsRegister() { 2046 const { registerShortcut, unregisterShortcut } = (0, import_data10.useDispatch)( 2047 import_keyboard_shortcuts4.store 2048 ); 2049 (0, import_element12.useEffect)(() => { 2050 registerShortcut({ 2051 name: "core/customize-widgets/undo", 2052 category: "global", 2053 description: (0, import_i18n9.__)("Undo your last changes."), 2054 keyCombination: { 2055 modifier: "primary", 2056 character: "z" 2057 } 2058 }); 2059 registerShortcut({ 2060 name: "core/customize-widgets/redo", 2061 category: "global", 2062 description: (0, import_i18n9.__)("Redo your last undo."), 2063 keyCombination: { 2064 modifier: "primaryShift", 2065 character: "z" 2066 }, 2067 // Disable on Apple OS because it conflicts with the browser's 2068 // history shortcut. It's a fine alias for both Windows and Linux. 2069 // Since there's no conflict for Ctrl+Shift+Z on both Windows and 2070 // Linux, we keep it as the default for consistency. 2071 aliases: (0, import_keycodes4.isAppleOS)() ? [] : [ 2072 { 2073 modifier: "primary", 2074 character: "y" 2075 } 2076 ] 2077 }); 2078 registerShortcut({ 2079 name: "core/customize-widgets/save", 2080 category: "global", 2081 description: (0, import_i18n9.__)("Save your changes."), 2082 keyCombination: { 2083 modifier: "primary", 2084 character: "s" 2085 } 2086 }); 2087 return () => { 2088 unregisterShortcut("core/customize-widgets/undo"); 2089 unregisterShortcut("core/customize-widgets/redo"); 2090 unregisterShortcut("core/customize-widgets/save"); 2091 }; 2092 }, [registerShortcut]); 2093 return null; 2094 } 2095 KeyboardShortcuts.Register = KeyboardShortcutsRegister; 2096 var keyboard_shortcuts_default = KeyboardShortcuts; 2097 2098 // packages/customize-widgets/build-module/components/block-appender/index.mjs 2099 var import_element13 = __toESM(require_element(), 1); 2100 var import_block_editor8 = __toESM(require_block_editor(), 1); 2101 var import_data11 = __toESM(require_data(), 1); 2102 var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); 2103 function BlockAppender(props) { 2104 const ref = (0, import_element13.useRef)(); 2105 const isBlocksListEmpty = (0, import_data11.useSelect)( 2106 (select) => select(import_block_editor8.store).getBlockCount() === 0 2107 ); 2108 (0, import_element13.useEffect)(() => { 2109 if (isBlocksListEmpty && ref.current) { 2110 const { ownerDocument } = ref.current; 2111 if (!ownerDocument.activeElement || ownerDocument.activeElement === ownerDocument.body) { 2112 ref.current.focus(); 2113 } 2114 } 2115 }, [isBlocksListEmpty]); 2116 return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_block_editor8.ButtonBlockAppender, { ...props, ref }); 2117 } 2118 2119 // packages/customize-widgets/build-module/components/sidebar-block-editor/index.mjs 2120 var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); 2121 var { ExperimentalBlockCanvas: BlockCanvas } = unlock( 2122 import_block_editor9.privateApis 2123 ); 2124 var { BlockKeyboardShortcuts } = unlock(import_block_library.privateApis); 2125 function SidebarBlockEditor({ 2126 blockEditorSettings, 2127 sidebar, 2128 inserter, 2129 inspector 2130 }) { 2131 const [isInserterOpened2, setIsInserterOpened2] = useInserter(inserter); 2132 const isMediumViewport = (0, import_compose3.useViewportMatch)("small"); 2133 const { 2134 hasUploadPermissions, 2135 isFixedToolbarActive, 2136 keepCaretInsideBlock, 2137 isWelcomeGuideActive 2138 } = (0, import_data12.useSelect)((select) => { 2139 const { get } = select(import_preferences3.store); 2140 return { 2141 hasUploadPermissions: select(import_core_data.store).canUser("create", { 2142 kind: "postType", 2143 name: "attachment" 2144 }) ?? true, 2145 isFixedToolbarActive: !!get( 2146 "core/customize-widgets", 2147 "fixedToolbar" 2148 ), 2149 keepCaretInsideBlock: !!get( 2150 "core/customize-widgets", 2151 "keepCaretInsideBlock" 2152 ), 2153 isWelcomeGuideActive: !!get( 2154 "core/customize-widgets", 2155 "welcomeGuide" 2156 ) 2157 }; 2158 }, []); 2159 const settings = (0, import_element14.useMemo)(() => { 2160 let mediaUploadBlockEditor; 2161 if (hasUploadPermissions) { 2162 mediaUploadBlockEditor = ({ onError, ...argumentsObject }) => { 2163 (0, import_media_utils.uploadMedia)({ 2164 wpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes, 2165 onError: ({ message }) => onError(message), 2166 ...argumentsObject 2167 }); 2168 }; 2169 } 2170 return { 2171 ...blockEditorSettings, 2172 __experimentalSetIsInserterOpened: setIsInserterOpened2, 2173 mediaUpload: mediaUploadBlockEditor, 2174 hasFixedToolbar: isFixedToolbarActive || !isMediumViewport, 2175 keepCaretInsideBlock, 2176 editorTool: "edit", 2177 __unstableHasCustomAppender: true 2178 }; 2179 }, [ 2180 hasUploadPermissions, 2181 blockEditorSettings, 2182 isFixedToolbarActive, 2183 isMediumViewport, 2184 keepCaretInsideBlock, 2185 setIsInserterOpened2 2186 ]); 2187 if (isWelcomeGuideActive) { 2188 return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(WelcomeGuide, { sidebar }); 2189 } 2190 return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [ 2191 /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(keyboard_shortcuts_default.Register, {}), 2192 /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BlockKeyboardShortcuts, {}), 2193 /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(SidebarEditorProvider, { sidebar, settings, children: [ 2194 /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( 2195 keyboard_shortcuts_default, 2196 { 2197 undo: sidebar.undo, 2198 redo: sidebar.redo, 2199 save: sidebar.save 2200 } 2201 ), 2202 /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( 2203 header_default, 2204 { 2205 sidebar, 2206 inserter, 2207 isInserterOpened: isInserterOpened2, 2208 setIsInserterOpened: setIsInserterOpened2, 2209 isFixedToolbarActive: isFixedToolbarActive || !isMediumViewport 2210 } 2211 ), 2212 (isFixedToolbarActive || !isMediumViewport) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_block_editor9.BlockToolbar, { hideDragHandle: true }), 2213 /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( 2214 BlockCanvas, 2215 { 2216 shouldIframe: false, 2217 styles: settings.defaultEditorStyles, 2218 height: "100%", 2219 children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_block_editor9.BlockList, { renderAppender: BlockAppender }) 2220 } 2221 ), 2222 (0, import_element14.createPortal)( 2223 // This is a temporary hack to prevent button component inside <BlockInspector> 2224 // from submitting form when type="button" is not specified. 2225 /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("form", { onSubmit: (event) => event.preventDefault(), children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_block_editor9.BlockInspector, {}) }), 2226 inspector.contentContainer[0] 2227 ) 2228 ] }), 2229 /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_block_editor9.__unstableBlockSettingsMenuFirstItem, { children: ({ onClose }) => /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( 2230 block_inspector_button_default, 2231 { 2232 inspector, 2233 closeMenu: onClose 2234 } 2235 ) }) 2236 ] }); 2237 } 2238 2239 // packages/customize-widgets/build-module/components/sidebar-controls/index.mjs 2240 var import_element15 = __toESM(require_element(), 1); 2241 var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); 2242 var SidebarControlsContext = (0, import_element15.createContext)(); 2243 SidebarControlsContext.displayName = "SidebarControlsContext"; 2244 function SidebarControls({ 2245 sidebarControls, 2246 activeSidebarControl, 2247 children 2248 }) { 2249 const context = (0, import_element15.useMemo)( 2250 () => ({ 2251 sidebarControls, 2252 activeSidebarControl 2253 }), 2254 [sidebarControls, activeSidebarControl] 2255 ); 2256 return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SidebarControlsContext.Provider, { value: context, children }); 2257 } 2258 function useSidebarControls() { 2259 const { sidebarControls } = (0, import_element15.useContext)(SidebarControlsContext); 2260 return sidebarControls; 2261 } 2262 function useActiveSidebarControl() { 2263 const { activeSidebarControl } = (0, import_element15.useContext)(SidebarControlsContext); 2264 return activeSidebarControl; 2265 } 2266 2267 // packages/customize-widgets/build-module/components/customize-widgets/use-clear-selected-block.mjs 2268 var import_element16 = __toESM(require_element(), 1); 2269 var import_data13 = __toESM(require_data(), 1); 2270 var import_block_editor10 = __toESM(require_block_editor(), 1); 2271 function useClearSelectedBlock(sidebarControl, popoverRef) { 2272 const { hasSelectedBlock, hasMultiSelection } = (0, import_data13.useSelect)(import_block_editor10.store); 2273 const { clearSelectedBlock } = (0, import_data13.useDispatch)(import_block_editor10.store); 2274 (0, import_element16.useEffect)(() => { 2275 if (popoverRef.current && sidebarControl) { 2276 let handleClearSelectedBlock = function(element) { 2277 if ( 2278 // 1. Make sure there are blocks being selected. 2279 (hasSelectedBlock() || hasMultiSelection()) && // 2. The element should exist in the DOM (not deleted). 2280 element && ownerDocument.contains(element) && // 3. It should also not exist in the container, the popover, nor the dialog. 2281 !container.contains(element) && !popoverRef.current.contains(element) && !element.closest('[role="dialog"]') && // 4. The inspector should not be opened. 2282 !inspector.expanded() 2283 ) { 2284 clearSelectedBlock(); 2285 } 2286 }, handleMouseDown = function(event) { 2287 handleClearSelectedBlock(event.target); 2288 }, handleBlur = function() { 2289 handleClearSelectedBlock(ownerDocument.activeElement); 2290 }; 2291 const inspector = sidebarControl.inspector; 2292 const container = sidebarControl.container[0]; 2293 const ownerDocument = container.ownerDocument; 2294 const ownerWindow = ownerDocument.defaultView; 2295 ownerDocument.addEventListener("mousedown", handleMouseDown); 2296 ownerWindow.addEventListener("blur", handleBlur); 2297 return () => { 2298 ownerDocument.removeEventListener( 2299 "mousedown", 2300 handleMouseDown 2301 ); 2302 ownerWindow.removeEventListener("blur", handleBlur); 2303 }; 2304 } 2305 }, [ 2306 popoverRef, 2307 sidebarControl, 2308 hasSelectedBlock, 2309 hasMultiSelection, 2310 clearSelectedBlock 2311 ]); 2312 } 2313 2314 // packages/customize-widgets/build-module/components/customize-widgets/index.mjs 2315 var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1); 2316 function CustomizeWidgets({ 2317 api, 2318 sidebarControls, 2319 blockEditorSettings 2320 }) { 2321 const [activeSidebarControl, setActiveSidebarControl] = (0, import_element17.useState)(null); 2322 const parentContainer = document.getElementById( 2323 "customize-theme-controls" 2324 ); 2325 const popoverRef = (0, import_element17.useRef)(); 2326 const adminPrimary = (0, import_element17.useMemo)(() => getAdminThemeColors().primary, []); 2327 useClearSelectedBlock(activeSidebarControl, popoverRef); 2328 (0, import_element17.useEffect)(() => { 2329 const unsubscribers = sidebarControls.map( 2330 (sidebarControl) => sidebarControl.subscribe((expanded) => { 2331 if (expanded) { 2332 setActiveSidebarControl(sidebarControl); 2333 } 2334 }) 2335 ); 2336 return () => { 2337 unsubscribers.forEach((unsubscriber) => unsubscriber()); 2338 }; 2339 }, [sidebarControls]); 2340 const activeSidebar = activeSidebarControl && (0, import_element17.createPortal)( 2341 /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)( 2342 SidebarBlockEditor, 2343 { 2344 blockEditorSettings, 2345 sidebar: activeSidebarControl.sidebarAdapter, 2346 inserter: activeSidebarControl.inserter, 2347 inspector: activeSidebarControl.inspector 2348 }, 2349 activeSidebarControl.id 2350 ) }), 2351 activeSidebarControl.container[0] 2352 ); 2353 const popover = parentContainer && (0, import_element17.createPortal)( 2354 /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "customize-widgets-popover", ref: popoverRef, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_components8.Popover.Slot, {}) }), 2355 parentContainer 2356 ); 2357 return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_components8.SlotFillProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_theme.ThemeProvider, { isRoot: true, color: { primary: adminPrimary }, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)( 2358 SidebarControls, 2359 { 2360 sidebarControls, 2361 activeSidebarControl, 2362 children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)( 2363 FocusControl, 2364 { 2365 api, 2366 sidebarControls, 2367 children: [ 2368 activeSidebar, 2369 popover 2370 ] 2371 } 2372 ) 2373 } 2374 ) }) }); 2375 } 2376 2377 // packages/customize-widgets/build-module/controls/sidebar-section.mjs 2378 var import_i18n10 = __toESM(require_i18n(), 1); 2379 2380 // packages/customize-widgets/build-module/controls/inspector-section.mjs 2381 function getInspectorSection() { 2382 const { 2383 wp: { customize } 2384 } = window; 2385 return class InspectorSection extends customize.Section { 2386 constructor(id, options) { 2387 super(id, options); 2388 this.parentSection = options.parentSection; 2389 this.returnFocusWhenClose = null; 2390 this._isOpen = false; 2391 } 2392 get isOpen() { 2393 return this._isOpen; 2394 } 2395 set isOpen(value) { 2396 this._isOpen = value; 2397 this.triggerActiveCallbacks(); 2398 } 2399 ready() { 2400 this.contentContainer[0].classList.add( 2401 "customize-widgets-layout__inspector" 2402 ); 2403 } 2404 isContextuallyActive() { 2405 return this.isOpen; 2406 } 2407 onChangeExpanded(expanded, args) { 2408 super.onChangeExpanded(expanded, args); 2409 if (this.parentSection && !args.unchanged) { 2410 if (expanded) { 2411 this.parentSection.collapse({ 2412 manualTransition: true 2413 }); 2414 } else { 2415 this.parentSection.expand({ 2416 manualTransition: true, 2417 completeCallback: () => { 2418 if (this.returnFocusWhenClose && !this.contentContainer[0].contains( 2419 this.returnFocusWhenClose 2420 )) { 2421 this.returnFocusWhenClose.focus(); 2422 } 2423 } 2424 }); 2425 } 2426 } 2427 } 2428 open({ returnFocusWhenClose } = {}) { 2429 this.isOpen = true; 2430 this.returnFocusWhenClose = returnFocusWhenClose; 2431 this.expand({ 2432 allowMultiple: true 2433 }); 2434 } 2435 close() { 2436 this.collapse({ 2437 allowMultiple: true 2438 }); 2439 } 2440 collapse(options) { 2441 this.isOpen = false; 2442 super.collapse(options); 2443 } 2444 triggerActiveCallbacks() { 2445 this.active.callbacks.fireWith(this.active, [false, true]); 2446 } 2447 }; 2448 } 2449 2450 // packages/customize-widgets/build-module/controls/sidebar-section.mjs 2451 var getInspectorSectionId = (sidebarId) => `widgets-inspector-$sidebarId}`; 2452 function getSidebarSection() { 2453 const { 2454 wp: { customize } 2455 } = window; 2456 const reduceMotionMediaQuery = window.matchMedia( 2457 "(prefers-reduced-motion: reduce)" 2458 ); 2459 let isReducedMotion = reduceMotionMediaQuery.matches; 2460 reduceMotionMediaQuery.addEventListener("change", (event) => { 2461 isReducedMotion = event.matches; 2462 }); 2463 return class SidebarSection extends customize.Section { 2464 ready() { 2465 const InspectorSection = getInspectorSection(); 2466 this.inspector = new InspectorSection( 2467 getInspectorSectionId(this.id), 2468 { 2469 title: (0, import_i18n10.__)("Block Settings"), 2470 parentSection: this, 2471 customizeAction: [ 2472 (0, import_i18n10.__)("Customizing"), 2473 (0, import_i18n10.__)("Widgets"), 2474 this.params.title 2475 ].join(" \u25B8 ") 2476 } 2477 ); 2478 customize.section.add(this.inspector); 2479 this.contentContainer[0].classList.add( 2480 "customize-widgets__sidebar-section" 2481 ); 2482 } 2483 hasSubSectionOpened() { 2484 return this.inspector.expanded(); 2485 } 2486 onChangeExpanded(expanded, _args) { 2487 const controls = this.controls(); 2488 const args = { 2489 ..._args, 2490 completeCallback() { 2491 controls.forEach((control) => { 2492 control.onChangeSectionExpanded?.(expanded, args); 2493 }); 2494 _args.completeCallback?.(); 2495 } 2496 }; 2497 if (args.manualTransition) { 2498 if (expanded) { 2499 this.contentContainer.addClass(["busy", "open"]); 2500 this.contentContainer.removeClass("is-sub-section-open"); 2501 this.contentContainer.closest(".wp-full-overlay").addClass("section-open"); 2502 } else { 2503 this.contentContainer.addClass([ 2504 "busy", 2505 "is-sub-section-open" 2506 ]); 2507 this.contentContainer.closest(".wp-full-overlay").addClass("section-open"); 2508 this.contentContainer.removeClass("open"); 2509 } 2510 const handleTransitionEnd = () => { 2511 this.contentContainer.removeClass("busy"); 2512 args.completeCallback(); 2513 }; 2514 if (isReducedMotion) { 2515 handleTransitionEnd(); 2516 } else { 2517 this.contentContainer.one( 2518 "transitionend", 2519 handleTransitionEnd 2520 ); 2521 } 2522 } else { 2523 super.onChangeExpanded(expanded, args); 2524 } 2525 } 2526 }; 2527 } 2528 2529 // packages/customize-widgets/build-module/controls/sidebar-control.mjs 2530 var import_data15 = __toESM(require_data(), 1); 2531 2532 // packages/customize-widgets/build-module/components/sidebar-block-editor/sidebar-adapter.mjs 2533 var { wp } = window; 2534 function parseWidgetId(widgetId) { 2535 const matches = widgetId.match(/^(.+)-(\d+)$/); 2536 if (matches) { 2537 return { 2538 idBase: matches[1], 2539 number: parseInt(matches[2], 10) 2540 }; 2541 } 2542 return { idBase: widgetId }; 2543 } 2544 function widgetIdToSettingId(widgetId) { 2545 const { idBase, number } = parseWidgetId(widgetId); 2546 if (number) { 2547 return `widget_$idBase}[$number}]`; 2548 } 2549 return `widget_$idBase}`; 2550 } 2551 function debounce(leading, callback, timeout) { 2552 let isLeading = false; 2553 let timerID; 2554 function debounced(...args) { 2555 const result = (isLeading ? callback : leading).apply(this, args); 2556 isLeading = true; 2557 clearTimeout(timerID); 2558 timerID = setTimeout(() => { 2559 isLeading = false; 2560 }, timeout); 2561 return result; 2562 } 2563 debounced.cancel = () => { 2564 isLeading = false; 2565 clearTimeout(timerID); 2566 }; 2567 return debounced; 2568 } 2569 var SidebarAdapter = class { 2570 constructor(setting, api) { 2571 this.setting = setting; 2572 this.api = api; 2573 this.locked = false; 2574 this.widgetsCache = /* @__PURE__ */ new WeakMap(); 2575 this.subscribers = /* @__PURE__ */ new Set(); 2576 this.history = [ 2577 this._getWidgetIds().map( 2578 (widgetId) => this.getWidget(widgetId) 2579 ) 2580 ]; 2581 this.historyIndex = 0; 2582 this.historySubscribers = /* @__PURE__ */ new Set(); 2583 this._debounceSetHistory = debounce( 2584 this._pushHistory, 2585 this._replaceHistory, 2586 1e3 2587 ); 2588 this.setting.bind(this._handleSettingChange.bind(this)); 2589 this.api.bind("change", this._handleAllSettingsChange.bind(this)); 2590 this.undo = this.undo.bind(this); 2591 this.redo = this.redo.bind(this); 2592 this.save = this.save.bind(this); 2593 } 2594 subscribe(callback) { 2595 this.subscribers.add(callback); 2596 return () => { 2597 this.subscribers.delete(callback); 2598 }; 2599 } 2600 getWidgets() { 2601 return this.history[this.historyIndex]; 2602 } 2603 _emit(...args) { 2604 for (const callback of this.subscribers) { 2605 callback(...args); 2606 } 2607 } 2608 _getWidgetIds() { 2609 return this.setting.get(); 2610 } 2611 _pushHistory() { 2612 this.history = [ 2613 ...this.history.slice(0, this.historyIndex + 1), 2614 this._getWidgetIds().map( 2615 (widgetId) => this.getWidget(widgetId) 2616 ) 2617 ]; 2618 this.historyIndex += 1; 2619 this.historySubscribers.forEach((listener) => listener()); 2620 } 2621 _replaceHistory() { 2622 this.history[this.historyIndex] = this._getWidgetIds().map( 2623 (widgetId) => this.getWidget(widgetId) 2624 ); 2625 } 2626 _handleSettingChange() { 2627 if (this.locked) { 2628 return; 2629 } 2630 const prevWidgets = this.getWidgets(); 2631 this._pushHistory(); 2632 this._emit(prevWidgets, this.getWidgets()); 2633 } 2634 _handleAllSettingsChange(setting) { 2635 if (this.locked) { 2636 return; 2637 } 2638 if (!setting.id.startsWith("widget_")) { 2639 return; 2640 } 2641 const widgetId = settingIdToWidgetId(setting.id); 2642 if (!this.setting.get().includes(widgetId)) { 2643 return; 2644 } 2645 const prevWidgets = this.getWidgets(); 2646 this._pushHistory(); 2647 this._emit(prevWidgets, this.getWidgets()); 2648 } 2649 _createWidget(widget) { 2650 const widgetModel = wp.customize.Widgets.availableWidgets.findWhere({ 2651 id_base: widget.idBase 2652 }); 2653 let number = widget.number; 2654 if (widgetModel.get("is_multi") && !number) { 2655 widgetModel.set( 2656 "multi_number", 2657 widgetModel.get("multi_number") + 1 2658 ); 2659 number = widgetModel.get("multi_number"); 2660 } 2661 const settingId = number ? `widget_$widget.idBase}[$number}]` : `widget_$widget.idBase}`; 2662 const settingArgs = { 2663 transport: wp.customize.Widgets.data.selectiveRefreshableWidgets[widgetModel.get("id_base")] ? "postMessage" : "refresh", 2664 previewer: this.setting.previewer 2665 }; 2666 const setting = this.api.create( 2667 settingId, 2668 settingId, 2669 "", 2670 settingArgs 2671 ); 2672 setting.set(widget.instance); 2673 const widgetId = settingIdToWidgetId(settingId); 2674 return widgetId; 2675 } 2676 _removeWidget(widget) { 2677 const settingId = widgetIdToSettingId(widget.id); 2678 const setting = this.api(settingId); 2679 if (setting) { 2680 const instance = setting.get(); 2681 this.widgetsCache.delete(instance); 2682 } 2683 this.api.remove(settingId); 2684 } 2685 _updateWidget(widget) { 2686 const prevWidget = this.getWidget(widget.id); 2687 if (prevWidget === widget) { 2688 return widget.id; 2689 } 2690 if (prevWidget.idBase && widget.idBase && prevWidget.idBase === widget.idBase) { 2691 const settingId = widgetIdToSettingId(widget.id); 2692 this.api(settingId).set(widget.instance); 2693 return widget.id; 2694 } 2695 this._removeWidget(widget); 2696 return this._createWidget(widget); 2697 } 2698 getWidget(widgetId) { 2699 if (!widgetId) { 2700 return null; 2701 } 2702 const { idBase, number } = parseWidgetId(widgetId); 2703 const settingId = widgetIdToSettingId(widgetId); 2704 const setting = this.api(settingId); 2705 if (!setting) { 2706 return null; 2707 } 2708 const instance = setting.get(); 2709 if (this.widgetsCache.has(instance)) { 2710 return this.widgetsCache.get(instance); 2711 } 2712 const widget = { 2713 id: widgetId, 2714 idBase, 2715 number, 2716 instance 2717 }; 2718 this.widgetsCache.set(instance, widget); 2719 return widget; 2720 } 2721 _updateWidgets(nextWidgets) { 2722 this.locked = true; 2723 const addedWidgetIds = []; 2724 const nextWidgetIds = nextWidgets.map((nextWidget) => { 2725 if (nextWidget.id && this.getWidget(nextWidget.id)) { 2726 addedWidgetIds.push(null); 2727 return this._updateWidget(nextWidget); 2728 } 2729 const widgetId = this._createWidget(nextWidget); 2730 addedWidgetIds.push(widgetId); 2731 return widgetId; 2732 }); 2733 const deletedWidgets = this.getWidgets().filter( 2734 (widget) => !nextWidgetIds.includes(widget.id) 2735 ); 2736 deletedWidgets.forEach((widget) => this._removeWidget(widget)); 2737 this.setting.set(nextWidgetIds); 2738 this.locked = false; 2739 return addedWidgetIds; 2740 } 2741 setWidgets(nextWidgets) { 2742 const addedWidgetIds = this._updateWidgets(nextWidgets); 2743 this._debounceSetHistory(); 2744 return addedWidgetIds; 2745 } 2746 /** 2747 * Undo/Redo related features 2748 */ 2749 hasUndo() { 2750 return this.historyIndex > 0; 2751 } 2752 hasRedo() { 2753 return this.historyIndex < this.history.length - 1; 2754 } 2755 _seek(historyIndex) { 2756 const currentWidgets = this.getWidgets(); 2757 this.historyIndex = historyIndex; 2758 const widgets = this.history[this.historyIndex]; 2759 this._updateWidgets(widgets); 2760 this._emit(currentWidgets, this.getWidgets()); 2761 this.historySubscribers.forEach((listener) => listener()); 2762 this._debounceSetHistory.cancel(); 2763 } 2764 undo() { 2765 if (!this.hasUndo()) { 2766 return; 2767 } 2768 this._seek(this.historyIndex - 1); 2769 } 2770 redo() { 2771 if (!this.hasRedo()) { 2772 return; 2773 } 2774 this._seek(this.historyIndex + 1); 2775 } 2776 subscribeHistory(listener) { 2777 this.historySubscribers.add(listener); 2778 return () => { 2779 this.historySubscribers.delete(listener); 2780 }; 2781 } 2782 save() { 2783 this.api.previewer.save(); 2784 } 2785 }; 2786 2787 // packages/customize-widgets/build-module/controls/inserter-outer-section.mjs 2788 var import_keycodes5 = __toESM(require_keycodes(), 1); 2789 var import_dom = __toESM(require_dom(), 1); 2790 var import_data14 = __toESM(require_data(), 1); 2791 function getInserterOuterSection() { 2792 const { 2793 wp: { customize } 2794 } = window; 2795 const OuterSection = customize.OuterSection; 2796 customize.OuterSection = class extends OuterSection { 2797 onChangeExpanded(expanded, args) { 2798 if (expanded) { 2799 customize.section.each((section) => { 2800 if (section.params.type === "outer" && section.id !== this.id) { 2801 if (section.expanded()) { 2802 section.collapse(); 2803 } 2804 } 2805 }); 2806 } 2807 return super.onChangeExpanded(expanded, args); 2808 } 2809 }; 2810 customize.sectionConstructor.outer = customize.OuterSection; 2811 return class InserterOuterSection extends customize.OuterSection { 2812 constructor(...args) { 2813 super(...args); 2814 this.params.type = "outer"; 2815 this.activeElementBeforeExpanded = null; 2816 const ownerWindow = this.contentContainer[0].ownerDocument.defaultView; 2817 ownerWindow.addEventListener( 2818 "keydown", 2819 (event) => { 2820 if (this.expanded() && (event.keyCode === import_keycodes5.ESCAPE || event.code === "Escape") && !event.defaultPrevented) { 2821 event.preventDefault(); 2822 event.stopPropagation(); 2823 (0, import_data14.dispatch)(store).setIsInserterOpened( 2824 false 2825 ); 2826 } 2827 }, 2828 // Use capture mode to make this run before other event listeners. 2829 true 2830 ); 2831 this.contentContainer.addClass("widgets-inserter"); 2832 this.isFromInternalAction = false; 2833 this.expanded.bind(() => { 2834 if (!this.isFromInternalAction) { 2835 (0, import_data14.dispatch)(store).setIsInserterOpened( 2836 this.expanded() 2837 ); 2838 } 2839 this.isFromInternalAction = false; 2840 }); 2841 } 2842 open() { 2843 if (!this.expanded()) { 2844 const contentContainer = this.contentContainer[0]; 2845 this.activeElementBeforeExpanded = contentContainer.ownerDocument.activeElement; 2846 this.isFromInternalAction = true; 2847 this.expand({ 2848 completeCallback() { 2849 const searchBox = import_dom.focus.tabbable.find(contentContainer)[1]; 2850 if (searchBox) { 2851 searchBox.focus(); 2852 } 2853 } 2854 }); 2855 } 2856 } 2857 close() { 2858 if (this.expanded()) { 2859 const contentContainer = this.contentContainer[0]; 2860 const activeElement = contentContainer.ownerDocument.activeElement; 2861 this.isFromInternalAction = true; 2862 this.collapse({ 2863 completeCallback() { 2864 if (contentContainer.contains(activeElement)) { 2865 if (this.activeElementBeforeExpanded) { 2866 this.activeElementBeforeExpanded.focus(); 2867 } 2868 } 2869 } 2870 }); 2871 } 2872 } 2873 }; 2874 } 2875 2876 // packages/customize-widgets/build-module/controls/sidebar-control.mjs 2877 var getInserterId = (controlId) => `widgets-inserter-$controlId}`; 2878 function getSidebarControl() { 2879 const { 2880 wp: { customize } 2881 } = window; 2882 return class SidebarControl extends customize.Control { 2883 constructor(...args) { 2884 super(...args); 2885 this.subscribers = /* @__PURE__ */ new Set(); 2886 } 2887 ready() { 2888 const InserterOuterSection = getInserterOuterSection(); 2889 this.inserter = new InserterOuterSection( 2890 getInserterId(this.id), 2891 {} 2892 ); 2893 customize.section.add(this.inserter); 2894 this.sectionInstance = customize.section(this.section()); 2895 this.inspector = this.sectionInstance.inspector; 2896 this.sidebarAdapter = new SidebarAdapter(this.setting, customize); 2897 } 2898 subscribe(callback) { 2899 this.subscribers.add(callback); 2900 return () => { 2901 this.subscribers.delete(callback); 2902 }; 2903 } 2904 onChangeSectionExpanded(expanded, args) { 2905 if (!args.unchanged) { 2906 if (!expanded) { 2907 (0, import_data15.dispatch)(store).setIsInserterOpened( 2908 false 2909 ); 2910 } 2911 this.subscribers.forEach( 2912 (subscriber) => subscriber(expanded, args) 2913 ); 2914 } 2915 } 2916 }; 2917 } 2918 2919 // packages/customize-widgets/build-module/filters/move-to-sidebar.mjs 2920 var import_block_editor11 = __toESM(require_block_editor(), 1); 2921 var import_compose4 = __toESM(require_compose(), 1); 2922 var import_data16 = __toESM(require_data(), 1); 2923 var import_hooks2 = __toESM(require_hooks(), 1); 2924 var import_widgets4 = __toESM(require_widgets(), 1); 2925 var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1); 2926 var withMoveToSidebarToolbarItem = (0, import_compose4.createHigherOrderComponent)( 2927 (BlockEdit) => (props) => { 2928 let widgetId = (0, import_widgets4.getWidgetIdFromBlock)(props); 2929 const sidebarControls = useSidebarControls(); 2930 const activeSidebarControl = useActiveSidebarControl(); 2931 const hasMultipleSidebars = sidebarControls?.length > 1; 2932 const blockName = props.name; 2933 const clientId = props.clientId; 2934 const canInsertBlockInSidebar = (0, import_data16.useSelect)( 2935 (select) => { 2936 return select(import_block_editor11.store).canInsertBlockType( 2937 blockName, 2938 "" 2939 ); 2940 }, 2941 [blockName] 2942 ); 2943 const block = (0, import_data16.useSelect)( 2944 (select) => select(import_block_editor11.store).getBlock(clientId), 2945 [clientId] 2946 ); 2947 const { removeBlock } = (0, import_data16.useDispatch)(import_block_editor11.store); 2948 const [, focusWidget] = useFocusControl(); 2949 function moveToSidebar(sidebarControlId) { 2950 const newSidebarControl = sidebarControls.find( 2951 (sidebarControl) => sidebarControl.id === sidebarControlId 2952 ); 2953 if (widgetId) { 2954 const oldSetting = activeSidebarControl.setting; 2955 const newSetting = newSidebarControl.setting; 2956 oldSetting(oldSetting().filter((id) => id !== widgetId)); 2957 newSetting([...newSetting(), widgetId]); 2958 } else { 2959 const sidebarAdapter = newSidebarControl.sidebarAdapter; 2960 removeBlock(clientId); 2961 const addedWidgetIds = sidebarAdapter.setWidgets([ 2962 ...sidebarAdapter.getWidgets(), 2963 blockToWidget(block) 2964 ]); 2965 widgetId = addedWidgetIds.reverse().find((id) => !!id); 2966 } 2967 focusWidget(widgetId); 2968 } 2969 return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [ 2970 /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(BlockEdit, { ...props }, "edit"), 2971 hasMultipleSidebars && canInsertBlockInSidebar && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_block_editor11.BlockControls, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)( 2972 import_widgets4.MoveToWidgetArea, 2973 { 2974 widgetAreas: sidebarControls.map( 2975 (sidebarControl) => ({ 2976 id: sidebarControl.id, 2977 name: sidebarControl.params.label, 2978 description: sidebarControl.params.description 2979 }) 2980 ), 2981 currentWidgetAreaId: activeSidebarControl?.id, 2982 onSelect: moveToSidebar 2983 } 2984 ) }) 2985 ] }); 2986 }, 2987 "withMoveToSidebarToolbarItem" 2988 ); 2989 (0, import_hooks2.addFilter)( 2990 "editor.BlockEdit", 2991 "core/customize-widgets/block-edit", 2992 withMoveToSidebarToolbarItem 2993 ); 2994 2995 // packages/customize-widgets/build-module/filters/replace-media-upload.mjs 2996 var import_hooks3 = __toESM(require_hooks(), 1); 2997 var import_media_utils2 = __toESM(require_media_utils(), 1); 2998 var replaceMediaUpload = () => import_media_utils2.MediaUpload; 2999 (0, import_hooks3.addFilter)( 3000 "editor.MediaUpload", 3001 "core/edit-widgets/replace-media-upload", 3002 replaceMediaUpload 3003 ); 3004 3005 // packages/customize-widgets/build-module/filters/wide-widget-display.mjs 3006 var import_compose5 = __toESM(require_compose(), 1); 3007 var import_hooks4 = __toESM(require_hooks(), 1); 3008 var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1); 3009 var { wp: wp2 } = window; 3010 var withWideWidgetDisplay = (0, import_compose5.createHigherOrderComponent)( 3011 (BlockEdit) => (props) => { 3012 const { idBase } = props.attributes; 3013 const isWide = wp2.customize.Widgets.data.availableWidgets.find( 3014 (widget) => widget.id_base === idBase 3015 )?.is_wide ?? false; 3016 return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(BlockEdit, { ...props, isWide }, "edit"); 3017 }, 3018 "withWideWidgetDisplay" 3019 ); 3020 (0, import_hooks4.addFilter)( 3021 "editor.BlockEdit", 3022 "core/customize-widgets/wide-widget-display", 3023 withWideWidgetDisplay 3024 ); 3025 3026 // packages/customize-widgets/build-module/index.mjs 3027 var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1); 3028 var { wp: wp3 } = window; 3029 var DISABLED_BLOCKS = [ 3030 "core/more", 3031 "core/block", 3032 "core/freeform", 3033 "core/template-part" 3034 ]; 3035 function initialize(editorName, blockEditorSettings) { 3036 (0, import_data17.dispatch)(import_preferences4.store).setDefaults("core/customize-widgets", { 3037 fixedToolbar: false, 3038 welcomeGuide: true 3039 }); 3040 (0, import_data17.dispatch)(import_blocks2.store).reapplyBlockTypeFilters(); 3041 const coreBlocks = (0, import_block_library2.__experimentalGetCoreBlocks)().filter((block) => { 3042 return !(DISABLED_BLOCKS.includes(block.name) || block.name.startsWith("core/post") || block.name.startsWith("core/query") || block.name.startsWith("core/site") || block.name.startsWith("core/navigation") || block.name.startsWith("core/term")); 3043 }); 3044 (0, import_block_library2.registerCoreBlocks)(coreBlocks); 3045 (0, import_widgets5.registerLegacyWidgetBlock)(); 3046 if (false) { 3047 (0, import_block_library2.__experimentalRegisterExperimentalCoreBlocks)({ 3048 enableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS 3049 }); 3050 } 3051 (0, import_widgets5.registerLegacyWidgetVariations)(blockEditorSettings); 3052 (0, import_widgets5.registerWidgetGroupBlock)(); 3053 (0, import_blocks2.setFreeformContentHandlerName)("core/html"); 3054 const SidebarControl = getSidebarControl(blockEditorSettings); 3055 wp3.customize.sectionConstructor.sidebar = getSidebarSection(); 3056 wp3.customize.controlConstructor.sidebar_block_editor = SidebarControl; 3057 const container = document.createElement("div"); 3058 document.body.appendChild(container); 3059 wp3.customize.bind("ready", () => { 3060 const sidebarControls = []; 3061 wp3.customize.control.each((control) => { 3062 if (control instanceof SidebarControl) { 3063 sidebarControls.push(control); 3064 } 3065 }); 3066 (0, import_element18.createRoot)(container).render( 3067 /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_element18.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)( 3068 CustomizeWidgets, 3069 { 3070 api: wp3.customize, 3071 sidebarControls, 3072 blockEditorSettings 3073 } 3074 ) }) 3075 ); 3076 }); 3077 } 3078 return __toCommonJS(index_exports); 3079 })(); 3080 (window.wp ||= {}).customizeWidgets = wp.customizeWidgets; 3081 })();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Fri Aug 7 08:20:20 2026 | Cross-referenced by PHPXref |