rebase code on oct-10-2023

This commit is contained in:
Rachit Bhargava
2023-10-10 17:51:46 -04:00
parent b16ad94b69
commit 8f1a2c3a66
2197 changed files with 184921 additions and 35568 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+8 -7
View File
@@ -34,7 +34,7 @@ function render_block_core_footnotes( $attributes, $content, $block ) {
$footnotes = json_decode( $footnotes, true );
if ( ! is_array( $footnotes ) || count( $footnotes ) === 0 ) {
if ( count( $footnotes ) === 0 ) {
return '';
}
@@ -98,7 +98,7 @@ function wp_save_footnotes_meta( $revision_id ) {
if ( $footnotes ) {
// Can't use update_post_meta() because it doesn't allow revisions.
update_metadata( 'post', $revision_id, 'footnotes', wp_slash( $footnotes ) );
update_metadata( 'post', $revision_id, 'footnotes', $footnotes );
}
}
}
@@ -154,14 +154,15 @@ function wp_add_footnotes_revisions_to_post_meta( $post ) {
if ( $footnotes ) {
// Can't use update_post_meta() because it doesn't allow revisions.
update_metadata( 'post', $wp_temporary_footnote_revision_id, 'footnotes', wp_slash( $footnotes ) );
update_metadata( 'post', $wp_temporary_footnote_revision_id, 'footnotes', $footnotes );
}
}
}
}
add_action( 'rest_after_insert_post', 'wp_add_footnotes_revisions_to_post_meta' );
add_action( 'rest_after_insert_page', 'wp_add_footnotes_revisions_to_post_meta' );
foreach ( array( 'post', 'page' ) as $post_type ) {
add_action( "rest_after_insert_{$post_type}", 'wp_add_footnotes_revisions_to_post_meta' );
}
/**
* Restores the footnotes meta value from the revision.
@@ -175,7 +176,7 @@ function wp_restore_footnotes_from_revision( $post_id, $revision_id ) {
$footnotes = get_post_meta( $revision_id, 'footnotes', true );
if ( $footnotes ) {
update_post_meta( $post_id, 'footnotes', wp_slash( $footnotes ) );
update_post_meta( $post_id, 'footnotes', $footnotes );
} else {
delete_post_meta( $post_id, 'footnotes' );
}
@@ -242,7 +243,7 @@ function _wp_rest_api_autosave_meta( $autosave ) {
return;
}
update_post_meta( $id, 'footnotes', wp_slash( $body['meta']['footnotes'] ) );
update_post_meta( $id, 'footnotes', $body['meta']['footnotes'] );
}
// See https://github.com/WordPress/wordpress-develop/blob/2103cb9966e57d452c94218bbc3171579b536a40/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php#L391C1-L391C1.
add_action( 'wp_creating_autosave', '_wp_rest_api_autosave_meta' );
@@ -20,9 +20,7 @@ class WP_Classic_To_Block_Menu_Converter {
* @since 6.3.0
*
* @param WP_Term $menu The Menu term object of the menu to convert.
* @return string|WP_Error The serialized and normalized parsed blocks on success,
* an empty string when there are no menus to convert,
* or WP_Error on invalid menu.
* @return string the serialized and normalized parsed blocks.
*/
public static function convert( $menu ) {
@@ -36,7 +34,7 @@ class WP_Classic_To_Block_Menu_Converter {
$menu_items = wp_get_nav_menu_items( $menu->term_id, array( 'update_post_term_cache' => false ) );
if ( empty( $menu_items ) ) {
return '';
return array();
}
// Set up the $menu_item variables.
@@ -105,10 +105,6 @@ class WP_Navigation_Fallback {
// If there is a classic menu then convert it to blocks.
$classic_nav_menu_blocks = WP_Classic_To_Block_Menu_Converter::convert( $classic_nav_menu );
if ( is_wp_error( $classic_nav_menu_blocks ) ) {
return $classic_nav_menu_blocks;
}
if ( empty( $classic_nav_menu_blocks ) ) {
return new WP_Error( 'cannot_convert_classic_menu', __( 'Unable to convert Classic Menu to blocks.' ) );
}
+2 -5
View File
@@ -1071,15 +1071,12 @@ class WP_User_Query {
if ( isset( $args['blog_id'] ) ) {
$blog_id = absint( $args['blog_id'] );
}
if ( $args['has_published_posts'] || in_array( 'post_count', $ordersby, true ) ) {
$switch = $blog_id && get_current_blog_id() !== $blog_id;
if ( ( $args['has_published_posts'] && $blog_id ) || in_array( 'post_count', $ordersby, true ) ) {
$switch = get_current_blog_id() !== $blog_id;
if ( $switch ) {
switch_to_blog( $blog_id );
}
$last_changed .= wp_cache_get_last_changed( 'posts' );
if ( $switch ) {
restore_current_blog();
}
+1 -10
View File
@@ -46279,8 +46279,6 @@ function useClipboardHandler() {
if (shouldHandleWholeBlocks && !expandSelectionIsNeeded) {
removeBlocks(selectedBlockClientIds);
} else {
event.target.ownerDocument.activeElement.contentEditable = false;
__unstableDeleteSelection();
}
} else if (event.type === 'paste') {
@@ -56120,14 +56118,7 @@ function RichTextWrapper({
}), anchorRef]),
contentEditable: true,
suppressContentEditableWarning: true,
className: classnames_default()('block-editor-rich-text__editable', props.className, 'rich-text') // Setting tabIndex to 0 is unnecessary, the element is already
// focusable because it's contentEditable. This also fixes a
// Safari bug where it's not possible to Shift+Click multi
// select blocks when Shift Clicking into an element with
// tabIndex because Safari will focus the element. However,
// Safari will correctly ignore nested contentEditable elements.
,
tabIndex: props.tabIndex === 0 ? null : props.tabIndex
className: classnames_default()('block-editor-rich-text__editable', props.className, 'rich-text')
}));
}
File diff suppressed because one or more lines are too long
+263 -314
View File
@@ -67779,7 +67779,7 @@ var CollectionContext = (0,external_React_.createContext)(
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/VFNGSUSF.js
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/HGFTMLQ7.js
@@ -67805,18 +67805,18 @@ var useCollectionItem = NQJBHION_createHook(
const context = (0,external_React_.useContext)(CollectionContext);
store = store || context;
const id = useId(props.id);
const ref = (0,external_React_.useRef)(element);
(0,external_React_.useEffect)(() => {
const element2 = ref.current;
if (!id)
return;
if (!element2)
return;
if (!shouldRegisterItem)
return;
const item = getItem({ id, element: element2 });
return store == null ? void 0 : store.renderItem(item);
}, [id, shouldRegisterItem, getItem, store]);
const unrenderItem = (0,external_React_.useRef)();
const ref = (0,external_React_.useCallback)(
(element2) => {
var _a2;
if (!element2 || !id || !shouldRegisterItem) {
return (_a2 = unrenderItem.current) == null ? void 0 : _a2.call(unrenderItem);
}
const item = getItem({ id, element: element2 });
unrenderItem.current = store == null ? void 0 : store.renderItem(item);
},
[id, shouldRegisterItem, getItem, store]
);
props = PNRLI7OV_spreadProps(PNRLI7OV_spreadValues({}, props), {
ref: useMergeRefs(ref, props.ref)
});
@@ -67927,182 +67927,7 @@ var CompositeContext = (0,external_React_.createContext)(
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/OGOHEUXI.js
// src/utils/store.ts
function getInternal(store, key) {
const internals = store.__unstableInternals;
WVTCK5PV_invariant(internals, "Invalid store");
return internals[key];
}
function createStore(initialState, ...stores) {
let state = initialState;
let prevStateBatch = state;
let lastUpdate = Symbol();
let initialized = false;
const updatedKeys = /* @__PURE__ */ new Set();
const setups = /* @__PURE__ */ new Set();
const listeners = /* @__PURE__ */ new Set();
const listenersBatch = /* @__PURE__ */ new Set();
const disposables = /* @__PURE__ */ new WeakMap();
const listenerKeys = /* @__PURE__ */ new WeakMap();
const storeSetup = (callback) => {
setups.add(callback);
return () => setups.delete(callback);
};
const storeInit = () => {
if (initialized)
return WVTCK5PV_noop;
if (!stores.length)
return WVTCK5PV_noop;
initialized = true;
const desyncs = getKeys(state).map(
(key) => WVTCK5PV_chain(
...stores.map((store) => {
var _a;
const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store);
if (!storeState)
return;
if (!WVTCK5PV_hasOwnProperty(storeState, key))
return;
return OGOHEUXI_sync(store, [key], (state2) => setState(key, state2[key]));
})
)
);
const teardowns = [];
setups.forEach((setup2) => teardowns.push(setup2()));
const cleanups = stores.map(init);
return WVTCK5PV_chain(...desyncs, ...teardowns, ...cleanups, () => {
initialized = false;
});
};
const sub = (keys, listener, batch2 = false) => {
const set = batch2 ? listenersBatch : listeners;
set.add(listener);
listenerKeys.set(listener, keys);
return () => {
var _a;
(_a = disposables.get(listener)) == null ? void 0 : _a();
disposables.delete(listener);
listenerKeys.delete(listener);
set.delete(listener);
};
};
const storeSubscribe = (keys, listener) => sub(keys, listener);
const storeSync = (keys, listener) => {
disposables.set(listener, listener(state, state));
return sub(keys, listener);
};
const storeBatch = (keys, listener) => {
disposables.set(listener, listener(state, prevStateBatch));
return sub(keys, listener, true);
};
const storePick = (keys) => createStore(pick(state, keys), finalStore);
const storeOmit = (keys) => createStore(omit(state, keys), finalStore);
const getState = () => state;
const setState = (key, value) => {
if (!WVTCK5PV_hasOwnProperty(state, key))
return;
const nextValue = WVTCK5PV_applyState(value, state[key]);
if (nextValue === state[key])
return;
stores.forEach((store) => {
var _a;
(_a = store == null ? void 0 : store.setState) == null ? void 0 : _a.call(store, key, nextValue);
});
const prevState = state;
state = _chunks_PNRLI7OV_spreadProps(_chunks_PNRLI7OV_spreadValues({}, state), { [key]: nextValue });
const thisUpdate = Symbol();
lastUpdate = thisUpdate;
updatedKeys.add(key);
const run = (listener, prev, uKeys) => {
var _a;
const keys = listenerKeys.get(listener);
const updated = (k) => uKeys ? uKeys.has(k) : k === key;
if (!keys || keys.some(updated)) {
(_a = disposables.get(listener)) == null ? void 0 : _a();
disposables.set(listener, listener(state, prev));
}
};
listeners.forEach((listener) => run(listener, prevState));
queueMicrotask(() => {
if (lastUpdate !== thisUpdate)
return;
const snapshot = state;
listenersBatch.forEach((listener) => {
run(listener, prevStateBatch, updatedKeys);
});
prevStateBatch = snapshot;
updatedKeys.clear();
});
};
const finalStore = {
getState,
setState,
__unstableInternals: {
setup: storeSetup,
init: storeInit,
subscribe: storeSubscribe,
sync: storeSync,
batch: storeBatch,
pick: storePick,
omit: storeOmit
}
};
return finalStore;
}
function setup(store, ...args) {
if (!store)
return;
return getInternal(store, "setup")(...args);
}
function init(store, ...args) {
if (!store)
return;
return getInternal(store, "init")(...args);
}
function OGOHEUXI_subscribe(store, ...args) {
if (!store)
return;
return getInternal(store, "subscribe")(...args);
}
function OGOHEUXI_sync(store, ...args) {
if (!store)
return;
return getInternal(store, "sync")(...args);
}
function batch(store, ...args) {
if (!store)
return;
return getInternal(store, "batch")(...args);
}
function omit2(store, ...args) {
if (!store)
return;
return getInternal(store, "omit")(...args);
}
function pick2(store, ...args) {
if (!store)
return;
return getInternal(store, "pick")(...args);
}
function mergeStore(...stores) {
const initialState = stores.reduce((state, store2) => {
var _a;
const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2);
if (!nextState)
return state;
return __spreadValues(__spreadValues({}, state), nextState);
}, {});
const store = createStore(initialState, ...stores);
return store;
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/QPTZ2G2N.js
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/OOWNFOTF.js
@@ -68111,34 +67936,9 @@ function mergeStore(...stores) {
var noopSubscribe = () => () => {
};
var inFlushSyncContext = false;
function safeFlushSync(fn, canFlushSync = true) {
if (inFlushSyncContext || !canFlushSync) {
fn();
return;
}
inFlushSyncContext = true;
const originalError = console.error;
if (false) {}
try {
(0,external_ReactDOM_namespaceObject.flushSync)(fn);
} finally {
console.error = originalError;
inFlushSyncContext = false;
}
}
function useStoreState(store, keyOrSelector = WVTCK5PV_identity) {
const storeSubscribe = external_React_.useCallback(
(callback) => {
if (!store)
return noopSubscribe();
return OGOHEUXI_subscribe(store, null, callback);
},
[store]
);
const getSnapshot = () => {
if (!store)
return;
@@ -68153,7 +67953,11 @@ function useStoreState(store, keyOrSelector = WVTCK5PV_identity) {
return;
return state[key];
};
return (0,shim.useSyncExternalStore)(storeSubscribe, getSnapshot, getSnapshot);
return (0,shim.useSyncExternalStore)(
(store == null ? void 0 : store.subscribe) || noopSubscribe,
getSnapshot,
getSnapshot
);
}
function useStoreProps(store, props, key, setKey) {
const value = WVTCK5PV_hasOwnProperty(props, key) ? props[key] : void 0;
@@ -68166,41 +67970,45 @@ function useStoreProps(store, props, key, setKey) {
queueMicrotask(() => {
canFlushSync = true;
});
return OGOHEUXI_sync(store, [key], (state, prev) => {
const { value: value2, setValue } = propsRef.current;
if (!setValue)
return;
if (state[key] === prev[key])
return;
if (state[key] === value2)
return;
safeFlushSync(() => setValue(state[key]), canFlushSync);
});
return store.sync(
(state, prev) => {
const { value: value2, setValue } = propsRef.current;
if (!setValue)
return;
if (state[key] === prev[key])
return;
if (state[key] === value2)
return;
if (canFlushSync) {
(0,external_ReactDOM_namespaceObject.flushSync)(() => setValue(state[key]));
} else {
setValue(state[key]);
}
},
[key]
);
}, [store, key]);
useSafeLayoutEffect(() => {
return batch(store, [key], () => {
return store.sync(() => {
if (value === void 0)
return;
store.setState(key, value);
});
}, [key]);
}, [store, key, value]);
}
function QPTZ2G2N_useStore(createStore) {
function OOWNFOTF_useStore(createStore) {
const store = useLazyValue(createStore);
useSafeLayoutEffect(() => init(store), [store]);
const useState = external_React_.useCallback(
useSafeLayoutEffect(() => store.init(), [store]);
const useState = (0,external_React_.useCallback)(
(keyOrSelector) => useStoreState(store, keyOrSelector),
[store]
);
return external_React_.useMemo(
() => PNRLI7OV_spreadProps(PNRLI7OV_spreadValues({}, store), { useState }),
[store, useState]
);
return (0,external_React_.useMemo)(() => PNRLI7OV_spreadProps(PNRLI7OV_spreadValues({}, store), { useState }), [store, useState]);
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/7SIWUER2.js
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/DCG3EYDE.js
@@ -68275,12 +68083,12 @@ function findNextPageItemId(element, store, next, pageUp = false) {
}
return id;
}
function _7SIWUER2_targetIsAnotherItem(event, store) {
function DCG3EYDE_targetIsAnotherItem(event, store) {
if (events_isSelfTarget(event))
return false;
return OXPV2NBK_isItem(store, event.target);
}
function _7SIWUER2_useRole(ref, props) {
function DCG3EYDE_useRole(ref, props) {
const roleProp = props.role;
const [role, setRole] = (0,external_React_.useState)(roleProp);
useSafeLayoutEffect(() => {
@@ -68311,7 +68119,7 @@ function supportsAriaSelected(role) {
return true;
return false;
}
var _7SIWUER2_useCompositeItem = NQJBHION_createHook(
var DCG3EYDE_useCompositeItem = NQJBHION_createHook(
(_a) => {
var _b = _a, {
store,
@@ -68373,7 +68181,7 @@ var _7SIWUER2_useCompositeItem = NQJBHION_createHook(
if (!store)
return;
const { activeId, virtualFocus: virtualFocus2, baseElement: baseElement2 } = store.getState();
if (_7SIWUER2_targetIsAnotherItem(event, store))
if (DCG3EYDE_targetIsAnotherItem(event, store))
return;
if (activeId !== id) {
store.setActiveId(id);
@@ -68473,7 +68281,7 @@ var _7SIWUER2_useCompositeItem = NQJBHION_createHook(
);
const isActiveItem = useStoreState(store, (state) => state.activeId === id);
const virtualFocus = useStoreState(store, "virtualFocus");
const role = _7SIWUER2_useRole(ref, props);
const role = DCG3EYDE_useRole(ref, props);
let ariaSelected;
if (isActiveItem) {
if (requiresAriaSelected(role)) {
@@ -68532,9 +68340,9 @@ var _7SIWUER2_useCompositeItem = NQJBHION_createHook(
});
}
);
var _7SIWUER2_CompositeItem = createMemoComponent(
var DCG3EYDE_CompositeItem = createMemoComponent(
(props) => {
const htmlProps = _7SIWUER2_useCompositeItem(props);
const htmlProps = DCG3EYDE_useCompositeItem(props);
return NQJBHION_createElement("button", htmlProps);
}
);
@@ -68542,7 +68350,7 @@ if (false) {}
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/JD3UVZX5.js
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/HCTED3MY.js
@@ -68551,7 +68359,7 @@ if (false) {}
var useToolbarItem = NQJBHION_createHook(
(_a) => {
var _b = _a, { store } = _b, props = __objRest(_b, ["store"]);
props = _7SIWUER2_useCompositeItem(PNRLI7OV_spreadValues({ store }, props));
props = DCG3EYDE_useCompositeItem(PNRLI7OV_spreadValues({ store }, props));
return props;
}
);
@@ -68906,7 +68714,7 @@ function ToolbarGroup({
/* harmony default export */ var toolbar_group = (ToolbarGroup);
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/FSTINJD5.js
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/WKNTOKYS.js
@@ -68929,7 +68737,7 @@ function useCollectionStore(props = {}) {
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/X5CHG5LF.js
;// CONCATENATED MODULE: ./node_modules/@ariakit/react-core/esm/__chunks/5PLAJI33.js
@@ -68961,19 +68769,155 @@ function useCompositeStore(props = {}) {
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/A7IMXABC.js
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/FQL4TRMX.js
// src/utils/store.ts
function createStore(initialState, ...stores) {
let state = initialState;
let prevStateBatch = state;
let lastUpdate = Symbol();
let initialized = false;
const updatedKeys = /* @__PURE__ */ new Set();
const setups = /* @__PURE__ */ new Set();
const listeners = /* @__PURE__ */ new Set();
const listenersBatch = /* @__PURE__ */ new Set();
const disposables = /* @__PURE__ */ new WeakMap();
const listenerKeys = /* @__PURE__ */ new WeakMap();
const setup = (callback) => {
setups.add(callback);
return () => setups.delete(callback);
};
const init = () => {
if (initialized)
return WVTCK5PV_noop;
if (!stores.length)
return WVTCK5PV_noop;
initialized = true;
const desyncs = getKeys(state).map(
(key) => WVTCK5PV_chain(
...stores.map((store) => {
var _a, _b;
const storeState = (_a = store == null ? void 0 : store.getState) == null ? void 0 : _a.call(store);
if (!storeState)
return;
if (!WVTCK5PV_hasOwnProperty(storeState, key))
return;
return (_b = store == null ? void 0 : store.sync) == null ? void 0 : _b.call(store, (state2) => setState(key, state2[key]), [key]);
})
)
);
const teardowns = [];
setups.forEach((setup2) => teardowns.push(setup2()));
const cleanups = stores.map((store) => {
var _a;
return (_a = store == null ? void 0 : store.init) == null ? void 0 : _a.call(store);
});
return WVTCK5PV_chain(...desyncs, ...teardowns, ...cleanups, () => {
initialized = false;
});
};
const sub = (listener, keys, batch = false) => {
const set = batch ? listenersBatch : listeners;
set.add(listener);
listenerKeys.set(listener, keys);
return () => {
var _a;
(_a = disposables.get(listener)) == null ? void 0 : _a();
disposables.delete(listener);
listenerKeys.delete(listener);
set.delete(listener);
};
};
const subscribe = (listener, keys) => sub(listener, keys);
const sync = (listener, keys) => {
disposables.set(listener, listener(state, state));
return sub(listener, keys);
};
const syncBatch = (listener, keys) => {
disposables.set(listener, listener(state, prevStateBatch));
return sub(listener, keys, true);
};
const getState = () => state;
const setState = (key, value) => {
if (!WVTCK5PV_hasOwnProperty(state, key))
return;
const nextValue = WVTCK5PV_applyState(value, state[key]);
if (nextValue === state[key])
return;
stores.forEach((store) => {
var _a;
(_a = store == null ? void 0 : store.setState) == null ? void 0 : _a.call(store, key, nextValue);
});
const prevState = state;
state = _chunks_PNRLI7OV_spreadProps(_chunks_PNRLI7OV_spreadValues({}, state), { [key]: nextValue });
const thisUpdate = Symbol();
lastUpdate = thisUpdate;
updatedKeys.add(key);
const run = (listener, prev, uKeys) => {
var _a;
const keys = listenerKeys.get(listener);
const updated = (k) => uKeys ? uKeys.has(k) : k === key;
if (!keys || keys.some(updated)) {
(_a = disposables.get(listener)) == null ? void 0 : _a();
disposables.set(listener, listener(state, prev));
}
};
listeners.forEach((listener) => run(listener, prevState));
queueMicrotask(() => {
if (lastUpdate !== thisUpdate)
return;
const snapshot = state;
listenersBatch.forEach((listener) => {
run(listener, prevStateBatch, updatedKeys);
});
prevStateBatch = snapshot;
updatedKeys.clear();
});
};
const pick2 = (...keys) => createStore(pick(state, keys), finalStore);
const omit2 = (...keys) => createStore(omit(state, keys), finalStore);
const finalStore = {
setup,
init,
subscribe,
sync,
syncBatch,
getState,
setState,
pick: pick2,
omit: omit2
};
return finalStore;
}
function mergeStore(...stores) {
const initialState = stores.reduce((state, store2) => {
var _a;
const nextState = (_a = store2 == null ? void 0 : store2.getState) == null ? void 0 : _a.call(store2);
if (!nextState)
return state;
return __spreadValues(__spreadValues({}, state), nextState);
}, {});
const store = createStore(initialState, ...stores);
return store;
}
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/SHUO6V52.js
// src/collection/collection-store.ts
function A7IMXABC_isElementPreceding(a, b) {
function SHUO6V52_isElementPreceding(a, b) {
return Boolean(
b.compareDocumentPosition(a) & Node.DOCUMENT_POSITION_PRECEDING
);
}
function A7IMXABC_sortBasedOnDOMPosition(items) {
function SHUO6V52_sortBasedOnDOMPosition(items) {
const pairs = items.map((item, index) => [index, item]);
let isOrderDifferent = false;
pairs.sort(([indexA, a], [indexB, b]) => {
@@ -68983,7 +68927,7 @@ function A7IMXABC_sortBasedOnDOMPosition(items) {
return 0;
if (!elementA || !elementB)
return 0;
if (A7IMXABC_isElementPreceding(elementA, elementB)) {
if (SHUO6V52_isElementPreceding(elementA, elementB)) {
if (indexA > indexB) {
isOrderDifferent = true;
}
@@ -68999,7 +68943,7 @@ function A7IMXABC_sortBasedOnDOMPosition(items) {
}
return items;
}
function A7IMXABC_getCommonParent(items) {
function SHUO6V52_getCommonParent(items) {
var _a;
const firstItem = items.find((item) => !!item.element);
const lastItem = [...items].reverse().find((item) => !!item.element);
@@ -69033,36 +68977,39 @@ function createCollectionStore(props = {}) {
const collection = createStore(initialState, props.store);
const sortItems = () => {
const state = privateStore.getState();
const renderedItems = A7IMXABC_sortBasedOnDOMPosition(state.renderedItems);
const renderedItems = SHUO6V52_sortBasedOnDOMPosition(state.renderedItems);
privateStore.setState("renderedItems", renderedItems);
collection.setState("renderedItems", renderedItems);
};
setup(collection, () => {
return batch(privateStore, ["renderedItems"], (state) => {
let firstRun = true;
let raf = requestAnimationFrame(sortItems);
if (typeof IntersectionObserver !== "function")
return;
const callback = () => {
if (firstRun) {
firstRun = false;
collection.setup(() => {
return privateStore.syncBatch(
(state) => {
let firstRun = true;
let raf = requestAnimationFrame(sortItems);
if (typeof IntersectionObserver !== "function")
return;
}
cancelAnimationFrame(raf);
raf = requestAnimationFrame(sortItems);
};
const root = A7IMXABC_getCommonParent(state.renderedItems);
const observer = new IntersectionObserver(callback, { root });
state.renderedItems.forEach((item) => {
if (!item.element)
return;
observer.observe(item.element);
});
return () => {
cancelAnimationFrame(raf);
observer.disconnect();
};
});
const callback = () => {
if (firstRun) {
firstRun = false;
return;
}
cancelAnimationFrame(raf);
raf = requestAnimationFrame(sortItems);
};
const root = SHUO6V52_getCommonParent(state.renderedItems);
const observer = new IntersectionObserver(callback, { root });
state.renderedItems.forEach((item) => {
if (!item.element)
return;
observer.observe(item.element);
});
return () => {
cancelAnimationFrame(raf);
observer.disconnect();
};
},
["renderedItems"]
);
});
const mergeItem = (item, setItems, canDeleteFromMap = false) => {
let prevItem;
@@ -69154,7 +69101,7 @@ function reverseArray(array) {
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/ROY5BBHL.js
;// CONCATENATED MODULE: ./node_modules/@ariakit/core/esm/__chunks/NRXA5QTV.js
@@ -69162,8 +69109,8 @@ function reverseArray(array) {
// src/composite/composite-store.ts
var ROY5BBHL_NULL_ITEM = { id: null };
function ROY5BBHL_findFirstEnabledItem(items, excludeId) {
var NRXA5QTV_NULL_ITEM = { id: null };
function NRXA5QTV_findFirstEnabledItem(items, excludeId) {
return items.find((item) => {
if (excludeId) {
return !item.disabled && item.id !== excludeId;
@@ -69179,7 +69126,7 @@ function getEnabledItems(items, excludeId) {
return !item.disabled;
});
}
function ROY5BBHL_getOppositeOrientation(orientation) {
function NRXA5QTV_getOppositeOrientation(orientation) {
if (orientation === "vertical")
return "horizontal";
if (orientation === "horizontal")
@@ -69189,15 +69136,15 @@ function ROY5BBHL_getOppositeOrientation(orientation) {
function getItemsInRow(items, rowId) {
return items.filter((item) => item.rowId === rowId);
}
function ROY5BBHL_flipItems(items, activeId, shouldInsertNullItem = false) {
function NRXA5QTV_flipItems(items, activeId, shouldInsertNullItem = false) {
const index = items.findIndex((item) => item.id === activeId);
return [
...items.slice(index + 1),
...shouldInsertNullItem ? [ROY5BBHL_NULL_ITEM] : [],
...shouldInsertNullItem ? [NRXA5QTV_NULL_ITEM] : [],
...items.slice(0, index)
];
}
function ROY5BBHL_groupItemsByRows(items) {
function NRXA5QTV_groupItemsByRows(items) {
const rows = [];
for (const item of items) {
const row = rows.find((currentRow) => {
@@ -69221,7 +69168,7 @@ function getMaxRowLength(array) {
}
return maxLength;
}
function ROY5BBHL_createEmptyItem(rowId) {
function NRXA5QTV_createEmptyItem(rowId) {
return {
id: "__EMPTY_ITEM__",
disabled: true,
@@ -69235,15 +69182,15 @@ function normalizeRows(rows, activeId, focusShift) {
const item = row[i];
if (!item || focusShift && item.disabled) {
const isFirst = i === 0;
const previousItem = isFirst && focusShift ? ROY5BBHL_findFirstEnabledItem(row) : row[i - 1];
row[i] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : ROY5BBHL_createEmptyItem(previousItem == null ? void 0 : previousItem.rowId);
const previousItem = isFirst && focusShift ? NRXA5QTV_findFirstEnabledItem(row) : row[i - 1];
row[i] = previousItem && activeId !== previousItem.id && focusShift ? previousItem : NRXA5QTV_createEmptyItem(previousItem == null ? void 0 : previousItem.rowId);
}
}
}
return rows;
}
function ROY5BBHL_verticalizeItems(items) {
const rows = ROY5BBHL_groupItemsByRows(items);
function NRXA5QTV_verticalizeItems(items) {
const rows = NRXA5QTV_groupItemsByRows(items);
const maxLength = getMaxRowLength(rows);
const verticalized = [];
for (let i = 0; i < maxLength; i += 1) {
@@ -69297,16 +69244,18 @@ function createCompositeStore(props = {}) {
focusShift: defaultValue(props.focusShift, syncState == null ? void 0 : syncState.focusShift, false)
});
const composite = createStore(initialState, collection, props.store);
setup(
composite,
() => OGOHEUXI_sync(composite, ["renderedItems", "activeId"], (state) => {
composite.setState("activeId", (activeId2) => {
var _a2;
if (activeId2 !== void 0)
return activeId2;
return (_a2 = ROY5BBHL_findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id;
});
})
composite.setup(
() => composite.sync(
(state) => {
composite.setState("activeId", (activeId2) => {
var _a2;
if (activeId2 !== void 0)
return activeId2;
return (_a2 = NRXA5QTV_findFirstEnabledItem(state.renderedItems)) == null ? void 0 : _a2.id;
});
},
["renderedItems", "activeId"]
)
);
const getNextId = (items, orientation, hasNullItem, skip) => {
var _a2, _b;
@@ -69315,11 +69264,11 @@ function createCompositeStore(props = {}) {
const isRTL = rtl && isHorizontal;
const allItems = isRTL ? reverseArray(items) : items;
if (activeId2 == null) {
return (_a2 = ROY5BBHL_findFirstEnabledItem(allItems)) == null ? void 0 : _a2.id;
return (_a2 = NRXA5QTV_findFirstEnabledItem(allItems)) == null ? void 0 : _a2.id;
}
const activeItem = allItems.find((item) => item.id === activeId2);
if (!activeItem) {
return (_b = ROY5BBHL_findFirstEnabledItem(allItems)) == null ? void 0 : _b.id;
return (_b = NRXA5QTV_findFirstEnabledItem(allItems)) == null ? void 0 : _b.id;
}
const isGrid = !!activeItem.rowId;
const activeIndex = allItems.indexOf(activeItem);
@@ -69331,7 +69280,7 @@ function createCompositeStore(props = {}) {
nextEnabledItemsInRow[nextEnabledItemsInRow.length - 1];
return nextItem2 == null ? void 0 : nextItem2.id;
}
const oppositeOrientation = ROY5BBHL_getOppositeOrientation(
const oppositeOrientation = NRXA5QTV_getOppositeOrientation(
// If it's a grid and orientation is not set, it's a next/previous call,
// which is inherently horizontal. up/down will call next with orientation
// set to vertical by default (see below on up/down methods).
@@ -69342,12 +69291,12 @@ function createCompositeStore(props = {}) {
hasNullItem = hasNullItem || !isGrid && canLoop && includesBaseElement;
if (canLoop) {
const loopItems = canWrap && !hasNullItem ? allItems : getItemsInRow(allItems, activeItem.rowId);
const sortedItems = ROY5BBHL_flipItems(loopItems, activeId2, hasNullItem);
const nextItem2 = ROY5BBHL_findFirstEnabledItem(sortedItems, activeId2);
const sortedItems = NRXA5QTV_flipItems(loopItems, activeId2, hasNullItem);
const nextItem2 = NRXA5QTV_findFirstEnabledItem(sortedItems, activeId2);
return nextItem2 == null ? void 0 : nextItem2.id;
}
if (canWrap) {
const nextItem2 = ROY5BBHL_findFirstEnabledItem(
const nextItem2 = NRXA5QTV_findFirstEnabledItem(
// We can use nextItems, which contains all the next items, including
// items from other rows, to wrap between rows. However, if there is a
// null item (the composite container), we'll only use the next items in
@@ -69360,7 +69309,7 @@ function createCompositeStore(props = {}) {
const nextId = hasNullItem ? (nextItem2 == null ? void 0 : nextItem2.id) || null : nextItem2 == null ? void 0 : nextItem2.id;
return nextId;
}
const nextItem = ROY5BBHL_findFirstEnabledItem(nextItemsInRow, activeId2);
const nextItem = NRXA5QTV_findFirstEnabledItem(nextItemsInRow, activeId2);
if (!nextItem && hasNullItem) {
return null;
}
@@ -69377,11 +69326,11 @@ function createCompositeStore(props = {}) {
},
first: () => {
var _a2;
return (_a2 = ROY5BBHL_findFirstEnabledItem(composite.getState().renderedItems)) == null ? void 0 : _a2.id;
return (_a2 = NRXA5QTV_findFirstEnabledItem(composite.getState().renderedItems)) == null ? void 0 : _a2.id;
},
last: () => {
var _a2;
return (_a2 = ROY5BBHL_findFirstEnabledItem(reverseArray(composite.getState().renderedItems))) == null ? void 0 : _a2.id;
return (_a2 = NRXA5QTV_findFirstEnabledItem(reverseArray(composite.getState().renderedItems))) == null ? void 0 : _a2.id;
},
next: (skip) => {
const { renderedItems, orientation } = composite.getState();
@@ -69390,7 +69339,7 @@ function createCompositeStore(props = {}) {
previous: (skip) => {
var _a2;
const { renderedItems, orientation, includesBaseElement } = composite.getState();
const isGrid = !!((_a2 = ROY5BBHL_findFirstEnabledItem(renderedItems)) == null ? void 0 : _a2.rowId);
const isGrid = !!((_a2 = NRXA5QTV_findFirstEnabledItem(renderedItems)) == null ? void 0 : _a2.rowId);
const hasNullItem = !isGrid && includesBaseElement;
return getNextId(
reverseArray(renderedItems),
@@ -69408,9 +69357,9 @@ function createCompositeStore(props = {}) {
includesBaseElement
} = composite.getState();
const shouldShift = focusShift && !skip;
const verticalItems = ROY5BBHL_verticalizeItems(
const verticalItems = NRXA5QTV_verticalizeItems(
flatten2DArray(
normalizeRows(ROY5BBHL_groupItemsByRows(renderedItems), activeId2, shouldShift)
normalizeRows(NRXA5QTV_groupItemsByRows(renderedItems), activeId2, shouldShift)
)
);
const canLoop = focusLoop && focusLoop !== "horizontal";
@@ -69420,11 +69369,11 @@ function createCompositeStore(props = {}) {
up: (skip) => {
const { activeId: activeId2, renderedItems, focusShift, includesBaseElement } = composite.getState();
const shouldShift = focusShift && !skip;
const verticalItems = ROY5BBHL_verticalizeItems(
const verticalItems = NRXA5QTV_verticalizeItems(
reverseArray(
flatten2DArray(
normalizeRows(
ROY5BBHL_groupItemsByRows(renderedItems),
NRXA5QTV_groupItemsByRows(renderedItems),
activeId2,
shouldShift
)
@@ -69481,7 +69430,7 @@ function useToolbarStoreProps(store, props) {
}
function useToolbarStore(props = {}) {
const options = useToolbarStoreOptions(props);
const store = QPTZ2G2N_useStore(
const store = OOWNFOTF_useStore(
() => createToolbarStore(PNRLI7OV_spreadValues(PNRLI7OV_spreadValues({}, props), options))
);
return useToolbarStoreProps(store, props);
File diff suppressed because one or more lines are too long
-5
View File
@@ -6356,11 +6356,6 @@ function useEntityBlockEditor(kind, name, {
});
function updateAttributes(attributes) {
// Only attempt to update attributes, if attributes is an object.
if (!attributes || Array.isArray(attributes) || typeof attributes !== 'object') {
return attributes;
}
attributes = { ...attributes
};
File diff suppressed because one or more lines are too long
+32 -37
View File
@@ -8968,40 +8968,6 @@ const interfaceLabels = {
footer: (0,external_wp_i18n_namespaceObject.__)('Editor footer')
};
function useEditorStyles() {
const {
hasThemeStyleSupport,
editorSettings
} = (0,external_wp_data_namespaceObject.useSelect)(select => ({
hasThemeStyleSupport: select(store_store).isFeatureActive('themeStyles'),
editorSettings: select(external_wp_editor_namespaceObject.store).getEditorSettings()
}), []); // Compute the default styles.
return (0,external_wp_element_namespaceObject.useMemo)(() => {
var _editorSettings$style, _editorSettings$style2;
const presetStyles = (_editorSettings$style = editorSettings.styles?.filter(style => style.__unstableType && style.__unstableType !== 'theme')) !== null && _editorSettings$style !== void 0 ? _editorSettings$style : [];
const defaultEditorStyles = [...editorSettings.defaultEditorStyles, ...presetStyles]; // Has theme styles if the theme supports them and if some styles were not preset styles (in which case they're theme styles).
const hasThemeStyles = hasThemeStyleSupport && presetStyles.length !== ((_editorSettings$style2 = editorSettings.styles?.length) !== null && _editorSettings$style2 !== void 0 ? _editorSettings$style2 : 0); // If theme styles are not present or displayed, ensure that
// base layout styles are still present in the editor.
if (!editorSettings.disableLayoutStyles && !hasThemeStyles) {
defaultEditorStyles.push({
css: getLayoutStyles({
style: {},
selector: 'body',
hasBlockGapSupport: false,
hasFallbackGapSupport: true,
fallbackGapValue: '0.5em'
})
});
}
return hasThemeStyles ? editorSettings.styles : defaultEditorStyles;
}, [editorSettings.defaultEditorStyles, editorSettings.disableLayoutStyles, editorSettings.styles, hasThemeStyleSupport]);
}
function Layout() {
const isMobileViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('medium', '<');
const isHugeViewport = (0,external_wp_compose_namespaceObject.useViewportMatch)('huge', '>=');
@@ -9030,14 +8996,43 @@ function Layout() {
isDistractionFree,
showBlockBreadcrumbs,
isTemplateMode,
documentLabel
documentLabel,
styles
} = (0,external_wp_data_namespaceObject.useSelect)(select => {
const {
getEditorSettings,
getPostTypeLabel
} = select(external_wp_editor_namespaceObject.store);
const {
isFeatureActive
} = select(store_store);
const editorSettings = getEditorSettings();
const postTypeLabel = getPostTypeLabel();
const hasThemeStyles = isFeatureActive('themeStyles');
const themeStyles = [];
const presetStyles = [];
editorSettings.styles?.forEach(style => {
if (!style.__unstableType || style.__unstableType === 'theme') {
themeStyles.push(style);
} else {
presetStyles.push(style);
}
});
const defaultEditorStyles = [...editorSettings.defaultEditorStyles, ...presetStyles]; // If theme styles are not present or displayed, ensure that
// base layout styles are still present in the editor.
if (!editorSettings.disableLayoutStyles && !(hasThemeStyles && themeStyles.length)) {
defaultEditorStyles.push({
css: getLayoutStyles({
style: {},
selector: 'body',
hasBlockGapSupport: false,
hasFallbackGapSupport: true,
fallbackGapValue: '0.5em'
})
});
}
return {
isTemplateMode: select(store_store).isEditingTemplate(),
hasFixedToolbar: select(store_store).isFeatureActive('fixedToolbar'),
@@ -9054,10 +9049,10 @@ function Layout() {
isDistractionFree: select(store_store).isFeatureActive('distractionFree'),
showBlockBreadcrumbs: select(store_store).isFeatureActive('showBlockBreadcrumbs'),
// translators: Default label for the Document in the Block Breadcrumb.
documentLabel: postTypeLabel || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun')
documentLabel: postTypeLabel || (0,external_wp_i18n_namespaceObject._x)('Document', 'noun'),
styles: hasThemeStyles && themeStyles.length ? editorSettings.styles : defaultEditorStyles
};
}, []);
const styles = useEditorStyles();
const openSidebarPanel = () => openGeneralSidebar(hasBlockSelected ? 'edit-post/block' : 'edit-post/document'); // Inserter and Sidebars are mutually exclusive
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -5622,7 +5622,7 @@ function wp_get_loading_optimization_attributes( $tag_name, $attr, $context ) {
};
// Closure to increase media count for images with certain minimum threshold, mostly used for header images.
$maybe_increase_content_media_count = static function() use ( $attr ) {
/** This filter is documented in wp-includes/media.php */
/** This filter is documented in wp-admin/includes/media.php */
$wp_min_priority_img_pixels = apply_filters( 'wp_min_priority_img_pixels', 50000 );
// Images with a certain minimum size in the header of the page are also counted towards the threshold.
if ( $wp_min_priority_img_pixels <= $attr['width'] * $attr['height'] ) {
+1 -1
View File
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.3.1';
$wp_version = '6.3';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.