kollapsminoriteten/wp-includes/js/dist/notices.js

209 lines
5.8 KiB
JavaScript
Raw Permalink Normal View History

2024-04-17 11:32:24 +02:00
/******/ (() => { // webpackBootstrap
2022-06-16 14:03:35 +02:00
/******/ "use strict";
/******/ // The require scope
/******/ var __webpack_require__ = {};
/******/
/************************************************************************/
/******/ /* webpack/runtime/define property getters */
2024-04-17 11:32:24 +02:00
/******/ (() => {
2022-06-16 14:03:35 +02:00
/******/ // define getter functions for harmony exports
2024-04-17 11:32:24 +02:00
/******/ __webpack_require__.d = (exports, definition) => {
2022-06-16 14:03:35 +02:00
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
2024-04-17 11:32:24 +02:00
/******/ })();
2022-06-16 14:03:35 +02:00
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
2024-04-17 11:32:24 +02:00
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
2022-06-16 14:03:35 +02:00
/******/
/******/ /* webpack/runtime/make namespace object */
2024-04-17 11:32:24 +02:00
/******/ (() => {
2022-06-16 14:03:35 +02:00
/******/ // define __esModule on exports
2024-04-17 11:32:24 +02:00
/******/ __webpack_require__.r = (exports) => {
2022-06-16 14:03:35 +02:00
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
2019-11-02 10:38:58 +01:00
/******/ };
2024-04-17 11:32:24 +02:00
/******/ })();
2022-06-16 14:03:35 +02:00
/******/
2019-11-02 10:38:58 +01:00
/************************************************************************/
2022-06-16 14:03:35 +02:00
var __webpack_exports__ = {};
2020-09-15 14:29:22 +02:00
// ESM COMPAT FLAG
2019-11-02 10:38:58 +01:00
__webpack_require__.r(__webpack_exports__);
2020-09-15 14:29:22 +02:00
2021-04-27 08:32:47 +02:00
// EXPORTS
2022-06-16 14:03:35 +02:00
__webpack_require__.d(__webpack_exports__, {
2024-04-17 11:32:24 +02:00
store: () => (/* reexport */ store)
2022-06-16 14:03:35 +02:00
});
2021-04-27 08:32:47 +02:00
2020-09-15 14:29:22 +02:00
// NAMESPACE OBJECT: ./node_modules/@wordpress/notices/build-module/store/actions.js
2019-11-02 10:38:58 +01:00
var actions_namespaceObject = {};
__webpack_require__.r(actions_namespaceObject);
2022-06-16 14:03:35 +02:00
__webpack_require__.d(actions_namespaceObject, {
2024-04-17 11:32:24 +02:00
createErrorNotice: () => (createErrorNotice),
createInfoNotice: () => (createInfoNotice),
createNotice: () => (createNotice),
createSuccessNotice: () => (createSuccessNotice),
createWarningNotice: () => (createWarningNotice),
removeAllNotices: () => (removeAllNotices),
removeNotice: () => (removeNotice),
removeNotices: () => (removeNotices)
2022-06-16 14:03:35 +02:00
});
2020-09-15 14:29:22 +02:00
// NAMESPACE OBJECT: ./node_modules/@wordpress/notices/build-module/store/selectors.js
2019-11-02 10:38:58 +01:00
var selectors_namespaceObject = {};
__webpack_require__.r(selectors_namespaceObject);
2022-06-16 14:03:35 +02:00
__webpack_require__.d(selectors_namespaceObject, {
2024-04-17 11:32:24 +02:00
getNotices: () => (getNotices)
2022-06-16 14:03:35 +02:00
});
2019-11-02 10:38:58 +01:00
2025-04-25 12:30:07 +02:00
;// external ["wp","data"]
2024-04-17 11:32:24 +02:00
const external_wp_data_namespaceObject = window["wp"]["data"];
2025-04-25 12:30:07 +02:00
;// ./node_modules/@wordpress/notices/build-module/store/utils/on-sub-key.js
2025-12-12 13:15:55 +01:00
const onSubKey = (actionProperty) => (reducer) => (state = {}, action) => {
2021-07-23 11:58:50 +02:00
const key = action[actionProperty];
2025-12-12 13:15:55 +01:00
if (key === void 0) {
2021-07-23 11:58:50 +02:00
return state;
2023-12-07 09:44:11 +01:00
}
2021-07-23 11:58:50 +02:00
const nextKeyState = reducer(state[key], action);
if (nextKeyState === state[key]) {
return state;
}
2023-12-07 09:44:11 +01:00
return {
...state,
2021-07-23 11:58:50 +02:00
[key]: nextKeyState
2019-11-02 10:38:58 +01:00
};
};
2025-12-12 13:15:55 +01:00
var on_sub_key_default = onSubKey;
2019-11-02 10:38:58 +01:00
2025-12-12 13:15:55 +01:00
;// ./node_modules/@wordpress/notices/build-module/store/reducer.js
2023-12-07 09:44:11 +01:00
2025-12-12 13:15:55 +01:00
const notices = on_sub_key_default("context")((state = [], action) => {
2019-11-02 10:38:58 +01:00
switch (action.type) {
2025-12-12 13:15:55 +01:00
case "CREATE_NOTICE":
return [
...state.filter(({ id }) => id !== action.notice.id),
action.notice
];
case "REMOVE_NOTICE":
return state.filter(({ id }) => id !== action.id);
case "REMOVE_NOTICES":
return state.filter(({ id }) => !action.ids.includes(id));
case "REMOVE_ALL_NOTICES":
return state.filter(({ type }) => type !== action.noticeType);
2019-11-02 10:38:58 +01:00
}
return state;
});
2025-12-12 13:15:55 +01:00
var reducer_default = notices;
2019-11-02 10:38:58 +01:00
2025-04-25 12:30:07 +02:00
;// ./node_modules/@wordpress/notices/build-module/store/constants.js
2025-12-12 13:15:55 +01:00
const DEFAULT_CONTEXT = "global";
const DEFAULT_STATUS = "info";
2023-12-07 09:44:11 +01:00
2019-11-02 10:38:58 +01:00
2025-04-25 12:30:07 +02:00
;// ./node_modules/@wordpress/notices/build-module/store/actions.js
2020-05-06 17:23:38 +02:00
2022-12-15 17:47:31 +01:00
let uniqueId = 0;
2023-09-26 10:33:34 +02:00
function createNotice(status = DEFAULT_STATUS, content, options = {}) {
2021-07-23 11:58:50 +02:00
const {
speak = true,
isDismissible = true,
context = DEFAULT_CONTEXT,
2022-12-15 17:47:31 +01:00
id = `${context}${++uniqueId}`,
2021-07-23 11:58:50 +02:00
actions = [],
2025-12-12 13:15:55 +01:00
type = "default",
2021-07-23 11:58:50 +02:00
__unstableHTML,
icon = null,
explicitDismiss = false,
2022-04-02 10:26:41 +02:00
onDismiss
2023-12-07 09:44:11 +01:00
} = options;
2020-05-06 17:23:38 +02:00
content = String(content);
return {
2025-12-12 13:15:55 +01:00
type: "CREATE_NOTICE",
2021-07-23 11:58:50 +02:00
context,
2020-05-06 17:23:38 +02:00
notice: {
2021-07-23 11:58:50 +02:00
id,
status,
content,
2020-05-06 17:23:38 +02:00
spokenMessage: speak ? content : null,
2021-07-23 11:58:50 +02:00
__unstableHTML,
isDismissible,
actions,
type,
icon,
explicitDismiss,
onDismiss
2019-11-02 10:38:58 +01:00
}
2020-05-06 17:23:38 +02:00
};
2019-11-02 10:38:58 +01:00
}
function createSuccessNotice(content, options) {
2025-12-12 13:15:55 +01:00
return createNotice("success", content, options);
2019-11-02 10:38:58 +01:00
}
function createInfoNotice(content, options) {
2025-12-12 13:15:55 +01:00
return createNotice("info", content, options);
2019-11-02 10:38:58 +01:00
}
function createErrorNotice(content, options) {
2025-12-12 13:15:55 +01:00
return createNotice("error", content, options);
2019-11-02 10:38:58 +01:00
}
function createWarningNotice(content, options) {
2025-12-12 13:15:55 +01:00
return createNotice("warning", content, options);
2019-11-02 10:38:58 +01:00
}
2023-09-26 10:33:34 +02:00
function removeNotice(id, context = DEFAULT_CONTEXT) {
2019-11-02 10:38:58 +01:00
return {
2025-12-12 13:15:55 +01:00
type: "REMOVE_NOTICE",
2021-07-23 11:58:50 +02:00
id,
context
2019-11-02 10:38:58 +01:00
};
}
2025-12-12 13:15:55 +01:00
function removeAllNotices(noticeType = "default", context = DEFAULT_CONTEXT) {
2023-09-26 10:33:34 +02:00
return {
2025-12-12 13:15:55 +01:00
type: "REMOVE_ALL_NOTICES",
2023-09-26 10:33:34 +02:00
noticeType,
context
};
}
function removeNotices(ids, context = DEFAULT_CONTEXT) {
return {
2025-12-12 13:15:55 +01:00
type: "REMOVE_NOTICES",
2023-09-26 10:33:34 +02:00
ids,
context
};
}
2019-11-02 10:38:58 +01:00
2023-12-07 09:44:11 +01:00
2025-12-12 13:15:55 +01:00
;// ./node_modules/@wordpress/notices/build-module/store/selectors.js
2020-05-06 17:23:38 +02:00
2021-07-23 11:58:50 +02:00
const DEFAULT_NOTICES = [];
2023-09-26 10:33:34 +02:00
function getNotices(state, context = DEFAULT_CONTEXT) {
2019-11-02 10:38:58 +01:00
return state[context] || DEFAULT_NOTICES;
}
2023-12-07 09:44:11 +01:00
2025-12-12 13:15:55 +01:00
;// ./node_modules/@wordpress/notices/build-module/store/index.js
2019-11-02 10:38:58 +01:00
2025-12-12 13:15:55 +01:00
const store = (0,external_wp_data_namespaceObject.createReduxStore)("core/notices", {
reducer: reducer_default,
2019-11-02 10:38:58 +01:00
actions: actions_namespaceObject,
2020-05-06 17:23:38 +02:00
selectors: selectors_namespaceObject
2021-04-27 08:32:47 +02:00
});
2022-06-16 14:03:35 +02:00
(0,external_wp_data_namespaceObject.register)(store);
2019-11-02 10:38:58 +01:00
2025-12-12 13:15:55 +01:00
2025-04-25 12:30:07 +02:00
;// ./node_modules/@wordpress/notices/build-module/index.js
2019-11-02 10:38:58 +01:00
2025-12-12 13:15:55 +01:00
2022-06-16 14:03:35 +02:00
(window.wp = window.wp || {}).notices = __webpack_exports__;
/******/ })()
;