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