| [ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 var wp; 2 (wp ||= {}).editWidgets = (() => { 3 var __create = Object.create; 4 var __defProp = Object.defineProperty; 5 var __getOwnPropDesc = Object.getOwnPropertyDescriptor; 6 var __getOwnPropNames = Object.getOwnPropertyNames; 7 var __getProtoOf = Object.getPrototypeOf; 8 var __hasOwnProp = Object.prototype.hasOwnProperty; 9 var __commonJS = (cb, mod) => function __require() { 10 return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; 11 }; 12 var __export = (target, all) => { 13 for (var name2 in all) 14 __defProp(target, name2, { get: all[name2], enumerable: true }); 15 }; 16 var __copyProps = (to, from, except, desc) => { 17 if (from && typeof from === "object" || typeof from === "function") { 18 for (let key of __getOwnPropNames(from)) 19 if (!__hasOwnProp.call(to, key) && key !== except) 20 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); 21 } 22 return to; 23 }; 24 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( 25 // If the importer is in node compatibility mode or this is not an ESM 26 // file that has been converted to a CommonJS file using a Babel- 27 // compatible transform (i.e. "__esModule" has not been set), then set 28 // "default" to the CommonJS "module.exports" for node compatibility. 29 isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, 30 mod 31 )); 32 var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); 33 34 // package-external:@wordpress/blocks 35 var require_blocks = __commonJS({ 36 "package-external:@wordpress/blocks"(exports, module) { 37 module.exports = window.wp.blocks; 38 } 39 }); 40 41 // package-external:@wordpress/data 42 var require_data = __commonJS({ 43 "package-external:@wordpress/data"(exports, module) { 44 module.exports = window.wp.data; 45 } 46 }); 47 48 // package-external:@wordpress/deprecated 49 var require_deprecated = __commonJS({ 50 "package-external:@wordpress/deprecated"(exports, module) { 51 module.exports = window.wp.deprecated; 52 } 53 }); 54 55 // package-external:@wordpress/element 56 var require_element = __commonJS({ 57 "package-external:@wordpress/element"(exports, module) { 58 module.exports = window.wp.element; 59 } 60 }); 61 62 // package-external:@wordpress/block-library 63 var require_block_library = __commonJS({ 64 "package-external:@wordpress/block-library"(exports, module) { 65 module.exports = window.wp.blockLibrary; 66 } 67 }); 68 69 // package-external:@wordpress/core-data 70 var require_core_data = __commonJS({ 71 "package-external:@wordpress/core-data"(exports, module) { 72 module.exports = window.wp.coreData; 73 } 74 }); 75 76 // package-external:@wordpress/widgets 77 var require_widgets = __commonJS({ 78 "package-external:@wordpress/widgets"(exports, module) { 79 module.exports = window.wp.widgets; 80 } 81 }); 82 83 // package-external:@wordpress/preferences 84 var require_preferences = __commonJS({ 85 "package-external:@wordpress/preferences"(exports, module) { 86 module.exports = window.wp.preferences; 87 } 88 }); 89 90 // package-external:@wordpress/api-fetch 91 var require_api_fetch = __commonJS({ 92 "package-external:@wordpress/api-fetch"(exports, module) { 93 module.exports = window.wp.apiFetch; 94 } 95 }); 96 97 // package-external:@wordpress/i18n 98 var require_i18n = __commonJS({ 99 "package-external:@wordpress/i18n"(exports, module) { 100 module.exports = window.wp.i18n; 101 } 102 }); 103 104 // package-external:@wordpress/notices 105 var require_notices = __commonJS({ 106 "package-external:@wordpress/notices"(exports, module) { 107 module.exports = window.wp.notices; 108 } 109 }); 110 111 // package-external:@wordpress/components 112 var require_components = __commonJS({ 113 "package-external:@wordpress/components"(exports, module) { 114 module.exports = window.wp.components; 115 } 116 }); 117 118 // package-external:@wordpress/primitives 119 var require_primitives = __commonJS({ 120 "package-external:@wordpress/primitives"(exports, module) { 121 module.exports = window.wp.primitives; 122 } 123 }); 124 125 // vendor-external:react/jsx-runtime 126 var require_jsx_runtime = __commonJS({ 127 "vendor-external:react/jsx-runtime"(exports, module) { 128 module.exports = window.ReactJSXRuntime; 129 } 130 }); 131 132 // package-external:@wordpress/viewport 133 var require_viewport = __commonJS({ 134 "package-external:@wordpress/viewport"(exports, module) { 135 module.exports = window.wp.viewport; 136 } 137 }); 138 139 // package-external:@wordpress/compose 140 var require_compose = __commonJS({ 141 "package-external:@wordpress/compose"(exports, module) { 142 module.exports = window.wp.compose; 143 } 144 }); 145 146 // package-external:@wordpress/plugins 147 var require_plugins = __commonJS({ 148 "package-external:@wordpress/plugins"(exports, module) { 149 module.exports = window.wp.plugins; 150 } 151 }); 152 153 // vendor-external:react 154 var require_react = __commonJS({ 155 "vendor-external:react"(exports, module) { 156 module.exports = window.React; 157 } 158 }); 159 160 // package-external:@wordpress/private-apis 161 var require_private_apis = __commonJS({ 162 "package-external:@wordpress/private-apis"(exports, module) { 163 module.exports = window.wp.privateApis; 164 } 165 }); 166 167 // package-external:@wordpress/block-editor 168 var require_block_editor = __commonJS({ 169 "package-external:@wordpress/block-editor"(exports, module) { 170 module.exports = window.wp.blockEditor; 171 } 172 }); 173 174 // package-external:@wordpress/hooks 175 var require_hooks = __commonJS({ 176 "package-external:@wordpress/hooks"(exports, module) { 177 module.exports = window.wp.hooks; 178 } 179 }); 180 181 // package-external:@wordpress/media-utils 182 var require_media_utils = __commonJS({ 183 "package-external:@wordpress/media-utils"(exports, module) { 184 module.exports = window.wp.mediaUtils; 185 } 186 }); 187 188 // package-external:@wordpress/patterns 189 var require_patterns = __commonJS({ 190 "package-external:@wordpress/patterns"(exports, module) { 191 module.exports = window.wp.patterns; 192 } 193 }); 194 195 // package-external:@wordpress/keyboard-shortcuts 196 var require_keyboard_shortcuts = __commonJS({ 197 "package-external:@wordpress/keyboard-shortcuts"(exports, module) { 198 module.exports = window.wp.keyboardShortcuts; 199 } 200 }); 201 202 // package-external:@wordpress/keycodes 203 var require_keycodes = __commonJS({ 204 "package-external:@wordpress/keycodes"(exports, module) { 205 module.exports = window.wp.keycodes; 206 } 207 }); 208 209 // package-external:@wordpress/url 210 var require_url = __commonJS({ 211 "package-external:@wordpress/url"(exports, module) { 212 module.exports = window.wp.url; 213 } 214 }); 215 216 // package-external:@wordpress/dom 217 var require_dom = __commonJS({ 218 "package-external:@wordpress/dom"(exports, module) { 219 module.exports = window.wp.dom; 220 } 221 }); 222 223 // packages/edit-widgets/build-module/index.mjs 224 var index_exports = {}; 225 __export(index_exports, { 226 initialize: () => initialize, 227 initializeEditor: () => initializeEditor, 228 reinitializeEditor: () => reinitializeEditor, 229 store: () => store2 230 }); 231 var import_blocks3 = __toESM(require_blocks(), 1); 232 var import_data32 = __toESM(require_data(), 1); 233 var import_deprecated6 = __toESM(require_deprecated(), 1); 234 var import_element26 = __toESM(require_element(), 1); 235 var import_block_library2 = __toESM(require_block_library(), 1); 236 var import_core_data12 = __toESM(require_core_data(), 1); 237 var import_widgets5 = __toESM(require_widgets(), 1); 238 var import_preferences10 = __toESM(require_preferences(), 1); 239 240 // packages/edit-widgets/build-module/store/index.mjs 241 var import_api_fetch = __toESM(require_api_fetch(), 1); 242 var import_data8 = __toESM(require_data(), 1); 243 244 // packages/edit-widgets/build-module/store/reducer.mjs 245 var import_data = __toESM(require_data(), 1); 246 function widgetAreasOpenState(state = {}, action) { 247 const { type } = action; 248 switch (type) { 249 case "SET_WIDGET_AREAS_OPEN_STATE": { 250 return action.widgetAreasOpenState; 251 } 252 case "SET_IS_WIDGET_AREA_OPEN": { 253 const { clientId, isOpen } = action; 254 return { 255 ...state, 256 [clientId]: isOpen 257 }; 258 } 259 default: { 260 return state; 261 } 262 } 263 } 264 function blockInserterPanel(state = false, action) { 265 switch (action.type) { 266 case "SET_IS_LIST_VIEW_OPENED": 267 return action.isOpen ? false : state; 268 case "SET_IS_INSERTER_OPENED": 269 return action.value; 270 } 271 return state; 272 } 273 function listViewPanel(state = false, action) { 274 switch (action.type) { 275 case "SET_IS_INSERTER_OPENED": 276 return action.value ? false : state; 277 case "SET_IS_LIST_VIEW_OPENED": 278 return action.isOpen; 279 } 280 return state; 281 } 282 function listViewToggleRef(state = { current: null }) { 283 return state; 284 } 285 function inserterSidebarToggleRef(state = { current: null }) { 286 return state; 287 } 288 function widgetSavingLock(state = {}, action) { 289 switch (action.type) { 290 case "LOCK_WIDGET_SAVING": 291 return { ...state, [action.lockName]: true }; 292 case "UNLOCK_WIDGET_SAVING": { 293 const { [action.lockName]: removedLockName, ...restState } = state; 294 return restState; 295 } 296 } 297 return state; 298 } 299 var reducer_default = (0, import_data.combineReducers)({ 300 blockInserterPanel, 301 inserterSidebarToggleRef, 302 listViewPanel, 303 listViewToggleRef, 304 widgetAreasOpenState, 305 widgetSavingLock 306 }); 307 308 // packages/edit-widgets/build-module/store/resolvers.mjs 309 var resolvers_exports = {}; 310 __export(resolvers_exports, { 311 getWidgetAreas: () => getWidgetAreas, 312 getWidgets: () => getWidgets 313 }); 314 var import_blocks2 = __toESM(require_blocks(), 1); 315 var import_core_data2 = __toESM(require_core_data(), 1); 316 317 // packages/edit-widgets/build-module/store/actions.mjs 318 var actions_exports2 = {}; 319 __export(actions_exports2, { 320 closeGeneralSidebar: () => closeGeneralSidebar, 321 lockWidgetSaving: () => lockWidgetSaving, 322 moveBlockToWidgetArea: () => moveBlockToWidgetArea, 323 persistStubPost: () => persistStubPost, 324 saveEditedWidgetAreas: () => saveEditedWidgetAreas, 325 saveWidgetArea: () => saveWidgetArea, 326 saveWidgetAreas: () => saveWidgetAreas, 327 setIsInserterOpened: () => setIsInserterOpened, 328 setIsListViewOpened: () => setIsListViewOpened, 329 setIsWidgetAreaOpen: () => setIsWidgetAreaOpen, 330 setWidgetAreasOpenState: () => setWidgetAreasOpenState, 331 setWidgetIdForClientId: () => setWidgetIdForClientId, 332 unlockWidgetSaving: () => unlockWidgetSaving 333 }); 334 var import_i18n3 = __toESM(require_i18n(), 1); 335 var import_notices = __toESM(require_notices(), 1); 336 337 // node_modules/clsx/dist/clsx.mjs 338 function r(e) { 339 var t, f, n = ""; 340 if ("string" == typeof e || "number" == typeof e) n += e; 341 else if ("object" == typeof e) if (Array.isArray(e)) { 342 var o = e.length; 343 for (t = 0; t < o; t++) e[t] && (f = r(e[t])) && (n && (n += " "), n += f); 344 } else for (f in e) e[f] && (n && (n += " "), n += f); 345 return n; 346 } 347 function clsx() { 348 for (var e, t, f = 0, n = "", o = arguments.length; f < o; f++) (e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t); 349 return n; 350 } 351 var clsx_default = clsx; 352 353 // packages/interface/build-module/components/complementary-area/index.mjs 354 var import_components5 = __toESM(require_components(), 1); 355 var import_data6 = __toESM(require_data(), 1); 356 var import_i18n = __toESM(require_i18n(), 1); 357 358 // packages/icons/build-module/library/block-default.mjs 359 var import_primitives = __toESM(require_primitives(), 1); 360 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1); 361 var block_default_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: "M19 8h-1V6h-5v2h-2V6H6v2H5c-1.1 0-2 .9-2 2v8c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2v-8c0-1.1-.9-2-2-2zm.5 10c0 .3-.2.5-.5.5H5c-.3 0-.5-.2-.5-.5v-8c0-.3.2-.5.5-.5h14c.3 0 .5.2.5.5v8z" }) }); 362 363 // packages/icons/build-module/library/check.mjs 364 var import_primitives2 = __toESM(require_primitives(), 1); 365 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1); 366 var check_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: "M16.5 7.5 10 13.9l-2.5-2.4-1 1 3.5 3.6 7.5-7.6z" }) }); 367 368 // packages/icons/build-module/library/close-small.mjs 369 var import_primitives3 = __toESM(require_primitives(), 1); 370 var import_jsx_runtime3 = __toESM(require_jsx_runtime(), 1); 371 var close_small_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: "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" }) }); 372 373 // packages/icons/build-module/library/drawer-left.mjs 374 var import_primitives4 = __toESM(require_primitives(), 1); 375 var import_jsx_runtime4 = __toESM(require_jsx_runtime(), 1); 376 var drawer_left_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, { fillRule: "evenodd", clipRule: "evenodd", d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zM8.5 18.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h2.5v13zm10-.5c0 .3-.2.5-.5.5h-8v-13h8c.3 0 .5.2.5.5v12z" }) }); 377 378 // packages/icons/build-module/library/drawer-right.mjs 379 var import_primitives5 = __toESM(require_primitives(), 1); 380 var import_jsx_runtime5 = __toESM(require_jsx_runtime(), 1); 381 var drawer_right_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, { fillRule: "evenodd", clipRule: "evenodd", d: "M18 4H6c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm-4 14.5H6c-.3 0-.5-.2-.5-.5V6c0-.3.2-.5.5-.5h8v13zm4.5-.5c0 .3-.2.5-.5.5h-2.5v-13H18c.3 0 .5.2.5.5v12z" }) }); 382 383 // packages/icons/build-module/library/external.mjs 384 var import_primitives6 = __toESM(require_primitives(), 1); 385 var import_jsx_runtime6 = __toESM(require_jsx_runtime(), 1); 386 var external_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: "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" }) }); 387 388 // packages/icons/build-module/library/list-view.mjs 389 var import_primitives7 = __toESM(require_primitives(), 1); 390 var import_jsx_runtime7 = __toESM(require_jsx_runtime(), 1); 391 var list_view_default = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_primitives7.Path, { d: "M3 6h11v1.5H3V6Zm3.5 5.5h11V13h-11v-1.5ZM21 17H10v1.5h11V17Z" }) }); 392 393 // packages/icons/build-module/library/more-vertical.mjs 394 var import_primitives8 = __toESM(require_primitives(), 1); 395 var import_jsx_runtime8 = __toESM(require_jsx_runtime(), 1); 396 var more_vertical_default = /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_primitives8.Path, { d: "M13 19h-2v-2h2v2zm0-6h-2v-2h2v2zm0-6h-2V5h2v2z" }) }); 397 398 // packages/icons/build-module/library/plus.mjs 399 var import_primitives9 = __toESM(require_primitives(), 1); 400 var import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1); 401 var plus_default = /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(import_primitives9.Path, { d: "M11 12.5V17.5H12.5V12.5H17.5V11H12.5V6H11V11H6V12.5H11Z" }) }); 402 403 // packages/icons/build-module/library/redo.mjs 404 var import_primitives10 = __toESM(require_primitives(), 1); 405 var import_jsx_runtime10 = __toESM(require_jsx_runtime(), 1); 406 var redo_default = /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives10.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_primitives10.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" }) }); 407 408 // packages/icons/build-module/library/star-empty.mjs 409 var import_primitives11 = __toESM(require_primitives(), 1); 410 var import_jsx_runtime11 = __toESM(require_jsx_runtime(), 1); 411 var star_empty_default = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives11.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_primitives11.Path, { fillRule: "evenodd", clipRule: "evenodd", d: "M9.706 8.646a.25.25 0 01-.188.137l-4.626.672a.25.25 0 00-.139.427l3.348 3.262a.25.25 0 01.072.222l-.79 4.607a.25.25 0 00.362.264l4.138-2.176a.25.25 0 01.233 0l4.137 2.175a.25.25 0 00.363-.263l-.79-4.607a.25.25 0 01.072-.222l3.347-3.262a.25.25 0 00-.139-.427l-4.626-.672a.25.25 0 01-.188-.137l-2.069-4.192a.25.25 0 00-.448 0L9.706 8.646zM12 7.39l-.948 1.921a1.75 1.75 0 01-1.317.957l-2.12.308 1.534 1.495c.412.402.6.982.503 1.55l-.362 2.11 1.896-.997a1.75 1.75 0 011.629 0l1.895.997-.362-2.11a1.75 1.75 0 01.504-1.55l1.533-1.495-2.12-.308a1.75 1.75 0 01-1.317-.957L12 7.39z" }) }); 412 413 // packages/icons/build-module/library/star-filled.mjs 414 var import_primitives12 = __toESM(require_primitives(), 1); 415 var import_jsx_runtime12 = __toESM(require_jsx_runtime(), 1); 416 var star_filled_default = /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_primitives12.Path, { d: "M11.776 4.454a.25.25 0 01.448 0l2.069 4.192a.25.25 0 00.188.137l4.626.672a.25.25 0 01.139.426l-3.348 3.263a.25.25 0 00-.072.222l.79 4.607a.25.25 0 01-.362.263l-4.138-2.175a.25.25 0 00-.232 0l-4.138 2.175a.25.25 0 01-.363-.263l.79-4.607a.25.25 0 00-.071-.222L4.754 9.881a.25.25 0 01.139-.426l4.626-.672a.25.25 0 00.188-.137l2.069-4.192z" }) }); 417 418 // packages/icons/build-module/library/undo.mjs 419 var import_primitives13 = __toESM(require_primitives(), 1); 420 var import_jsx_runtime13 = __toESM(require_jsx_runtime(), 1); 421 var undo_default = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.SVG, { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_primitives13.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" }) }); 422 423 // packages/interface/build-module/components/complementary-area/index.mjs 424 var import_element2 = __toESM(require_element(), 1); 425 var import_viewport = __toESM(require_viewport(), 1); 426 var import_preferences3 = __toESM(require_preferences(), 1); 427 var import_compose = __toESM(require_compose(), 1); 428 var import_plugins2 = __toESM(require_plugins(), 1); 429 430 // packages/interface/build-module/components/complementary-area-toggle/index.mjs 431 var import_components = __toESM(require_components(), 1); 432 var import_data5 = __toESM(require_data(), 1); 433 var import_plugins = __toESM(require_plugins(), 1); 434 435 // packages/interface/build-module/store/index.mjs 436 var import_data4 = __toESM(require_data(), 1); 437 438 // packages/interface/build-module/store/actions.mjs 439 var actions_exports = {}; 440 __export(actions_exports, { 441 closeModal: () => closeModal, 442 disableComplementaryArea: () => disableComplementaryArea, 443 enableComplementaryArea: () => enableComplementaryArea, 444 openModal: () => openModal, 445 pinItem: () => pinItem, 446 setDefaultComplementaryArea: () => setDefaultComplementaryArea, 447 setFeatureDefaults: () => setFeatureDefaults, 448 setFeatureValue: () => setFeatureValue, 449 toggleFeature: () => toggleFeature, 450 unpinItem: () => unpinItem 451 }); 452 var import_deprecated2 = __toESM(require_deprecated(), 1); 453 var import_preferences = __toESM(require_preferences(), 1); 454 455 // packages/interface/build-module/store/deprecated.mjs 456 var import_deprecated = __toESM(require_deprecated(), 1); 457 function normalizeComplementaryAreaScope(scope) { 458 if (["core/edit-post", "core/edit-site"].includes(scope)) { 459 (0, import_deprecated.default)(`$scope} interface scope`, { 460 alternative: "core interface scope", 461 hint: "core/edit-post and core/edit-site are merging.", 462 version: "6.6" 463 }); 464 return "core"; 465 } 466 return scope; 467 } 468 function normalizeComplementaryAreaName(scope, name2) { 469 if (scope === "core" && name2 === "edit-site/template") { 470 (0, import_deprecated.default)(`edit-site/template sidebar`, { 471 alternative: "edit-post/document", 472 version: "6.6" 473 }); 474 return "edit-post/document"; 475 } 476 if (scope === "core" && name2 === "edit-site/block-inspector") { 477 (0, import_deprecated.default)(`edit-site/block-inspector sidebar`, { 478 alternative: "edit-post/block", 479 version: "6.6" 480 }); 481 return "edit-post/block"; 482 } 483 return name2; 484 } 485 486 // packages/interface/build-module/store/actions.mjs 487 var setDefaultComplementaryArea = (scope, area) => { 488 scope = normalizeComplementaryAreaScope(scope); 489 area = normalizeComplementaryAreaName(scope, area); 490 return { 491 type: "SET_DEFAULT_COMPLEMENTARY_AREA", 492 scope, 493 area 494 }; 495 }; 496 var enableComplementaryArea = (scope, area) => ({ registry, dispatch: dispatch2 }) => { 497 if (!area) { 498 return; 499 } 500 scope = normalizeComplementaryAreaScope(scope); 501 area = normalizeComplementaryAreaName(scope, area); 502 const isComplementaryAreaVisible = registry.select(import_preferences.store).get(scope, "isComplementaryAreaVisible"); 503 if (!isComplementaryAreaVisible) { 504 registry.dispatch(import_preferences.store).set(scope, "isComplementaryAreaVisible", true); 505 } 506 dispatch2({ 507 type: "ENABLE_COMPLEMENTARY_AREA", 508 scope, 509 area 510 }); 511 }; 512 var disableComplementaryArea = (scope) => ({ registry }) => { 513 scope = normalizeComplementaryAreaScope(scope); 514 const isComplementaryAreaVisible = registry.select(import_preferences.store).get(scope, "isComplementaryAreaVisible"); 515 if (isComplementaryAreaVisible) { 516 registry.dispatch(import_preferences.store).set(scope, "isComplementaryAreaVisible", false); 517 } 518 }; 519 var pinItem = (scope, item) => ({ registry }) => { 520 if (!item) { 521 return; 522 } 523 scope = normalizeComplementaryAreaScope(scope); 524 item = normalizeComplementaryAreaName(scope, item); 525 const pinnedItems = registry.select(import_preferences.store).get(scope, "pinnedItems"); 526 if (pinnedItems?.[item] === true) { 527 return; 528 } 529 registry.dispatch(import_preferences.store).set(scope, "pinnedItems", { 530 ...pinnedItems, 531 [item]: true 532 }); 533 }; 534 var unpinItem = (scope, item) => ({ registry }) => { 535 if (!item) { 536 return; 537 } 538 scope = normalizeComplementaryAreaScope(scope); 539 item = normalizeComplementaryAreaName(scope, item); 540 const pinnedItems = registry.select(import_preferences.store).get(scope, "pinnedItems"); 541 registry.dispatch(import_preferences.store).set(scope, "pinnedItems", { 542 ...pinnedItems, 543 [item]: false 544 }); 545 }; 546 function toggleFeature(scope, featureName) { 547 return function({ registry }) { 548 (0, import_deprecated2.default)(`dispatch( 'core/interface' ).toggleFeature`, { 549 since: "6.0", 550 alternative: `dispatch( 'core/preferences' ).toggle` 551 }); 552 registry.dispatch(import_preferences.store).toggle(scope, featureName); 553 }; 554 } 555 function setFeatureValue(scope, featureName, value) { 556 return function({ registry }) { 557 (0, import_deprecated2.default)(`dispatch( 'core/interface' ).setFeatureValue`, { 558 since: "6.0", 559 alternative: `dispatch( 'core/preferences' ).set` 560 }); 561 registry.dispatch(import_preferences.store).set(scope, featureName, !!value); 562 }; 563 } 564 function setFeatureDefaults(scope, defaults) { 565 return function({ registry }) { 566 (0, import_deprecated2.default)(`dispatch( 'core/interface' ).setFeatureDefaults`, { 567 since: "6.0", 568 alternative: `dispatch( 'core/preferences' ).setDefaults` 569 }); 570 registry.dispatch(import_preferences.store).setDefaults(scope, defaults); 571 }; 572 } 573 function openModal(name2) { 574 return { 575 type: "OPEN_MODAL", 576 name: name2 577 }; 578 } 579 function closeModal() { 580 return { 581 type: "CLOSE_MODAL" 582 }; 583 } 584 585 // packages/interface/build-module/store/selectors.mjs 586 var selectors_exports = {}; 587 __export(selectors_exports, { 588 getActiveComplementaryArea: () => getActiveComplementaryArea, 589 isComplementaryAreaLoading: () => isComplementaryAreaLoading, 590 isFeatureActive: () => isFeatureActive, 591 isItemPinned: () => isItemPinned, 592 isModalActive: () => isModalActive 593 }); 594 var import_data2 = __toESM(require_data(), 1); 595 var import_deprecated4 = __toESM(require_deprecated(), 1); 596 var import_preferences2 = __toESM(require_preferences(), 1); 597 var getActiveComplementaryArea = (0, import_data2.createRegistrySelector)( 598 (select) => (state, scope) => { 599 scope = normalizeComplementaryAreaScope(scope); 600 const isComplementaryAreaVisible = select(import_preferences2.store).get( 601 scope, 602 "isComplementaryAreaVisible" 603 ); 604 if (isComplementaryAreaVisible === void 0) { 605 return void 0; 606 } 607 if (isComplementaryAreaVisible === false) { 608 return null; 609 } 610 return state?.complementaryAreas?.[scope]; 611 } 612 ); 613 var isComplementaryAreaLoading = (0, import_data2.createRegistrySelector)( 614 (select) => (state, scope) => { 615 scope = normalizeComplementaryAreaScope(scope); 616 const isVisible = select(import_preferences2.store).get( 617 scope, 618 "isComplementaryAreaVisible" 619 ); 620 const identifier = state?.complementaryAreas?.[scope]; 621 return isVisible && identifier === void 0; 622 } 623 ); 624 var isItemPinned = (0, import_data2.createRegistrySelector)( 625 (select) => (state, scope, item) => { 626 scope = normalizeComplementaryAreaScope(scope); 627 item = normalizeComplementaryAreaName(scope, item); 628 const pinnedItems = select(import_preferences2.store).get( 629 scope, 630 "pinnedItems" 631 ); 632 return pinnedItems?.[item] ?? true; 633 } 634 ); 635 var isFeatureActive = (0, import_data2.createRegistrySelector)( 636 (select) => (state, scope, featureName) => { 637 (0, import_deprecated4.default)( 638 `select( 'core/interface' ).isFeatureActive( scope, featureName )`, 639 { 640 since: "6.0", 641 alternative: `select( 'core/preferences' ).get( scope, featureName )` 642 } 643 ); 644 return !!select(import_preferences2.store).get(scope, featureName); 645 } 646 ); 647 function isModalActive(state, modalName) { 648 return state.activeModal === modalName; 649 } 650 651 // packages/interface/build-module/store/reducer.mjs 652 var import_data3 = __toESM(require_data(), 1); 653 function complementaryAreas(state = {}, action) { 654 switch (action.type) { 655 case "SET_DEFAULT_COMPLEMENTARY_AREA": { 656 const { scope, area } = action; 657 if (state[scope]) { 658 return state; 659 } 660 return { 661 ...state, 662 [scope]: area 663 }; 664 } 665 case "ENABLE_COMPLEMENTARY_AREA": { 666 const { scope, area } = action; 667 return { 668 ...state, 669 [scope]: area 670 }; 671 } 672 } 673 return state; 674 } 675 function activeModal(state = null, action) { 676 switch (action.type) { 677 case "OPEN_MODAL": 678 return action.name; 679 case "CLOSE_MODAL": 680 return null; 681 } 682 return state; 683 } 684 var reducer_default2 = (0, import_data3.combineReducers)({ 685 complementaryAreas, 686 activeModal 687 }); 688 689 // packages/interface/build-module/store/constants.mjs 690 var STORE_NAME = "core/interface"; 691 692 // packages/interface/build-module/store/index.mjs 693 var store = (0, import_data4.createReduxStore)(STORE_NAME, { 694 reducer: reducer_default2, 695 actions: actions_exports, 696 selectors: selectors_exports 697 }); 698 (0, import_data4.register)(store); 699 700 // packages/interface/build-module/components/complementary-area-toggle/index.mjs 701 var import_jsx_runtime14 = __toESM(require_jsx_runtime(), 1); 702 function roleSupportsCheckedState(role) { 703 return [ 704 "checkbox", 705 "option", 706 "radio", 707 "switch", 708 "menuitemcheckbox", 709 "menuitemradio", 710 "treeitem" 711 ].includes(role); 712 } 713 function ComplementaryAreaToggle({ 714 as = import_components.Button, 715 scope, 716 identifier: identifierProp, 717 icon: iconProp, 718 selectedIcon, 719 name: name2, 720 shortcut, 721 ...props 722 }) { 723 const ComponentToUse = as; 724 const context = (0, import_plugins.usePluginContext)(); 725 const icon = iconProp || context.icon; 726 const identifier = identifierProp || `$context.name}/$name2}`; 727 const isSelected = (0, import_data5.useSelect)( 728 (select) => select(store).getActiveComplementaryArea(scope) === identifier, 729 [identifier, scope] 730 ); 731 const { enableComplementaryArea: enableComplementaryArea2, disableComplementaryArea: disableComplementaryArea2 } = (0, import_data5.useDispatch)(store); 732 return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)( 733 ComponentToUse, 734 { 735 icon: selectedIcon && isSelected ? selectedIcon : icon, 736 "aria-controls": identifier.replace("/", ":"), 737 "aria-checked": roleSupportsCheckedState(props.role) ? isSelected : void 0, 738 onClick: () => { 739 if (isSelected) { 740 disableComplementaryArea2(scope); 741 } else { 742 enableComplementaryArea2(scope, identifier); 743 } 744 }, 745 shortcut, 746 ...props 747 } 748 ); 749 } 750 751 // packages/interface/build-module/components/complementary-area-header/index.mjs 752 var import_jsx_runtime15 = __toESM(require_jsx_runtime(), 1); 753 var ComplementaryAreaHeader = ({ 754 children, 755 className, 756 toggleButtonProps 757 }) => { 758 const toggleButton = /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ComplementaryAreaToggle, { icon: close_small_default, ...toggleButtonProps }); 759 return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)( 760 "div", 761 { 762 className: clsx_default( 763 "components-panel__header", 764 "interface-complementary-area-header", 765 className 766 ), 767 tabIndex: -1, 768 children: [ 769 children, 770 toggleButton 771 ] 772 } 773 ); 774 }; 775 var complementary_area_header_default = ComplementaryAreaHeader; 776 777 // packages/interface/build-module/components/complementary-area-more-menu-item/index.mjs 778 var import_components3 = __toESM(require_components(), 1); 779 780 // packages/interface/build-module/components/action-item/index.mjs 781 var import_components2 = __toESM(require_components(), 1); 782 var import_element = __toESM(require_element(), 1); 783 var import_jsx_runtime16 = __toESM(require_jsx_runtime(), 1); 784 var noop = () => { 785 }; 786 function ActionItemSlot({ 787 name: name2, 788 as: Component2 = import_components2.MenuGroup, 789 fillProps = {}, 790 bubblesVirtually, 791 ...props 792 }) { 793 return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)( 794 import_components2.Slot, 795 { 796 name: name2, 797 bubblesVirtually, 798 fillProps, 799 children: (fills) => { 800 if (!import_element.Children.toArray(fills).length) { 801 return null; 802 } 803 const initializedByPlugins = []; 804 import_element.Children.forEach( 805 fills, 806 ({ 807 props: { __unstableExplicitMenuItem, __unstableTarget } 808 }) => { 809 if (__unstableTarget && __unstableExplicitMenuItem) { 810 initializedByPlugins.push(__unstableTarget); 811 } 812 } 813 ); 814 const children = import_element.Children.map(fills, (child) => { 815 if (!child.props.__unstableExplicitMenuItem && initializedByPlugins.includes( 816 child.props.__unstableTarget 817 )) { 818 return null; 819 } 820 return child; 821 }); 822 return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(Component2, { ...props, children }); 823 } 824 } 825 ); 826 } 827 function ActionItem({ name: name2, as: Component2 = import_components2.Button, onClick, ...props }) { 828 return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_components2.Fill, { name: name2, children: ({ onClick: fpOnClick }) => { 829 return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)( 830 Component2, 831 { 832 onClick: onClick || fpOnClick ? (...args) => { 833 (onClick || noop)(...args); 834 (fpOnClick || noop)(...args); 835 } : void 0, 836 ...props 837 } 838 ); 839 } }); 840 } 841 ActionItem.Slot = ActionItemSlot; 842 var action_item_default = ActionItem; 843 844 // packages/interface/build-module/components/complementary-area-more-menu-item/index.mjs 845 var import_jsx_runtime17 = __toESM(require_jsx_runtime(), 1); 846 var PluginsMenuItem = ({ 847 // Menu item is marked with unstable prop for backward compatibility. 848 // They are removed so they don't leak to DOM elements. 849 // @see https://github.com/WordPress/gutenberg/issues/14457 850 __unstableExplicitMenuItem, 851 __unstableTarget, 852 ...restProps 853 }) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_components3.MenuItem, { ...restProps }); 854 function ComplementaryAreaMoreMenuItem({ 855 scope, 856 target, 857 __unstableExplicitMenuItem, 858 ...props 859 }) { 860 return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)( 861 ComplementaryAreaToggle, 862 { 863 as: (toggleProps) => { 864 return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)( 865 action_item_default, 866 { 867 __unstableExplicitMenuItem, 868 __unstableTarget: `$scope}/$target}`, 869 as: PluginsMenuItem, 870 name: `$scope}/plugin-more-menu`, 871 ...toggleProps 872 } 873 ); 874 }, 875 role: "menuitemcheckbox", 876 selectedIcon: check_default, 877 name: target, 878 scope, 879 ...props 880 } 881 ); 882 } 883 884 // packages/interface/build-module/components/pinned-items/index.mjs 885 var import_components4 = __toESM(require_components(), 1); 886 var import_jsx_runtime18 = __toESM(require_jsx_runtime(), 1); 887 function PinnedItems({ scope, ...props }) { 888 return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components4.Fill, { name: `PinnedItems/$scope}`, ...props }); 889 } 890 function PinnedItemsSlot({ scope, className, ...props }) { 891 return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components4.Slot, { name: `PinnedItems/$scope}`, ...props, children: (fills) => fills?.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)( 892 "div", 893 { 894 className: clsx_default( 895 className, 896 "interface-pinned-items" 897 ), 898 children: fills 899 } 900 ) }); 901 } 902 PinnedItems.Slot = PinnedItemsSlot; 903 var pinned_items_default = PinnedItems; 904 905 // packages/interface/build-module/components/complementary-area/index.mjs 906 var import_jsx_runtime19 = __toESM(require_jsx_runtime(), 1); 907 var ANIMATION_DURATION = 0.3; 908 function ComplementaryAreaSlot({ scope, ...props }) { 909 return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_components5.Slot, { name: `ComplementaryArea/$scope}`, ...props }); 910 } 911 var SIDEBAR_WIDTH = 280; 912 var variants = { 913 open: { width: SIDEBAR_WIDTH }, 914 closed: { width: 0 }, 915 mobileOpen: { width: "100vw" } 916 }; 917 function ComplementaryAreaFill({ 918 activeArea, 919 isActive, 920 scope, 921 children, 922 className, 923 id 924 }) { 925 const disableMotion = (0, import_compose.useReducedMotion)(); 926 const isMobileViewport = (0, import_compose.useViewportMatch)("medium", "<"); 927 const previousActiveArea = (0, import_compose.usePrevious)(activeArea); 928 const previousIsActive = (0, import_compose.usePrevious)(isActive); 929 const [, setState] = (0, import_element2.useState)({}); 930 (0, import_element2.useEffect)(() => { 931 setState({}); 932 }, [isActive]); 933 const transition = { 934 type: "tween", 935 duration: disableMotion || isMobileViewport || !!previousActiveArea && !!activeArea && activeArea !== previousActiveArea ? 0 : ANIMATION_DURATION, 936 ease: [0.6, 0, 0.4, 1] 937 }; 938 return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_components5.Fill, { name: `ComplementaryArea/$scope}`, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_components5.__unstableAnimatePresence, { initial: false, children: (previousIsActive || isActive) && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( 939 import_components5.__unstableMotion.div, 940 { 941 variants, 942 initial: "closed", 943 animate: isMobileViewport ? "mobileOpen" : "open", 944 exit: "closed", 945 transition, 946 className: "interface-complementary-area__fill", 947 children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( 948 "div", 949 { 950 id, 951 className, 952 style: { 953 width: isMobileViewport ? "100vw" : SIDEBAR_WIDTH 954 }, 955 children 956 } 957 ) 958 } 959 ) }) }); 960 } 961 function useAdjustComplementaryListener(scope, identifier, activeArea, isActive, isSmall) { 962 const previousIsSmallRef = (0, import_element2.useRef)(false); 963 const shouldOpenWhenNotSmallRef = (0, import_element2.useRef)(false); 964 const { enableComplementaryArea: enableComplementaryArea2, disableComplementaryArea: disableComplementaryArea2 } = (0, import_data6.useDispatch)(store); 965 (0, import_element2.useEffect)(() => { 966 if (isActive && isSmall && !previousIsSmallRef.current) { 967 disableComplementaryArea2(scope); 968 shouldOpenWhenNotSmallRef.current = true; 969 } else if ( 970 // If there is a flag indicating the complementary area should be 971 // enabled when we go from small to big window size and we are going 972 // from a small to big window size. 973 shouldOpenWhenNotSmallRef.current && !isSmall && previousIsSmallRef.current 974 ) { 975 shouldOpenWhenNotSmallRef.current = false; 976 enableComplementaryArea2(scope, identifier); 977 } else if ( 978 // If the flag is indicating the current complementary should be 979 // reopened but another complementary area becomes active, remove 980 // the flag. 981 shouldOpenWhenNotSmallRef.current && activeArea && activeArea !== identifier 982 ) { 983 shouldOpenWhenNotSmallRef.current = false; 984 } 985 if (isSmall !== previousIsSmallRef.current) { 986 previousIsSmallRef.current = isSmall; 987 } 988 }, [ 989 isActive, 990 isSmall, 991 scope, 992 identifier, 993 activeArea, 994 disableComplementaryArea2, 995 enableComplementaryArea2 996 ]); 997 } 998 function ComplementaryArea({ 999 children, 1000 className, 1001 closeLabel = (0, import_i18n.__)("Close plugin"), 1002 identifier: identifierProp, 1003 header, 1004 headerClassName, 1005 icon: iconProp, 1006 isPinnable = true, 1007 panelClassName, 1008 scope, 1009 name: name2, 1010 title, 1011 toggleShortcut, 1012 isActiveByDefault 1013 }) { 1014 const context = (0, import_plugins2.usePluginContext)(); 1015 const icon = iconProp || context.icon; 1016 const identifier = identifierProp || `$context.name}/$name2}`; 1017 const [isReady, setIsReady] = (0, import_element2.useState)(false); 1018 const { 1019 isLoading, 1020 isActive, 1021 isPinned, 1022 activeArea, 1023 isSmall, 1024 isLarge, 1025 showIconLabels 1026 } = (0, import_data6.useSelect)( 1027 (select) => { 1028 const { 1029 getActiveComplementaryArea: getActiveComplementaryArea2, 1030 isComplementaryAreaLoading: isComplementaryAreaLoading2, 1031 isItemPinned: isItemPinned2 1032 } = select(store); 1033 const { get } = select(import_preferences3.store); 1034 const _activeArea = getActiveComplementaryArea2(scope); 1035 return { 1036 isLoading: isComplementaryAreaLoading2(scope), 1037 isActive: _activeArea === identifier, 1038 isPinned: isItemPinned2(scope, identifier), 1039 activeArea: _activeArea, 1040 isSmall: select(import_viewport.store).isViewportMatch("< medium"), 1041 isLarge: select(import_viewport.store).isViewportMatch("large"), 1042 showIconLabels: get("core", "showIconLabels") 1043 }; 1044 }, 1045 [identifier, scope] 1046 ); 1047 const isMobileViewport = (0, import_compose.useViewportMatch)("medium", "<"); 1048 useAdjustComplementaryListener( 1049 scope, 1050 identifier, 1051 activeArea, 1052 isActive, 1053 isSmall 1054 ); 1055 const { 1056 enableComplementaryArea: enableComplementaryArea2, 1057 disableComplementaryArea: disableComplementaryArea2, 1058 pinItem: pinItem2, 1059 unpinItem: unpinItem2 1060 } = (0, import_data6.useDispatch)(store); 1061 (0, import_element2.useEffect)(() => { 1062 if (isActiveByDefault && activeArea === void 0 && !isSmall) { 1063 enableComplementaryArea2(scope, identifier); 1064 } else if (activeArea === void 0 && isSmall) { 1065 disableComplementaryArea2(scope, identifier); 1066 } 1067 setIsReady(true); 1068 }, [ 1069 activeArea, 1070 isActiveByDefault, 1071 scope, 1072 identifier, 1073 isSmall, 1074 enableComplementaryArea2, 1075 disableComplementaryArea2 1076 ]); 1077 if (!isReady) { 1078 return; 1079 } 1080 return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [ 1081 isPinnable && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(pinned_items_default, { scope, children: isPinned && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( 1082 ComplementaryAreaToggle, 1083 { 1084 scope, 1085 identifier, 1086 isPressed: isActive && (!showIconLabels || isLarge), 1087 "aria-expanded": isActive, 1088 "aria-disabled": isLoading, 1089 label: title, 1090 icon: showIconLabels ? check_default : icon, 1091 showTooltip: !showIconLabels, 1092 variant: showIconLabels ? "tertiary" : void 0, 1093 size: "compact", 1094 shortcut: toggleShortcut 1095 } 1096 ) }), 1097 name2 && isPinnable && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( 1098 ComplementaryAreaMoreMenuItem, 1099 { 1100 target: name2, 1101 scope, 1102 icon, 1103 identifier, 1104 children: title 1105 } 1106 ), 1107 /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)( 1108 ComplementaryAreaFill, 1109 { 1110 activeArea, 1111 isActive, 1112 className: clsx_default("interface-complementary-area", className), 1113 scope, 1114 id: identifier.replace("/", ":"), 1115 children: [ 1116 /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( 1117 complementary_area_header_default, 1118 { 1119 className: headerClassName, 1120 closeLabel, 1121 onClose: () => disableComplementaryArea2(scope), 1122 toggleButtonProps: { 1123 label: closeLabel, 1124 size: "compact", 1125 shortcut: toggleShortcut, 1126 scope, 1127 identifier 1128 }, 1129 children: header || /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [ 1130 /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("h2", { className: "interface-complementary-area-header__title", children: title }), 1131 isPinnable && !isMobileViewport && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)( 1132 import_components5.Button, 1133 { 1134 className: "interface-complementary-area__pin-unpin-item", 1135 icon: isPinned ? star_filled_default : star_empty_default, 1136 label: isPinned ? (0, import_i18n.__)("Unpin from toolbar") : (0, import_i18n.__)("Pin to toolbar"), 1137 onClick: () => (isPinned ? unpinItem2 : pinItem2)( 1138 scope, 1139 identifier 1140 ), 1141 isPressed: isPinned, 1142 "aria-expanded": isPinned, 1143 size: "compact" 1144 } 1145 ) 1146 ] }) 1147 } 1148 ), 1149 /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_components5.Panel, { className: panelClassName, children }) 1150 ] 1151 } 1152 ) 1153 ] }); 1154 } 1155 ComplementaryArea.Slot = ComplementaryAreaSlot; 1156 var complementary_area_default = ComplementaryArea; 1157 1158 // node_modules/@base-ui/utils/useRefWithInit.mjs 1159 var React = __toESM(require_react(), 1); 1160 var UNINITIALIZED = {}; 1161 function useRefWithInit(init, initArg) { 1162 const ref = React.useRef(UNINITIALIZED); 1163 if (ref.current === UNINITIALIZED) { 1164 ref.current = init(initArg); 1165 } 1166 return ref; 1167 } 1168 1169 // node_modules/@base-ui/utils/warn.mjs 1170 var set; 1171 if (true) { 1172 set = /* @__PURE__ */ new Set(); 1173 } 1174 function warn(...messages) { 1175 if (true) { 1176 const messageKey = messages.join(" "); 1177 if (!set.has(messageKey)) { 1178 set.add(messageKey); 1179 console.warn(`Base UI: $messageKey}`); 1180 } 1181 } 1182 } 1183 1184 // node_modules/@base-ui/react/internals/useRenderElement.mjs 1185 var React4 = __toESM(require_react(), 1); 1186 1187 // node_modules/@base-ui/utils/useMergedRefs.mjs 1188 function useMergedRefs(a, b, c, d) { 1189 const forkRef = useRefWithInit(createForkRef).current; 1190 if (didChange(forkRef, a, b, c, d)) { 1191 update(forkRef, [a, b, c, d]); 1192 } 1193 return forkRef.callback; 1194 } 1195 function useMergedRefsN(refs) { 1196 const forkRef = useRefWithInit(createForkRef).current; 1197 if (didChangeN(forkRef, refs)) { 1198 update(forkRef, refs); 1199 } 1200 return forkRef.callback; 1201 } 1202 function createForkRef() { 1203 return { 1204 callback: null, 1205 cleanup: null, 1206 refs: [] 1207 }; 1208 } 1209 function didChange(forkRef, a, b, c, d) { 1210 return forkRef.refs[0] !== a || forkRef.refs[1] !== b || forkRef.refs[2] !== c || forkRef.refs[3] !== d; 1211 } 1212 function didChangeN(forkRef, newRefs) { 1213 return forkRef.refs.length !== newRefs.length || forkRef.refs.some((ref, index) => ref !== newRefs[index]); 1214 } 1215 function update(forkRef, refs) { 1216 forkRef.refs = refs; 1217 if (refs.every((ref) => ref == null)) { 1218 forkRef.callback = null; 1219 return; 1220 } 1221 forkRef.callback = (instance) => { 1222 if (forkRef.cleanup) { 1223 forkRef.cleanup(); 1224 forkRef.cleanup = null; 1225 } 1226 if (instance != null) { 1227 const cleanupCallbacks = Array(refs.length).fill(null); 1228 for (let i = 0; i < refs.length; i += 1) { 1229 const ref = refs[i]; 1230 if (ref == null) { 1231 continue; 1232 } 1233 switch (typeof ref) { 1234 case "function": { 1235 const refCleanup = ref(instance); 1236 if (typeof refCleanup === "function") { 1237 cleanupCallbacks[i] = refCleanup; 1238 } 1239 break; 1240 } 1241 case "object": { 1242 ref.current = instance; 1243 break; 1244 } 1245 default: 1246 } 1247 } 1248 forkRef.cleanup = () => { 1249 for (let i = 0; i < refs.length; i += 1) { 1250 const ref = refs[i]; 1251 if (ref == null) { 1252 continue; 1253 } 1254 switch (typeof ref) { 1255 case "function": { 1256 const cleanupCallback = cleanupCallbacks[i]; 1257 if (typeof cleanupCallback === "function") { 1258 cleanupCallback(); 1259 } else { 1260 ref(null); 1261 } 1262 break; 1263 } 1264 case "object": { 1265 ref.current = null; 1266 break; 1267 } 1268 default: 1269 } 1270 } 1271 }; 1272 } 1273 }; 1274 } 1275 1276 // node_modules/@base-ui/utils/getReactElementRef.mjs 1277 var React3 = __toESM(require_react(), 1); 1278 1279 // node_modules/@base-ui/utils/reactVersion.mjs 1280 var React2 = __toESM(require_react(), 1); 1281 var majorVersion = parseInt(React2.version, 10); 1282 function isReactVersionAtLeast(reactVersionToCheck) { 1283 return majorVersion >= reactVersionToCheck; 1284 } 1285 1286 // node_modules/@base-ui/utils/getReactElementRef.mjs 1287 function getReactElementRef(element) { 1288 if (!/* @__PURE__ */ React3.isValidElement(element)) { 1289 return null; 1290 } 1291 const reactElement = element; 1292 const propsWithRef = reactElement.props; 1293 return (isReactVersionAtLeast(19) ? propsWithRef?.ref : reactElement.ref) ?? null; 1294 } 1295 1296 // node_modules/@base-ui/utils/mergeObjects.mjs 1297 function mergeObjects(a, b) { 1298 if (a && !b) { 1299 return a; 1300 } 1301 if (!a && b) { 1302 return b; 1303 } 1304 if (a || b) { 1305 return { 1306 ...a, 1307 ...b 1308 }; 1309 } 1310 return void 0; 1311 } 1312 1313 // node_modules/@base-ui/utils/empty.mjs 1314 var EMPTY_ARRAY = Object.freeze([]); 1315 var EMPTY_OBJECT = Object.freeze({}); 1316 1317 // node_modules/@base-ui/react/internals/getStateAttributesProps.mjs 1318 function getStateAttributesProps(state, customMapping) { 1319 const props = {}; 1320 for (const key in state) { 1321 const value = state[key]; 1322 if (customMapping?.hasOwnProperty(key)) { 1323 const customProps = customMapping[key](value); 1324 if (customProps != null) { 1325 Object.assign(props, customProps); 1326 } 1327 continue; 1328 } 1329 if (value === true) { 1330 props[`data-$key.toLowerCase()}`] = ""; 1331 } else if (value) { 1332 props[`data-$key.toLowerCase()}`] = value.toString(); 1333 } 1334 } 1335 return props; 1336 } 1337 1338 // node_modules/@base-ui/react/utils/resolveClassName.mjs 1339 function resolveClassName(className, state) { 1340 return typeof className === "function" ? className(state) : className; 1341 } 1342 1343 // node_modules/@base-ui/react/utils/resolveStyle.mjs 1344 function resolveStyle(style, state) { 1345 return typeof style === "function" ? style(state) : style; 1346 } 1347 1348 // node_modules/@base-ui/react/merge-props/mergeProps.mjs 1349 var EMPTY_PROPS = {}; 1350 function mergeProps(a, b, c, d, e) { 1351 if (!c && !d && !e && !a) { 1352 return createInitialMergedProps(b); 1353 } 1354 let merged = createInitialMergedProps(a); 1355 if (b) { 1356 merged = mergeInto(merged, b); 1357 } 1358 if (c) { 1359 merged = mergeInto(merged, c); 1360 } 1361 if (d) { 1362 merged = mergeInto(merged, d); 1363 } 1364 if (e) { 1365 merged = mergeInto(merged, e); 1366 } 1367 return merged; 1368 } 1369 function mergePropsN(props) { 1370 if (props.length === 0) { 1371 return EMPTY_PROPS; 1372 } 1373 if (props.length === 1) { 1374 return createInitialMergedProps(props[0]); 1375 } 1376 let merged = createInitialMergedProps(props[0]); 1377 for (let i = 1; i < props.length; i += 1) { 1378 merged = mergeInto(merged, props[i]); 1379 } 1380 return merged; 1381 } 1382 function createInitialMergedProps(inputProps) { 1383 if (isPropsGetter(inputProps)) { 1384 return { 1385 ...resolvePropsGetter(inputProps, EMPTY_PROPS) 1386 }; 1387 } 1388 return copyInitialProps(inputProps); 1389 } 1390 function mergeInto(merged, inputProps) { 1391 if (isPropsGetter(inputProps)) { 1392 return resolvePropsGetter(inputProps, merged); 1393 } 1394 return mutablyMergeInto(merged, inputProps); 1395 } 1396 function copyInitialProps(inputProps) { 1397 const copiedProps = { 1398 ...inputProps 1399 }; 1400 for (const propName in copiedProps) { 1401 const propValue = copiedProps[propName]; 1402 if (isEventHandler(propName, propValue)) { 1403 copiedProps[propName] = wrapEventHandler(propValue); 1404 } 1405 } 1406 return copiedProps; 1407 } 1408 function mutablyMergeInto(mergedProps, externalProps) { 1409 if (!externalProps) { 1410 return mergedProps; 1411 } 1412 for (const propName in externalProps) { 1413 const externalPropValue = externalProps[propName]; 1414 switch (propName) { 1415 case "style": { 1416 mergedProps[propName] = mergeObjects(mergedProps.style, externalPropValue); 1417 break; 1418 } 1419 case "className": { 1420 mergedProps[propName] = mergeClassNames(mergedProps.className, externalPropValue); 1421 break; 1422 } 1423 default: { 1424 if (isEventHandler(propName, externalPropValue)) { 1425 mergedProps[propName] = mergeEventHandlers(mergedProps[propName], externalPropValue); 1426 } else { 1427 mergedProps[propName] = externalPropValue; 1428 } 1429 } 1430 } 1431 } 1432 return mergedProps; 1433 } 1434 function isEventHandler(key, value) { 1435 const code0 = key.charCodeAt(0); 1436 const code1 = key.charCodeAt(1); 1437 const code2 = key.charCodeAt(2); 1438 return code0 === 111 && code1 === 110 && code2 >= 65 && code2 <= 90 && (typeof value === "function" || typeof value === "undefined"); 1439 } 1440 function isPropsGetter(inputProps) { 1441 return typeof inputProps === "function"; 1442 } 1443 function resolvePropsGetter(inputProps, previousProps) { 1444 if (isPropsGetter(inputProps)) { 1445 return inputProps(previousProps); 1446 } 1447 return inputProps ?? EMPTY_PROPS; 1448 } 1449 function mergeEventHandlers(ourHandler, theirHandler) { 1450 if (!theirHandler) { 1451 return ourHandler; 1452 } 1453 if (!ourHandler) { 1454 return wrapEventHandler(theirHandler); 1455 } 1456 return (...args) => { 1457 const event = args[0]; 1458 if (isSyntheticEvent(event)) { 1459 const baseUIEvent = event; 1460 makeEventPreventable(baseUIEvent); 1461 const result2 = theirHandler(...args); 1462 if (!baseUIEvent.baseUIHandlerPrevented) { 1463 ourHandler?.(...args); 1464 } 1465 return result2; 1466 } 1467 const result = theirHandler(...args); 1468 ourHandler?.(...args); 1469 return result; 1470 }; 1471 } 1472 function wrapEventHandler(handler) { 1473 if (!handler) { 1474 return handler; 1475 } 1476 return (...args) => { 1477 const event = args[0]; 1478 if (isSyntheticEvent(event)) { 1479 makeEventPreventable(event); 1480 } 1481 return handler(...args); 1482 }; 1483 } 1484 function makeEventPreventable(event) { 1485 event.preventBaseUIHandler = () => { 1486 event.baseUIHandlerPrevented = true; 1487 }; 1488 return event; 1489 } 1490 function mergeClassNames(ourClassName, theirClassName) { 1491 if (theirClassName) { 1492 if (ourClassName) { 1493 return theirClassName + " " + ourClassName; 1494 } 1495 return theirClassName; 1496 } 1497 return ourClassName; 1498 } 1499 function isSyntheticEvent(event) { 1500 return event != null && typeof event === "object" && "nativeEvent" in event; 1501 } 1502 1503 // node_modules/@base-ui/react/internals/useRenderElement.mjs 1504 var import_react = __toESM(require_react(), 1); 1505 function useRenderElement(element, componentProps, params = {}) { 1506 const renderProp = componentProps.render; 1507 const outProps = useRenderElementProps(componentProps, params); 1508 if (params.enabled === false) { 1509 return null; 1510 } 1511 const state = params.state ?? EMPTY_OBJECT; 1512 return evaluateRenderProp(element, renderProp, outProps, state); 1513 } 1514 function useRenderElementProps(componentProps, params = {}) { 1515 const { 1516 className: classNameProp, 1517 style: styleProp, 1518 render: renderProp 1519 } = componentProps; 1520 const { 1521 state = EMPTY_OBJECT, 1522 ref, 1523 props, 1524 stateAttributesMapping, 1525 enabled = true 1526 } = params; 1527 const className = enabled ? resolveClassName(classNameProp, state) : void 0; 1528 const style = enabled ? resolveStyle(styleProp, state) : void 0; 1529 const stateProps = enabled ? getStateAttributesProps(state, stateAttributesMapping) : EMPTY_OBJECT; 1530 const resolvedProps = enabled && props ? resolveRenderFunctionProps(props) : void 0; 1531 const outProps = enabled ? mergeObjects(stateProps, resolvedProps) ?? {} : EMPTY_OBJECT; 1532 if (typeof document !== "undefined") { 1533 if (!enabled) { 1534 useMergedRefs(null, null); 1535 } else if (Array.isArray(ref)) { 1536 outProps.ref = useMergedRefsN([outProps.ref, getReactElementRef(renderProp), ...ref]); 1537 } else { 1538 outProps.ref = useMergedRefs(outProps.ref, getReactElementRef(renderProp), ref); 1539 } 1540 } 1541 if (!enabled) { 1542 return EMPTY_OBJECT; 1543 } 1544 if (className !== void 0) { 1545 outProps.className = mergeClassNames(outProps.className, className); 1546 } 1547 if (style !== void 0) { 1548 outProps.style = mergeObjects(outProps.style, style); 1549 } 1550 return outProps; 1551 } 1552 function resolveRenderFunctionProps(props) { 1553 if (Array.isArray(props)) { 1554 return mergePropsN(props); 1555 } 1556 return mergeProps(void 0, props); 1557 } 1558 var REACT_LAZY_TYPE = /* @__PURE__ */ Symbol.for("react.lazy"); 1559 var COMPONENT_IDENTIFIER_PATTERN = /^[A-Z][A-Za-z0-9$]*$/; 1560 var LOWERCASE_CHARACTER_PATTERN = /[a-z]/; 1561 function evaluateRenderProp(element, render, props, state) { 1562 if (render) { 1563 if (typeof render === "function") { 1564 if (true) { 1565 warnIfRenderPropLooksLikeComponent(render); 1566 } 1567 return render(props, state); 1568 } 1569 const mergedProps = mergeProps(props, render.props); 1570 mergedProps.ref = props.ref; 1571 let newElement = render; 1572 if (newElement?.$$typeof === REACT_LAZY_TYPE) { 1573 const children = React4.Children.toArray(render); 1574 newElement = children[0]; 1575 } 1576 if (true) { 1577 if (!/* @__PURE__ */ React4.isValidElement(newElement)) { 1578 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")); 1579 } 1580 } 1581 return /* @__PURE__ */ React4.cloneElement(newElement, mergedProps); 1582 } 1583 if (element) { 1584 if (typeof element === "string") { 1585 return renderTag(element, props); 1586 } 1587 } 1588 throw new Error(true ? "Base UI: Render element or function are not defined." : formatErrorMessage_default(8)); 1589 } 1590 function warnIfRenderPropLooksLikeComponent(renderFn) { 1591 const functionName = renderFn.name; 1592 if (functionName.length === 0) { 1593 return; 1594 } 1595 if (!COMPONENT_IDENTIFIER_PATTERN.test(functionName)) { 1596 return; 1597 } 1598 if (!LOWERCASE_CHARACTER_PATTERN.test(functionName)) { 1599 return; 1600 } 1601 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"); 1602 } 1603 function renderTag(Tag, props) { 1604 if (Tag === "button") { 1605 return /* @__PURE__ */ (0, import_react.createElement)("button", { 1606 type: "button", 1607 ...props, 1608 key: props.key 1609 }); 1610 } 1611 if (Tag === "img") { 1612 return /* @__PURE__ */ (0, import_react.createElement)("img", { 1613 alt: "", 1614 ...props, 1615 key: props.key 1616 }); 1617 } 1618 return /* @__PURE__ */ React4.createElement(Tag, props); 1619 } 1620 1621 // node_modules/@base-ui/react/use-render/useRender.mjs 1622 function useRender(params) { 1623 return useRenderElement(params.defaultTagName ?? "div", params, params); 1624 } 1625 1626 // packages/ui/build-module/visually-hidden/visually-hidden.mjs 1627 var import_element3 = __toESM(require_element(), 1); 1628 var STYLE_HASH_ATTRIBUTE = "data-wp-hash"; 1629 function getRuntime() { 1630 const globalScope = globalThis; 1631 if (globalScope.__wpStyleRuntime) { 1632 return globalScope.__wpStyleRuntime; 1633 } 1634 globalScope.__wpStyleRuntime = { 1635 documents: /* @__PURE__ */ new Map(), 1636 styles: /* @__PURE__ */ new Map(), 1637 injectedStyles: /* @__PURE__ */ new WeakMap() 1638 }; 1639 if (typeof document !== "undefined") { 1640 registerDocument(document); 1641 } 1642 return globalScope.__wpStyleRuntime; 1643 } 1644 function documentContainsStyleHash(targetDocument, hash) { 1645 if (!targetDocument.head) { 1646 return false; 1647 } 1648 for (const style of targetDocument.head.querySelectorAll( 1649 `style[$STYLE_HASH_ATTRIBUTE}]` 1650 )) { 1651 if (style.getAttribute(STYLE_HASH_ATTRIBUTE) === hash) { 1652 return true; 1653 } 1654 } 1655 return false; 1656 } 1657 function injectStyle(targetDocument, hash, css) { 1658 if (!targetDocument.head) { 1659 return; 1660 } 1661 const runtime = getRuntime(); 1662 let injectedStyles = runtime.injectedStyles.get(targetDocument); 1663 if (!injectedStyles) { 1664 injectedStyles = /* @__PURE__ */ new Set(); 1665 runtime.injectedStyles.set(targetDocument, injectedStyles); 1666 } 1667 if (injectedStyles.has(hash)) { 1668 return; 1669 } 1670 if (documentContainsStyleHash(targetDocument, hash)) { 1671 injectedStyles.add(hash); 1672 return; 1673 } 1674 const style = targetDocument.createElement("style"); 1675 style.setAttribute(STYLE_HASH_ATTRIBUTE, hash); 1676 style.appendChild(targetDocument.createTextNode(css)); 1677 targetDocument.head.appendChild(style); 1678 injectedStyles.add(hash); 1679 } 1680 function registerDocument(targetDocument) { 1681 const runtime = getRuntime(); 1682 runtime.documents.set( 1683 targetDocument, 1684 (runtime.documents.get(targetDocument) ?? 0) + 1 1685 ); 1686 for (const [hash, css] of runtime.styles) { 1687 injectStyle(targetDocument, hash, css); 1688 } 1689 return () => { 1690 const count = runtime.documents.get(targetDocument); 1691 if (count === void 0) { 1692 return; 1693 } 1694 if (count <= 1) { 1695 runtime.documents.delete(targetDocument); 1696 return; 1697 } 1698 runtime.documents.set(targetDocument, count - 1); 1699 }; 1700 } 1701 function registerStyle(hash, css) { 1702 const runtime = getRuntime(); 1703 runtime.styles.set(hash, css); 1704 for (const targetDocument of runtime.documents.keys()) { 1705 injectStyle(targetDocument, hash, css); 1706 } 1707 } 1708 if (typeof process === "undefined" || true) { 1709 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}}}"); 1710 } 1711 var style_default = { "visually-hidden": "f37b9e2e191ebd66__visually-hidden" }; 1712 var VisuallyHidden = (0, import_element3.forwardRef)( 1713 function VisuallyHidden2({ render, ...restProps }, ref) { 1714 const element = useRender({ 1715 render, 1716 ref, 1717 props: mergeProps( 1718 { className: style_default["visually-hidden"] }, 1719 restProps, 1720 { 1721 // @ts-expect-error Arbitrary data-* attributes aren't indexable on the typed div props. Kept hardcoded so consumers can't change or remove it. 1722 "data-visually-hidden": "" 1723 } 1724 ) 1725 }); 1726 return element; 1727 } 1728 ); 1729 1730 // packages/admin-ui/build-module/navigable-region/index.mjs 1731 var import_element4 = __toESM(require_element(), 1); 1732 var import_jsx_runtime20 = __toESM(require_jsx_runtime(), 1); 1733 var NavigableRegion = (0, import_element4.forwardRef)( 1734 ({ children, className, ariaLabel, as: Tag = "div", ...props }, ref) => { 1735 return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)( 1736 Tag, 1737 { 1738 ref, 1739 className: clsx_default("admin-ui-navigable-region", className), 1740 "aria-label": ariaLabel, 1741 role: "region", 1742 tabIndex: "-1", 1743 ...props, 1744 children 1745 } 1746 ); 1747 } 1748 ); 1749 NavigableRegion.displayName = "NavigableRegion"; 1750 var navigable_region_default = NavigableRegion; 1751 1752 // packages/interface/build-module/components/interface-skeleton/index.mjs 1753 var import_element5 = __toESM(require_element(), 1); 1754 var import_components6 = __toESM(require_components(), 1); 1755 var import_i18n2 = __toESM(require_i18n(), 1); 1756 var import_compose2 = __toESM(require_compose(), 1); 1757 var import_jsx_runtime21 = __toESM(require_jsx_runtime(), 1); 1758 var ANIMATION_DURATION2 = 0.25; 1759 var commonTransition = { 1760 type: "tween", 1761 duration: ANIMATION_DURATION2, 1762 ease: [0.6, 0, 0.4, 1] 1763 }; 1764 function useHTMLClass(className) { 1765 (0, import_element5.useEffect)(() => { 1766 const element = document && document.querySelector(`html:not(.$className})`); 1767 if (!element) { 1768 return; 1769 } 1770 element.classList.toggle(className); 1771 return () => { 1772 element.classList.toggle(className); 1773 }; 1774 }, [className]); 1775 } 1776 var headerVariants = { 1777 hidden: { opacity: 1, marginTop: -60 }, 1778 visible: { opacity: 1, marginTop: 0 }, 1779 distractionFreeHover: { 1780 opacity: 1, 1781 marginTop: 0, 1782 transition: { 1783 ...commonTransition, 1784 delay: 0.2, 1785 delayChildren: 0.2 1786 } 1787 }, 1788 distractionFreeHidden: { 1789 opacity: 0, 1790 marginTop: -60 1791 }, 1792 distractionFreeDisabled: { 1793 opacity: 0, 1794 marginTop: 0, 1795 transition: { 1796 ...commonTransition, 1797 delay: 0.8, 1798 delayChildren: 0.8 1799 } 1800 } 1801 }; 1802 function InterfaceSkeleton({ 1803 isDistractionFree, 1804 footer, 1805 header, 1806 editorNotices, 1807 sidebar, 1808 secondarySidebar, 1809 content, 1810 actions, 1811 labels, 1812 className 1813 }, ref) { 1814 const [secondarySidebarResizeListener, secondarySidebarSize] = (0, import_compose2.useResizeObserver)(); 1815 const isMobileViewport = (0, import_compose2.useViewportMatch)("medium", "<"); 1816 const disableMotion = (0, import_compose2.useReducedMotion)(); 1817 const defaultTransition = { 1818 type: "tween", 1819 duration: disableMotion ? 0 : ANIMATION_DURATION2, 1820 ease: [0.6, 0, 0.4, 1] 1821 }; 1822 useHTMLClass("interface-interface-skeleton__html-container"); 1823 const defaultLabels = { 1824 /* translators: accessibility text for the top bar landmark region. */ 1825 header: (0, import_i18n2._x)("Header", "header landmark area"), 1826 /* translators: accessibility text for the content landmark region. */ 1827 body: (0, import_i18n2.__)("Content"), 1828 /* translators: accessibility text for the secondary sidebar landmark region. */ 1829 secondarySidebar: (0, import_i18n2.__)("Block Library"), 1830 /* translators: accessibility text for the settings landmark region. */ 1831 sidebar: (0, import_i18n2._x)("Settings", "settings landmark area"), 1832 /* translators: accessibility text for the publish landmark region. */ 1833 actions: (0, import_i18n2.__)("Publish"), 1834 /* translators: accessibility text for the footer landmark region. */ 1835 footer: (0, import_i18n2.__)("Footer") 1836 }; 1837 const mergedLabels = { ...defaultLabels, ...labels }; 1838 return /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)( 1839 "div", 1840 { 1841 ref, 1842 className: clsx_default( 1843 className, 1844 "interface-interface-skeleton", 1845 !!footer && "has-footer" 1846 ), 1847 children: [ 1848 /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "interface-interface-skeleton__editor", children: [ 1849 /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_components6.__unstableAnimatePresence, { initial: false, children: !!header && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)( 1850 navigable_region_default, 1851 { 1852 as: import_components6.__unstableMotion.div, 1853 className: "interface-interface-skeleton__header", 1854 ariaLabel: mergedLabels.header, 1855 initial: isDistractionFree && !isMobileViewport ? "distractionFreeHidden" : "hidden", 1856 whileHover: isDistractionFree && !isMobileViewport ? "distractionFreeHover" : "visible", 1857 animate: isDistractionFree && !isMobileViewport ? "distractionFreeDisabled" : "visible", 1858 exit: isDistractionFree && !isMobileViewport ? "distractionFreeHidden" : "hidden", 1859 variants: headerVariants, 1860 transition: defaultTransition, 1861 children: header 1862 } 1863 ) }), 1864 isDistractionFree && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "interface-interface-skeleton__header", children: editorNotices }), 1865 /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)("div", { className: "interface-interface-skeleton__body", children: [ 1866 /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_components6.__unstableAnimatePresence, { initial: false, children: !!secondarySidebar && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)( 1867 navigable_region_default, 1868 { 1869 className: "interface-interface-skeleton__secondary-sidebar", 1870 ariaLabel: mergedLabels.secondarySidebar, 1871 as: import_components6.__unstableMotion.div, 1872 initial: "closed", 1873 animate: "open", 1874 exit: "closed", 1875 variants: { 1876 open: { width: secondarySidebarSize.width }, 1877 closed: { width: 0 } 1878 }, 1879 transition: defaultTransition, 1880 children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)( 1881 import_components6.__unstableMotion.div, 1882 { 1883 style: { 1884 position: "absolute", 1885 width: isMobileViewport ? "100vw" : "fit-content", 1886 height: "100%", 1887 left: 0 1888 }, 1889 variants: { 1890 open: { x: 0 }, 1891 closed: { x: "-100%" } 1892 }, 1893 transition: defaultTransition, 1894 children: [ 1895 secondarySidebarResizeListener, 1896 secondarySidebar 1897 ] 1898 } 1899 ) 1900 } 1901 ) }), 1902 /* @__PURE__ */ (0, import_jsx_runtime21.jsx)( 1903 navigable_region_default, 1904 { 1905 className: "interface-interface-skeleton__content", 1906 ariaLabel: mergedLabels.body, 1907 children: content 1908 } 1909 ), 1910 !!sidebar && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)( 1911 navigable_region_default, 1912 { 1913 className: "interface-interface-skeleton__sidebar", 1914 ariaLabel: mergedLabels.sidebar, 1915 children: sidebar 1916 } 1917 ), 1918 !!actions && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)( 1919 navigable_region_default, 1920 { 1921 className: "interface-interface-skeleton__actions", 1922 ariaLabel: mergedLabels.actions, 1923 children: actions 1924 } 1925 ) 1926 ] }) 1927 ] }), 1928 !!footer && /* @__PURE__ */ (0, import_jsx_runtime21.jsx)( 1929 navigable_region_default, 1930 { 1931 className: "interface-interface-skeleton__footer", 1932 ariaLabel: mergedLabels.footer, 1933 children: footer 1934 } 1935 ) 1936 ] 1937 } 1938 ); 1939 } 1940 var interface_skeleton_default = (0, import_element5.forwardRef)(InterfaceSkeleton); 1941 1942 // packages/edit-widgets/build-module/store/actions.mjs 1943 var import_widgets2 = __toESM(require_widgets(), 1); 1944 var import_core_data = __toESM(require_core_data(), 1); 1945 var import_block_editor = __toESM(require_block_editor(), 1); 1946 1947 // packages/edit-widgets/build-module/store/transformers.mjs 1948 var import_blocks = __toESM(require_blocks(), 1); 1949 var import_widgets = __toESM(require_widgets(), 1); 1950 function transformWidgetToBlock(widget) { 1951 if (widget.id_base === "block") { 1952 const parsedBlocks = (0, import_blocks.parse)(widget.instance.raw.content, { 1953 __unstableSkipAutop: true 1954 }); 1955 if (!parsedBlocks.length) { 1956 return (0, import_widgets.addWidgetIdToBlock)( 1957 (0, import_blocks.createBlock)("core/paragraph", {}, []), 1958 widget.id 1959 ); 1960 } 1961 return (0, import_widgets.addWidgetIdToBlock)(parsedBlocks[0], widget.id); 1962 } 1963 let attributes; 1964 if (widget._embedded.about[0].is_multi) { 1965 attributes = { 1966 idBase: widget.id_base, 1967 instance: widget.instance 1968 }; 1969 } else { 1970 attributes = { 1971 id: widget.id 1972 }; 1973 } 1974 return (0, import_widgets.addWidgetIdToBlock)( 1975 (0, import_blocks.createBlock)("core/legacy-widget", attributes, []), 1976 widget.id 1977 ); 1978 } 1979 function transformBlockToWidget(block, relatedWidget = {}) { 1980 let widget; 1981 const isValidLegacyWidgetBlock = block.name === "core/legacy-widget" && (block.attributes.id || block.attributes.instance); 1982 if (isValidLegacyWidgetBlock) { 1983 widget = { 1984 ...relatedWidget, 1985 id: block.attributes.id ?? relatedWidget.id, 1986 id_base: block.attributes.idBase ?? relatedWidget.id_base, 1987 instance: block.attributes.instance ?? relatedWidget.instance 1988 }; 1989 } else { 1990 widget = { 1991 ...relatedWidget, 1992 id_base: "block", 1993 instance: { 1994 raw: { 1995 content: (0, import_blocks.serialize)(block) 1996 } 1997 } 1998 }; 1999 } 2000 delete widget.rendered; 2001 delete widget.rendered_form; 2002 return widget; 2003 } 2004 2005 // packages/edit-widgets/build-module/store/utils.mjs 2006 var KIND = "root"; 2007 var WIDGET_AREA_ENTITY_TYPE = "sidebar"; 2008 var POST_TYPE = "postType"; 2009 var buildWidgetAreaPostId = (widgetAreaId) => `widget-area-$widgetAreaId}`; 2010 var buildWidgetAreasPostId = () => `widget-areas`; 2011 function buildWidgetAreasQuery() { 2012 return { 2013 per_page: -1 2014 }; 2015 } 2016 function buildWidgetsQuery() { 2017 return { 2018 per_page: -1, 2019 _embed: "about" 2020 }; 2021 } 2022 var createStubPost = (id, blocks) => ({ 2023 id, 2024 slug: id, 2025 status: "draft", 2026 type: "page", 2027 blocks, 2028 meta: { 2029 widgetAreaId: id 2030 } 2031 }); 2032 2033 // packages/edit-widgets/build-module/store/constants.mjs 2034 var STORE_NAME2 = "core/edit-widgets"; 2035 2036 // packages/edit-widgets/build-module/store/actions.mjs 2037 var persistStubPost = (id, blocks) => ({ registry }) => { 2038 const stubPost = createStubPost(id, blocks); 2039 registry.dispatch(import_core_data.store).receiveEntityRecords( 2040 KIND, 2041 POST_TYPE, 2042 stubPost, 2043 { id: stubPost.id }, 2044 false 2045 ); 2046 return stubPost; 2047 }; 2048 var saveEditedWidgetAreas = () => async ({ select, dispatch: dispatch2, registry }) => { 2049 const editedWidgetAreas = select.getEditedWidgetAreas(); 2050 if (!editedWidgetAreas?.length) { 2051 return; 2052 } 2053 try { 2054 await dispatch2.saveWidgetAreas(editedWidgetAreas); 2055 registry.dispatch(import_notices.store).createSuccessNotice((0, import_i18n3.__)("Widgets saved."), { 2056 type: "snackbar" 2057 }); 2058 } catch (e) { 2059 registry.dispatch(import_notices.store).createErrorNotice( 2060 /* translators: %s: The error message. */ 2061 (0, import_i18n3.sprintf)((0, import_i18n3.__)("There was an error. %s"), e.message), 2062 { 2063 type: "snackbar" 2064 } 2065 ); 2066 } 2067 }; 2068 var saveWidgetAreas = (widgetAreas) => async ({ dispatch: dispatch2, registry }) => { 2069 try { 2070 for (const widgetArea of widgetAreas) { 2071 await dispatch2.saveWidgetArea(widgetArea.id); 2072 } 2073 } finally { 2074 await registry.dispatch(import_core_data.store).finishResolution( 2075 "getEntityRecord", 2076 KIND, 2077 WIDGET_AREA_ENTITY_TYPE, 2078 buildWidgetAreasQuery() 2079 ); 2080 } 2081 }; 2082 var saveWidgetArea = (widgetAreaId) => async ({ dispatch: dispatch2, select, registry }) => { 2083 const widgets = select.getWidgets(); 2084 const post = registry.select(import_core_data.store).getEditedEntityRecord( 2085 KIND, 2086 POST_TYPE, 2087 buildWidgetAreaPostId(widgetAreaId) 2088 ); 2089 const areaWidgets = Object.values(widgets).filter( 2090 ({ sidebar }) => sidebar === widgetAreaId 2091 ); 2092 const usedReferenceWidgets = []; 2093 const widgetsBlocks = post.blocks.filter((block) => { 2094 const { id } = block.attributes; 2095 if (block.name === "core/legacy-widget" && id) { 2096 if (usedReferenceWidgets.includes(id)) { 2097 return false; 2098 } 2099 usedReferenceWidgets.push(id); 2100 } 2101 return true; 2102 }); 2103 const deletedWidgets = []; 2104 for (const widget of areaWidgets) { 2105 const widgetsNewArea = select.getWidgetAreaForWidgetId(widget.id); 2106 if (!widgetsNewArea) { 2107 deletedWidgets.push(widget); 2108 } 2109 } 2110 const batchMeta = []; 2111 const batchTasks = []; 2112 const sidebarWidgetsIds = []; 2113 for (let i = 0; i < widgetsBlocks.length; i++) { 2114 const block = widgetsBlocks[i]; 2115 const widgetId = (0, import_widgets2.getWidgetIdFromBlock)(block); 2116 const oldWidget = widgets[widgetId]; 2117 const widget = transformBlockToWidget(block, oldWidget); 2118 sidebarWidgetsIds.push(widgetId); 2119 if (oldWidget) { 2120 registry.dispatch(import_core_data.store).editEntityRecord( 2121 "root", 2122 "widget", 2123 widgetId, 2124 { 2125 ...widget, 2126 sidebar: widgetAreaId 2127 }, 2128 { undoIgnore: true } 2129 ); 2130 const hasEdits = registry.select(import_core_data.store).hasEditsForEntityRecord("root", "widget", widgetId); 2131 if (!hasEdits) { 2132 continue; 2133 } 2134 batchTasks.push( 2135 ({ saveEditedEntityRecord }) => saveEditedEntityRecord("root", "widget", widgetId) 2136 ); 2137 } else { 2138 batchTasks.push( 2139 ({ saveEntityRecord }) => saveEntityRecord("root", "widget", { 2140 ...widget, 2141 sidebar: widgetAreaId 2142 }) 2143 ); 2144 } 2145 batchMeta.push({ 2146 block, 2147 position: i, 2148 clientId: block.clientId 2149 }); 2150 } 2151 for (const widget of deletedWidgets) { 2152 batchTasks.push( 2153 ({ deleteEntityRecord }) => deleteEntityRecord("root", "widget", widget.id, { 2154 force: true 2155 }) 2156 ); 2157 } 2158 const records = await registry.dispatch(import_core_data.store).__experimentalBatch(batchTasks); 2159 const preservedRecords = records.filter( 2160 (record) => !record.hasOwnProperty("deleted") 2161 ); 2162 const failedWidgetNames = []; 2163 for (let i = 0; i < preservedRecords.length; i++) { 2164 const widget = preservedRecords[i]; 2165 const { block, position } = batchMeta[i]; 2166 post.blocks[position].attributes.__internalWidgetId = widget.id; 2167 const error = registry.select(import_core_data.store).getLastEntitySaveError("root", "widget", widget.id); 2168 if (error) { 2169 failedWidgetNames.push(block.attributes?.name || block?.name); 2170 } 2171 if (!sidebarWidgetsIds[position]) { 2172 sidebarWidgetsIds[position] = widget.id; 2173 } 2174 } 2175 if (failedWidgetNames.length) { 2176 throw new Error( 2177 (0, import_i18n3.sprintf)( 2178 /* translators: %s: List of widget names */ 2179 (0, import_i18n3.__)("Could not save the following widgets: %s."), 2180 failedWidgetNames.join(", ") 2181 ) 2182 ); 2183 } 2184 registry.dispatch(import_core_data.store).editEntityRecord( 2185 KIND, 2186 WIDGET_AREA_ENTITY_TYPE, 2187 widgetAreaId, 2188 { 2189 widgets: sidebarWidgetsIds 2190 }, 2191 { undoIgnore: true } 2192 ); 2193 dispatch2(trySaveWidgetArea(widgetAreaId)); 2194 registry.dispatch(import_core_data.store).receiveEntityRecords(KIND, POST_TYPE, post, void 0); 2195 }; 2196 var trySaveWidgetArea = (widgetAreaId) => ({ registry }) => { 2197 registry.dispatch(import_core_data.store).saveEditedEntityRecord( 2198 KIND, 2199 WIDGET_AREA_ENTITY_TYPE, 2200 widgetAreaId, 2201 { 2202 throwOnError: true 2203 } 2204 ); 2205 }; 2206 function setWidgetIdForClientId(clientId, widgetId) { 2207 return { 2208 type: "SET_WIDGET_ID_FOR_CLIENT_ID", 2209 clientId, 2210 widgetId 2211 }; 2212 } 2213 function setWidgetAreasOpenState(widgetAreasOpenState2) { 2214 return { 2215 type: "SET_WIDGET_AREAS_OPEN_STATE", 2216 widgetAreasOpenState: widgetAreasOpenState2 2217 }; 2218 } 2219 function setIsWidgetAreaOpen(clientId, isOpen) { 2220 return { 2221 type: "SET_IS_WIDGET_AREA_OPEN", 2222 clientId, 2223 isOpen 2224 }; 2225 } 2226 function setIsInserterOpened(value) { 2227 return { 2228 type: "SET_IS_INSERTER_OPENED", 2229 value 2230 }; 2231 } 2232 function setIsListViewOpened(isOpen) { 2233 return { 2234 type: "SET_IS_LIST_VIEW_OPENED", 2235 isOpen 2236 }; 2237 } 2238 var closeGeneralSidebar = () => ({ registry }) => { 2239 registry.dispatch(store).disableComplementaryArea(STORE_NAME2); 2240 }; 2241 var moveBlockToWidgetArea = (clientId, widgetAreaId) => async ({ dispatch: dispatch2, select, registry }) => { 2242 const sourceRootClientId = registry.select(import_block_editor.store).getBlockRootClientId(clientId); 2243 const widgetAreas = registry.select(import_block_editor.store).getBlocks(); 2244 const destinationWidgetAreaBlock = widgetAreas.find( 2245 ({ attributes }) => attributes.id === widgetAreaId 2246 ); 2247 const destinationRootClientId = destinationWidgetAreaBlock.clientId; 2248 const destinationInnerBlocksClientIds = registry.select(import_block_editor.store).getBlockOrder(destinationRootClientId); 2249 const destinationIndex = destinationInnerBlocksClientIds.length; 2250 const isDestinationWidgetAreaOpen = select.getIsWidgetAreaOpen( 2251 destinationRootClientId 2252 ); 2253 if (!isDestinationWidgetAreaOpen) { 2254 dispatch2.setIsWidgetAreaOpen(destinationRootClientId, true); 2255 } 2256 registry.dispatch(import_block_editor.store).moveBlocksToPosition( 2257 [clientId], 2258 sourceRootClientId, 2259 destinationRootClientId, 2260 destinationIndex 2261 ); 2262 }; 2263 function unlockWidgetSaving(lockName) { 2264 return { 2265 type: "UNLOCK_WIDGET_SAVING", 2266 lockName 2267 }; 2268 } 2269 function lockWidgetSaving(lockName) { 2270 return { 2271 type: "LOCK_WIDGET_SAVING", 2272 lockName 2273 }; 2274 } 2275 2276 // packages/edit-widgets/build-module/store/resolvers.mjs 2277 var getWidgetAreas = () => async ({ dispatch: dispatch2, registry }) => { 2278 const query = buildWidgetAreasQuery(); 2279 const widgetAreas = await registry.resolveSelect(import_core_data2.store).getEntityRecords(KIND, WIDGET_AREA_ENTITY_TYPE, query); 2280 const widgetAreaBlocks = []; 2281 const sortedWidgetAreas = widgetAreas.sort((a, b) => { 2282 if (a.id === "wp_inactive_widgets") { 2283 return 1; 2284 } 2285 if (b.id === "wp_inactive_widgets") { 2286 return -1; 2287 } 2288 return 0; 2289 }); 2290 for (const widgetArea of sortedWidgetAreas) { 2291 widgetAreaBlocks.push( 2292 (0, import_blocks2.createBlock)("core/widget-area", { 2293 id: widgetArea.id, 2294 name: widgetArea.name 2295 }) 2296 ); 2297 if (!widgetArea.widgets.length) { 2298 dispatch2( 2299 persistStubPost( 2300 buildWidgetAreaPostId(widgetArea.id), 2301 [] 2302 ) 2303 ); 2304 } 2305 } 2306 const widgetAreasOpenState2 = {}; 2307 widgetAreaBlocks.forEach((widgetAreaBlock, index) => { 2308 widgetAreasOpenState2[widgetAreaBlock.clientId] = index === 0; 2309 }); 2310 dispatch2(setWidgetAreasOpenState(widgetAreasOpenState2)); 2311 dispatch2( 2312 persistStubPost(buildWidgetAreasPostId(), widgetAreaBlocks) 2313 ); 2314 }; 2315 var getWidgets = () => async ({ dispatch: dispatch2, registry }) => { 2316 const query = buildWidgetsQuery(); 2317 const widgets = await registry.resolveSelect(import_core_data2.store).getEntityRecords("root", "widget", query); 2318 const groupedBySidebar = {}; 2319 for (const widget of widgets) { 2320 const block = transformWidgetToBlock(widget); 2321 groupedBySidebar[widget.sidebar] = groupedBySidebar[widget.sidebar] || []; 2322 groupedBySidebar[widget.sidebar].push(block); 2323 } 2324 for (const sidebarId in groupedBySidebar) { 2325 if (groupedBySidebar.hasOwnProperty(sidebarId)) { 2326 dispatch2( 2327 persistStubPost( 2328 buildWidgetAreaPostId(sidebarId), 2329 groupedBySidebar[sidebarId] 2330 ) 2331 ); 2332 } 2333 } 2334 }; 2335 2336 // packages/edit-widgets/build-module/store/selectors.mjs 2337 var selectors_exports2 = {}; 2338 __export(selectors_exports2, { 2339 __experimentalGetInsertionPoint: () => __experimentalGetInsertionPoint, 2340 canInsertBlockInWidgetArea: () => canInsertBlockInWidgetArea, 2341 getEditedWidgetAreas: () => getEditedWidgetAreas, 2342 getIsWidgetAreaOpen: () => getIsWidgetAreaOpen, 2343 getParentWidgetAreaBlock: () => getParentWidgetAreaBlock, 2344 getReferenceWidgetBlocks: () => getReferenceWidgetBlocks, 2345 getWidget: () => getWidget, 2346 getWidgetAreaForWidgetId: () => getWidgetAreaForWidgetId, 2347 getWidgetAreas: () => getWidgetAreas2, 2348 getWidgets: () => getWidgets2, 2349 isInserterOpened: () => isInserterOpened, 2350 isListViewOpened: () => isListViewOpened, 2351 isSavingWidgetAreas: () => isSavingWidgetAreas, 2352 isWidgetSavingLocked: () => isWidgetSavingLocked 2353 }); 2354 var import_data7 = __toESM(require_data(), 1); 2355 var import_widgets3 = __toESM(require_widgets(), 1); 2356 var import_core_data3 = __toESM(require_core_data(), 1); 2357 var import_block_editor2 = __toESM(require_block_editor(), 1); 2358 var EMPTY_INSERTION_POINT = { 2359 rootClientId: void 0, 2360 insertionIndex: void 0 2361 }; 2362 var getWidgets2 = (0, import_data7.createRegistrySelector)( 2363 (select) => (0, import_data7.createSelector)( 2364 () => { 2365 const widgets = select(import_core_data3.store).getEntityRecords( 2366 "root", 2367 "widget", 2368 buildWidgetsQuery() 2369 ); 2370 return ( 2371 // Key widgets by their ID. 2372 widgets?.reduce( 2373 (allWidgets, widget) => ({ 2374 ...allWidgets, 2375 [widget.id]: widget 2376 }), 2377 {} 2378 ) ?? {} 2379 ); 2380 }, 2381 () => [ 2382 select(import_core_data3.store).getEntityRecords( 2383 "root", 2384 "widget", 2385 buildWidgetsQuery() 2386 ) 2387 ] 2388 ) 2389 ); 2390 var getWidget = (0, import_data7.createRegistrySelector)( 2391 (select) => (state, id) => { 2392 const widgets = select(STORE_NAME2).getWidgets(); 2393 return widgets[id]; 2394 } 2395 ); 2396 var getWidgetAreas2 = (0, import_data7.createRegistrySelector)((select) => () => { 2397 const query = buildWidgetAreasQuery(); 2398 return select(import_core_data3.store).getEntityRecords( 2399 KIND, 2400 WIDGET_AREA_ENTITY_TYPE, 2401 query 2402 ); 2403 }); 2404 var getWidgetAreaForWidgetId = (0, import_data7.createRegistrySelector)( 2405 (select) => (state, widgetId) => { 2406 const widgetAreas = select(STORE_NAME2).getWidgetAreas(); 2407 return widgetAreas.find((widgetArea) => { 2408 const post = select(import_core_data3.store).getEditedEntityRecord( 2409 KIND, 2410 POST_TYPE, 2411 buildWidgetAreaPostId(widgetArea.id) 2412 ); 2413 const blockWidgetIds = post.blocks.map( 2414 (block) => (0, import_widgets3.getWidgetIdFromBlock)(block) 2415 ); 2416 return blockWidgetIds.includes(widgetId); 2417 }); 2418 } 2419 ); 2420 var getParentWidgetAreaBlock = (0, import_data7.createRegistrySelector)( 2421 (select) => (state, clientId) => { 2422 const { getBlock, getBlockName, getBlockParents } = select(import_block_editor2.store); 2423 const blockParents = getBlockParents(clientId); 2424 const widgetAreaClientId = blockParents.find( 2425 (parentClientId) => getBlockName(parentClientId) === "core/widget-area" 2426 ); 2427 return getBlock(widgetAreaClientId); 2428 } 2429 ); 2430 var getEditedWidgetAreas = (0, import_data7.createRegistrySelector)( 2431 (select) => (state, ids) => { 2432 let widgetAreas = select(STORE_NAME2).getWidgetAreas(); 2433 if (!widgetAreas) { 2434 return []; 2435 } 2436 if (ids) { 2437 widgetAreas = widgetAreas.filter( 2438 ({ id }) => ids.includes(id) 2439 ); 2440 } 2441 return widgetAreas.filter( 2442 ({ id }) => select(import_core_data3.store).hasEditsForEntityRecord( 2443 KIND, 2444 POST_TYPE, 2445 buildWidgetAreaPostId(id) 2446 ) 2447 ).map( 2448 ({ id }) => select(import_core_data3.store).getEditedEntityRecord( 2449 KIND, 2450 WIDGET_AREA_ENTITY_TYPE, 2451 id 2452 ) 2453 ); 2454 } 2455 ); 2456 var getReferenceWidgetBlocks = (0, import_data7.createRegistrySelector)( 2457 (select) => (state, referenceWidgetName = null) => { 2458 const results = []; 2459 const widgetAreas = select(STORE_NAME2).getWidgetAreas(); 2460 for (const _widgetArea of widgetAreas) { 2461 const post = select(import_core_data3.store).getEditedEntityRecord( 2462 KIND, 2463 POST_TYPE, 2464 buildWidgetAreaPostId(_widgetArea.id) 2465 ); 2466 for (const block of post.blocks) { 2467 if (block.name === "core/legacy-widget" && (!referenceWidgetName || block.attributes?.referenceWidgetName === referenceWidgetName)) { 2468 results.push(block); 2469 } 2470 } 2471 } 2472 return results; 2473 } 2474 ); 2475 var isSavingWidgetAreas = (0, import_data7.createRegistrySelector)((select) => () => { 2476 const widgetAreasIds = select(STORE_NAME2).getWidgetAreas()?.map(({ id }) => id); 2477 if (!widgetAreasIds) { 2478 return false; 2479 } 2480 for (const id of widgetAreasIds) { 2481 const isSaving = select(import_core_data3.store).isSavingEntityRecord( 2482 KIND, 2483 WIDGET_AREA_ENTITY_TYPE, 2484 id 2485 ); 2486 if (isSaving) { 2487 return true; 2488 } 2489 } 2490 const widgetIds = [ 2491 ...Object.keys(select(STORE_NAME2).getWidgets()), 2492 void 0 2493 // account for new widgets without an ID 2494 ]; 2495 for (const id of widgetIds) { 2496 const isSaving = select(import_core_data3.store).isSavingEntityRecord( 2497 "root", 2498 "widget", 2499 id 2500 ); 2501 if (isSaving) { 2502 return true; 2503 } 2504 } 2505 return false; 2506 }); 2507 var getIsWidgetAreaOpen = (state, clientId) => { 2508 const { widgetAreasOpenState: widgetAreasOpenState2 } = state; 2509 return !!widgetAreasOpenState2[clientId]; 2510 }; 2511 function isInserterOpened(state) { 2512 return !!state.blockInserterPanel; 2513 } 2514 function __experimentalGetInsertionPoint(state) { 2515 if (typeof state.blockInserterPanel === "boolean") { 2516 return EMPTY_INSERTION_POINT; 2517 } 2518 return state.blockInserterPanel; 2519 } 2520 var canInsertBlockInWidgetArea = (0, import_data7.createRegistrySelector)( 2521 (select) => (state, blockName) => { 2522 const widgetAreas = select(import_block_editor2.store).getBlocks(); 2523 const [firstWidgetArea] = widgetAreas; 2524 return select(import_block_editor2.store).canInsertBlockType( 2525 blockName, 2526 firstWidgetArea.clientId 2527 ); 2528 } 2529 ); 2530 function isListViewOpened(state) { 2531 return state.listViewPanel; 2532 } 2533 function isWidgetSavingLocked(state) { 2534 return Object.keys(state.widgetSavingLock).length > 0; 2535 } 2536 2537 // packages/edit-widgets/build-module/store/private-selectors.mjs 2538 var private_selectors_exports = {}; 2539 __export(private_selectors_exports, { 2540 getInserterSidebarToggleRef: () => getInserterSidebarToggleRef, 2541 getListViewToggleRef: () => getListViewToggleRef 2542 }); 2543 function getListViewToggleRef(state) { 2544 return state.listViewToggleRef; 2545 } 2546 function getInserterSidebarToggleRef(state) { 2547 return state.inserterSidebarToggleRef; 2548 } 2549 2550 // packages/edit-widgets/build-module/lock-unlock.mjs 2551 var import_private_apis = __toESM(require_private_apis(), 1); 2552 var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( 2553 "I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", 2554 "@wordpress/edit-widgets" 2555 ); 2556 2557 // packages/edit-widgets/build-module/store/index.mjs 2558 var storeConfig = { 2559 reducer: reducer_default, 2560 selectors: selectors_exports2, 2561 resolvers: resolvers_exports, 2562 actions: actions_exports2 2563 }; 2564 var store2 = (0, import_data8.createReduxStore)(STORE_NAME2, storeConfig); 2565 (0, import_data8.register)(store2); 2566 import_api_fetch.default.use(function(options, next) { 2567 if (options.path?.indexOf("/wp/v2/types/widget-area") === 0) { 2568 return Promise.resolve({}); 2569 } 2570 return next(options); 2571 }); 2572 unlock(store2).registerPrivateSelectors(private_selectors_exports); 2573 2574 // packages/edit-widgets/build-module/filters/move-to-widget-area.mjs 2575 var import_block_editor3 = __toESM(require_block_editor(), 1); 2576 var import_compose3 = __toESM(require_compose(), 1); 2577 var import_data9 = __toESM(require_data(), 1); 2578 var import_hooks = __toESM(require_hooks(), 1); 2579 var import_widgets4 = __toESM(require_widgets(), 1); 2580 var import_jsx_runtime22 = __toESM(require_jsx_runtime(), 1); 2581 var withMoveToWidgetAreaToolbarItem = (0, import_compose3.createHigherOrderComponent)( 2582 (BlockEdit) => (props) => { 2583 const { clientId, name: blockName } = props; 2584 const { widgetAreas, currentWidgetAreaId, canInsertBlockInWidgetArea: canInsertBlockInWidgetArea2 } = (0, import_data9.useSelect)( 2585 (select) => { 2586 if (blockName === "core/widget-area") { 2587 return {}; 2588 } 2589 const selectors = select(store2); 2590 const widgetAreaBlock = selectors.getParentWidgetAreaBlock(clientId); 2591 return { 2592 widgetAreas: selectors.getWidgetAreas(), 2593 currentWidgetAreaId: widgetAreaBlock?.attributes?.id, 2594 canInsertBlockInWidgetArea: selectors.canInsertBlockInWidgetArea(blockName) 2595 }; 2596 }, 2597 [clientId, blockName] 2598 ); 2599 const { moveBlockToWidgetArea: moveBlockToWidgetArea2 } = (0, import_data9.useDispatch)(store2); 2600 const hasMultipleWidgetAreas = widgetAreas?.length > 1; 2601 const isMoveToWidgetAreaVisible = blockName !== "core/widget-area" && hasMultipleWidgetAreas && canInsertBlockInWidgetArea2; 2602 return /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)(import_jsx_runtime22.Fragment, { children: [ 2603 /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(BlockEdit, { ...props }, "edit"), 2604 isMoveToWidgetAreaVisible && /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_block_editor3.BlockControls, { children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)( 2605 import_widgets4.MoveToWidgetArea, 2606 { 2607 widgetAreas, 2608 currentWidgetAreaId, 2609 onSelect: (widgetAreaId) => { 2610 moveBlockToWidgetArea2( 2611 props.clientId, 2612 widgetAreaId 2613 ); 2614 } 2615 } 2616 ) }) 2617 ] }); 2618 }, 2619 "withMoveToWidgetAreaToolbarItem" 2620 ); 2621 (0, import_hooks.addFilter)( 2622 "editor.BlockEdit", 2623 "core/edit-widgets/block-edit", 2624 withMoveToWidgetAreaToolbarItem 2625 ); 2626 2627 // packages/edit-widgets/build-module/filters/replace-media-upload.mjs 2628 var import_hooks2 = __toESM(require_hooks(), 1); 2629 var import_media_utils = __toESM(require_media_utils(), 1); 2630 var replaceMediaUpload = () => import_media_utils.MediaUpload; 2631 (0, import_hooks2.addFilter)( 2632 "editor.MediaUpload", 2633 "core/edit-widgets/replace-media-upload", 2634 replaceMediaUpload 2635 ); 2636 2637 // packages/edit-widgets/build-module/blocks/widget-area/index.mjs 2638 var widget_area_exports = {}; 2639 __export(widget_area_exports, { 2640 metadata: () => block_default, 2641 name: () => name, 2642 settings: () => settings 2643 }); 2644 var import_i18n4 = __toESM(require_i18n(), 1); 2645 2646 // packages/edit-widgets/build-module/blocks/widget-area/block.json 2647 var block_default = { 2648 $schema: "https://schemas.wp.org/trunk/block.json", 2649 apiVersion: 3, 2650 name: "core/widget-area", 2651 title: "Widget Area", 2652 category: "widgets", 2653 attributes: { 2654 id: { 2655 type: "string" 2656 }, 2657 name: { 2658 type: "string" 2659 } 2660 }, 2661 supports: { 2662 html: false, 2663 inserter: false, 2664 customClassName: false, 2665 reusable: false, 2666 renaming: false, 2667 visibility: false, 2668 __experimentalToolbar: false, 2669 __experimentalParentSelector: false, 2670 __experimentalDisableBlockOverlay: true 2671 }, 2672 editorStyle: "wp-block-widget-area-editor", 2673 style: "wp-block-widget-area" 2674 }; 2675 2676 // packages/edit-widgets/build-module/blocks/widget-area/edit/index.mjs 2677 var import_element8 = __toESM(require_element(), 1); 2678 var import_data10 = __toESM(require_data(), 1); 2679 var import_core_data5 = __toESM(require_core_data(), 1); 2680 var import_components7 = __toESM(require_components(), 1); 2681 var import_block_editor5 = __toESM(require_block_editor(), 1); 2682 2683 // packages/edit-widgets/build-module/blocks/widget-area/edit/inner-blocks.mjs 2684 var import_core_data4 = __toESM(require_core_data(), 1); 2685 var import_block_editor4 = __toESM(require_block_editor(), 1); 2686 var import_element7 = __toESM(require_element(), 1); 2687 2688 // packages/edit-widgets/build-module/blocks/widget-area/edit/use-is-dragging-within.mjs 2689 var import_element6 = __toESM(require_element(), 1); 2690 var useIsDraggingWithin = (elementRef) => { 2691 const [isDraggingWithin, setIsDraggingWithin] = (0, import_element6.useState)(false); 2692 (0, import_element6.useEffect)(() => { 2693 const { ownerDocument } = elementRef.current; 2694 function handleDragStart(event) { 2695 handleDragEnter(event); 2696 } 2697 function handleDragEnd() { 2698 setIsDraggingWithin(false); 2699 } 2700 function handleDragEnter(event) { 2701 if (elementRef.current.contains(event.target)) { 2702 setIsDraggingWithin(true); 2703 } else { 2704 setIsDraggingWithin(false); 2705 } 2706 } 2707 ownerDocument.addEventListener("dragstart", handleDragStart); 2708 ownerDocument.addEventListener("dragend", handleDragEnd); 2709 ownerDocument.addEventListener("dragenter", handleDragEnter); 2710 return () => { 2711 ownerDocument.removeEventListener("dragstart", handleDragStart); 2712 ownerDocument.removeEventListener("dragend", handleDragEnd); 2713 ownerDocument.removeEventListener("dragenter", handleDragEnter); 2714 }; 2715 }, []); 2716 return isDraggingWithin; 2717 }; 2718 var use_is_dragging_within_default = useIsDraggingWithin; 2719 2720 // packages/edit-widgets/build-module/blocks/widget-area/edit/inner-blocks.mjs 2721 var import_jsx_runtime23 = __toESM(require_jsx_runtime(), 1); 2722 function WidgetAreaInnerBlocks({ id }) { 2723 const [blocks, onInput, onChange] = (0, import_core_data4.useEntityBlockEditor)( 2724 "root", 2725 "postType" 2726 ); 2727 const innerBlocksRef = (0, import_element7.useRef)(); 2728 const isDraggingWithinInnerBlocks = use_is_dragging_within_default(innerBlocksRef); 2729 const shouldHighlightDropZone = isDraggingWithinInnerBlocks; 2730 const innerBlocksProps = (0, import_block_editor4.useInnerBlocksProps)( 2731 { ref: innerBlocksRef }, 2732 { 2733 value: blocks, 2734 onInput, 2735 onChange, 2736 templateLock: false, 2737 renderAppender: import_block_editor4.InnerBlocks.ButtonBlockAppender 2738 } 2739 ); 2740 return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)( 2741 "div", 2742 { 2743 "data-widget-area-id": id, 2744 className: clsx_default( 2745 "wp-block-widget-area__inner-blocks block-editor-inner-blocks editor-styles-wrapper", 2746 { 2747 "wp-block-widget-area__highlight-drop-zone": shouldHighlightDropZone 2748 } 2749 ), 2750 children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { ...innerBlocksProps }) 2751 } 2752 ); 2753 } 2754 2755 // packages/edit-widgets/build-module/blocks/widget-area/edit/index.mjs 2756 var import_jsx_runtime24 = __toESM(require_jsx_runtime(), 1); 2757 function WidgetAreaEdit({ 2758 clientId, 2759 attributes: { id, name: name2 } 2760 }) { 2761 const isOpen = (0, import_data10.useSelect)( 2762 (select) => select(store2).getIsWidgetAreaOpen(clientId), 2763 [clientId] 2764 ); 2765 const { setIsWidgetAreaOpen: setIsWidgetAreaOpen2 } = (0, import_data10.useDispatch)(store2); 2766 const wrapper = (0, import_element8.useRef)(); 2767 const setOpen = (0, import_element8.useCallback)( 2768 (openState) => setIsWidgetAreaOpen2(clientId, openState), 2769 [clientId] 2770 ); 2771 const isDragging = useIsDragging(wrapper); 2772 const isDraggingWithin = use_is_dragging_within_default(wrapper); 2773 const [openedWhileDragging, setOpenedWhileDragging] = (0, import_element8.useState)(false); 2774 (0, import_element8.useEffect)(() => { 2775 if (!isDragging) { 2776 setOpenedWhileDragging(false); 2777 return; 2778 } 2779 if (isDraggingWithin && !isOpen) { 2780 setOpen(true); 2781 setOpenedWhileDragging(true); 2782 } else if (!isDraggingWithin && isOpen && openedWhileDragging) { 2783 setOpen(false); 2784 } 2785 }, [isOpen, isDragging, isDraggingWithin, openedWhileDragging]); 2786 const blockProps = (0, import_block_editor5.useBlockProps)(); 2787 return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { ...blockProps, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components7.Panel, { ref: wrapper, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)( 2788 import_components7.PanelBody, 2789 { 2790 title: name2, 2791 opened: isOpen, 2792 onToggle: () => { 2793 setIsWidgetAreaOpen2(clientId, !isOpen); 2794 }, 2795 scrollAfterOpen: !isDragging, 2796 children: ({ opened }) => ( 2797 // This is required to ensure LegacyWidget blocks are not 2798 // unmounted when the panel is collapsed. Unmounting legacy 2799 // widgets may have unintended consequences (e.g. TinyMCE 2800 // not being properly reinitialized) 2801 /* @__PURE__ */ (0, import_jsx_runtime24.jsx)( 2802 import_components7.__unstableDisclosureContent, 2803 { 2804 className: "wp-block-widget-area__panel-body-content", 2805 visible: opened, 2806 children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)( 2807 import_core_data5.EntityProvider, 2808 { 2809 kind: "root", 2810 type: "postType", 2811 id: `widget-area-$id}`, 2812 children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(WidgetAreaInnerBlocks, { id }) 2813 } 2814 ) 2815 } 2816 ) 2817 ) 2818 } 2819 ) }) }); 2820 } 2821 var useIsDragging = (elementRef) => { 2822 const [isDragging, setIsDragging] = (0, import_element8.useState)(false); 2823 (0, import_element8.useEffect)(() => { 2824 const { ownerDocument } = elementRef.current; 2825 function handleDragStart() { 2826 setIsDragging(true); 2827 } 2828 function handleDragEnd() { 2829 setIsDragging(false); 2830 } 2831 ownerDocument.addEventListener("dragstart", handleDragStart); 2832 ownerDocument.addEventListener("dragend", handleDragEnd); 2833 return () => { 2834 ownerDocument.removeEventListener("dragstart", handleDragStart); 2835 ownerDocument.removeEventListener("dragend", handleDragEnd); 2836 }; 2837 }, []); 2838 return isDragging; 2839 }; 2840 2841 // packages/edit-widgets/build-module/blocks/widget-area/index.mjs 2842 var { name } = block_default; 2843 var settings = { 2844 title: (0, import_i18n4.__)("Widget Area"), 2845 description: (0, import_i18n4.__)("A widget area container."), 2846 __experimentalLabel: ({ name: label }) => label, 2847 edit: WidgetAreaEdit 2848 }; 2849 2850 // packages/edit-widgets/build-module/components/layout/index.mjs 2851 var import_i18n21 = __toESM(require_i18n(), 1); 2852 var import_data31 = __toESM(require_data(), 1); 2853 var import_plugins3 = __toESM(require_plugins(), 1); 2854 var import_notices4 = __toESM(require_notices(), 1); 2855 var import_components22 = __toESM(require_components(), 1); 2856 2857 // packages/edit-widgets/build-module/components/error-boundary/index.mjs 2858 var import_element9 = __toESM(require_element(), 1); 2859 var import_i18n5 = __toESM(require_i18n(), 1); 2860 var import_components8 = __toESM(require_components(), 1); 2861 var import_block_editor6 = __toESM(require_block_editor(), 1); 2862 var import_compose4 = __toESM(require_compose(), 1); 2863 var import_hooks3 = __toESM(require_hooks(), 1); 2864 var import_jsx_runtime25 = __toESM(require_jsx_runtime(), 1); 2865 function CopyButton({ text, children }) { 2866 const ref = (0, import_compose4.useCopyToClipboard)(text); 2867 return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_components8.Button, { __next40pxDefaultSize: true, variant: "secondary", ref, children }); 2868 } 2869 function ErrorBoundaryWarning({ message, error }) { 2870 const actions = [ 2871 /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CopyButton, { text: error.stack, children: (0, import_i18n5.__)("Copy Error") }, "copy-error") 2872 ]; 2873 return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_block_editor6.Warning, { className: "edit-widgets-error-boundary", actions, children: message }); 2874 } 2875 var ErrorBoundary = class extends import_element9.Component { 2876 constructor() { 2877 super(...arguments); 2878 this.state = { 2879 error: null 2880 }; 2881 } 2882 componentDidCatch(error) { 2883 (0, import_hooks3.doAction)("editor.ErrorBoundary.errorLogged", error); 2884 } 2885 static getDerivedStateFromError(error) { 2886 return { error }; 2887 } 2888 render() { 2889 if (!this.state.error) { 2890 return this.props.children; 2891 } 2892 return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)( 2893 ErrorBoundaryWarning, 2894 { 2895 message: (0, import_i18n5.__)( 2896 "The editor has encountered an unexpected error." 2897 ), 2898 error: this.state.error 2899 } 2900 ); 2901 } 2902 }; 2903 2904 // packages/edit-widgets/build-module/components/widget-areas-block-editor-provider/index.mjs 2905 var import_components9 = __toESM(require_components(), 1); 2906 var import_compose5 = __toESM(require_compose(), 1); 2907 var import_media_utils2 = __toESM(require_media_utils(), 1); 2908 var import_data13 = __toESM(require_data(), 1); 2909 var import_core_data8 = __toESM(require_core_data(), 1); 2910 var import_element11 = __toESM(require_element(), 1); 2911 var import_block_editor8 = __toESM(require_block_editor(), 1); 2912 var import_patterns = __toESM(require_patterns(), 1); 2913 var import_preferences4 = __toESM(require_preferences(), 1); 2914 var import_block_library = __toESM(require_block_library(), 1); 2915 2916 // packages/edit-widgets/build-module/components/keyboard-shortcuts/index.mjs 2917 var import_element10 = __toESM(require_element(), 1); 2918 var import_keyboard_shortcuts = __toESM(require_keyboard_shortcuts(), 1); 2919 var import_keycodes = __toESM(require_keycodes(), 1); 2920 var import_data11 = __toESM(require_data(), 1); 2921 var import_i18n6 = __toESM(require_i18n(), 1); 2922 var import_core_data6 = __toESM(require_core_data(), 1); 2923 function KeyboardShortcuts() { 2924 const { redo, undo } = (0, import_data11.useDispatch)(import_core_data6.store); 2925 const { saveEditedWidgetAreas: saveEditedWidgetAreas2 } = (0, import_data11.useDispatch)(store2); 2926 (0, import_keyboard_shortcuts.useShortcut)("core/edit-widgets/undo", (event) => { 2927 undo(); 2928 event.preventDefault(); 2929 }); 2930 (0, import_keyboard_shortcuts.useShortcut)("core/edit-widgets/redo", (event) => { 2931 redo(); 2932 event.preventDefault(); 2933 }); 2934 (0, import_keyboard_shortcuts.useShortcut)("core/edit-widgets/save", (event) => { 2935 event.preventDefault(); 2936 saveEditedWidgetAreas2(); 2937 }); 2938 return null; 2939 } 2940 function KeyboardShortcutsRegister() { 2941 const { registerShortcut } = (0, import_data11.useDispatch)(import_keyboard_shortcuts.store); 2942 (0, import_element10.useEffect)(() => { 2943 registerShortcut({ 2944 name: "core/edit-widgets/undo", 2945 category: "global", 2946 description: (0, import_i18n6.__)("Undo your last changes."), 2947 keyCombination: { 2948 modifier: "primary", 2949 character: "z" 2950 } 2951 }); 2952 registerShortcut({ 2953 name: "core/edit-widgets/redo", 2954 category: "global", 2955 description: (0, import_i18n6.__)("Redo your last undo."), 2956 keyCombination: { 2957 modifier: "primaryShift", 2958 character: "z" 2959 }, 2960 // Disable on Apple OS because it conflicts with the browser's 2961 // history shortcut. It's a fine alias for both Windows and Linux. 2962 // Since there's no conflict for Ctrl+Shift+Z on both Windows and 2963 // Linux, we keep it as the default for consistency. 2964 aliases: (0, import_keycodes.isAppleOS)() ? [] : [ 2965 { 2966 modifier: "primary", 2967 character: "y" 2968 } 2969 ] 2970 }); 2971 registerShortcut({ 2972 name: "core/edit-widgets/save", 2973 category: "global", 2974 description: (0, import_i18n6.__)("Save your changes."), 2975 keyCombination: { 2976 modifier: "primary", 2977 character: "s" 2978 } 2979 }); 2980 registerShortcut({ 2981 name: "core/edit-widgets/keyboard-shortcuts", 2982 category: "main", 2983 description: (0, import_i18n6.__)("Display these keyboard shortcuts."), 2984 keyCombination: { 2985 modifier: "access", 2986 character: "h" 2987 } 2988 }); 2989 registerShortcut({ 2990 name: "core/edit-widgets/next-region", 2991 category: "global", 2992 description: (0, import_i18n6.__)("Navigate to the next part of the editor."), 2993 keyCombination: { 2994 modifier: "ctrl", 2995 character: "`" 2996 }, 2997 aliases: [ 2998 { 2999 modifier: "access", 3000 character: "n" 3001 } 3002 ] 3003 }); 3004 registerShortcut({ 3005 name: "core/edit-widgets/previous-region", 3006 category: "global", 3007 description: (0, import_i18n6.__)("Navigate to the previous part of the editor."), 3008 keyCombination: { 3009 modifier: "ctrlShift", 3010 character: "`" 3011 }, 3012 aliases: [ 3013 { 3014 modifier: "access", 3015 character: "p" 3016 }, 3017 { 3018 modifier: "ctrlShift", 3019 character: "~" 3020 } 3021 ] 3022 }); 3023 }, [registerShortcut]); 3024 return null; 3025 } 3026 KeyboardShortcuts.Register = KeyboardShortcutsRegister; 3027 var keyboard_shortcuts_default = KeyboardShortcuts; 3028 3029 // packages/edit-widgets/build-module/hooks/use-last-selected-widget-area.mjs 3030 var import_data12 = __toESM(require_data(), 1); 3031 var import_block_editor7 = __toESM(require_block_editor(), 1); 3032 var import_core_data7 = __toESM(require_core_data(), 1); 3033 var useLastSelectedWidgetArea = () => (0, import_data12.useSelect)((select) => { 3034 const { getBlockSelectionEnd, getBlockName } = select(import_block_editor7.store); 3035 const selectionEndClientId = getBlockSelectionEnd(); 3036 if (getBlockName(selectionEndClientId) === "core/widget-area") { 3037 return selectionEndClientId; 3038 } 3039 const { getParentWidgetAreaBlock: getParentWidgetAreaBlock2 } = select(store2); 3040 const widgetAreaBlock = getParentWidgetAreaBlock2(selectionEndClientId); 3041 const widgetAreaBlockClientId = widgetAreaBlock?.clientId; 3042 if (widgetAreaBlockClientId) { 3043 return widgetAreaBlockClientId; 3044 } 3045 const { getEntityRecord } = select(import_core_data7.store); 3046 const widgetAreasPost = getEntityRecord( 3047 KIND, 3048 POST_TYPE, 3049 buildWidgetAreasPostId() 3050 ); 3051 return widgetAreasPost?.blocks[0]?.clientId; 3052 }, []); 3053 var use_last_selected_widget_area_default = useLastSelectedWidgetArea; 3054 3055 // packages/edit-widgets/build-module/constants.mjs 3056 var ALLOW_REUSABLE_BLOCKS = false; 3057 3058 // packages/edit-widgets/build-module/components/widget-areas-block-editor-provider/index.mjs 3059 var import_jsx_runtime26 = __toESM(require_jsx_runtime(), 1); 3060 var { ExperimentalBlockEditorProvider } = unlock(import_block_editor8.privateApis); 3061 var { PatternsMenuItems } = unlock(import_patterns.privateApis); 3062 var { BlockKeyboardShortcuts } = unlock(import_block_library.privateApis); 3063 var EMPTY_ARRAY2 = []; 3064 function WidgetAreasBlockEditorProvider({ 3065 blockEditorSettings, 3066 children, 3067 ...props 3068 }) { 3069 const isLargeViewport = (0, import_compose5.useViewportMatch)("medium"); 3070 const { 3071 hasUploadPermissions, 3072 reusableBlocks, 3073 isFixedToolbarActive, 3074 keepCaretInsideBlock, 3075 pageOnFront, 3076 pageForPosts 3077 } = (0, import_data13.useSelect)((select) => { 3078 const { canUser, getEntityRecord, getEntityRecords } = select(import_core_data8.store); 3079 const siteSettings = canUser("read", { 3080 kind: "root", 3081 name: "site" 3082 }) ? getEntityRecord("root", "site") : void 0; 3083 return { 3084 hasUploadPermissions: canUser("create", { 3085 kind: "postType", 3086 name: "attachment" 3087 }) ?? true, 3088 reusableBlocks: ALLOW_REUSABLE_BLOCKS ? getEntityRecords("postType", "wp_block") : EMPTY_ARRAY2, 3089 isFixedToolbarActive: !!select(import_preferences4.store).get( 3090 "core/edit-widgets", 3091 "fixedToolbar" 3092 ), 3093 keepCaretInsideBlock: !!select(import_preferences4.store).get( 3094 "core/edit-widgets", 3095 "keepCaretInsideBlock" 3096 ), 3097 pageOnFront: siteSettings?.page_on_front, 3098 pageForPosts: siteSettings?.page_for_posts 3099 }; 3100 }, []); 3101 const { setIsInserterOpened: setIsInserterOpened2 } = (0, import_data13.useDispatch)(store2); 3102 const settings2 = (0, import_element11.useMemo)(() => { 3103 let mediaUploadBlockEditor; 3104 if (hasUploadPermissions) { 3105 mediaUploadBlockEditor = ({ onError, ...argumentsObject }) => { 3106 (0, import_media_utils2.uploadMedia)({ 3107 wpAllowedMimeTypes: blockEditorSettings.allowedMimeTypes, 3108 onError: ({ message }) => onError(message), 3109 ...argumentsObject 3110 }); 3111 }; 3112 } 3113 return { 3114 ...blockEditorSettings, 3115 __experimentalReusableBlocks: reusableBlocks, 3116 hasFixedToolbar: isFixedToolbarActive || !isLargeViewport, 3117 keepCaretInsideBlock, 3118 mediaUpload: mediaUploadBlockEditor, 3119 templateLock: "all", 3120 __experimentalSetIsInserterOpened: setIsInserterOpened2, 3121 pageOnFront, 3122 pageForPosts, 3123 editorTool: "edit" 3124 }; 3125 }, [ 3126 hasUploadPermissions, 3127 blockEditorSettings, 3128 isFixedToolbarActive, 3129 isLargeViewport, 3130 keepCaretInsideBlock, 3131 reusableBlocks, 3132 setIsInserterOpened2, 3133 pageOnFront, 3134 pageForPosts 3135 ]); 3136 const widgetAreaId = use_last_selected_widget_area_default(); 3137 const [blocks, onInput, onChange] = (0, import_core_data8.useEntityBlockEditor)( 3138 KIND, 3139 POST_TYPE, 3140 { id: buildWidgetAreasPostId() } 3141 ); 3142 return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_components9.SlotFillProvider, { children: [ 3143 /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(keyboard_shortcuts_default.Register, {}), 3144 /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(BlockKeyboardShortcuts, {}), 3145 /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)( 3146 ExperimentalBlockEditorProvider, 3147 { 3148 value: blocks, 3149 onInput, 3150 onChange, 3151 settings: settings2, 3152 useSubRegistry: false, 3153 ...props, 3154 children: [ 3155 children, 3156 /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PatternsMenuItems, { rootClientId: widgetAreaId }) 3157 ] 3158 } 3159 ) 3160 ] }); 3161 } 3162 3163 // packages/edit-widgets/build-module/components/sidebar/index.mjs 3164 var import_element13 = __toESM(require_element(), 1); 3165 var import_i18n8 = __toESM(require_i18n(), 1); 3166 var import_block_editor10 = __toESM(require_block_editor(), 1); 3167 var import_components11 = __toESM(require_components(), 1); 3168 var import_data15 = __toESM(require_data(), 1); 3169 3170 // packages/edit-widgets/build-module/components/sidebar/widget-areas.mjs 3171 var import_data14 = __toESM(require_data(), 1); 3172 var import_element12 = __toESM(require_element(), 1); 3173 var import_block_editor9 = __toESM(require_block_editor(), 1); 3174 var import_components10 = __toESM(require_components(), 1); 3175 var import_i18n7 = __toESM(require_i18n(), 1); 3176 var import_url = __toESM(require_url(), 1); 3177 var import_dom = __toESM(require_dom(), 1); 3178 var import_jsx_runtime27 = __toESM(require_jsx_runtime(), 1); 3179 function WidgetAreas({ selectedWidgetAreaId }) { 3180 const widgetAreas = (0, import_data14.useSelect)( 3181 (select) => select(store2).getWidgetAreas(), 3182 [] 3183 ); 3184 const selectedWidgetArea = (0, import_element12.useMemo)( 3185 () => selectedWidgetAreaId && widgetAreas?.find( 3186 (widgetArea) => widgetArea.id === selectedWidgetAreaId 3187 ), 3188 [selectedWidgetAreaId, widgetAreas] 3189 ); 3190 let description; 3191 if (!selectedWidgetArea) { 3192 description = (0, import_i18n7.__)( 3193 // eslint-disable-next-line no-restricted-syntax -- 'sidebar' is a common web design term for layouts 3194 "Widget Areas are global parts in your site\u2019s layout that can accept blocks. These vary by theme, but are typically parts like your Sidebar or Footer." 3195 ); 3196 } else if (selectedWidgetAreaId === "wp_inactive_widgets") { 3197 description = (0, import_i18n7.__)( 3198 "Blocks in this Widget Area will not be displayed in your site." 3199 ); 3200 } else { 3201 description = selectedWidgetArea.description; 3202 } 3203 return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "edit-widgets-widget-areas", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "edit-widgets-widget-areas__top-container", children: [ 3204 /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_block_editor9.BlockIcon, { icon: block_default_default }), 3205 /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [ 3206 /* @__PURE__ */ (0, import_jsx_runtime27.jsx)( 3207 "p", 3208 { 3209 dangerouslySetInnerHTML: { 3210 __html: (0, import_dom.safeHTML)(description) 3211 } 3212 } 3213 ), 3214 widgetAreas?.length === 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { children: (0, import_i18n7.__)( 3215 "Your theme does not contain any Widget Areas." 3216 ) }), 3217 !selectedWidgetArea && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)( 3218 import_components10.Button, 3219 { 3220 __next40pxDefaultSize: true, 3221 href: (0, import_url.addQueryArgs)("customize.php", { 3222 "autofocus[panel]": "widgets", 3223 return: window.location.pathname 3224 }), 3225 variant: "tertiary", 3226 children: (0, import_i18n7.__)("Manage with live preview") 3227 } 3228 ) 3229 ] }) 3230 ] }) }); 3231 } 3232 3233 // packages/edit-widgets/build-module/components/sidebar/index.mjs 3234 var import_jsx_runtime28 = __toESM(require_jsx_runtime(), 1); 3235 var SIDEBAR_ACTIVE_BY_DEFAULT = true; 3236 var BLOCK_INSPECTOR_IDENTIFIER = "edit-widgets/block-inspector"; 3237 var WIDGET_AREAS_IDENTIFIER = "edit-widgets/block-areas"; 3238 var { Tabs } = unlock(import_components11.privateApis); 3239 function SidebarHeader({ selectedWidgetAreaBlock }) { 3240 return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Tabs.TabList, { children: [ 3241 /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Tabs.Tab, { tabId: WIDGET_AREAS_IDENTIFIER, children: selectedWidgetAreaBlock ? selectedWidgetAreaBlock.attributes.name : (0, import_i18n8.__)("Widget Areas") }), 3242 /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Tabs.Tab, { tabId: BLOCK_INSPECTOR_IDENTIFIER, children: (0, import_i18n8.__)("Block") }) 3243 ] }); 3244 } 3245 function SidebarContent({ 3246 hasSelectedNonAreaBlock, 3247 currentArea, 3248 isGeneralSidebarOpen, 3249 selectedWidgetAreaBlock 3250 }) { 3251 const { enableComplementaryArea: enableComplementaryArea2 } = (0, import_data15.useDispatch)(store); 3252 (0, import_element13.useEffect)(() => { 3253 if (hasSelectedNonAreaBlock && currentArea === WIDGET_AREAS_IDENTIFIER && isGeneralSidebarOpen) { 3254 enableComplementaryArea2( 3255 "core/edit-widgets", 3256 BLOCK_INSPECTOR_IDENTIFIER 3257 ); 3258 } 3259 if (!hasSelectedNonAreaBlock && currentArea === BLOCK_INSPECTOR_IDENTIFIER && isGeneralSidebarOpen) { 3260 enableComplementaryArea2( 3261 "core/edit-widgets", 3262 WIDGET_AREAS_IDENTIFIER 3263 ); 3264 } 3265 }, [hasSelectedNonAreaBlock, enableComplementaryArea2]); 3266 const tabsContextValue = (0, import_element13.useContext)(Tabs.Context); 3267 return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)( 3268 complementary_area_default, 3269 { 3270 className: "edit-widgets-sidebar", 3271 header: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Tabs.Context.Provider, { value: tabsContextValue, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)( 3272 SidebarHeader, 3273 { 3274 selectedWidgetAreaBlock 3275 } 3276 ) }), 3277 headerClassName: "edit-widgets-sidebar__panel-tabs", 3278 title: (0, import_i18n8.__)("Settings"), 3279 closeLabel: (0, import_i18n8.__)("Close Settings"), 3280 scope: "core/edit-widgets", 3281 identifier: currentArea, 3282 icon: (0, import_i18n8.isRTL)() ? drawer_left_default : drawer_right_default, 3283 isActiveByDefault: SIDEBAR_ACTIVE_BY_DEFAULT, 3284 children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(Tabs.Context.Provider, { value: tabsContextValue, children: [ 3285 /* @__PURE__ */ (0, import_jsx_runtime28.jsx)( 3286 Tabs.TabPanel, 3287 { 3288 tabId: WIDGET_AREAS_IDENTIFIER, 3289 focusable: false, 3290 children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)( 3291 WidgetAreas, 3292 { 3293 selectedWidgetAreaId: selectedWidgetAreaBlock?.attributes.id 3294 } 3295 ) 3296 } 3297 ), 3298 /* @__PURE__ */ (0, import_jsx_runtime28.jsx)( 3299 Tabs.TabPanel, 3300 { 3301 tabId: BLOCK_INSPECTOR_IDENTIFIER, 3302 focusable: false, 3303 children: hasSelectedNonAreaBlock ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_block_editor10.BlockInspector, {}) : ( 3304 // Pretend that Widget Areas are part of the UI by not 3305 // showing the Block Inspector when one is selected. 3306 /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("span", { className: "block-editor-block-inspector__no-blocks", children: (0, import_i18n8.__)("No block selected.") }) 3307 ) 3308 } 3309 ) 3310 ] }) 3311 } 3312 ); 3313 } 3314 function Sidebar() { 3315 const { 3316 currentArea, 3317 hasSelectedNonAreaBlock, 3318 isGeneralSidebarOpen, 3319 selectedWidgetAreaBlock 3320 } = (0, import_data15.useSelect)((select) => { 3321 const { getSelectedBlock, getBlock, getBlockParentsByBlockName } = select(import_block_editor10.store); 3322 const { getActiveComplementaryArea: getActiveComplementaryArea2 } = select(store); 3323 const selectedBlock = getSelectedBlock(); 3324 const activeArea = getActiveComplementaryArea2(store2.name); 3325 let currentSelection = activeArea; 3326 if (!currentSelection) { 3327 if (selectedBlock) { 3328 currentSelection = BLOCK_INSPECTOR_IDENTIFIER; 3329 } else { 3330 currentSelection = WIDGET_AREAS_IDENTIFIER; 3331 } 3332 } 3333 let widgetAreaBlock; 3334 if (selectedBlock) { 3335 if (selectedBlock.name === "core/widget-area") { 3336 widgetAreaBlock = selectedBlock; 3337 } else { 3338 widgetAreaBlock = getBlock( 3339 getBlockParentsByBlockName( 3340 selectedBlock.clientId, 3341 "core/widget-area" 3342 )[0] 3343 ); 3344 } 3345 } 3346 return { 3347 currentArea: currentSelection, 3348 hasSelectedNonAreaBlock: !!(selectedBlock && selectedBlock.name !== "core/widget-area"), 3349 isGeneralSidebarOpen: !!activeArea, 3350 selectedWidgetAreaBlock: widgetAreaBlock 3351 }; 3352 }, []); 3353 const { enableComplementaryArea: enableComplementaryArea2 } = (0, import_data15.useDispatch)(store); 3354 const onTabSelect = (0, import_element13.useCallback)( 3355 (newSelectedTabId) => { 3356 if (!!newSelectedTabId) { 3357 enableComplementaryArea2( 3358 store2.name, 3359 newSelectedTabId 3360 ); 3361 } 3362 }, 3363 [enableComplementaryArea2] 3364 ); 3365 return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)( 3366 Tabs, 3367 { 3368 selectedTabId: isGeneralSidebarOpen ? currentArea : null, 3369 onSelect: onTabSelect, 3370 selectOnMove: false, 3371 children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)( 3372 SidebarContent, 3373 { 3374 hasSelectedNonAreaBlock, 3375 currentArea, 3376 isGeneralSidebarOpen, 3377 selectedWidgetAreaBlock 3378 } 3379 ) 3380 } 3381 ); 3382 } 3383 3384 // packages/edit-widgets/build-module/components/layout/interface.mjs 3385 var import_compose12 = __toESM(require_compose(), 1); 3386 var import_block_editor17 = __toESM(require_block_editor(), 1); 3387 var import_element23 = __toESM(require_element(), 1); 3388 var import_data28 = __toESM(require_data(), 1); 3389 var import_i18n18 = __toESM(require_i18n(), 1); 3390 var import_preferences8 = __toESM(require_preferences(), 1); 3391 3392 // packages/edit-widgets/build-module/components/header/index.mjs 3393 var import_block_editor12 = __toESM(require_block_editor(), 1); 3394 var import_data22 = __toESM(require_data(), 1); 3395 var import_element19 = __toESM(require_element(), 1); 3396 var import_i18n16 = __toESM(require_i18n(), 1); 3397 var import_components19 = __toESM(require_components(), 1); 3398 var import_compose8 = __toESM(require_compose(), 1); 3399 var import_preferences6 = __toESM(require_preferences(), 1); 3400 3401 // packages/edit-widgets/build-module/components/header/document-tools/index.mjs 3402 var import_data18 = __toESM(require_data(), 1); 3403 var import_i18n11 = __toESM(require_i18n(), 1); 3404 var import_components14 = __toESM(require_components(), 1); 3405 var import_block_editor11 = __toESM(require_block_editor(), 1); 3406 var import_element16 = __toESM(require_element(), 1); 3407 var import_compose6 = __toESM(require_compose(), 1); 3408 3409 // packages/edit-widgets/build-module/components/header/undo-redo/undo.mjs 3410 var import_i18n9 = __toESM(require_i18n(), 1); 3411 var import_components12 = __toESM(require_components(), 1); 3412 var import_data16 = __toESM(require_data(), 1); 3413 var import_keycodes2 = __toESM(require_keycodes(), 1); 3414 var import_core_data9 = __toESM(require_core_data(), 1); 3415 var import_element14 = __toESM(require_element(), 1); 3416 var import_jsx_runtime29 = __toESM(require_jsx_runtime(), 1); 3417 function UndoButton(props, ref) { 3418 const hasUndo = (0, import_data16.useSelect)( 3419 (select) => select(import_core_data9.store).hasUndo(), 3420 [] 3421 ); 3422 const { undo } = (0, import_data16.useDispatch)(import_core_data9.store); 3423 return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)( 3424 import_components12.Button, 3425 { 3426 ...props, 3427 ref, 3428 icon: !(0, import_i18n9.isRTL)() ? undo_default : redo_default, 3429 label: (0, import_i18n9.__)("Undo"), 3430 shortcut: import_keycodes2.displayShortcut.primary("z"), 3431 "aria-disabled": !hasUndo, 3432 onClick: hasUndo ? undo : void 0, 3433 size: "compact" 3434 } 3435 ); 3436 } 3437 var undo_default2 = (0, import_element14.forwardRef)(UndoButton); 3438 3439 // packages/edit-widgets/build-module/components/header/undo-redo/redo.mjs 3440 var import_i18n10 = __toESM(require_i18n(), 1); 3441 var import_components13 = __toESM(require_components(), 1); 3442 var import_data17 = __toESM(require_data(), 1); 3443 var import_keycodes3 = __toESM(require_keycodes(), 1); 3444 var import_core_data10 = __toESM(require_core_data(), 1); 3445 var import_element15 = __toESM(require_element(), 1); 3446 var import_jsx_runtime30 = __toESM(require_jsx_runtime(), 1); 3447 function RedoButton(props, ref) { 3448 const shortcut = (0, import_keycodes3.isAppleOS)() ? import_keycodes3.displayShortcut.primaryShift("z") : import_keycodes3.displayShortcut.primary("y"); 3449 const hasRedo = (0, import_data17.useSelect)( 3450 (select) => select(import_core_data10.store).hasRedo(), 3451 [] 3452 ); 3453 const { redo } = (0, import_data17.useDispatch)(import_core_data10.store); 3454 return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)( 3455 import_components13.Button, 3456 { 3457 ...props, 3458 ref, 3459 icon: !(0, import_i18n10.isRTL)() ? redo_default : undo_default, 3460 label: (0, import_i18n10.__)("Redo"), 3461 shortcut, 3462 "aria-disabled": !hasRedo, 3463 onClick: hasRedo ? redo : void 0, 3464 size: "compact" 3465 } 3466 ); 3467 } 3468 var redo_default2 = (0, import_element15.forwardRef)(RedoButton); 3469 3470 // packages/edit-widgets/build-module/components/header/document-tools/index.mjs 3471 var import_jsx_runtime31 = __toESM(require_jsx_runtime(), 1); 3472 function DocumentTools() { 3473 const isMediumViewport = (0, import_compose6.useViewportMatch)("medium"); 3474 const { 3475 isInserterOpen, 3476 isListViewOpen, 3477 inserterSidebarToggleRef: inserterSidebarToggleRef2, 3478 listViewToggleRef: listViewToggleRef2 3479 } = (0, import_data18.useSelect)((select) => { 3480 const { 3481 isInserterOpened: isInserterOpened2, 3482 getInserterSidebarToggleRef: getInserterSidebarToggleRef2, 3483 isListViewOpened: isListViewOpened2, 3484 getListViewToggleRef: getListViewToggleRef2 3485 } = unlock(select(store2)); 3486 return { 3487 isInserterOpen: isInserterOpened2(), 3488 isListViewOpen: isListViewOpened2(), 3489 inserterSidebarToggleRef: getInserterSidebarToggleRef2(), 3490 listViewToggleRef: getListViewToggleRef2() 3491 }; 3492 }, []); 3493 const { setIsInserterOpened: setIsInserterOpened2, setIsListViewOpened: setIsListViewOpened2 } = (0, import_data18.useDispatch)(store2); 3494 const toggleListView = (0, import_element16.useCallback)( 3495 () => setIsListViewOpened2(!isListViewOpen), 3496 [setIsListViewOpened2, isListViewOpen] 3497 ); 3498 const toggleInserterSidebar = (0, import_element16.useCallback)( 3499 () => setIsInserterOpened2(!isInserterOpen), 3500 [setIsInserterOpened2, isInserterOpen] 3501 ); 3502 return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)( 3503 import_block_editor11.NavigableToolbar, 3504 { 3505 className: "edit-widgets-header-toolbar", 3506 "aria-label": (0, import_i18n11.__)("Document tools"), 3507 variant: "unstyled", 3508 children: [ 3509 /* @__PURE__ */ (0, import_jsx_runtime31.jsx)( 3510 import_components14.ToolbarItem, 3511 { 3512 ref: inserterSidebarToggleRef2, 3513 as: import_components14.Button, 3514 className: "edit-widgets-header-toolbar__inserter-toggle", 3515 variant: "primary", 3516 isPressed: isInserterOpen, 3517 onMouseDown: (event) => { 3518 event.preventDefault(); 3519 }, 3520 onClick: toggleInserterSidebar, 3521 icon: plus_default, 3522 label: (0, import_i18n11._x)( 3523 "Block Inserter", 3524 "Generic label for block inserter button" 3525 ), 3526 size: "compact" 3527 } 3528 ), 3529 isMediumViewport && /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(import_jsx_runtime31.Fragment, { children: [ 3530 /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_components14.ToolbarItem, { as: undo_default2 }), 3531 /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_components14.ToolbarItem, { as: redo_default2 }), 3532 /* @__PURE__ */ (0, import_jsx_runtime31.jsx)( 3533 import_components14.ToolbarItem, 3534 { 3535 as: import_components14.Button, 3536 className: "edit-widgets-header-toolbar__list-view-toggle", 3537 icon: list_view_default, 3538 isPressed: isListViewOpen, 3539 label: (0, import_i18n11.__)("List View"), 3540 onClick: toggleListView, 3541 ref: listViewToggleRef2, 3542 size: "compact" 3543 } 3544 ) 3545 ] }) 3546 ] 3547 } 3548 ); 3549 } 3550 var document_tools_default = DocumentTools; 3551 3552 // packages/edit-widgets/build-module/components/save-button/index.mjs 3553 var import_components15 = __toESM(require_components(), 1); 3554 var import_i18n12 = __toESM(require_i18n(), 1); 3555 var import_data19 = __toESM(require_data(), 1); 3556 var import_jsx_runtime32 = __toESM(require_jsx_runtime(), 1); 3557 function SaveButton() { 3558 const { hasEditedWidgetAreaIds, isSaving, isWidgetSaveLocked } = (0, import_data19.useSelect)( 3559 (select) => { 3560 const { 3561 getEditedWidgetAreas: getEditedWidgetAreas2, 3562 isSavingWidgetAreas: isSavingWidgetAreas2, 3563 isWidgetSavingLocked: isWidgetSavingLocked2 3564 } = select(store2); 3565 return { 3566 hasEditedWidgetAreaIds: getEditedWidgetAreas2()?.length > 0, 3567 isSaving: isSavingWidgetAreas2(), 3568 isWidgetSaveLocked: isWidgetSavingLocked2() 3569 }; 3570 }, 3571 [] 3572 ); 3573 const { saveEditedWidgetAreas: saveEditedWidgetAreas2 } = (0, import_data19.useDispatch)(store2); 3574 const isDisabled = isWidgetSaveLocked || isSaving || !hasEditedWidgetAreaIds; 3575 return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)( 3576 import_components15.Button, 3577 { 3578 variant: "primary", 3579 isBusy: isSaving, 3580 "aria-disabled": isDisabled, 3581 onClick: isDisabled ? void 0 : saveEditedWidgetAreas2, 3582 size: "compact", 3583 children: isSaving ? (0, import_i18n12.__)("Saving\u2026") : (0, import_i18n12.__)("Update") 3584 } 3585 ); 3586 } 3587 var save_button_default = SaveButton; 3588 3589 // packages/edit-widgets/build-module/components/more-menu/index.mjs 3590 var import_components18 = __toESM(require_components(), 1); 3591 var import_element18 = __toESM(require_element(), 1); 3592 var import_i18n15 = __toESM(require_i18n(), 1); 3593 var import_preferences5 = __toESM(require_preferences(), 1); 3594 var import_keycodes5 = __toESM(require_keycodes(), 1); 3595 var import_keyboard_shortcuts5 = __toESM(require_keyboard_shortcuts(), 1); 3596 var import_compose7 = __toESM(require_compose(), 1); 3597 3598 // packages/edit-widgets/build-module/components/keyboard-shortcut-help-modal/index.mjs 3599 var import_components16 = __toESM(require_components(), 1); 3600 var import_i18n14 = __toESM(require_i18n(), 1); 3601 var import_keyboard_shortcuts4 = __toESM(require_keyboard_shortcuts(), 1); 3602 var import_data21 = __toESM(require_data(), 1); 3603 3604 // packages/edit-widgets/build-module/components/keyboard-shortcut-help-modal/config.mjs 3605 var import_i18n13 = __toESM(require_i18n(), 1); 3606 var textFormattingShortcuts = [ 3607 { 3608 keyCombination: { modifier: "primary", character: "b" }, 3609 description: (0, import_i18n13.__)("Make the selected text bold.") 3610 }, 3611 { 3612 keyCombination: { modifier: "primary", character: "i" }, 3613 description: (0, import_i18n13.__)("Make the selected text italic.") 3614 }, 3615 { 3616 keyCombination: { modifier: "primary", character: "k" }, 3617 description: (0, import_i18n13.__)("Convert the selected text into a link.") 3618 }, 3619 { 3620 keyCombination: { modifier: "primaryShift", character: "k" }, 3621 description: (0, import_i18n13.__)("Remove a link.") 3622 }, 3623 { 3624 keyCombination: { character: "[[" }, 3625 description: (0, import_i18n13.__)("Insert a link to a post or page.") 3626 }, 3627 { 3628 keyCombination: { modifier: "primary", character: "u" }, 3629 description: (0, import_i18n13.__)("Underline the selected text.") 3630 }, 3631 { 3632 keyCombination: { modifier: "access", character: "d" }, 3633 description: (0, import_i18n13.__)("Strikethrough the selected text.") 3634 }, 3635 { 3636 keyCombination: { modifier: "access", character: "x" }, 3637 description: (0, import_i18n13.__)("Make the selected text inline code.") 3638 }, 3639 { 3640 keyCombination: { 3641 modifier: "access", 3642 character: "0" 3643 }, 3644 aliases: [ 3645 { 3646 modifier: "access", 3647 character: "7" 3648 } 3649 ], 3650 description: (0, import_i18n13.__)("Convert the current heading to a paragraph.") 3651 }, 3652 { 3653 keyCombination: { modifier: "access", character: "1-6" }, 3654 description: (0, import_i18n13.__)( 3655 "Convert the current paragraph or heading to a heading of level 1 to 6." 3656 ) 3657 }, 3658 { 3659 keyCombination: { modifier: "primaryShift", character: "SPACE" }, 3660 description: (0, import_i18n13.__)("Add non breaking space.") 3661 } 3662 ]; 3663 3664 // packages/edit-widgets/build-module/components/keyboard-shortcut-help-modal/shortcut.mjs 3665 var import_element17 = __toESM(require_element(), 1); 3666 var import_keycodes4 = __toESM(require_keycodes(), 1); 3667 var import_jsx_runtime33 = __toESM(require_jsx_runtime(), 1); 3668 function KeyCombination({ keyCombination, forceAriaLabel }) { 3669 const shortcut = keyCombination.modifier ? import_keycodes4.displayShortcutList[keyCombination.modifier]( 3670 keyCombination.character 3671 ) : keyCombination.character; 3672 const ariaLabel = keyCombination.modifier ? import_keycodes4.shortcutAriaLabel[keyCombination.modifier]( 3673 keyCombination.character 3674 ) : keyCombination.character; 3675 const shortcuts = Array.isArray(shortcut) ? shortcut : [shortcut]; 3676 return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)( 3677 "kbd", 3678 { 3679 className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-key-combination", 3680 "aria-label": forceAriaLabel || ariaLabel, 3681 children: shortcuts.map((character, index) => { 3682 if (character === "+") { 3683 return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(import_element17.Fragment, { children: character }, index); 3684 } 3685 return /* @__PURE__ */ (0, import_jsx_runtime33.jsx)( 3686 "kbd", 3687 { 3688 className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-key", 3689 children: character 3690 }, 3691 index 3692 ); 3693 }) 3694 } 3695 ); 3696 } 3697 function Shortcut({ description, keyCombination, aliases = [], ariaLabel }) { 3698 return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(import_jsx_runtime33.Fragment, { children: [ 3699 /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-description", children: description }), 3700 /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-term", children: [ 3701 /* @__PURE__ */ (0, import_jsx_runtime33.jsx)( 3702 KeyCombination, 3703 { 3704 keyCombination, 3705 forceAriaLabel: ariaLabel 3706 } 3707 ), 3708 aliases.map((alias, index) => /* @__PURE__ */ (0, import_jsx_runtime33.jsx)( 3709 KeyCombination, 3710 { 3711 keyCombination: alias, 3712 forceAriaLabel: ariaLabel 3713 }, 3714 index 3715 )) 3716 ] }) 3717 ] }); 3718 } 3719 var shortcut_default = Shortcut; 3720 3721 // packages/edit-widgets/build-module/components/keyboard-shortcut-help-modal/dynamic-shortcut.mjs 3722 var import_data20 = __toESM(require_data(), 1); 3723 var import_keyboard_shortcuts3 = __toESM(require_keyboard_shortcuts(), 1); 3724 var import_jsx_runtime34 = __toESM(require_jsx_runtime(), 1); 3725 function DynamicShortcut({ name: name2 }) { 3726 const { keyCombination, description, aliases } = (0, import_data20.useSelect)( 3727 (select) => { 3728 const { 3729 getShortcutKeyCombination, 3730 getShortcutDescription, 3731 getShortcutAliases 3732 } = select(import_keyboard_shortcuts3.store); 3733 return { 3734 keyCombination: getShortcutKeyCombination(name2), 3735 aliases: getShortcutAliases(name2), 3736 description: getShortcutDescription(name2) 3737 }; 3738 }, 3739 [name2] 3740 ); 3741 if (!keyCombination) { 3742 return null; 3743 } 3744 return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)( 3745 shortcut_default, 3746 { 3747 keyCombination, 3748 description, 3749 aliases 3750 } 3751 ); 3752 } 3753 var dynamic_shortcut_default = DynamicShortcut; 3754 3755 // packages/edit-widgets/build-module/components/keyboard-shortcut-help-modal/index.mjs 3756 var import_jsx_runtime35 = __toESM(require_jsx_runtime(), 1); 3757 var ShortcutList = ({ shortcuts }) => ( 3758 /* 3759 * Disable reason: The `list` ARIA role is redundant but 3760 * Safari+VoiceOver won't announce the list otherwise. 3761 */ 3762 /* eslint-disable jsx-a11y/no-redundant-roles */ 3763 /* @__PURE__ */ (0, import_jsx_runtime35.jsx)( 3764 "ul", 3765 { 3766 className: "edit-widgets-keyboard-shortcut-help-modal__shortcut-list", 3767 role: "list", 3768 children: shortcuts.map((shortcut, index) => /* @__PURE__ */ (0, import_jsx_runtime35.jsx)( 3769 "li", 3770 { 3771 className: "edit-widgets-keyboard-shortcut-help-modal__shortcut", 3772 children: typeof shortcut === "string" ? /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(dynamic_shortcut_default, { name: shortcut }) : /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(shortcut_default, { ...shortcut }) 3773 }, 3774 index 3775 )) 3776 } 3777 ) 3778 ); 3779 var ShortcutSection = ({ title, shortcuts, className }) => /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)( 3780 "section", 3781 { 3782 className: clsx_default( 3783 "edit-widgets-keyboard-shortcut-help-modal__section", 3784 className 3785 ), 3786 children: [ 3787 !!title && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("h2", { className: "edit-widgets-keyboard-shortcut-help-modal__section-title", children: title }), 3788 /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(ShortcutList, { shortcuts }) 3789 ] 3790 } 3791 ); 3792 var ShortcutCategorySection = ({ 3793 title, 3794 categoryName, 3795 additionalShortcuts = [] 3796 }) => { 3797 const categoryShortcuts = (0, import_data21.useSelect)( 3798 (select) => { 3799 return select(import_keyboard_shortcuts4.store).getCategoryShortcuts( 3800 categoryName 3801 ); 3802 }, 3803 [categoryName] 3804 ); 3805 return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)( 3806 ShortcutSection, 3807 { 3808 title, 3809 shortcuts: categoryShortcuts.concat(additionalShortcuts) 3810 } 3811 ); 3812 }; 3813 function KeyboardShortcutHelpModal({ 3814 isModalActive: isModalActive2, 3815 toggleModal 3816 }) { 3817 (0, import_keyboard_shortcuts4.useShortcut)("core/edit-widgets/keyboard-shortcuts", toggleModal, { 3818 bindGlobal: true 3819 }); 3820 if (!isModalActive2) { 3821 return null; 3822 } 3823 return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)( 3824 import_components16.Modal, 3825 { 3826 className: "edit-widgets-keyboard-shortcut-help-modal", 3827 title: (0, import_i18n14.__)("Keyboard shortcuts"), 3828 onRequestClose: toggleModal, 3829 children: [ 3830 /* @__PURE__ */ (0, import_jsx_runtime35.jsx)( 3831 ShortcutSection, 3832 { 3833 className: "edit-widgets-keyboard-shortcut-help-modal__main-shortcuts", 3834 shortcuts: ["core/edit-widgets/keyboard-shortcuts"] 3835 } 3836 ), 3837 /* @__PURE__ */ (0, import_jsx_runtime35.jsx)( 3838 ShortcutCategorySection, 3839 { 3840 title: (0, import_i18n14.__)("Global shortcuts"), 3841 categoryName: "global" 3842 } 3843 ), 3844 /* @__PURE__ */ (0, import_jsx_runtime35.jsx)( 3845 ShortcutCategorySection, 3846 { 3847 title: (0, import_i18n14.__)("Selection shortcuts"), 3848 categoryName: "selection" 3849 } 3850 ), 3851 /* @__PURE__ */ (0, import_jsx_runtime35.jsx)( 3852 ShortcutCategorySection, 3853 { 3854 title: (0, import_i18n14.__)("Block shortcuts"), 3855 categoryName: "block", 3856 additionalShortcuts: [ 3857 { 3858 keyCombination: { character: "/" }, 3859 description: (0, import_i18n14.__)( 3860 "Change the block type after adding a new paragraph." 3861 ), 3862 /* translators: The forward-slash character. e.g. '/'. */ 3863 ariaLabel: (0, import_i18n14.__)("Forward-slash") 3864 } 3865 ] 3866 } 3867 ), 3868 /* @__PURE__ */ (0, import_jsx_runtime35.jsx)( 3869 ShortcutSection, 3870 { 3871 title: (0, import_i18n14.__)("Text formatting"), 3872 shortcuts: textFormattingShortcuts 3873 } 3874 ), 3875 /* @__PURE__ */ (0, import_jsx_runtime35.jsx)( 3876 ShortcutCategorySection, 3877 { 3878 title: (0, import_i18n14.__)("List View shortcuts"), 3879 categoryName: "list-view" 3880 } 3881 ) 3882 ] 3883 } 3884 ); 3885 } 3886 3887 // packages/edit-widgets/build-module/components/more-menu/tools-more-menu-group.mjs 3888 var import_components17 = __toESM(require_components(), 1); 3889 var import_jsx_runtime36 = __toESM(require_jsx_runtime(), 1); 3890 var { Fill: ToolsMoreMenuGroup, Slot: Slot4 } = (0, import_components17.createSlotFill)( 3891 "EditWidgetsToolsMoreMenuGroup" 3892 ); 3893 ToolsMoreMenuGroup.Slot = ({ fillProps }) => /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(Slot4, { fillProps, children: (fills) => fills.length > 0 && fills }); 3894 var tools_more_menu_group_default = ToolsMoreMenuGroup; 3895 3896 // packages/edit-widgets/build-module/components/more-menu/index.mjs 3897 var import_jsx_runtime37 = __toESM(require_jsx_runtime(), 1); 3898 function MoreMenu() { 3899 const [ 3900 isKeyboardShortcutsModalActive, 3901 setIsKeyboardShortcutsModalVisible 3902 ] = (0, import_element18.useState)(false); 3903 const toggleKeyboardShortcutsModal = () => setIsKeyboardShortcutsModalVisible(!isKeyboardShortcutsModalActive); 3904 (0, import_keyboard_shortcuts5.useShortcut)( 3905 "core/edit-widgets/keyboard-shortcuts", 3906 toggleKeyboardShortcutsModal 3907 ); 3908 const isLargeViewport = (0, import_compose7.useViewportMatch)("medium"); 3909 return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [ 3910 /* @__PURE__ */ (0, import_jsx_runtime37.jsx)( 3911 import_components18.DropdownMenu, 3912 { 3913 icon: more_vertical_default, 3914 label: (0, import_i18n15.__)("Options"), 3915 popoverProps: { 3916 placement: "bottom-end", 3917 className: "more-menu-dropdown__content" 3918 }, 3919 toggleProps: { 3920 tooltipPosition: "bottom", 3921 size: "compact" 3922 }, 3923 children: (onClose) => /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_jsx_runtime37.Fragment, { children: [ 3924 isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_components18.MenuGroup, { label: (0, import_i18n15._x)("View", "noun"), children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)( 3925 import_preferences5.PreferenceToggleMenuItem, 3926 { 3927 scope: "core/edit-widgets", 3928 name: "fixedToolbar", 3929 label: (0, import_i18n15.__)("Top toolbar"), 3930 info: (0, import_i18n15.__)( 3931 "Access all block and document tools in a single place" 3932 ), 3933 messageActivated: (0, import_i18n15.__)( 3934 "Top toolbar activated" 3935 ), 3936 messageDeactivated: (0, import_i18n15.__)( 3937 "Top toolbar deactivated" 3938 ) 3939 } 3940 ) }), 3941 /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_components18.MenuGroup, { label: (0, import_i18n15.__)("Tools"), children: [ 3942 /* @__PURE__ */ (0, import_jsx_runtime37.jsx)( 3943 import_components18.MenuItem, 3944 { 3945 onClick: () => { 3946 setIsKeyboardShortcutsModalVisible(true); 3947 }, 3948 shortcut: import_keycodes5.displayShortcut.access("h"), 3949 children: (0, import_i18n15.__)("Keyboard shortcuts") 3950 } 3951 ), 3952 /* @__PURE__ */ (0, import_jsx_runtime37.jsx)( 3953 import_preferences5.PreferenceToggleMenuItem, 3954 { 3955 scope: "core/edit-widgets", 3956 name: "welcomeGuide", 3957 label: (0, import_i18n15.__)("Welcome Guide") 3958 } 3959 ), 3960 /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)( 3961 import_components18.MenuItem, 3962 { 3963 role: "menuitem", 3964 icon: external_default, 3965 href: (0, import_i18n15.__)( 3966 "https://wordpress.org/documentation/article/block-based-widgets-editor/" 3967 ), 3968 target: "_blank", 3969 rel: "noopener", 3970 children: [ 3971 (0, import_i18n15.__)("Help"), 3972 /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(VisuallyHidden, { 3973 render: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("span", {}), 3974 /* translators: accessibility text */ 3975 children: (0, import_i18n15.__)("(opens in a new tab)") 3976 }) 3977 ] 3978 } 3979 ), 3980 /* @__PURE__ */ (0, import_jsx_runtime37.jsx)( 3981 tools_more_menu_group_default.Slot, 3982 { 3983 fillProps: { onClose } 3984 } 3985 ) 3986 ] }), 3987 /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_components18.MenuGroup, { label: (0, import_i18n15.__)("Preferences"), children: [ 3988 /* @__PURE__ */ (0, import_jsx_runtime37.jsx)( 3989 import_preferences5.PreferenceToggleMenuItem, 3990 { 3991 scope: "core/edit-widgets", 3992 name: "keepCaretInsideBlock", 3993 label: (0, import_i18n15.__)( 3994 "Contain text cursor inside block" 3995 ), 3996 info: (0, import_i18n15.__)( 3997 "Aids screen readers by stopping text caret from leaving blocks." 3998 ), 3999 messageActivated: (0, import_i18n15.__)( 4000 "Contain text cursor inside block activated" 4001 ), 4002 messageDeactivated: (0, import_i18n15.__)( 4003 "Contain text cursor inside block deactivated" 4004 ) 4005 } 4006 ), 4007 /* @__PURE__ */ (0, import_jsx_runtime37.jsx)( 4008 import_preferences5.PreferenceToggleMenuItem, 4009 { 4010 scope: "core/edit-widgets", 4011 name: "themeStyles", 4012 info: (0, import_i18n15.__)( 4013 "Make the editor look like your theme." 4014 ), 4015 label: (0, import_i18n15.__)("Use theme styles") 4016 } 4017 ), 4018 isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)( 4019 import_preferences5.PreferenceToggleMenuItem, 4020 { 4021 scope: "core/edit-widgets", 4022 name: "showBlockBreadcrumbs", 4023 label: (0, import_i18n15.__)("Display block breadcrumbs"), 4024 info: (0, import_i18n15.__)( 4025 "Shows block breadcrumbs at the bottom of the editor." 4026 ), 4027 messageActivated: (0, import_i18n15.__)( 4028 "Display block breadcrumbs activated" 4029 ), 4030 messageDeactivated: (0, import_i18n15.__)( 4031 "Display block breadcrumbs deactivated" 4032 ) 4033 } 4034 ) 4035 ] }) 4036 ] }) 4037 } 4038 ), 4039 /* @__PURE__ */ (0, import_jsx_runtime37.jsx)( 4040 KeyboardShortcutHelpModal, 4041 { 4042 isModalActive: isKeyboardShortcutsModalActive, 4043 toggleModal: toggleKeyboardShortcutsModal 4044 } 4045 ) 4046 ] }); 4047 } 4048 4049 // packages/edit-widgets/build-module/components/header/index.mjs 4050 var import_jsx_runtime38 = __toESM(require_jsx_runtime(), 1); 4051 function Header() { 4052 const isLargeViewport = (0, import_compose8.useViewportMatch)("medium"); 4053 const blockToolbarRef = (0, import_element19.useRef)(); 4054 const { hasFixedToolbar } = (0, import_data22.useSelect)( 4055 (select) => ({ 4056 hasFixedToolbar: !!select(import_preferences6.store).get( 4057 "core/edit-widgets", 4058 "fixedToolbar" 4059 ) 4060 }), 4061 [] 4062 ); 4063 return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_jsx_runtime38.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "edit-widgets-header", children: [ 4064 /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "edit-widgets-header__navigable-toolbar-wrapper", children: [ 4065 isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h1", { className: "edit-widgets-header__title", children: (0, import_i18n16.__)("Widgets") }), 4066 !isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( 4067 VisuallyHidden, 4068 { 4069 className: "edit-widgets-header__title", 4070 render: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h1", {}), 4071 children: (0, import_i18n16.__)("Widgets") 4072 } 4073 ), 4074 /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(document_tools_default, {}), 4075 hasFixedToolbar && isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(import_jsx_runtime38.Fragment, { children: [ 4076 /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("div", { className: "selected-block-tools-wrapper", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(import_block_editor12.BlockToolbar, { hideDragHandle: true }) }), 4077 /* @__PURE__ */ (0, import_jsx_runtime38.jsx)( 4078 import_components19.Popover.Slot, 4079 { 4080 ref: blockToolbarRef, 4081 name: "block-toolbar" 4082 } 4083 ) 4084 ] }) 4085 ] }), 4086 /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "edit-widgets-header__actions", children: [ 4087 /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(pinned_items_default.Slot, { scope: "core/edit-widgets" }), 4088 /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(save_button_default, {}), 4089 /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(MoreMenu, {}) 4090 ] }) 4091 ] }) }); 4092 } 4093 var header_default = Header; 4094 4095 // packages/edit-widgets/build-module/components/widget-areas-block-editor-content/index.mjs 4096 var import_block_editor13 = __toESM(require_block_editor(), 1); 4097 var import_compose9 = __toESM(require_compose(), 1); 4098 var import_data23 = __toESM(require_data(), 1); 4099 var import_element20 = __toESM(require_element(), 1); 4100 var import_preferences7 = __toESM(require_preferences(), 1); 4101 4102 // packages/edit-widgets/build-module/components/notices/index.mjs 4103 var import_notices2 = __toESM(require_notices(), 1); 4104 var import_jsx_runtime39 = __toESM(require_jsx_runtime(), 1); 4105 function Notices() { 4106 return /* @__PURE__ */ (0, import_jsx_runtime39.jsxs)(import_jsx_runtime39.Fragment, { children: [ 4107 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)( 4108 import_notices2.InlineNotices, 4109 { 4110 pinnedNoticesClassName: "edit-widgets-notices__pinned", 4111 dismissibleNoticesClassName: "edit-widgets-notices__dismissible" 4112 } 4113 ), 4114 /* @__PURE__ */ (0, import_jsx_runtime39.jsx)(import_notices2.SnackbarNotices, { className: "edit-widgets-notices__snackbar" }) 4115 ] }); 4116 } 4117 var notices_default = Notices; 4118 4119 // packages/edit-widgets/build-module/components/widget-areas-block-editor-content/index.mjs 4120 var import_jsx_runtime40 = __toESM(require_jsx_runtime(), 1); 4121 function WidgetAreasBlockEditorContent({ 4122 blockEditorSettings 4123 }) { 4124 const hasThemeStyles = (0, import_data23.useSelect)( 4125 (select) => !!select(import_preferences7.store).get( 4126 "core/edit-widgets", 4127 "themeStyles" 4128 ), 4129 [] 4130 ); 4131 const isLargeViewport = (0, import_compose9.useViewportMatch)("medium"); 4132 const styles = (0, import_element20.useMemo)(() => { 4133 return hasThemeStyles ? blockEditorSettings.styles : []; 4134 }, [blockEditorSettings, hasThemeStyles]); 4135 return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: "edit-widgets-block-editor", children: [ 4136 /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(notices_default, {}), 4137 !isLargeViewport && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_block_editor13.BlockToolbar, { hideDragHandle: true }), 4138 /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_block_editor13.BlockTools, { children: [ 4139 /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(keyboard_shortcuts_default, {}), 4140 /* @__PURE__ */ (0, import_jsx_runtime40.jsx)( 4141 import_block_editor13.__unstableEditorStyles, 4142 { 4143 styles, 4144 scope: ":where(.editor-styles-wrapper)" 4145 } 4146 ), 4147 /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_block_editor13.BlockSelectionClearer, { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_block_editor13.WritingFlow, { children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_block_editor13.BlockList, { className: "edit-widgets-main-block-list" }) }) }) 4148 ] }) 4149 ] }); 4150 } 4151 4152 // packages/edit-widgets/build-module/components/secondary-sidebar/index.mjs 4153 var import_data27 = __toESM(require_data(), 1); 4154 4155 // packages/edit-widgets/build-module/components/secondary-sidebar/inserter-sidebar.mjs 4156 var import_block_editor15 = __toESM(require_block_editor(), 1); 4157 var import_compose10 = __toESM(require_compose(), 1); 4158 var import_element21 = __toESM(require_element(), 1); 4159 var import_data25 = __toESM(require_data(), 1); 4160 4161 // packages/edit-widgets/build-module/hooks/use-widget-library-insertion-point.mjs 4162 var import_data24 = __toESM(require_data(), 1); 4163 var import_block_editor14 = __toESM(require_block_editor(), 1); 4164 var import_core_data11 = __toESM(require_core_data(), 1); 4165 var useWidgetLibraryInsertionPoint = () => { 4166 const firstRootId = (0, import_data24.useSelect)((select) => { 4167 const { getEntityRecord } = select(import_core_data11.store); 4168 const widgetAreasPost = getEntityRecord( 4169 KIND, 4170 POST_TYPE, 4171 buildWidgetAreasPostId() 4172 ); 4173 return widgetAreasPost?.blocks[0]?.clientId; 4174 }, []); 4175 return (0, import_data24.useSelect)( 4176 (select) => { 4177 const { 4178 getBlockRootClientId, 4179 getBlockSelectionEnd, 4180 getBlockOrder, 4181 getBlockIndex 4182 } = select(import_block_editor14.store); 4183 const insertionPoint = select(store2).__experimentalGetInsertionPoint(); 4184 if (insertionPoint.rootClientId) { 4185 return insertionPoint; 4186 } 4187 const clientId = getBlockSelectionEnd() || firstRootId; 4188 const rootClientId = getBlockRootClientId(clientId); 4189 if (clientId && rootClientId === "") { 4190 return { 4191 rootClientId: clientId, 4192 insertionIndex: getBlockOrder(clientId).length 4193 }; 4194 } 4195 return { 4196 rootClientId, 4197 insertionIndex: getBlockIndex(clientId) + 1 4198 }; 4199 }, 4200 [firstRootId] 4201 ); 4202 }; 4203 var use_widget_library_insertion_point_default = useWidgetLibraryInsertionPoint; 4204 4205 // packages/edit-widgets/build-module/components/secondary-sidebar/inserter-sidebar.mjs 4206 var import_jsx_runtime41 = __toESM(require_jsx_runtime(), 1); 4207 function InserterSidebar() { 4208 const isMobileViewport = (0, import_compose10.useViewportMatch)("medium", "<"); 4209 const { rootClientId, insertionIndex } = use_widget_library_insertion_point_default(); 4210 const { setIsInserterOpened: setIsInserterOpened2 } = (0, import_data25.useDispatch)(store2); 4211 const closeInserter = (0, import_element21.useCallback)(() => { 4212 return setIsInserterOpened2(false); 4213 }, [setIsInserterOpened2]); 4214 const libraryRef = (0, import_element21.useRef)(); 4215 return /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "edit-widgets-layout__inserter-panel", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)("div", { className: "edit-widgets-layout__inserter-panel-content", children: /* @__PURE__ */ (0, import_jsx_runtime41.jsx)( 4216 import_block_editor15.__experimentalLibrary, 4217 { 4218 showInserterHelpPanel: true, 4219 shouldFocusBlock: isMobileViewport, 4220 rootClientId, 4221 __experimentalInsertionIndex: insertionIndex, 4222 ref: libraryRef, 4223 onClose: closeInserter 4224 } 4225 ) }) }); 4226 } 4227 4228 // packages/edit-widgets/build-module/components/secondary-sidebar/list-view-sidebar.mjs 4229 var import_block_editor16 = __toESM(require_block_editor(), 1); 4230 var import_components20 = __toESM(require_components(), 1); 4231 var import_compose11 = __toESM(require_compose(), 1); 4232 var import_data26 = __toESM(require_data(), 1); 4233 var import_element22 = __toESM(require_element(), 1); 4234 var import_i18n17 = __toESM(require_i18n(), 1); 4235 var import_keycodes6 = __toESM(require_keycodes(), 1); 4236 var import_jsx_runtime42 = __toESM(require_jsx_runtime(), 1); 4237 function ListViewSidebar() { 4238 const { setIsListViewOpened: setIsListViewOpened2 } = (0, import_data26.useDispatch)(store2); 4239 const { getListViewToggleRef: getListViewToggleRef2 } = unlock((0, import_data26.useSelect)(store2)); 4240 const [dropZoneElement, setDropZoneElement] = (0, import_element22.useState)(null); 4241 const focusOnMountRef = (0, import_compose11.useFocusOnMount)("firstElement"); 4242 const closeListView = (0, import_element22.useCallback)(() => { 4243 setIsListViewOpened2(false); 4244 getListViewToggleRef2().current?.focus(); 4245 }, [getListViewToggleRef2, setIsListViewOpened2]); 4246 const closeOnEscape = (0, import_element22.useCallback)( 4247 (event) => { 4248 if (event.keyCode === import_keycodes6.ESCAPE && !event.defaultPrevented) { 4249 event.preventDefault(); 4250 closeListView(); 4251 } 4252 }, 4253 [closeListView] 4254 ); 4255 return ( 4256 // eslint-disable-next-line jsx-a11y/no-static-element-interactions 4257 /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)( 4258 "div", 4259 { 4260 className: "edit-widgets-editor__list-view-panel", 4261 onKeyDown: closeOnEscape, 4262 children: [ 4263 /* @__PURE__ */ (0, import_jsx_runtime42.jsxs)("div", { className: "edit-widgets-editor__list-view-panel-header", children: [ 4264 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)("strong", { children: (0, import_i18n17.__)("List View") }), 4265 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)( 4266 import_components20.Button, 4267 { 4268 icon: close_small_default, 4269 label: (0, import_i18n17.__)("Close"), 4270 onClick: closeListView, 4271 size: "compact" 4272 } 4273 ) 4274 ] }), 4275 /* @__PURE__ */ (0, import_jsx_runtime42.jsx)( 4276 "div", 4277 { 4278 className: "edit-widgets-editor__list-view-panel-content", 4279 ref: (0, import_compose11.useMergeRefs)([focusOnMountRef, setDropZoneElement]), 4280 children: /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(import_block_editor16.__experimentalListView, { dropZoneElement }) 4281 } 4282 ) 4283 ] 4284 } 4285 ) 4286 ); 4287 } 4288 4289 // packages/edit-widgets/build-module/components/secondary-sidebar/index.mjs 4290 var import_jsx_runtime43 = __toESM(require_jsx_runtime(), 1); 4291 function SecondarySidebar() { 4292 const { isInserterOpen, isListViewOpen } = (0, import_data27.useSelect)((select) => { 4293 const { isInserterOpened: isInserterOpened2, isListViewOpened: isListViewOpened2 } = select(store2); 4294 return { 4295 isInserterOpen: isInserterOpened2(), 4296 isListViewOpen: isListViewOpened2() 4297 }; 4298 }, []); 4299 if (isInserterOpen) { 4300 return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(InserterSidebar, {}); 4301 } 4302 if (isListViewOpen) { 4303 return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(ListViewSidebar, {}); 4304 } 4305 return null; 4306 } 4307 4308 // packages/edit-widgets/build-module/components/layout/interface.mjs 4309 var import_jsx_runtime44 = __toESM(require_jsx_runtime(), 1); 4310 var interfaceLabels = { 4311 /* translators: accessibility text for the widgets screen top bar landmark region. */ 4312 header: (0, import_i18n18.__)("Widgets top bar"), 4313 /* translators: accessibility text for the widgets screen content landmark region. */ 4314 body: (0, import_i18n18.__)("Widgets and blocks"), 4315 /* translators: accessibility text for the widgets screen settings landmark region. */ 4316 sidebar: (0, import_i18n18.__)("Widgets settings"), 4317 /* translators: accessibility text for the widgets screen footer landmark region. */ 4318 footer: (0, import_i18n18.__)("Widgets footer") 4319 }; 4320 function Interface({ blockEditorSettings }) { 4321 const isMobileViewport = (0, import_compose12.useViewportMatch)("medium", "<"); 4322 const isHugeViewport = (0, import_compose12.useViewportMatch)("huge", ">="); 4323 const { setIsInserterOpened: setIsInserterOpened2, setIsListViewOpened: setIsListViewOpened2, closeGeneralSidebar: closeGeneralSidebar2 } = (0, import_data28.useDispatch)(store2); 4324 const { 4325 hasBlockBreadCrumbsEnabled, 4326 hasSidebarEnabled, 4327 isInserterOpened: isInserterOpened2, 4328 isListViewOpened: isListViewOpened2 4329 } = (0, import_data28.useSelect)( 4330 (select) => ({ 4331 hasSidebarEnabled: !!select( 4332 store 4333 ).getActiveComplementaryArea(store2.name), 4334 isInserterOpened: !!select(store2).isInserterOpened(), 4335 isListViewOpened: !!select(store2).isListViewOpened(), 4336 hasBlockBreadCrumbsEnabled: !!select(import_preferences8.store).get( 4337 "core/edit-widgets", 4338 "showBlockBreadcrumbs" 4339 ) 4340 }), 4341 [] 4342 ); 4343 (0, import_element23.useEffect)(() => { 4344 if (hasSidebarEnabled && !isHugeViewport) { 4345 setIsInserterOpened2(false); 4346 setIsListViewOpened2(false); 4347 } 4348 }, [hasSidebarEnabled, isHugeViewport]); 4349 (0, import_element23.useEffect)(() => { 4350 if ((isInserterOpened2 || isListViewOpened2) && !isHugeViewport) { 4351 closeGeneralSidebar2(); 4352 } 4353 }, [isInserterOpened2, isListViewOpened2, isHugeViewport]); 4354 const secondarySidebarLabel = isListViewOpened2 ? (0, import_i18n18.__)("List View") : (0, import_i18n18.__)("Block Library"); 4355 const hasSecondarySidebar = isListViewOpened2 || isInserterOpened2; 4356 return /* @__PURE__ */ (0, import_jsx_runtime44.jsx)( 4357 interface_skeleton_default, 4358 { 4359 labels: { 4360 ...interfaceLabels, 4361 secondarySidebar: secondarySidebarLabel 4362 }, 4363 header: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(header_default, {}), 4364 secondarySidebar: hasSecondarySidebar && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(SecondarySidebar, {}), 4365 sidebar: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(complementary_area_default.Slot, { scope: "core/edit-widgets" }), 4366 content: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_jsx_runtime44.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)( 4367 WidgetAreasBlockEditorContent, 4368 { 4369 blockEditorSettings 4370 } 4371 ) }), 4372 footer: hasBlockBreadCrumbsEnabled && !isMobileViewport && /* @__PURE__ */ (0, import_jsx_runtime44.jsx)("div", { className: "edit-widgets-layout__footer", children: /* @__PURE__ */ (0, import_jsx_runtime44.jsx)(import_block_editor17.BlockBreadcrumb, { rootLabelText: (0, import_i18n18.__)("Widgets") }) }) 4373 } 4374 ); 4375 } 4376 var interface_default = Interface; 4377 4378 // packages/edit-widgets/build-module/components/layout/unsaved-changes-warning.mjs 4379 var import_i18n19 = __toESM(require_i18n(), 1); 4380 var import_element24 = __toESM(require_element(), 1); 4381 var import_data29 = __toESM(require_data(), 1); 4382 function UnsavedChangesWarning() { 4383 const isDirty = (0, import_data29.useSelect)((select) => { 4384 const { getEditedWidgetAreas: getEditedWidgetAreas2 } = select(store2); 4385 const editedWidgetAreas = getEditedWidgetAreas2(); 4386 return editedWidgetAreas?.length > 0; 4387 }, []); 4388 (0, import_element24.useEffect)(() => { 4389 const warnIfUnsavedChanges = (event) => { 4390 if (isDirty) { 4391 event.returnValue = (0, import_i18n19.__)( 4392 "You have unsaved changes. If you proceed, they will be lost." 4393 ); 4394 return event.returnValue; 4395 } 4396 }; 4397 window.addEventListener("beforeunload", warnIfUnsavedChanges); 4398 return () => { 4399 window.removeEventListener("beforeunload", warnIfUnsavedChanges); 4400 }; 4401 }, [isDirty]); 4402 return null; 4403 } 4404 4405 // packages/edit-widgets/build-module/components/welcome-guide/index.mjs 4406 var import_data30 = __toESM(require_data(), 1); 4407 var import_components21 = __toESM(require_components(), 1); 4408 var import_i18n20 = __toESM(require_i18n(), 1); 4409 var import_element25 = __toESM(require_element(), 1); 4410 var import_preferences9 = __toESM(require_preferences(), 1); 4411 var import_jsx_runtime45 = __toESM(require_jsx_runtime(), 1); 4412 function WelcomeGuide() { 4413 const isActive = (0, import_data30.useSelect)( 4414 (select) => !!select(import_preferences9.store).get( 4415 "core/edit-widgets", 4416 "welcomeGuide" 4417 ), 4418 [] 4419 ); 4420 const { toggle } = (0, import_data30.useDispatch)(import_preferences9.store); 4421 const widgetAreas = (0, import_data30.useSelect)( 4422 (select) => select(store2).getWidgetAreas({ per_page: -1 }), 4423 [] 4424 ); 4425 if (!isActive) { 4426 return null; 4427 } 4428 const isEntirelyBlockWidgets = widgetAreas?.every( 4429 (widgetArea) => widgetArea.id === "wp_inactive_widgets" || widgetArea.widgets.every( 4430 (widgetId) => widgetId.startsWith("block-") 4431 ) 4432 ); 4433 const numWidgetAreas = widgetAreas?.filter( 4434 (widgetArea) => widgetArea.id !== "wp_inactive_widgets" 4435 ).length ?? 0; 4436 return /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 4437 import_components21.Guide, 4438 { 4439 className: "edit-widgets-welcome-guide", 4440 contentLabel: (0, import_i18n20.__)("Welcome to block Widgets"), 4441 finishButtonText: (0, import_i18n20.__)("Get started"), 4442 onFinish: () => toggle("core/edit-widgets", "welcomeGuide"), 4443 pages: [ 4444 { 4445 image: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 4446 WelcomeGuideImage, 4447 { 4448 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.svg", 4449 animatedSrc: "https://s.w.org/images/block-editor/welcome-canvas.gif" 4450 } 4451 ), 4452 content: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [ 4453 /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("h1", { className: "edit-widgets-welcome-guide__heading", children: (0, import_i18n20.__)("Welcome to block Widgets") }), 4454 isEntirelyBlockWidgets ? /* @__PURE__ */ (0, import_jsx_runtime45.jsx)(import_jsx_runtime45.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0, import_i18n20.sprintf)( 4455 // Translators: %s: Number of block areas in the current theme. 4456 (0, import_i18n20._n)( 4457 "Your theme provides %s \u201Cblock\u201D area 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.", 4458 "Your theme provides %s 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.", 4459 numWidgetAreas 4460 ), 4461 numWidgetAreas 4462 ) }) }) : /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [ 4463 /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0, import_i18n20.__)( 4464 "You can now add any block to your site\u2019s widget areas. Don\u2019t worry, all of your favorite widgets still work flawlessly." 4465 ) }), 4466 /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("p", { className: "edit-widgets-welcome-guide__text", children: [ 4467 /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("strong", { children: (0, import_i18n20.__)( 4468 "Want to stick with the old widgets?" 4469 ) }), 4470 " ", 4471 /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 4472 import_components21.ExternalLink, 4473 { 4474 href: (0, import_i18n20.__)( 4475 "https://wordpress.org/plugins/classic-widgets/" 4476 ), 4477 children: (0, import_i18n20.__)( 4478 "Get the Classic Widgets plugin." 4479 ) 4480 } 4481 ) 4482 ] }) 4483 ] }) 4484 ] }) 4485 }, 4486 { 4487 image: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 4488 WelcomeGuideImage, 4489 { 4490 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-editor.svg", 4491 animatedSrc: "https://s.w.org/images/block-editor/welcome-editor.gif" 4492 } 4493 ), 4494 content: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [ 4495 /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("h1", { className: "edit-widgets-welcome-guide__heading", children: (0, import_i18n20.__)("Customize each block") }), 4496 /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0, import_i18n20.__)( 4497 "Each block comes with its own set of controls for changing things like color, width, and alignment. These will show and hide automatically when you have a block selected." 4498 ) }) 4499 ] }) 4500 }, 4501 { 4502 image: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 4503 WelcomeGuideImage, 4504 { 4505 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-library.svg", 4506 animatedSrc: "https://s.w.org/images/block-editor/welcome-library.gif" 4507 } 4508 ), 4509 content: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [ 4510 /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("h1", { className: "edit-widgets-welcome-guide__heading", children: (0, import_i18n20.__)("Explore all blocks") }), 4511 /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0, import_element25.createInterpolateElement)( 4512 (0, import_i18n20.__)( 4513 "All of the blocks available to you live in the block library. You\u2019ll find it wherever you see the <InserterIconImage /> icon." 4514 ), 4515 { 4516 InserterIconImage: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 4517 "img", 4518 { 4519 className: "edit-widgets-welcome-guide__inserter-icon", 4520 alt: (0, import_i18n20.__)("inserter"), 4521 src: "data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 18 18' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='18' height='18' rx='2' fill='%231E1E1E'/%3E%3Cpath d='M9.22727 4V14M4 8.77273H14' stroke='white' stroke-width='1.5'/%3E%3C/svg%3E%0A" 4522 } 4523 ) 4524 } 4525 ) }) 4526 ] }) 4527 }, 4528 { 4529 image: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 4530 WelcomeGuideImage, 4531 { 4532 nonAnimatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.svg", 4533 animatedSrc: "https://s.w.org/images/block-editor/welcome-documentation.gif" 4534 } 4535 ), 4536 content: /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)(import_jsx_runtime45.Fragment, { children: [ 4537 /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("h1", { className: "edit-widgets-welcome-guide__heading", children: (0, import_i18n20.__)("Learn more") }), 4538 /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("p", { className: "edit-widgets-welcome-guide__text", children: (0, import_element25.createInterpolateElement)( 4539 (0, import_i18n20.__)( 4540 "New to the block editor? Want to learn more about using it? <a>Here's a detailed guide.</a>" 4541 ), 4542 { 4543 a: /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 4544 import_components21.ExternalLink, 4545 { 4546 href: (0, import_i18n20.__)( 4547 "https://wordpress.org/documentation/article/wordpress-block-editor/" 4548 ) 4549 } 4550 ) 4551 } 4552 ) }) 4553 ] }) 4554 } 4555 ] 4556 } 4557 ); 4558 } 4559 function WelcomeGuideImage({ nonAnimatedSrc, animatedSrc }) { 4560 return /* @__PURE__ */ (0, import_jsx_runtime45.jsxs)("picture", { className: "edit-widgets-welcome-guide__image", children: [ 4561 /* @__PURE__ */ (0, import_jsx_runtime45.jsx)( 4562 "source", 4563 { 4564 srcSet: nonAnimatedSrc, 4565 media: "(prefers-reduced-motion: reduce)" 4566 } 4567 ), 4568 /* @__PURE__ */ (0, import_jsx_runtime45.jsx)("img", { src: animatedSrc, width: "312", height: "240", alt: "" }) 4569 ] }); 4570 } 4571 4572 // packages/edit-widgets/build-module/components/layout/index.mjs 4573 var import_jsx_runtime46 = __toESM(require_jsx_runtime(), 1); 4574 function Layout({ blockEditorSettings }) { 4575 const { createErrorNotice } = (0, import_data31.useDispatch)(import_notices4.store); 4576 function onPluginAreaError(name2) { 4577 createErrorNotice( 4578 (0, import_i18n21.sprintf)( 4579 /* translators: %s: plugin name */ 4580 (0, import_i18n21.__)( 4581 'The "%s" plugin has encountered an error and cannot be rendered.' 4582 ), 4583 name2 4584 ) 4585 ); 4586 } 4587 const navigateRegionsProps = (0, import_components22.__unstableUseNavigateRegions)(); 4588 return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ErrorBoundary, { children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)( 4589 "div", 4590 { 4591 className: navigateRegionsProps.className, 4592 ...navigateRegionsProps, 4593 ref: navigateRegionsProps.ref, 4594 children: /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)( 4595 WidgetAreasBlockEditorProvider, 4596 { 4597 blockEditorSettings, 4598 children: [ 4599 /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(interface_default, { blockEditorSettings }), 4600 /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Sidebar, {}), 4601 /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_plugins3.PluginArea, { onError: onPluginAreaError }), 4602 /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(UnsavedChangesWarning, {}), 4603 /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(WelcomeGuide, {}) 4604 ] 4605 } 4606 ) 4607 } 4608 ) }); 4609 } 4610 var layout_default = Layout; 4611 4612 // packages/edit-widgets/build-module/index.mjs 4613 var import_jsx_runtime47 = __toESM(require_jsx_runtime(), 1); 4614 var disabledBlocks = [ 4615 "core/more", 4616 "core/freeform", 4617 "core/template-part", 4618 ...ALLOW_REUSABLE_BLOCKS ? [] : ["core/block"] 4619 ]; 4620 function initializeEditor(id, settings2) { 4621 const target = document.getElementById(id); 4622 const root = (0, import_element26.createRoot)(target); 4623 const coreBlocks = (0, import_block_library2.__experimentalGetCoreBlocks)().filter((block) => { 4624 return !(disabledBlocks.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")); 4625 }); 4626 (0, import_data32.dispatch)(import_preferences10.store).setDefaults("core/edit-widgets", { 4627 fixedToolbar: false, 4628 welcomeGuide: true, 4629 showBlockBreadcrumbs: true, 4630 themeStyles: true 4631 }); 4632 (0, import_data32.dispatch)(import_blocks3.store).reapplyBlockTypeFilters(); 4633 (0, import_block_library2.registerCoreBlocks)(coreBlocks); 4634 (0, import_widgets5.registerLegacyWidgetBlock)(); 4635 if (false) { 4636 (0, import_block_library2.__experimentalRegisterExperimentalCoreBlocks)({ 4637 enableFSEBlocks: ENABLE_EXPERIMENTAL_FSE_BLOCKS 4638 }); 4639 } 4640 (0, import_widgets5.registerLegacyWidgetVariations)(settings2); 4641 registerBlock(widget_area_exports); 4642 (0, import_widgets5.registerWidgetGroupBlock)(); 4643 settings2.__experimentalFetchLinkSuggestions = (search, searchOptions) => (0, import_core_data12.__experimentalFetchLinkSuggestions)(search, searchOptions, settings2); 4644 (0, import_blocks3.setFreeformContentHandlerName)("core/html"); 4645 root.render( 4646 /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_element26.StrictMode, { children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(layout_default, { blockEditorSettings: settings2 }) }) 4647 ); 4648 return root; 4649 } 4650 var initialize = initializeEditor; 4651 function reinitializeEditor() { 4652 (0, import_deprecated6.default)("wp.editWidgets.reinitializeEditor", { 4653 since: "6.2", 4654 version: "6.3" 4655 }); 4656 } 4657 var registerBlock = (block) => { 4658 if (!block) { 4659 return; 4660 } 4661 const { metadata, settings: settings2, name: name2 } = block; 4662 if (metadata) { 4663 (0, import_blocks3.unstable__bootstrapServerSideBlockDefinitions)({ [name2]: metadata }); 4664 } 4665 (0, import_blocks3.registerBlockType)(name2, settings2); 4666 }; 4667 return __toCommonJS(index_exports); 4668 })();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated : Wed Jul 15 08:20:16 2026 | Cross-referenced by PHPXref |