This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.quicklink={})}(this,function(e){function n(e){return new Promise(function(n,r,t){(t=new XMLHttpRequest).open("GET",e,t.withCredentials=!0),t.onload=function(){200===t.status?n():r()},t.send()})}var r,t=(r=document.createElement("link")).relList&&r.relList.supports&&r.relList.supports("prefetch")?function(e){return new Promise(function(n,r,t){(t=document.createElement("link")).rel="prefetch",t.href=e,t.onload=n,t.onerror=r,document.head.appendChild(t)})}:n,o=window.requestIdleCallback||function(e){var n=Date.now();return setTimeout(function(){e({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(Date.now()-n))}})},1)},i=new Set,c=new Set,a=!1;function u(e){if(e){if(e.saveData)return new Error("Save-Data is enabled");if(/2g/.test(e.effectiveType))return new Error("network conditions are poor")}return!0}function s(e,r,o){var s=u(navigator.connection);return s in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { UAParser } from "ua-parser-js"; | |
| /** | |
| * Uses the `Sec-CH-UA-Mobile` header if it's available to work out how many | |
| * items to show per page. | |
| */ | |
| export const getItemsPerPage = ({ | |
| astroRequest, | |
| mobileItemsPerPage = 5, | |
| desktopItemsPerPage = 12, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Replace text inside class attributes across the DOM (allows partial matches). | |
| * | |
| * @param {string} find - Text to find inside class attribute (partial allowed). | |
| * @param {string} replaceWith - Replacement text. | |
| * @param {Object} [options] | |
| * @param {HTMLElement|Document|Element} [options.scope=document] - Limit to a subtree. | |
| * @returns {number} Count of elements that were modified. | |
| */ | |
| function replaceClassNames(find, replaceWith, { scope = document } = {}) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import type { PropsWithChildren, ReactElement, ReactNode } from 'react'; | |
| import React, { Children, cloneElement, isValidElement } from 'react'; | |
| import { render } from '@testing-library/react'; | |
| function setFakeReactDispatcher<T>(action: () => T): T { | |
| /** | |
| * We use some internals from React to avoid a lot of warnings in our tests when faking | |
| * to render server components. If the structure of React changes, this function should still work, | |
| * but the tests will again print warnings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import type { PropsWithChildren, ReactElement, ReactNode } from 'react'; | |
| import React, { Children, cloneElement, isValidElement } from 'react'; | |
| import { render } from '@testing-library/react'; | |
| function setFakeReactDispatcher<T>(action: () => T): T { | |
| /** | |
| * We use some internals from React to avoid a lot of warnings in our tests when faking | |
| * to render server components. If the structure of React changes, this function should still work, | |
| * but the tests will again print warnings. |
OlderNewer