lol backups and old site first commit

This commit is contained in:
2026-09-06 00:14:06 +02:00
parent 1e8a86873d
commit 56e7e28142
4021 changed files with 1866999 additions and 0 deletions
@@ -0,0 +1,108 @@
// packages/block-library/build-module/accordion/view.mjs
import { store, getContext } from "@wordpress/interactivity";
var hashHandled = false;
var { actions } = store(
"core/accordion",
{
state: {
get isOpen() {
const { id, accordionItems } = getContext();
const accordionItem = accordionItems.find(
(item) => item.id === id
);
return accordionItem ? accordionItem.isOpen : false;
},
get isHidden() {
const { id, accordionItems } = getContext();
const accordionItem = accordionItems.find(
(item) => item.id === id
);
return accordionItem?.isOpen ? null : "until-found";
}
},
actions: {
toggle: () => {
const context = getContext();
const { id, autoclose, accordionItems } = context;
const accordionItem = accordionItems.find(
(item) => item.id === id
);
if (autoclose) {
accordionItems.forEach((item) => {
item.isOpen = item.id === id ? !accordionItem.isOpen : false;
});
} else {
accordionItem.isOpen = !accordionItem.isOpen;
}
},
openPanelByHash: () => {
if (hashHandled || !window.location?.hash?.length) {
return;
}
const context = getContext();
const { id, accordionItems, autoclose } = context;
const hash = decodeURIComponent(
window.location.hash.slice(1)
);
const targetElement = window.document.getElementById(hash);
if (!targetElement) {
return;
}
const panelElement = window.document.querySelector(
'.wp-block-accordion-panel[aria-labelledby="' + id + '"]'
);
if (!panelElement || !panelElement.contains(targetElement)) {
return;
}
hashHandled = true;
if (autoclose) {
accordionItems.forEach((item) => {
item.isOpen = item.id === id;
});
} else {
const targetItem = accordionItems.find(
(item) => item.id === id
);
if (targetItem) {
targetItem.isOpen = true;
}
}
window.setTimeout(() => {
targetElement.scrollIntoView();
}, 0);
},
handleBeforeMatch: () => {
const context = getContext();
const { id, autoclose, accordionItems } = context;
const accordionItem = accordionItems.find(
(item) => item.id === id
);
if (accordionItem) {
if (autoclose) {
accordionItems.forEach((item) => {
item.isOpen = item.id === id;
});
} else {
accordionItem.isOpen = true;
}
}
}
},
callbacks: {
initAccordionItems: () => {
const context = getContext();
const { id, openByDefault, accordionItems } = context;
accordionItems.push({
id,
isOpen: openByDefault
});
actions.openPanelByHash();
},
hashChange: () => {
hashHandled = false;
actions.openPanelByHash();
}
}
},
{ lock: true }
);
@@ -0,0 +1 @@
<?php return array('dependencies' => array(), 'module_dependencies' => array(array('id' => '@wordpress/interactivity', 'import' => 'static')), 'version' => '2bfb90e7aee6b5300a7c');
@@ -0,0 +1 @@
import{store as p,getContext as s}from"@wordpress/interactivity";var d=!1,{actions:l}=p("core/accordion",{state:{get isOpen(){let{id:c,accordionItems:e}=s(),t=e.find(n=>n.id===c);return t?t.isOpen:!1},get isHidden(){let{id:c,accordionItems:e}=s();return e.find(n=>n.id===c)?.isOpen?null:"until-found"}},actions:{toggle:()=>{let c=s(),{id:e,autoclose:t,accordionItems:n}=c,i=n.find(o=>o.id===e);t?n.forEach(o=>{o.isOpen=o.id===e?!i.isOpen:!1}):i.isOpen=!i.isOpen},openPanelByHash:()=>{if(d||!window.location?.hash?.length)return;let c=s(),{id:e,accordionItems:t,autoclose:n}=c,i=decodeURIComponent(window.location.hash.slice(1)),o=window.document.getElementById(i);if(!o)return;let r=window.document.querySelector('.wp-block-accordion-panel[aria-labelledby="'+e+'"]');if(!(!r||!r.contains(o))){if(d=!0,n)t.forEach(a=>{a.isOpen=a.id===e});else{let a=t.find(f=>f.id===e);a&&(a.isOpen=!0)}window.setTimeout(()=>{o.scrollIntoView()},0)}},handleBeforeMatch:()=>{let c=s(),{id:e,autoclose:t,accordionItems:n}=c,i=n.find(o=>o.id===e);i&&(t?n.forEach(o=>{o.isOpen=o.id===e}):i.isOpen=!0)}},callbacks:{initAccordionItems:()=>{let c=s(),{id:e,openByDefault:t,accordionItems:n}=c;n.push({id:e,isOpen:t}),l.openPanelByHash()},hashChange:()=>{d=!1,l.openPanelByHash()}}},{lock:!0});
@@ -0,0 +1,44 @@
// packages/block-library/build-module/file/view.mjs
import { store } from "@wordpress/interactivity";
// packages/block-library/build-module/file/utils/index.mjs
var browserSupportsPdfs = () => {
if (window.navigator.pdfViewerEnabled) {
return true;
}
if (window.navigator.userAgent.indexOf("Mobi") > -1) {
return false;
}
if (window.navigator.userAgent.indexOf("Android") > -1) {
return false;
}
if (window.navigator.userAgent.indexOf("Macintosh") > -1 && window.navigator.maxTouchPoints && window.navigator.maxTouchPoints > 2) {
return false;
}
if (!!(window.ActiveXObject || "ActiveXObject" in window) && !(createActiveXObject("AcroPDF.PDF") || createActiveXObject("PDF.PdfCtrl"))) {
return false;
}
return true;
};
var createActiveXObject = (type) => {
let ax;
try {
ax = new window.ActiveXObject(type);
} catch {
ax = void 0;
}
return ax;
};
// packages/block-library/build-module/file/view.mjs
store(
"core/file",
{
state: {
get hasPdfPreview() {
return browserSupportsPdfs();
}
}
},
{ lock: true }
);
@@ -0,0 +1 @@
<?php return array('dependencies' => array(), 'module_dependencies' => array(array('id' => '@wordpress/interactivity', 'import' => 'static')), 'version' => 'a9114a756e418400594c');
@@ -0,0 +1 @@
import{store as n}from"@wordpress/interactivity";var t=()=>window.navigator.pdfViewerEnabled?!0:!(window.navigator.userAgent.indexOf("Mobi")>-1||window.navigator.userAgent.indexOf("Android")>-1||window.navigator.userAgent.indexOf("Macintosh")>-1&&window.navigator.maxTouchPoints&&window.navigator.maxTouchPoints>2||(window.ActiveXObject||"ActiveXObject"in window)&&!(e("AcroPDF.PDF")||e("PDF.PdfCtrl"))),e=i=>{let r;try{r=new window.ActiveXObject(i)}catch{r=void 0}return r};n("core/file",{state:{get hasPdfPreview(){return t()}}},{lock:!0});
@@ -0,0 +1,45 @@
// packages/block-library/build-module/form/view.mjs
var formSettings;
try {
formSettings = JSON.parse(
document.getElementById(
"wp-script-module-data-@wordpress/block-library/form/view"
)?.textContent
);
} catch {
}
document.querySelectorAll("form.wp-block-form").forEach(function(form) {
if (!formSettings || !form.action || !form.action.startsWith("mailto:")) {
return;
}
const redirectNotification = (status) => {
const urlParams = new URLSearchParams(window.location.search);
urlParams.append("wp-form-result", status);
window.location.search = urlParams.toString();
};
form.addEventListener("submit", async function(event) {
event.preventDefault();
const formData = Object.fromEntries(new FormData(form).entries());
formData.formAction = form.action;
formData._ajax_nonce = formSettings.nonce;
formData.action = formSettings.action;
formData._wp_http_referer = window.location.href;
formData.formAction = form.action;
try {
const response = await fetch(formSettings.ajaxUrl, {
method: "POST",
headers: {
"Content-Type": "application/x-www-form-urlencoded"
},
body: new URLSearchParams(formData).toString()
});
if (response.ok) {
redirectNotification("success");
} else {
redirectNotification("error");
}
} catch {
redirectNotification("error");
}
});
});
@@ -0,0 +1 @@
<?php return array('dependencies' => array(), 'version' => '5542f8ad251fe43ef09e');
@@ -0,0 +1 @@
var o;try{o=JSON.parse(document.getElementById("wp-script-module-data-@wordpress/block-library/form/view")?.textContent)}catch{}document.querySelectorAll("form.wp-block-form").forEach(function(e){if(!o||!e.action||!e.action.startsWith("mailto:"))return;let r=n=>{let t=new URLSearchParams(window.location.search);t.append("wp-form-result",n),window.location.search=t.toString()};e.addEventListener("submit",async function(n){n.preventDefault();let t=Object.fromEntries(new FormData(e).entries());t.formAction=e.action,t._ajax_nonce=o.nonce,t.action=o.action,t._wp_http_referer=window.location.href,t.formAction=e.action;try{(await fetch(o.ajaxUrl,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams(t).toString()})).ok?r("success"):r("error")}catch{r("error")}})});
@@ -0,0 +1,462 @@
// packages/block-library/build-module/image/view.mjs
import {
store,
getContext,
getElement,
getConfig,
withSyncEvent,
withScope
} from "@wordpress/interactivity";
// packages/block-library/build-module/image/constants.mjs
var IMAGE_PRELOAD_DELAY = 200;
// packages/block-library/build-module/image/view.mjs
var isTouching = false;
var lastTouchTime = 0;
var touchStartEvent = {
startX: 0,
startY: 0,
startTime: 0
};
var focusableSelectors = [
".wp-lightbox-close-button",
".wp-lightbox-navigation-button"
];
function getImageSrc({ uploadedSrc }) {
return uploadedSrc || "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";
}
function getImageSrcset({ lightboxSrcset }) {
return lightboxSrcset || "";
}
var { state, actions, callbacks } = store(
"core/image",
{
state: {
selectedImageId: null,
selectedGalleryId: null,
preloadTimers: /* @__PURE__ */ new Map(),
preloadedImageIds: /* @__PURE__ */ new Set(),
get galleryImages() {
if (!state.selectedGalleryId) {
return [state.selectedImageId];
}
return Object.entries(state.metadata).filter(
([, value]) => value.galleryId === state.selectedGalleryId
).sort(([, a], [, b]) => {
const orderA = a.order ?? 0;
const orderB = b.order ?? 0;
return orderA - orderB;
}).map(([key]) => key);
},
get selectedImageIndex() {
return state.galleryImages.findIndex(
(id) => id === state.selectedImageId
);
},
get selectedImage() {
return state.metadata[state.selectedImageId];
},
get hasNavigationIcon() {
const { navigationButtonType } = state.selectedImage;
return navigationButtonType === "icon" || navigationButtonType === "both";
},
get hasNavigationText() {
const { navigationButtonType } = state.selectedImage;
return navigationButtonType === "text" || navigationButtonType === "both";
},
get thisImage() {
const { imageId } = getContext();
return state.metadata[imageId];
},
get hasNavigation() {
return state.galleryImages.length > 1;
},
get hasNextImage() {
return state.selectedImageIndex + 1 < state.galleryImages.length;
},
get hasPreviousImage() {
return state.selectedImageIndex - 1 >= 0;
},
get overlayOpened() {
return state.selectedImageId !== null;
},
get roleAttribute() {
return state.overlayOpened ? "dialog" : null;
},
get ariaModal() {
return state.overlayOpened ? "true" : null;
},
get ariaLabel() {
return state.selectedImage.customAriaLabel || getConfig().defaultAriaLabel;
},
get closeButtonAriaLabel() {
return state.hasNavigationText ? void 0 : getConfig().closeButtonText;
},
get prevButtonAriaLabel() {
return state.hasNavigationText ? void 0 : getConfig().prevButtonText;
},
get nextButtonAriaLabel() {
return state.hasNavigationText ? void 0 : getConfig().nextButtonText;
},
get enlargedSrc() {
return getImageSrc(state.selectedImage);
},
get enlargedSrcset() {
return getImageSrcset(state.selectedImage);
},
get figureStyles() {
return state.overlayOpened && `${state.selectedImage.figureStyles?.replace(
/margin[^;]*;?/g,
""
)};`;
},
get imgStyles() {
return state.overlayOpened && `${state.selectedImage.imgStyles?.replace(
/;$/,
""
)}; object-fit:cover;`;
},
get isContentHidden() {
const ctx = getContext();
return state.overlayEnabled && state.selectedImageId === ctx.imageId;
},
get isContentVisible() {
const ctx = getContext();
return !state.overlayEnabled && state.selectedImageId === ctx.imageId;
}
},
actions: {
showLightbox() {
const { imageId } = getContext();
if (!state.metadata[imageId].imageRef?.complete) {
return;
}
state.scrollTopReset = document.documentElement.scrollTop;
state.scrollLeftReset = document.documentElement.scrollLeft;
state.selectedImageId = imageId;
const { galleryId } = getContext("core/gallery") || {};
state.selectedGalleryId = galleryId || null;
state.overlayEnabled = true;
callbacks.setOverlayStyles();
},
hideLightbox() {
if (state.overlayEnabled) {
state.overlayEnabled = false;
setTimeout(function() {
state.selectedImage.buttonRef.focus({
preventScroll: true
});
state.selectedImageId = null;
state.selectedGalleryId = null;
}, 450);
}
},
showPreviousImage: withSyncEvent((event) => {
event.stopPropagation();
const nextIndex = state.hasPreviousImage ? state.selectedImageIndex - 1 : state.galleryImages.length - 1;
state.selectedImageId = state.galleryImages[nextIndex];
callbacks.setOverlayStyles();
}),
showNextImage: withSyncEvent((event) => {
event.stopPropagation();
const nextIndex = state.hasNextImage ? state.selectedImageIndex + 1 : 0;
state.selectedImageId = state.galleryImages[nextIndex];
callbacks.setOverlayStyles();
}),
handleKeydown: withSyncEvent((event) => {
if (state.overlayEnabled) {
if (event.key === "Escape") {
actions.hideLightbox();
} else if (event.key === "ArrowLeft") {
actions.showPreviousImage(event);
} else if (event.key === "ArrowRight") {
actions.showNextImage(event);
} else if (event.key === "Tab") {
const focusableElements = Array.from(
document.querySelectorAll(focusableSelectors)
);
const firstFocusableElement = focusableElements[0];
const lastFocusableElement = focusableElements[focusableElements.length - 1];
if (event.shiftKey && event.target === firstFocusableElement) {
event.preventDefault();
lastFocusableElement.focus();
} else if (!event.shiftKey && event.target === lastFocusableElement) {
event.preventDefault();
firstFocusableElement.focus();
}
}
}
}),
handleTouchMove: withSyncEvent((event) => {
if (state.overlayEnabled) {
event.preventDefault();
}
}),
handleTouchStart(event) {
isTouching = true;
const t = event.touches && event.touches[0];
if (t) {
touchStartEvent.startX = t.clientX;
touchStartEvent.startY = t.clientY;
touchStartEvent.startTime = Date.now();
}
},
handleTouchEnd: withSyncEvent((event) => {
const touchEndEvent = event.changedTouches && event.changedTouches[0] || event.touches && event.touches[0];
const now = Date.now();
if (touchEndEvent && state.overlayEnabled) {
const deltaX = touchEndEvent.clientX - touchStartEvent.startX;
const deltaY = touchEndEvent.clientY - touchStartEvent.startY;
const absDeltaX = Math.abs(deltaX);
const absDeltaY = Math.abs(deltaY);
const elapsedMs = now - touchStartEvent.startTime;
const isHorizontalSwipe = (
// Swipe distance is greater than 50px
absDeltaX > 50 && // Horizontal movement is much larger than the vertical movement
absDeltaX > absDeltaY * 1.5 && // Fast action of less than 800ms
elapsedMs < 800
);
if (isHorizontalSwipe) {
event.preventDefault();
if (deltaX < 0) {
actions.showNextImage(event);
} else {
actions.showPreviousImage(event);
}
}
}
lastTouchTime = now;
isTouching = false;
}),
handleScroll() {
if (state.overlayOpened) {
if (!isTouching && Date.now() - lastTouchTime > 450) {
window.scrollTo(
state.scrollLeftReset,
state.scrollTopReset
);
}
}
},
preloadImage() {
const { imageId } = getContext();
if (state.preloadedImageIds.has(imageId)) {
return;
}
const imageMetadata = state.metadata[imageId];
const imageLink = document.createElement("link");
imageLink.rel = "preload";
imageLink.as = "image";
imageLink.href = getImageSrc(imageMetadata);
const srcset = getImageSrcset(imageMetadata);
if (srcset) {
imageLink.setAttribute("imagesrcset", srcset);
imageLink.setAttribute("imagesizes", "100vw");
}
document.head.appendChild(imageLink);
state.preloadedImageIds.add(imageId);
},
preloadImageWithDelay() {
const { imageId } = getContext();
actions.cancelPreload();
const timerId = setTimeout(
withScope(() => {
actions.preloadImage();
state.preloadTimers.delete(imageId);
}),
IMAGE_PRELOAD_DELAY
);
state.preloadTimers.set(imageId, timerId);
},
cancelPreload() {
const { imageId } = getContext();
if (state.preloadTimers.has(imageId)) {
clearTimeout(state.preloadTimers.get(imageId));
state.preloadTimers.delete(imageId);
}
}
},
callbacks: {
setOverlayStyles() {
if (!state.overlayEnabled) {
return;
}
let {
naturalWidth,
naturalHeight,
offsetWidth: originalWidth,
offsetHeight: originalHeight
} = state.selectedImage.imageRef;
let { x: screenPosX, y: screenPosY } = state.selectedImage.imageRef.getBoundingClientRect();
const naturalRatio = naturalWidth / naturalHeight;
let originalRatio = originalWidth / originalHeight;
if (state.selectedImage.scaleAttr === "contain") {
if (naturalRatio > originalRatio) {
const heightWithoutSpace = originalWidth / naturalRatio;
screenPosY += (originalHeight - heightWithoutSpace) / 2;
originalHeight = heightWithoutSpace;
} else {
const widthWithoutSpace = originalHeight * naturalRatio;
screenPosX += (originalWidth - widthWithoutSpace) / 2;
originalWidth = widthWithoutSpace;
}
}
originalRatio = originalWidth / originalHeight;
let imgMaxWidth = parseFloat(
state.selectedImage.targetWidth && state.selectedImage.targetWidth !== "none" ? state.selectedImage.targetWidth : naturalWidth
);
let imgMaxHeight = parseFloat(
state.selectedImage.targetHeight && state.selectedImage.targetHeight !== "none" ? state.selectedImage.targetHeight : naturalHeight
);
let imgRatio = imgMaxWidth / imgMaxHeight;
let containerMaxWidth = imgMaxWidth;
let containerMaxHeight = imgMaxHeight;
let containerWidth = imgMaxWidth;
let containerHeight = imgMaxHeight;
if (naturalRatio.toFixed(2) !== imgRatio.toFixed(2)) {
if (naturalRatio > imgRatio) {
const reducedHeight = imgMaxWidth / naturalRatio;
if (imgMaxHeight - reducedHeight > imgMaxWidth) {
imgMaxHeight = reducedHeight;
imgMaxWidth = reducedHeight * naturalRatio;
} else {
imgMaxHeight = imgMaxWidth / naturalRatio;
}
} else {
const reducedWidth = imgMaxHeight * naturalRatio;
if (imgMaxWidth - reducedWidth > imgMaxHeight) {
imgMaxWidth = reducedWidth;
imgMaxHeight = reducedWidth / naturalRatio;
} else {
imgMaxWidth = imgMaxHeight * naturalRatio;
}
}
containerWidth = imgMaxWidth;
containerHeight = imgMaxHeight;
imgRatio = imgMaxWidth / imgMaxHeight;
if (originalRatio > imgRatio) {
containerMaxWidth = imgMaxWidth;
containerMaxHeight = containerMaxWidth / originalRatio;
} else {
containerMaxHeight = imgMaxHeight;
containerMaxWidth = containerMaxHeight * originalRatio;
}
}
if (originalWidth > containerWidth || originalHeight > containerHeight) {
containerWidth = originalWidth;
containerHeight = originalHeight;
}
let horizontalPadding = 0;
let verticalPadding = 160;
if (480 < window.innerWidth) {
horizontalPadding = 80;
verticalPadding = 160;
}
if (960 < window.innerWidth) {
horizontalPadding = state.hasNavigation ? 320 : 80;
verticalPadding = 80;
}
const targetMaxWidth = Math.min(
window.innerWidth - horizontalPadding,
containerWidth
);
const targetMaxHeight = Math.min(
window.innerHeight - verticalPadding,
containerHeight
);
const targetContainerRatio = targetMaxWidth / targetMaxHeight;
if (originalRatio > targetContainerRatio) {
containerWidth = targetMaxWidth;
containerHeight = containerWidth / originalRatio;
} else {
containerHeight = targetMaxHeight;
containerWidth = containerHeight * originalRatio;
}
const containerScale = originalWidth / containerWidth;
const lightboxImgWidth = imgMaxWidth * (containerWidth / containerMaxWidth);
const lightboxImgHeight = imgMaxHeight * (containerHeight / containerMaxHeight);
state.overlayStyles = `
--wp--lightbox-initial-top-position: ${screenPosY}px;
--wp--lightbox-initial-left-position: ${screenPosX}px;
--wp--lightbox-container-width: ${containerWidth + 1}px;
--wp--lightbox-container-height: ${containerHeight + 1}px;
--wp--lightbox-image-width: ${lightboxImgWidth}px;
--wp--lightbox-image-height: ${lightboxImgHeight}px;
--wp--lightbox-scale: ${containerScale};
--wp--lightbox-scrollbar-width: ${window.innerWidth - document.documentElement.clientWidth}px;
`;
},
setButtonStyles() {
const { ref } = getElement();
if (!ref) {
return;
}
const { imageId } = getContext();
state.metadata[imageId].imageRef = ref;
state.metadata[imageId].currentSrc = ref.currentSrc;
const {
naturalWidth,
naturalHeight,
offsetWidth,
offsetHeight
} = ref;
if (naturalWidth === 0 || naturalHeight === 0) {
return;
}
const figure = ref.parentElement;
const figureWidth = ref.parentElement.clientWidth;
let figureHeight = ref.parentElement.clientHeight;
const caption = figure.querySelector("figcaption");
if (caption) {
const captionComputedStyle = window.getComputedStyle(caption);
if (!["absolute", "fixed"].includes(
captionComputedStyle.position
)) {
figureHeight = figureHeight - caption.offsetHeight - parseFloat(captionComputedStyle.marginTop) - parseFloat(captionComputedStyle.marginBottom);
}
}
const buttonOffsetTop = figureHeight - offsetHeight;
const buttonOffsetRight = figureWidth - offsetWidth;
let buttonTop = buttonOffsetTop + 16;
let buttonRight = buttonOffsetRight + 16;
if (state.metadata[imageId].scaleAttr === "contain") {
const naturalRatio = naturalWidth / naturalHeight;
const offsetRatio = offsetWidth / offsetHeight;
if (naturalRatio >= offsetRatio) {
const referenceHeight = offsetWidth / naturalRatio;
buttonTop = (offsetHeight - referenceHeight) / 2 + buttonOffsetTop + 16;
buttonRight = buttonOffsetRight + 16;
} else {
const referenceWidth = offsetHeight * naturalRatio;
buttonTop = buttonOffsetTop + 16;
buttonRight = (offsetWidth - referenceWidth) / 2 + buttonOffsetRight + 16;
}
}
state.metadata[imageId].buttonTop = buttonTop;
state.metadata[imageId].buttonRight = buttonRight;
},
setOverlayFocus() {
if (state.overlayEnabled) {
const { ref } = getElement();
ref.focus();
}
},
setInertElements() {
document.querySelectorAll("body > :not(.wp-lightbox-overlay)").forEach((el) => {
if (state.overlayEnabled) {
el.setAttribute("inert", "");
} else {
el.removeAttribute("inert");
}
});
},
initTriggerButton() {
const { imageId } = getContext();
const { ref } = getElement();
state.metadata[imageId].buttonRef = ref;
}
}
},
{ lock: true }
);
@@ -0,0 +1 @@
<?php return array('dependencies' => array(), 'module_dependencies' => array(array('id' => '@wordpress/interactivity', 'import' => 'static')), 'version' => '25ee935fd6c67371d0f3');
File diff suppressed because one or more lines are too long
@@ -0,0 +1,180 @@
// packages/block-library/build-module/navigation/view.mjs
import {
store,
getContext,
getElement,
withSyncEvent
} from "@wordpress/interactivity";
var focusableSelectors = [
"a[href]",
'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',
"select:not([disabled]):not([aria-hidden])",
"textarea:not([disabled]):not([aria-hidden])",
"button:not([disabled]):not([aria-hidden])",
"[contenteditable]",
'[tabindex]:not([tabindex^="-"])'
];
function getFocusableElements(ref) {
const focusableElements = ref.querySelectorAll(focusableSelectors);
return Array.from(focusableElements).filter((element) => {
if (typeof element.checkVisibility === "function") {
return element.checkVisibility({
checkOpacity: false,
checkVisibilityCSS: true
});
}
return element.offsetParent !== null;
});
}
document.addEventListener("click", () => {
});
var { state, actions } = store(
"core/navigation",
{
state: {
get roleAttribute() {
const ctx = getContext();
return ctx.type === "overlay" && state.isMenuOpen ? "dialog" : null;
},
get ariaModal() {
const ctx = getContext();
return ctx.type === "overlay" && state.isMenuOpen ? "true" : null;
},
get ariaLabel() {
const ctx = getContext();
return ctx.type === "overlay" && state.isMenuOpen ? ctx.ariaLabel : null;
},
get isMenuOpen() {
return Object.values(state.menuOpenedBy).filter(Boolean).length > 0;
},
get menuOpenedBy() {
const ctx = getContext();
return ctx.type === "overlay" ? ctx.overlayOpenedBy : ctx.submenuOpenedBy;
},
get isSubmenuOpen() {
const ctx = getContext();
const isOverlayOpen = Object.values(ctx.overlayOpenedBy || {}).filter(Boolean).length > 0;
return isOverlayOpen || state.isMenuOpen;
}
},
actions: {
openMenuOnHover(event) {
if (event?.pointerType === "touch") {
return;
}
const { type } = getContext();
if (type === "submenu") {
actions.openMenu("hover");
}
},
closeMenuOnHover(event) {
if (event?.pointerType === "touch") {
return;
}
const { type } = getContext();
if (type === "submenu") {
actions.closeMenu("hover");
}
},
openMenuOnClick() {
const ctx = getContext();
const { ref } = getElement();
ctx.previousFocus = ref;
actions.openMenu("click");
},
closeMenuOnClick() {
actions.closeMenu("click");
actions.closeMenu("focus");
},
openMenuOnFocus() {
actions.openMenu("focus");
},
toggleMenuOnClick() {
const ctx = getContext();
const { ref } = getElement();
if (window.document.activeElement !== ref) {
ref.focus();
}
const { menuOpenedBy } = state;
if (menuOpenedBy.click || menuOpenedBy.focus) {
actions.closeMenu("click");
actions.closeMenu("focus");
actions.closeMenu("hover");
} else {
ctx.previousFocus = ref;
actions.openMenu("click");
}
},
handleMenuKeydown: withSyncEvent((event) => {
const { type, firstFocusableElement, lastFocusableElement } = getContext();
if (state.menuOpenedBy.click) {
if (event.key === "Escape") {
event.stopPropagation();
actions.closeMenu("click");
actions.closeMenu("focus");
return;
}
if (type === "overlay" && event.key === "Tab") {
if (event.shiftKey && window.document.activeElement === firstFocusableElement) {
event.preventDefault();
lastFocusableElement.focus();
} else if (!event.shiftKey && window.document.activeElement === lastFocusableElement) {
event.preventDefault();
firstFocusableElement.focus();
}
}
}
}),
handleMenuFocusout: withSyncEvent((event) => {
const { modal, type } = getContext();
if (event.relatedTarget === null || !modal?.contains(event.relatedTarget) && event.target !== window.document.activeElement && type === "submenu") {
actions.closeMenu("click");
actions.closeMenu("focus");
}
}),
openMenu(menuOpenedOn = "click") {
const { type } = getContext();
state.menuOpenedBy[menuOpenedOn] = true;
if (type === "overlay") {
document.documentElement.classList.add("has-modal-open");
}
},
closeMenu(menuClosedOn = "click") {
const ctx = getContext();
state.menuOpenedBy[menuClosedOn] = false;
if (!state.isMenuOpen) {
if (ctx.modal?.contains(window.document.activeElement)) {
ctx.previousFocus?.focus();
}
ctx.modal = null;
ctx.previousFocus = null;
if (ctx.type === "overlay") {
document.documentElement.classList.remove(
"has-modal-open"
);
}
}
}
},
callbacks: {
initMenu() {
const ctx = getContext();
const { ref } = getElement();
if (state.isMenuOpen) {
const focusableElements = getFocusableElements(ref);
ctx.modal = ref;
ctx.firstFocusableElement = focusableElements[0];
ctx.lastFocusableElement = focusableElements[focusableElements.length - 1];
}
},
focusFirstElement() {
const { ref } = getElement();
if (state.isMenuOpen) {
const focusableElements = getFocusableElements(ref);
focusableElements?.[0]?.focus();
}
}
}
},
{ lock: true }
);
@@ -0,0 +1 @@
<?php return array('dependencies' => array(), 'module_dependencies' => array(array('id' => '@wordpress/interactivity', 'import' => 'static')), 'version' => '1bf28ded04f9f188bdcb');
@@ -0,0 +1 @@
import{store as r,getContext as o,getElement as s,withSyncEvent as i}from"@wordpress/interactivity";var d=["a[href]",'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',"select:not([disabled]):not([aria-hidden])","textarea:not([disabled]):not([aria-hidden])","button:not([disabled]):not([aria-hidden])","[contenteditable]",'[tabindex]:not([tabindex^="-"])'];function a(e){let n=e.querySelectorAll(d);return Array.from(n).filter(t=>typeof t.checkVisibility=="function"?t.checkVisibility({checkOpacity:!1,checkVisibilityCSS:!0}):t.offsetParent!==null)}document.addEventListener("click",()=>{});var{state:l,actions:c}=r("core/navigation",{state:{get roleAttribute(){return o().type==="overlay"&&l.isMenuOpen?"dialog":null},get ariaModal(){return o().type==="overlay"&&l.isMenuOpen?"true":null},get ariaLabel(){let e=o();return e.type==="overlay"&&l.isMenuOpen?e.ariaLabel:null},get isMenuOpen(){return Object.values(l.menuOpenedBy).filter(Boolean).length>0},get menuOpenedBy(){let e=o();return e.type==="overlay"?e.overlayOpenedBy:e.submenuOpenedBy},get isSubmenuOpen(){let e=o();return Object.values(e.overlayOpenedBy||{}).filter(Boolean).length>0||l.isMenuOpen}},actions:{openMenuOnHover(e){if(e?.pointerType==="touch")return;let{type:n}=o();n==="submenu"&&c.openMenu("hover")},closeMenuOnHover(e){if(e?.pointerType==="touch")return;let{type:n}=o();n==="submenu"&&c.closeMenu("hover")},openMenuOnClick(){let e=o(),{ref:n}=s();e.previousFocus=n,c.openMenu("click")},closeMenuOnClick(){c.closeMenu("click"),c.closeMenu("focus")},openMenuOnFocus(){c.openMenu("focus")},toggleMenuOnClick(){let e=o(),{ref:n}=s();window.document.activeElement!==n&&n.focus();let{menuOpenedBy:t}=l;t.click||t.focus?(c.closeMenu("click"),c.closeMenu("focus"),c.closeMenu("hover")):(e.previousFocus=n,c.openMenu("click"))},handleMenuKeydown:i(e=>{let{type:n,firstFocusableElement:t,lastFocusableElement:u}=o();if(l.menuOpenedBy.click){if(e.key==="Escape"){e.stopPropagation(),c.closeMenu("click"),c.closeMenu("focus");return}n==="overlay"&&e.key==="Tab"&&(e.shiftKey&&window.document.activeElement===t?(e.preventDefault(),u.focus()):!e.shiftKey&&window.document.activeElement===u&&(e.preventDefault(),t.focus()))}}),handleMenuFocusout:i(e=>{let{modal:n,type:t}=o();(e.relatedTarget===null||!n?.contains(e.relatedTarget)&&e.target!==window.document.activeElement&&t==="submenu")&&(c.closeMenu("click"),c.closeMenu("focus"))}),openMenu(e="click"){let{type:n}=o();l.menuOpenedBy[e]=!0,n==="overlay"&&document.documentElement.classList.add("has-modal-open")},closeMenu(e="click"){let n=o();l.menuOpenedBy[e]=!1,l.isMenuOpen||(n.modal?.contains(window.document.activeElement)&&n.previousFocus?.focus(),n.modal=null,n.previousFocus=null,n.type==="overlay"&&document.documentElement.classList.remove("has-modal-open"))}},callbacks:{initMenu(){let e=o(),{ref:n}=s();if(l.isMenuOpen){let t=a(n);e.modal=n,e.firstFocusableElement=t[0],e.lastFocusableElement=t[t.length-1]}},focusFirstElement(){let{ref:e}=s();l.isMenuOpen&&a(e)?.[0]?.focus()}}},{lock:!0});
File diff suppressed because it is too large Load Diff
@@ -0,0 +1 @@
<?php return array('dependencies' => array(), 'module_dependencies' => array(array('id' => '@wordpress/interactivity', 'import' => 'static')), 'version' => 'e921883a3f8a7b1ead70');
File diff suppressed because one or more lines are too long
@@ -0,0 +1,53 @@
// packages/block-library/build-module/query/view.mjs
import {
store,
getContext,
getElement,
withSyncEvent
} from "@wordpress/interactivity";
var isValidLink = (ref) => ref && ref instanceof window.HTMLAnchorElement && ref.href && (!ref.target || ref.target === "_self") && ref.origin === window.location.origin;
var isValidEvent = (event) => event.button === 0 && // Left clicks only.
!event.metaKey && // Open in new tab (Mac).
!event.ctrlKey && // Open in new tab (Windows).
!event.altKey && // Download.
!event.shiftKey && !event.defaultPrevented;
store(
"core/query",
{
actions: {
navigate: withSyncEvent(function* (event) {
const ctx = getContext();
const { ref } = getElement();
const queryRef = ref.closest(
".wp-block-query[data-wp-router-region]"
);
if (isValidLink(ref) && isValidEvent(event)) {
event.preventDefault();
const { actions } = yield import("@wordpress/interactivity-router");
yield actions.navigate(ref.href);
ctx.url = ref.href;
const firstAnchor = `.wp-block-post-template a[href]`;
queryRef.querySelector(firstAnchor)?.focus();
}
}),
*prefetch() {
const { ref } = getElement();
if (isValidLink(ref)) {
const { actions } = yield import("@wordpress/interactivity-router");
yield actions.prefetch(ref.href);
}
}
},
callbacks: {
*prefetch() {
const { url } = getContext();
const { ref } = getElement();
if (url && isValidLink(ref)) {
const { actions } = yield import("@wordpress/interactivity-router");
yield actions.prefetch(ref.href);
}
}
}
},
{ lock: true }
);
@@ -0,0 +1 @@
<?php return array('dependencies' => array(), 'module_dependencies' => array(array('id' => '@wordpress/interactivity', 'import' => 'static'), array('id' => '@wordpress/interactivity-router', 'import' => 'dynamic')), 'version' => '7a4ec5bfb61a7137cf4b');
@@ -0,0 +1 @@
import{store as a,getContext as c,getElement as r,withSyncEvent as l}from"@wordpress/interactivity";var i=t=>t&&t instanceof window.HTMLAnchorElement&&t.href&&(!t.target||t.target==="_self")&&t.origin===window.location.origin,f=t=>t.button===0&&!t.metaKey&&!t.ctrlKey&&!t.altKey&&!t.shiftKey&&!t.defaultPrevented;a("core/query",{actions:{navigate:l(function*(t){let e=c(),{ref:o}=r(),n=o.closest(".wp-block-query[data-wp-router-region]");if(i(o)&&f(t)){t.preventDefault();let{actions:s}=yield import("@wordpress/interactivity-router");yield s.navigate(o.href),e.url=o.href,n.querySelector(".wp-block-post-template a[href]")?.focus()}}),*prefetch(){let{ref:t}=r();if(i(t)){let{actions:e}=yield import("@wordpress/interactivity-router");yield e.prefetch(t.href)}}},callbacks:{*prefetch(){let{url:t}=c(),{ref:e}=r();if(t&&i(e)){let{actions:o}=yield import("@wordpress/interactivity-router");yield o.prefetch(e.href)}}}},{lock:!0});
@@ -0,0 +1,63 @@
// packages/block-library/build-module/search/view.mjs
import {
store,
getContext,
getElement,
withSyncEvent
} from "@wordpress/interactivity";
var { actions } = store(
"core/search",
{
state: {
get ariaLabel() {
const {
isSearchInputVisible,
ariaLabelCollapsed,
ariaLabelExpanded
} = getContext();
return isSearchInputVisible ? ariaLabelExpanded : ariaLabelCollapsed;
},
get ariaControls() {
const { isSearchInputVisible, inputId } = getContext();
return isSearchInputVisible ? null : inputId;
},
get type() {
const { isSearchInputVisible } = getContext();
return isSearchInputVisible ? "submit" : "button";
},
get tabindex() {
const { isSearchInputVisible } = getContext();
return isSearchInputVisible ? "0" : "-1";
}
},
actions: {
openSearchInput: withSyncEvent((event) => {
const ctx = getContext();
const { ref } = getElement();
if (!ctx.isSearchInputVisible) {
event.preventDefault();
ctx.isSearchInputVisible = true;
ref.parentElement.querySelector("input").focus();
}
}),
closeSearchInput() {
const ctx = getContext();
ctx.isSearchInputVisible = false;
},
handleSearchKeydown: withSyncEvent((event) => {
const { ref } = getElement();
if (event?.key === "Escape") {
actions.closeSearchInput();
ref.querySelector("button").focus();
}
}),
handleSearchFocusout: withSyncEvent((event) => {
const { ref } = getElement();
if (!ref.contains(event.relatedTarget) && event.target !== window.document.activeElement) {
actions.closeSearchInput();
}
})
}
},
{ lock: true }
);
@@ -0,0 +1 @@
<?php return array('dependencies' => array(), 'module_dependencies' => array(array('id' => '@wordpress/interactivity', 'import' => 'static')), 'version' => '38bd0e230eaffa354d2a');
@@ -0,0 +1 @@
import{store as i,getContext as n,getElement as a,withSyncEvent as c}from"@wordpress/interactivity";var{actions:s}=i("core/search",{state:{get ariaLabel(){let{isSearchInputVisible:e,ariaLabelCollapsed:t,ariaLabelExpanded:r}=n();return e?r:t},get ariaControls(){let{isSearchInputVisible:e,inputId:t}=n();return e?null:t},get type(){let{isSearchInputVisible:e}=n();return e?"submit":"button"},get tabindex(){let{isSearchInputVisible:e}=n();return e?"0":"-1"}},actions:{openSearchInput:c(e=>{let t=n(),{ref:r}=a();t.isSearchInputVisible||(e.preventDefault(),t.isSearchInputVisible=!0,r.parentElement.querySelector("input").focus())}),closeSearchInput(){let e=n();e.isSearchInputVisible=!1},handleSearchKeydown:c(e=>{let{ref:t}=a();e?.key==="Escape"&&(s.closeSearchInput(),t.querySelector("button").focus())}),handleSearchFocusout:c(e=>{let{ref:t}=a();!t.contains(e.relatedTarget)&&e.target!==window.document.activeElement&&s.closeSearchInput()})}},{lock:!0});
@@ -0,0 +1,170 @@
// packages/block-library/build-module/tabs/view.mjs
import {
store,
getContext,
getElement,
withSyncEvent
} from "@wordpress/interactivity";
var { actions, state } = store(
"core/tabs",
{
state: {
/**
* Gets a contextually aware list of tabs for the current tabs block.
*
* @type {Array}
*/
get tabsList() {
const context = getContext();
const tabsId = context?.tabsId;
const tabsList = state[tabsId];
return tabsList;
},
/**
* Gets the index of the active tab element whether it
* is a tab label or tab panel.
*
* @type {number|null}
*/
get tabIndex() {
const { attributes } = getElement();
const tabId = attributes?.id?.replace("tab__", "") || null;
if (!tabId) {
return null;
}
const { tabsList } = state;
const tabIndex = tabsList.findIndex((t) => t === tabId);
return tabIndex;
},
/**
* Whether the tab panel or tab label is the active tab.
*
* @type {boolean}
*/
get isActiveTab() {
const { activeTabIndex } = getContext();
const { tabIndex } = state;
return activeTabIndex === tabIndex;
},
/**
* The value of the tabindex attribute for tab buttons.
* Only the active tab should be in the tab sequence.
*
* @type {number}
*/
get tabIndexAttribute() {
return state.isActiveTab ? 0 : -1;
}
},
actions: {
/**
* Handles the keydown events for the tab label and tabs controller.
*
* @param {KeyboardEvent} event The keydown event.
*/
handleTabKeyDown: withSyncEvent((event) => {
const { tabIndex, tabsList } = state;
if (tabIndex === null) {
return;
}
if (event.key === "ArrowRight") {
event.preventDefault();
actions.moveFocus(tabIndex + 1);
} else if (event.key === "ArrowLeft") {
event.preventDefault();
actions.moveFocus(tabIndex - 1);
} else if (event.key === "Home") {
event.preventDefault();
actions.moveFocus(0);
} else if (event.key === "End") {
event.preventDefault();
actions.moveFocus(tabsList.length - 1);
}
}),
/**
* Handles the click event for the tab label.
*
* @param {MouseEvent} event The click event.
*/
handleTabClick: withSyncEvent((event) => {
event.preventDefault();
const { tabIndex } = state;
if (tabIndex !== null) {
actions.setActiveTab(tabIndex);
}
}),
/**
* Moves focus to a specific tab without activating it.
*
* @param {number} tabIndex The index to move focus to.
*/
moveFocus: (tabIndex) => {
const { tabsList } = state;
if (!tabsList || tabsList.length === 0) {
return;
}
let newIndex = tabIndex;
if (newIndex < 0) {
newIndex = tabsList.length - 1;
} else if (newIndex >= tabsList.length) {
newIndex = 0;
}
const tabId = tabsList[newIndex];
const tabElement = document.getElementById("tab__" + tabId);
if (tabElement) {
tabElement.focus();
}
},
/**
* Sets the active tab index.
*
* @param {number} tabIndex The index of the active tab.
* @param {boolean} scrollToTab Whether to scroll to the tab element.
*/
setActiveTab: (tabIndex, scrollToTab = false) => {
const { tabsList } = state;
if (!tabsList || tabsList.length === 0) {
return;
}
let newIndex = tabIndex;
if (newIndex < 0) {
newIndex = 0;
} else if (newIndex >= tabsList.length) {
newIndex = tabsList.length - 1;
}
const context = getContext();
context.activeTabIndex = newIndex;
if (scrollToTab) {
const tabId = tabsList[newIndex];
const tabElement = document.getElementById(tabId);
if (tabElement) {
setTimeout(() => {
tabElement.scrollIntoView({ behavior: "smooth" });
}, 100);
}
}
}
},
callbacks: {
/**
* When the tabs are initialized, we need to check if there is a hash in the url and if so if it exists in the current tabsList, set the active tab to that index.
*
*/
onTabsInit: () => {
const { tabsList } = state;
if (tabsList.length === 0) {
return;
}
const { hash } = window.location;
const tabId = hash.replace("#", "");
const tabIndex = tabsList.findIndex((t) => t === tabId);
if (tabIndex >= 0) {
actions.setActiveTab(tabIndex, true);
}
}
}
},
{
lock: true
}
);
@@ -0,0 +1 @@
<?php return array('dependencies' => array(), 'module_dependencies' => array(array('id' => '@wordpress/interactivity', 'import' => 'static')), 'version' => 'cc1a34b1bee3c2e17bc4');
@@ -0,0 +1 @@
import{store as d,getContext as i,getElement as u,withSyncEvent as b}from"@wordpress/interactivity";var{actions:c,state:a}=d("core/tabs",{state:{get tabsList(){let t=i()?.tabsId;return a[t]},get tabIndex(){let{attributes:e}=u(),t=e?.id?.replace("tab__","")||null;if(!t)return null;let{tabsList:n}=a;return n.findIndex(o=>o===t)},get isActiveTab(){let{activeTabIndex:e}=i(),{tabIndex:t}=a;return e===t},get tabIndexAttribute(){return a.isActiveTab?0:-1}},actions:{handleTabKeyDown:b(e=>{let{tabIndex:t,tabsList:n}=a;t!==null&&(e.key==="ArrowRight"?(e.preventDefault(),c.moveFocus(t+1)):e.key==="ArrowLeft"?(e.preventDefault(),c.moveFocus(t-1)):e.key==="Home"?(e.preventDefault(),c.moveFocus(0)):e.key==="End"&&(e.preventDefault(),c.moveFocus(n.length-1)))}),handleTabClick:b(e=>{e.preventDefault();let{tabIndex:t}=a;t!==null&&c.setActiveTab(t)}),moveFocus:e=>{let{tabsList:t}=a;if(!t||t.length===0)return;let n=e;n<0?n=t.length-1:n>=t.length&&(n=0);let s=t[n],o=document.getElementById("tab__"+s);o&&o.focus()},setActiveTab:(e,t=!1)=>{let{tabsList:n}=a;if(!n||n.length===0)return;let s=e;s<0?s=0:s>=n.length&&(s=n.length-1);let o=i();if(o.activeTabIndex=s,t){let r=n[s],l=document.getElementById(r);l&&setTimeout(()=>{l.scrollIntoView({behavior:"smooth"})},100)}}},callbacks:{onTabsInit:()=>{let{tabsList:e}=a;if(e.length===0)return;let{hash:t}=window.location,n=t.replace("#",""),s=e.findIndex(o=>o===n);s>=0&&c.setActiveTab(s,!0)}}},{lock:!0});