✨ Simplify arrow function syntax and remove unnecessary whitespace across composable utilities
This commit is contained in:
@@ -18,7 +18,7 @@ export function useClipboard() {
|
|||||||
* @param {string} text - Text to copy
|
* @param {string} text - Text to copy
|
||||||
* @returns {Promise<boolean>} Success status
|
* @returns {Promise<boolean>} Success status
|
||||||
*/
|
*/
|
||||||
const copyToClipboard = async (text) => {
|
const copyToClipboard = async text => {
|
||||||
error.value = null;
|
error.value = null;
|
||||||
copied.value = false;
|
copied.value = false;
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import { onMounted, onUnmounted } from 'vue';
|
|||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export function useKeyboardShortcuts(shortcuts = {}) {
|
export function useKeyboardShortcuts(shortcuts = {}) {
|
||||||
const handleKeyDown = (event) => {
|
const handleKeyDown = event => {
|
||||||
const key = event.key.toLowerCase();
|
const key = event.key.toLowerCase();
|
||||||
const ctrl = event.ctrlKey || event.metaKey; // Support both Ctrl and Cmd
|
const ctrl = event.ctrlKey || event.metaKey; // Support both Ctrl and Cmd
|
||||||
const shift = event.shiftKey;
|
const shift = event.shiftKey;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ export function useLocalStorage(key, defaultValue) {
|
|||||||
// Watch for changes and save to localStorage
|
// Watch for changes and save to localStorage
|
||||||
watch(
|
watch(
|
||||||
storedValue,
|
storedValue,
|
||||||
(newValue) => {
|
newValue => {
|
||||||
try {
|
try {
|
||||||
localStorage.setItem(key, JSON.stringify(newValue));
|
localStorage.setItem(key, JSON.stringify(newValue));
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
@@ -52,7 +52,7 @@ export function useLocalStorage(key, defaultValue) {
|
|||||||
export function useSearchHistory(key = 'searchHistory', maxItems = 5) {
|
export function useSearchHistory(key = 'searchHistory', maxItems = 5) {
|
||||||
const history = useLocalStorage(key, []);
|
const history = useLocalStorage(key, []);
|
||||||
|
|
||||||
const addToHistory = (query) => {
|
const addToHistory = query => {
|
||||||
if (!query || query.trim() === '') return;
|
if (!query || query.trim() === '') return;
|
||||||
|
|
||||||
// Remove duplicates and add to front
|
// Remove duplicates and add to front
|
||||||
@@ -64,7 +64,7 @@ export function useSearchHistory(key = 'searchHistory', maxItems = 5) {
|
|||||||
history.value = newHistory;
|
history.value = newHistory;
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeFromHistory = (query) => {
|
const removeFromHistory = query => {
|
||||||
history.value = history.value.filter(item => item !== query);
|
history.value = history.value.filter(item => item !== query);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user