[ Index ] |
PHP Cross Reference of WordPress Trunk (Updated Daily) |
[Summary view] [Print] [Text view]
1 /******/ (() => { // webpackBootstrap 2 /******/ "use strict"; 3 /******/ // The require scope 4 /******/ var __webpack_require__ = {}; 5 /******/ 6 /************************************************************************/ 7 /******/ /* webpack/runtime/compat get default export */ 8 /******/ (() => { 9 /******/ // getDefaultExport function for compatibility with non-harmony modules 10 /******/ __webpack_require__.n = (module) => { 11 /******/ var getter = module && module.__esModule ? 12 /******/ () => (module['default']) : 13 /******/ () => (module); 14 /******/ __webpack_require__.d(getter, { a: getter }); 15 /******/ return getter; 16 /******/ }; 17 /******/ })(); 18 /******/ 19 /******/ /* webpack/runtime/define property getters */ 20 /******/ (() => { 21 /******/ // define getter functions for harmony exports 22 /******/ __webpack_require__.d = (exports, definition) => { 23 /******/ for(var key in definition) { 24 /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 25 /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 26 /******/ } 27 /******/ } 28 /******/ }; 29 /******/ })(); 30 /******/ 31 /******/ /* webpack/runtime/hasOwnProperty shorthand */ 32 /******/ (() => { 33 /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 34 /******/ })(); 35 /******/ 36 /******/ /* webpack/runtime/make namespace object */ 37 /******/ (() => { 38 /******/ // define __esModule on exports 39 /******/ __webpack_require__.r = (exports) => { 40 /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 41 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 42 /******/ } 43 /******/ Object.defineProperty(exports, '__esModule', { value: true }); 44 /******/ }; 45 /******/ })(); 46 /******/ 47 /************************************************************************/ 48 var __webpack_exports__ = {}; 49 // ESM COMPAT FLAG 50 __webpack_require__.r(__webpack_exports__); 51 52 // EXPORTS 53 __webpack_require__.d(__webpack_exports__, { 54 __unstableCreatePersistenceLayer: () => (/* binding */ __unstableCreatePersistenceLayer), 55 create: () => (/* reexport */ create) 56 }); 57 58 ;// external ["wp","apiFetch"] 59 const external_wp_apiFetch_namespaceObject = window["wp"]["apiFetch"]; 60 var external_wp_apiFetch_default = /*#__PURE__*/__webpack_require__.n(external_wp_apiFetch_namespaceObject); 61 ;// ./node_modules/@wordpress/preferences-persistence/build-module/create/debounce-async.js 62 function debounceAsync(func, delayMS) { 63 let timeoutId; 64 let activePromise; 65 return async function debounced(...args) { 66 if (!activePromise && !timeoutId) { 67 return new Promise((resolve, reject) => { 68 activePromise = func(...args).then((...thenArgs) => { 69 resolve(...thenArgs); 70 }).catch((error) => { 71 reject(error); 72 }).finally(() => { 73 activePromise = null; 74 }); 75 }); 76 } 77 if (activePromise) { 78 await activePromise; 79 } 80 if (timeoutId) { 81 clearTimeout(timeoutId); 82 timeoutId = null; 83 } 84 return new Promise((resolve, reject) => { 85 timeoutId = setTimeout(() => { 86 activePromise = func(...args).then((...thenArgs) => { 87 resolve(...thenArgs); 88 }).catch((error) => { 89 reject(error); 90 }).finally(() => { 91 activePromise = null; 92 timeoutId = null; 93 }); 94 }, delayMS); 95 }); 96 }; 97 } 98 99 100 ;// ./node_modules/@wordpress/preferences-persistence/build-module/create/index.js 101 102 103 const EMPTY_OBJECT = {}; 104 const localStorage = window.localStorage; 105 function create({ 106 preloadedData, 107 localStorageRestoreKey = "WP_PREFERENCES_RESTORE_DATA", 108 requestDebounceMS = 2500 109 } = {}) { 110 let cache = preloadedData; 111 const debouncedApiFetch = debounceAsync((external_wp_apiFetch_default()), requestDebounceMS); 112 async function get() { 113 if (cache) { 114 return cache; 115 } 116 const user = await external_wp_apiFetch_default()({ 117 path: "/wp/v2/users/me?context=edit" 118 }); 119 const serverData = user?.meta?.persisted_preferences; 120 const localData = JSON.parse( 121 localStorage.getItem(localStorageRestoreKey) 122 ); 123 const serverTimestamp = Date.parse(serverData?._modified) || 0; 124 const localTimestamp = Date.parse(localData?._modified) || 0; 125 if (serverData && serverTimestamp >= localTimestamp) { 126 cache = serverData; 127 } else if (localData) { 128 cache = localData; 129 } else { 130 cache = EMPTY_OBJECT; 131 } 132 return cache; 133 } 134 function set(newData) { 135 const dataWithTimestamp = { 136 ...newData, 137 _modified: (/* @__PURE__ */ new Date()).toISOString() 138 }; 139 cache = dataWithTimestamp; 140 localStorage.setItem( 141 localStorageRestoreKey, 142 JSON.stringify(dataWithTimestamp) 143 ); 144 debouncedApiFetch({ 145 path: "/wp/v2/users/me", 146 method: "PUT", 147 // `keepalive` will still send the request in the background, 148 // even when a browser unload event might interrupt it. 149 // This should hopefully make things more resilient. 150 // This does have a size limit of 64kb, but the data is usually 151 // much less. 152 keepalive: true, 153 data: { 154 meta: { 155 persisted_preferences: dataWithTimestamp 156 } 157 } 158 }).catch(() => { 159 }); 160 } 161 return { 162 get, 163 set 164 }; 165 } 166 167 168 ;// ./node_modules/@wordpress/preferences-persistence/build-module/migrations/legacy-local-storage-data/move-feature-preferences.js 169 function moveFeaturePreferences(state, sourceStoreName) { 170 const preferencesStoreName = "core/preferences"; 171 const interfaceStoreName = "core/interface"; 172 const interfaceFeatures = state?.[interfaceStoreName]?.preferences?.features?.[sourceStoreName]; 173 const sourceFeatures = state?.[sourceStoreName]?.preferences?.features; 174 const featuresToMigrate = interfaceFeatures ? interfaceFeatures : sourceFeatures; 175 if (!featuresToMigrate) { 176 return state; 177 } 178 const existingPreferences = state?.[preferencesStoreName]?.preferences; 179 if (existingPreferences?.[sourceStoreName]) { 180 return state; 181 } 182 let updatedInterfaceState; 183 if (interfaceFeatures) { 184 const otherInterfaceState = state?.[interfaceStoreName]; 185 const otherInterfaceScopes = state?.[interfaceStoreName]?.preferences?.features; 186 updatedInterfaceState = { 187 [interfaceStoreName]: { 188 ...otherInterfaceState, 189 preferences: { 190 features: { 191 ...otherInterfaceScopes, 192 [sourceStoreName]: void 0 193 } 194 } 195 } 196 }; 197 } 198 let updatedSourceState; 199 if (sourceFeatures) { 200 const otherSourceState = state?.[sourceStoreName]; 201 const sourcePreferences = state?.[sourceStoreName]?.preferences; 202 updatedSourceState = { 203 [sourceStoreName]: { 204 ...otherSourceState, 205 preferences: { 206 ...sourcePreferences, 207 features: void 0 208 } 209 } 210 }; 211 } 212 return { 213 ...state, 214 [preferencesStoreName]: { 215 preferences: { 216 ...existingPreferences, 217 [sourceStoreName]: featuresToMigrate 218 } 219 }, 220 ...updatedInterfaceState, 221 ...updatedSourceState 222 }; 223 } 224 225 226 ;// ./node_modules/@wordpress/preferences-persistence/build-module/migrations/legacy-local-storage-data/move-third-party-feature-preferences.js 227 function moveThirdPartyFeaturePreferencesToPreferences(state) { 228 const interfaceStoreName = "core/interface"; 229 const preferencesStoreName = "core/preferences"; 230 const interfaceScopes = state?.[interfaceStoreName]?.preferences?.features; 231 const interfaceScopeKeys = interfaceScopes ? Object.keys(interfaceScopes) : []; 232 if (!interfaceScopeKeys?.length) { 233 return state; 234 } 235 return interfaceScopeKeys.reduce(function(convertedState, scope) { 236 if (scope.startsWith("core")) { 237 return convertedState; 238 } 239 const featuresToMigrate = interfaceScopes?.[scope]; 240 if (!featuresToMigrate) { 241 return convertedState; 242 } 243 const existingMigratedData = convertedState?.[preferencesStoreName]?.preferences?.[scope]; 244 if (existingMigratedData) { 245 return convertedState; 246 } 247 const otherPreferencesScopes = convertedState?.[preferencesStoreName]?.preferences; 248 const otherInterfaceState = convertedState?.[interfaceStoreName]; 249 const otherInterfaceScopes = convertedState?.[interfaceStoreName]?.preferences?.features; 250 return { 251 ...convertedState, 252 [preferencesStoreName]: { 253 preferences: { 254 ...otherPreferencesScopes, 255 [scope]: featuresToMigrate 256 } 257 }, 258 [interfaceStoreName]: { 259 ...otherInterfaceState, 260 preferences: { 261 features: { 262 ...otherInterfaceScopes, 263 [scope]: void 0 264 } 265 } 266 } 267 }; 268 }, state); 269 } 270 271 272 ;// ./node_modules/@wordpress/preferences-persistence/build-module/migrations/legacy-local-storage-data/move-individual-preference.js 273 const identity = (arg) => arg; 274 function moveIndividualPreferenceToPreferences(state, { from: sourceStoreName, to: scope }, key, convert = identity) { 275 const preferencesStoreName = "core/preferences"; 276 const sourcePreference = state?.[sourceStoreName]?.preferences?.[key]; 277 if (sourcePreference === void 0) { 278 return state; 279 } 280 const targetPreference = state?.[preferencesStoreName]?.preferences?.[scope]?.[key]; 281 if (targetPreference) { 282 return state; 283 } 284 const otherScopes = state?.[preferencesStoreName]?.preferences; 285 const otherPreferences = state?.[preferencesStoreName]?.preferences?.[scope]; 286 const otherSourceState = state?.[sourceStoreName]; 287 const allSourcePreferences = state?.[sourceStoreName]?.preferences; 288 const convertedPreferences = convert({ [key]: sourcePreference }); 289 return { 290 ...state, 291 [preferencesStoreName]: { 292 preferences: { 293 ...otherScopes, 294 [scope]: { 295 ...otherPreferences, 296 ...convertedPreferences 297 } 298 } 299 }, 300 [sourceStoreName]: { 301 ...otherSourceState, 302 preferences: { 303 ...allSourcePreferences, 304 [key]: void 0 305 } 306 } 307 }; 308 } 309 310 311 ;// ./node_modules/@wordpress/preferences-persistence/build-module/migrations/legacy-local-storage-data/move-interface-enable-items.js 312 function moveInterfaceEnableItems(state) { 313 const interfaceStoreName = "core/interface"; 314 const preferencesStoreName = "core/preferences"; 315 const sourceEnableItems = state?.[interfaceStoreName]?.enableItems; 316 if (!sourceEnableItems) { 317 return state; 318 } 319 const allPreferences = state?.[preferencesStoreName]?.preferences ?? {}; 320 const sourceComplementaryAreas = sourceEnableItems?.singleEnableItems?.complementaryArea ?? {}; 321 const preferencesWithConvertedComplementaryAreas = Object.keys( 322 sourceComplementaryAreas 323 ).reduce((accumulator, scope) => { 324 const data = sourceComplementaryAreas[scope]; 325 if (accumulator?.[scope]?.complementaryArea) { 326 return accumulator; 327 } 328 return { 329 ...accumulator, 330 [scope]: { 331 ...accumulator[scope], 332 complementaryArea: data 333 } 334 }; 335 }, allPreferences); 336 const sourcePinnedItems = sourceEnableItems?.multipleEnableItems?.pinnedItems ?? {}; 337 const allConvertedData = Object.keys(sourcePinnedItems).reduce( 338 (accumulator, scope) => { 339 const data = sourcePinnedItems[scope]; 340 if (accumulator?.[scope]?.pinnedItems) { 341 return accumulator; 342 } 343 return { 344 ...accumulator, 345 [scope]: { 346 ...accumulator[scope], 347 pinnedItems: data 348 } 349 }; 350 }, 351 preferencesWithConvertedComplementaryAreas 352 ); 353 const otherInterfaceItems = state[interfaceStoreName]; 354 return { 355 ...state, 356 [preferencesStoreName]: { 357 preferences: allConvertedData 358 }, 359 [interfaceStoreName]: { 360 ...otherInterfaceItems, 361 enableItems: void 0 362 } 363 }; 364 } 365 366 367 ;// ./node_modules/@wordpress/preferences-persistence/build-module/migrations/legacy-local-storage-data/convert-edit-post-panels.js 368 function convertEditPostPanels(preferences) { 369 const panels = preferences?.panels ?? {}; 370 return Object.keys(panels).reduce( 371 (convertedData, panelName) => { 372 const panel = panels[panelName]; 373 if (panel?.enabled === false) { 374 convertedData.inactivePanels.push(panelName); 375 } 376 if (panel?.opened === true) { 377 convertedData.openPanels.push(panelName); 378 } 379 return convertedData; 380 }, 381 { inactivePanels: [], openPanels: [] } 382 ); 383 } 384 385 386 ;// ./node_modules/@wordpress/preferences-persistence/build-module/migrations/legacy-local-storage-data/index.js 387 388 389 390 391 392 function getLegacyData(userId) { 393 const key = `WP_DATA_USER_$userId}`; 394 const unparsedData = window.localStorage.getItem(key); 395 return JSON.parse(unparsedData); 396 } 397 function convertLegacyData(data) { 398 if (!data) { 399 return; 400 } 401 data = moveFeaturePreferences(data, "core/edit-widgets"); 402 data = moveFeaturePreferences(data, "core/customize-widgets"); 403 data = moveFeaturePreferences(data, "core/edit-post"); 404 data = moveFeaturePreferences(data, "core/edit-site"); 405 data = moveThirdPartyFeaturePreferencesToPreferences(data); 406 data = moveInterfaceEnableItems(data); 407 data = moveIndividualPreferenceToPreferences( 408 data, 409 { from: "core/edit-post", to: "core/edit-post" }, 410 "hiddenBlockTypes" 411 ); 412 data = moveIndividualPreferenceToPreferences( 413 data, 414 { from: "core/edit-post", to: "core/edit-post" }, 415 "editorMode" 416 ); 417 data = moveIndividualPreferenceToPreferences( 418 data, 419 { from: "core/edit-post", to: "core/edit-post" }, 420 "panels", 421 convertEditPostPanels 422 ); 423 data = moveIndividualPreferenceToPreferences( 424 data, 425 { from: "core/editor", to: "core" }, 426 "isPublishSidebarEnabled" 427 ); 428 data = moveIndividualPreferenceToPreferences( 429 data, 430 { from: "core/edit-post", to: "core" }, 431 "isPublishSidebarEnabled" 432 ); 433 data = moveIndividualPreferenceToPreferences( 434 data, 435 { from: "core/edit-site", to: "core/edit-site" }, 436 "editorMode" 437 ); 438 return data?.["core/preferences"]?.preferences; 439 } 440 function convertLegacyLocalStorageData(userId) { 441 const data = getLegacyData(userId); 442 return convertLegacyData(data); 443 } 444 445 446 ;// ./node_modules/@wordpress/preferences-persistence/build-module/migrations/preferences-package-data/convert-complementary-areas.js 447 function convertComplementaryAreas(state) { 448 return Object.keys(state).reduce((stateAccumulator, scope) => { 449 const scopeData = state[scope]; 450 if (scopeData?.complementaryArea) { 451 const updatedScopeData = { ...scopeData }; 452 delete updatedScopeData.complementaryArea; 453 updatedScopeData.isComplementaryAreaVisible = true; 454 stateAccumulator[scope] = updatedScopeData; 455 return stateAccumulator; 456 } 457 return stateAccumulator; 458 }, state); 459 } 460 461 462 ;// ./node_modules/@wordpress/preferences-persistence/build-module/migrations/preferences-package-data/convert-editor-settings.js 463 function convertEditorSettings(data) { 464 let newData = data; 465 const settingsToMoveToCore = [ 466 "allowRightClickOverrides", 467 "distractionFree", 468 "editorMode", 469 "fixedToolbar", 470 "focusMode", 471 "hiddenBlockTypes", 472 "inactivePanels", 473 "keepCaretInsideBlock", 474 "mostUsedBlocks", 475 "openPanels", 476 "showBlockBreadcrumbs", 477 "showIconLabels", 478 "showListViewByDefault", 479 "isPublishSidebarEnabled", 480 "isComplementaryAreaVisible", 481 "pinnedItems" 482 ]; 483 settingsToMoveToCore.forEach((setting) => { 484 if (data?.["core/edit-post"]?.[setting] !== void 0) { 485 newData = { 486 ...newData, 487 core: { 488 ...newData?.core, 489 [setting]: data["core/edit-post"][setting] 490 } 491 }; 492 delete newData["core/edit-post"][setting]; 493 } 494 if (data?.["core/edit-site"]?.[setting] !== void 0) { 495 delete newData["core/edit-site"][setting]; 496 } 497 }); 498 if (Object.keys(newData?.["core/edit-post"] ?? {})?.length === 0) { 499 delete newData["core/edit-post"]; 500 } 501 if (Object.keys(newData?.["core/edit-site"] ?? {})?.length === 0) { 502 delete newData["core/edit-site"]; 503 } 504 return newData; 505 } 506 507 508 ;// ./node_modules/@wordpress/preferences-persistence/build-module/migrations/preferences-package-data/index.js 509 510 511 function convertPreferencesPackageData(data) { 512 let newData = convertComplementaryAreas(data); 513 newData = convertEditorSettings(newData); 514 return newData; 515 } 516 517 518 ;// ./node_modules/@wordpress/preferences-persistence/build-module/index.js 519 520 521 522 function __unstableCreatePersistenceLayer(serverData, userId) { 523 const localStorageRestoreKey = `WP_PREFERENCES_USER_$userId}`; 524 const localData = JSON.parse( 525 window.localStorage.getItem(localStorageRestoreKey) 526 ); 527 const serverModified = Date.parse(serverData && serverData._modified) || 0; 528 const localModified = Date.parse(localData && localData._modified) || 0; 529 let preloadedData; 530 if (serverData && serverModified >= localModified) { 531 preloadedData = convertPreferencesPackageData(serverData); 532 } else if (localData) { 533 preloadedData = convertPreferencesPackageData(localData); 534 } else { 535 preloadedData = convertLegacyLocalStorageData(userId); 536 } 537 return create({ 538 preloadedData, 539 localStorageRestoreKey 540 }); 541 } 542 543 544 (window.wp = window.wp || {}).preferencesPersistence = __webpack_exports__; 545 /******/ })() 546 ;
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated : Thu Oct 23 08:20:05 2025 | Cross-referenced by PHPXref |