| 1 |
var __create = Object.create; |
| 2 |
var __defProp = Object.defineProperty; |
| 3 |
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; |
| 4 |
var __getOwnPropNames = Object.getOwnPropertyNames; |
| 5 |
var __getProtoOf = Object.getPrototypeOf; |
| 6 |
var __hasOwnProp = Object.prototype.hasOwnProperty; |
| 7 |
var __commonJS = (cb, mod) => function __require() { |
| 8 |
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports; |
| 9 |
}; |
| 10 |
var __copyProps = (to, from, except, desc) => { |
| 11 |
if (from && typeof from === "object" || typeof from === "function") { |
| 12 |
for (let key of __getOwnPropNames(from)) |
| 13 |
if (!__hasOwnProp.call(to, key) && key !== except) |
| 14 |
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); |
| 15 |
} |
| 16 |
return to; |
| 17 |
}; |
| 18 |
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( |
| 19 |
// If the importer is in node compatibility mode or this is not an ESM |
| 20 |
// file that has been converted to a CommonJS file using a Babel- |
| 21 |
// compatible transform (i.e. "__esModule" has not been set), then set |
| 22 |
// "default" to the CommonJS "module.exports" for node compatibility. |
| 23 |
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, |
| 24 |
mod |
| 25 |
)); |
| 26 |
|
| 27 |
// package-external:@wordpress/data |
| 28 |
var require_data = __commonJS({ |
| 29 |
"package-external:@wordpress/data"(exports, module) { |
| 30 |
module.exports = window.wp.data; |
| 31 |
} |
| 32 |
}); |
| 33 |
|
| 34 |
// package-external:@wordpress/core-data |
| 35 |
var require_core_data = __commonJS({ |
| 36 |
"package-external:@wordpress/core-data"(exports, module) { |
| 37 |
module.exports = window.wp.coreData; |
| 38 |
} |
| 39 |
}); |
| 40 |
|
| 41 |
// package-external:@wordpress/i18n |
| 42 |
var require_i18n = __commonJS({ |
| 43 |
"package-external:@wordpress/i18n"(exports, module) { |
| 44 |
module.exports = window.wp.i18n; |
| 45 |
} |
| 46 |
}); |
| 47 |
|
| 48 |
// package-external:@wordpress/element |
| 49 |
var require_element = __commonJS({ |
| 50 |
"package-external:@wordpress/element"(exports, module) { |
| 51 |
module.exports = window.wp.element; |
| 52 |
} |
| 53 |
}); |
| 54 |
|
| 55 |
// package-external:@wordpress/preferences |
| 56 |
var require_preferences = __commonJS({ |
| 57 |
"package-external:@wordpress/preferences"(exports, module) { |
| 58 |
module.exports = window.wp.preferences; |
| 59 |
} |
| 60 |
}); |
| 61 |
|
| 62 |
// package-external:@wordpress/private-apis |
| 63 |
var require_private_apis = __commonJS({ |
| 64 |
"package-external:@wordpress/private-apis"(exports, module) { |
| 65 |
module.exports = window.wp.privateApis; |
| 66 |
} |
| 67 |
}); |
| 68 |
|
| 69 |
// routes/navigation-list/route.ts |
| 70 |
var import_data5 = __toESM(require_data()); |
| 71 |
var import_core_data3 = __toESM(require_core_data()); |
| 72 |
var import_i18n = __toESM(require_i18n()); |
| 73 |
import { notFound } from "@wordpress/route"; |
| 74 |
|
| 75 |
// routes/navigation-list/view-utils.ts |
| 76 |
var import_data4 = __toESM(require_data()); |
| 77 |
var import_core_data2 = __toESM(require_core_data()); |
| 78 |
|
| 79 |
// packages/views/build-module/use-view.mjs |
| 80 |
var import_element = __toESM(require_element(), 1); |
| 81 |
var import_data = __toESM(require_data(), 1); |
| 82 |
var import_preferences = __toESM(require_preferences(), 1); |
| 83 |
|
| 84 |
// packages/views/build-module/load-view.mjs |
| 85 |
var import_data2 = __toESM(require_data(), 1); |
| 86 |
var import_preferences2 = __toESM(require_preferences(), 1); |
| 87 |
|
| 88 |
// packages/views/build-module/use-view-config.mjs |
| 89 |
var import_data3 = __toESM(require_data(), 1); |
| 90 |
var import_core_data = __toESM(require_core_data(), 1); |
| 91 |
|
| 92 |
// packages/views/build-module/lock-unlock.mjs |
| 93 |
var import_private_apis = __toESM(require_private_apis(), 1); |
| 94 |
var { lock, unlock } = (0, import_private_apis.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( |
| 95 |
"I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", |
| 96 |
"@wordpress/views" |
| 97 |
); |
| 98 |
|
| 99 |
// routes/lock-unlock/index.ts |
| 100 |
var import_private_apis2 = __toESM(require_private_apis()); |
| 101 |
var { lock: lock2, unlock: unlock2 } = (0, import_private_apis2.__dangerousOptInToUnstableAPIsOnlyForCoreModules)( |
| 102 |
"I acknowledge private features are not for use in themes or plugins and doing so will break in the next version of WordPress.", |
| 103 |
"@wordpress/routes" |
| 104 |
); |
| 105 |
|
| 106 |
// routes/navigation-list/view-utils.ts |
| 107 |
var NAVIGATION_POST_TYPE = "wp_navigation"; |
| 108 |
async function loadNavigationViewConfig() { |
| 109 |
const config = await unlock2((0, import_data4.resolveSelect)(import_core_data2.store)).getViewConfig( |
| 110 |
"postType", |
| 111 |
NAVIGATION_POST_TYPE |
| 112 |
); |
| 113 |
return { |
| 114 |
default_view: config?.default_view, |
| 115 |
default_layouts: config?.default_layouts, |
| 116 |
view_list: config?.view_list |
| 117 |
}; |
| 118 |
} |
| 119 |
|
| 120 |
// routes/navigation-list/route.ts |
| 121 |
var NAVIGATION_POST_TYPE2 = "wp_navigation"; |
| 122 |
var PRELOADED_NAVIGATION_MENUS_QUERY = { |
| 123 |
per_page: -1, |
| 124 |
status: ["publish", "draft"], |
| 125 |
order: "desc", |
| 126 |
orderby: "date" |
| 127 |
}; |
| 128 |
var route = { |
| 129 |
async beforeLoad() { |
| 130 |
const theme = await (0, import_data5.resolveSelect)(import_core_data3.store).getCurrentTheme(); |
| 131 |
if (!theme?.is_block_theme) { |
| 132 |
throw notFound(); |
| 133 |
} |
| 134 |
}, |
| 135 |
title: () => (0, import_i18n.__)("Navigation"), |
| 136 |
canvas: async ({ |
| 137 |
search |
| 138 |
}) => { |
| 139 |
const navigations = await (0, import_data5.resolveSelect)(import_core_data3.store).getEntityRecords( |
| 140 |
"postType", |
| 141 |
NAVIGATION_POST_TYPE2, |
| 142 |
PRELOADED_NAVIGATION_MENUS_QUERY |
| 143 |
); |
| 144 |
const firstNavigation = navigations?.[0]; |
| 145 |
if (!firstNavigation) { |
| 146 |
return { postType: NAVIGATION_POST_TYPE2, isPreview: true }; |
| 147 |
} |
| 148 |
const postId = search.ids ? parseInt(search.ids[0]) : firstNavigation.id; |
| 149 |
return { |
| 150 |
postType: NAVIGATION_POST_TYPE2, |
| 151 |
postId, |
| 152 |
isPreview: true |
| 153 |
}; |
| 154 |
}, |
| 155 |
loader: async () => { |
| 156 |
await Promise.all([ |
| 157 |
// Preload the view configuration the stage resolves its view from. |
| 158 |
loadNavigationViewConfig(), |
| 159 |
// Preload navigation menus |
| 160 |
(0, import_data5.resolveSelect)(import_core_data3.store).getEntityRecords( |
| 161 |
"postType", |
| 162 |
NAVIGATION_POST_TYPE2, |
| 163 |
PRELOADED_NAVIGATION_MENUS_QUERY |
| 164 |
), |
| 165 |
(0, import_data5.resolveSelect)(import_core_data3.store).canUser("create", { |
| 166 |
kind: "postType", |
| 167 |
name: NAVIGATION_POST_TYPE2 |
| 168 |
}), |
| 169 |
// Preload post type object (what usePostFields needs) |
| 170 |
(0, import_data5.resolveSelect)(import_core_data3.store).getPostType(NAVIGATION_POST_TYPE2), |
| 171 |
// Preload users data (what usePostFields needs for author field) |
| 172 |
(0, import_data5.resolveSelect)(import_core_data3.store).getEntityRecords("root", "user", { |
| 173 |
per_page: -1 |
| 174 |
}) |
| 175 |
]); |
| 176 |
} |
| 177 |
}; |
| 178 |
export { |
| 179 |
route |
| 180 |
}; |
| 181 |
|