mirror of
https://github.com/robonen/tools.git
synced 2026-03-20 19:04:46 +00:00
feat(monorepo): migrate vue packages and apply oxlint refactors
This commit is contained in:
@@ -8,7 +8,7 @@ describe('focusGuard', () => {
|
||||
|
||||
it('initialize with the correct default namespace', () => {
|
||||
const guard = focusGuard();
|
||||
|
||||
|
||||
expect(guard.selector).toBe('data-focus-guard');
|
||||
});
|
||||
|
||||
@@ -31,7 +31,7 @@ describe('focusGuard', () => {
|
||||
guard.removeGuard();
|
||||
|
||||
const guards = document.querySelectorAll(`[${guard.selector}]`);
|
||||
|
||||
|
||||
expect(guards.length).toBe(0);
|
||||
});
|
||||
|
||||
@@ -66,4 +66,4 @@ describe('focusGuard', () => {
|
||||
expect(element.getAttribute('tabindex')).toBe('0');
|
||||
expect(element.getAttribute('style')).toBe('outline: none; opacity: 0; pointer-events: none; position: fixed;');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -2,20 +2,20 @@
|
||||
* @name focusGuard
|
||||
* @category Browsers
|
||||
* @description Adds a pair of focus guards at the boundaries of the DOM tree to ensure consistent focus behavior
|
||||
*
|
||||
*
|
||||
* @param {string} namespace - The namespace to use for the guard attributes
|
||||
* @returns {Object} - An object containing the selector, createGuard, and removeGuard functions
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* const guard = focusGuard();
|
||||
* guard.createGuard();
|
||||
* guard.removeGuard();
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* const guard = focusGuard('focus-guard');
|
||||
* guard.createGuard();
|
||||
* guard.removeGuard();
|
||||
*
|
||||
*
|
||||
* @since 0.0.3
|
||||
*/
|
||||
export function focusGuard(namespace = 'focus-guard') {
|
||||
@@ -29,7 +29,7 @@ export function focusGuard(namespace = 'focus-guard') {
|
||||
};
|
||||
|
||||
const removeGuard = () => {
|
||||
document.querySelectorAll(`[${guardAttr}]`).forEach((element) => element.remove());
|
||||
document.querySelectorAll(`[${guardAttr}]`).forEach(element => element.remove());
|
||||
};
|
||||
|
||||
return {
|
||||
@@ -47,4 +47,4 @@ export function createGuardAttrs(namespace = 'focus-guard') {
|
||||
element.setAttribute('style', 'outline: none; opacity: 0; pointer-events: none; position: fixed;');
|
||||
|
||||
return element;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
export * from './focusGuard';
|
||||
export * from './focusGuard';
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
*
|
||||
* @since 0.0.1
|
||||
*/
|
||||
export const _global =
|
||||
typeof globalThis !== 'undefined'
|
||||
export const _global
|
||||
= typeof globalThis !== 'undefined'
|
||||
? globalThis
|
||||
: typeof window !== 'undefined'
|
||||
? window
|
||||
@@ -22,7 +22,7 @@ export const _global =
|
||||
* @name isClient
|
||||
* @category Multi
|
||||
* @description Check if the current environment is the client
|
||||
*
|
||||
*
|
||||
* @since 0.0.1
|
||||
*/
|
||||
export const isClient = typeof window !== 'undefined' && typeof document !== 'undefined';
|
||||
export const isClient = typeof window !== 'undefined' && typeof document !== 'undefined';
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export * from './global';
|
||||
// export * from './debounce';
|
||||
// export * from './debounce';
|
||||
|
||||
Reference in New Issue
Block a user