PluginProbe
Gutenberg / 22.7.0
Gutenberg v22.7.0
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
← All changes | build/scripts/notices/index.js +35 -22 23.6.2 → 22.7.0 View file →
@@ -61,13 +61,29 @@
61 61 store: () => store
62 62 });
63 63
64 64 // packages/notices/build-module/store/index.mjs
65 - var import_data2 = __toESM(require_data(), 1);
65 + var import_data = __toESM(require_data(), 1);
66 66
67 + // packages/notices/build-module/store/utils/on-sub-key.mjs
68 + var onSubKey = (actionProperty) => (reducer) => (state = {}, action) => {
69 + const key = action[actionProperty];
70 + if (key === void 0) {
71 + return state;
72 + }
73 + const nextKeyState = reducer(state[key], action);
74 + if (nextKeyState === state[key]) {
75 + return state;
76 + }
77 + return {
78 + ...state,
79 + [key]: nextKeyState
80 + };
81 + };
82 + var on_sub_key_default = onSubKey;
83 +
67 84 // packages/notices/build-module/store/reducer.mjs
68 - var import_data = __toESM(require_data(), 1);
69 - var notices = (0, import_data.keyedReducer)("context")((state = [], action) => {
85 + var notices = on_sub_key_default("context")((state = [], action) => {
70 86 switch (action.type) {
71 87 case "CREATE_NOTICE":
72 88 return [
73 89 ...state.filter(({ id }) => id !== action.notice.id),
@@ -180,14 +196,14 @@
180 196 return state[context] || DEFAULT_NOTICES;
181 197 }
182 198
183 199 // packages/notices/build-module/store/index.mjs
184 - var store = (0, import_data2.createReduxStore)("core/notices", {
200 + var store = (0, import_data.createReduxStore)("core/notices", {
185 201 reducer: reducer_default,
186 202 actions: actions_exports,
187 203 selectors: selectors_exports
188 204 });
189 - (0, import_data2.register)(store);
205 + (0, import_data.register)(store);
190 206
191 207 // node_modules/clsx/dist/clsx.mjs
192 208 function r(e) {
193 209 var t, f, n = "";
@@ -205,25 +221,27 @@
205 221 var clsx_default = clsx;
206 222
207 223 // packages/notices/build-module/components/inline-notices/index.mjs
208 224 var import_components = __toESM(require_components(), 1);
209 - var import_data3 = __toESM(require_data(), 1);
225 + var import_data2 = __toESM(require_data(), 1);
210 226 var import_jsx_runtime = __toESM(require_jsx_runtime(), 1);
211 - function hasRenderableChildren(children) {
212 - return children !== null && children !== void 0 && children !== false && children !== "";
227 + if (typeof document !== "undefined" && true && !document.head.querySelector("style[data-wp-hash='51ef33823e']")) {
228 + const style = document.createElement("style");
229 + style.setAttribute("data-wp-hash", "51ef33823e");
230 + style.appendChild(document.createTextNode(".components-notices__dismissible,.components-notices__pinned{color:#1e1e1e}.components-notices__dismissible .components-notice,.components-notices__pinned .components-notice{border-bottom:1px solid #0003;box-sizing:border-box;min-height:64px;padding:0 12px}.components-notices__dismissible .components-notice .components-notice__dismiss,.components-notices__pinned .components-notice .components-notice__dismiss{margin-top:12px}"));
231 + document.head.appendChild(style);
213 232 }
214 233 function InlineNotices({
215 234 children,
216 - className,
217 235 pinnedNoticesClassName,
218 236 dismissibleNoticesClassName,
219 237 context
220 238 }) {
221 - const notices2 = (0, import_data3.useSelect)(
239 + const notices2 = (0, import_data2.useSelect)(
222 240 (select) => select(store).getNotices(context),
223 241 [context]
224 242 );
225 - const { removeNotice: removeNotice2 } = (0, import_data3.useDispatch)(store);
243 + const { removeNotice: removeNotice2 } = (0, import_data2.useDispatch)(store);
226 244 const dismissibleNotices = notices2.filter(
227 245 ({ isDismissible, type }) => isDismissible && type === "default"
228 246 );
229 247 const nonDismissibleNotices = notices2.filter(
@@ -228,15 +246,10 @@
228 246 );
229 247 const nonDismissibleNotices = notices2.filter(
230 248 ({ isDismissible, type }) => !isDismissible && type === "default"
231 249 );
232 - const hasPinnedNotices = nonDismissibleNotices.length > 0;
233 - const hasDismissibleNotices = dismissibleNotices.length > 0 || hasRenderableChildren(children);
234 - if (!hasPinnedNotices && !hasDismissibleNotices) {
235 - return null;
236 - }
237 - return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: clsx_default("notices-inline-notices-wrapper", className), children: [
238 - hasPinnedNotices && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
250 + return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
251 + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
239 252 import_components.NoticeList,
240 253 {
241 254 notices: nonDismissibleNotices,
242 255 className: clsx_default(
@@ -244,9 +257,9 @@
244 257 pinnedNoticesClassName
245 258 )
246 259 }
247 260 ),
248 - hasDismissibleNotices && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
261 + /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
249 262 import_components.NoticeList,
250 263 {
251 264 notices: dismissibleNotices,
252 265 className: clsx_default(
@@ -261,9 +274,9 @@
261 274 }
262 275
263 276 // packages/notices/build-module/components/snackbar-notices/index.mjs
264 277 var import_components2 = __toESM(require_components(), 1);
265 - var import_data4 = __toESM(require_data(), 1);
278 + var import_data3 = __toESM(require_data(), 1);
266 279 var import_jsx_runtime2 = __toESM(require_jsx_runtime(), 1);
267 280 var MAX_VISIBLE_NOTICES = -3;
268 281 function SnackbarNotices({
269 282 className,
@@ -268,13 +281,13 @@
268 281 function SnackbarNotices({
269 282 className,
270 283 context
271 284 }) {
272 - const notices2 = (0, import_data4.useSelect)(
285 + const notices2 = (0, import_data3.useSelect)(
273 286 (select) => select(store).getNotices(context),
274 287 [context]
275 288 );
276 - const { removeNotice: removeNotice2 } = (0, import_data4.useDispatch)(store);
289 + const { removeNotice: removeNotice2 } = (0, import_data3.useDispatch)(store);
277 290 const snackbarNotices = notices2.filter(({ type }) => type === "snackbar").slice(MAX_VISIBLE_NOTICES);
278 291 return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
279 292 import_components2.SnackbarList,
280 293 {