mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-26 11:21:16 +01:00
Upgrade Tauri dependencies
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { useQueryClient } from '@tanstack/react-query';
|
||||
import { getCurrent } from '@tauri-apps/api/webviewWindow';
|
||||
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
|
||||
import { useEffect } from 'react';
|
||||
import { useAtiveWorkspaceChangedToast } from '../hooks/useAtiveWorkspaceChangedToast';
|
||||
import { useClipboardText } from '../hooks/useClipboardText';
|
||||
@@ -86,7 +86,7 @@ export function GlobalHooks() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (model.model === 'http_request' && windowLabel !== getCurrent().label) {
|
||||
if (model.model === 'http_request' && windowLabel !== getCurrentWebviewWindow().label) {
|
||||
wasUpdatedExternally(model.id);
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ export function GlobalHooks() {
|
||||
}
|
||||
|
||||
const { interfaceScale, interfaceFontSize, editorFontSize } = settings;
|
||||
getCurrent().setZoom(interfaceScale).catch(console.error);
|
||||
getCurrentWebviewWindow().setZoom(interfaceScale).catch(console.error);
|
||||
document.documentElement.style.setProperty('font-size', `${interfaceFontSize}px`);
|
||||
document.documentElement.style.setProperty('--editor-font-size', `${editorFontSize}px`);
|
||||
}, [settings]);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getCurrent } from '@tauri-apps/api/webviewWindow';
|
||||
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
|
||||
import classNames from 'classnames';
|
||||
import React from 'react';
|
||||
import { useKeyPressEvent, useLocalStorage } from 'react-use';
|
||||
@@ -24,7 +24,7 @@ export const Settings = () => {
|
||||
|
||||
// Close settings window on escape
|
||||
// TODO: Could this be put in a better place? Eg. in Rust key listener when creating the window
|
||||
useKeyPressEvent('Escape', () => getCurrent().close());
|
||||
useKeyPressEvent('Escape', () => getCurrentWebviewWindow().close());
|
||||
|
||||
return (
|
||||
<div className={classNames('grid grid-rows-[auto_minmax(0,1fr)] h-full')}>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getCurrent } from '@tauri-apps/api/webviewWindow';
|
||||
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
|
||||
import classNames from 'classnames';
|
||||
import React, { useState } from 'react';
|
||||
import { useOsInfo } from '../hooks/useOsInfo';
|
||||
@@ -25,7 +25,7 @@ export function WindowControls({ className, onlyX }: Props) {
|
||||
<Button
|
||||
className="!h-full px-4 text-fg-subtle hocus:text-fg hocus:bg-background-highlight-secondary rounded-none"
|
||||
color="custom"
|
||||
onClick={() => getCurrent().minimize()}
|
||||
onClick={() => getCurrentWebviewWindow().minimize()}
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<path fill="currentColor" d="M14 8v1H3V8z" />
|
||||
@@ -35,7 +35,7 @@ export function WindowControls({ className, onlyX }: Props) {
|
||||
className="!h-full px-4 text-fg-subtle hocus:text-fg hocus:bg-background-highlight rounded-none"
|
||||
color="custom"
|
||||
onClick={async () => {
|
||||
const w = getCurrent();
|
||||
const w = getCurrentWebviewWindow();
|
||||
await w.toggleMaximize();
|
||||
setMaximized(await w.isMaximized());
|
||||
}}
|
||||
@@ -58,7 +58,7 @@ export function WindowControls({ className, onlyX }: Props) {
|
||||
<Button
|
||||
color="custom"
|
||||
className="!h-full px-4 text-fg-subtle rounded-none hocus:bg-fg-danger hocus:text-fg"
|
||||
onClick={() => getCurrent().close()}
|
||||
onClick={() => getCurrentWebviewWindow().close()}
|
||||
>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 16 16">
|
||||
<path
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { useQuery } from '@tanstack/react-query';
|
||||
import { getCurrent } from '@tauri-apps/api/webviewWindow';
|
||||
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
|
||||
import { useWindowSize } from 'react-use';
|
||||
import { useDebouncedValue } from './useDebouncedValue';
|
||||
|
||||
@@ -15,7 +15,7 @@ export function useIsFullscreen() {
|
||||
useQuery({
|
||||
queryKey: ['is_fullscreen', debouncedWindowWidth],
|
||||
queryFn: async () => {
|
||||
return getCurrent().isFullscreen();
|
||||
return getCurrentWebviewWindow().isFullscreen();
|
||||
},
|
||||
}).data ?? false
|
||||
);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getCurrent } from '@tauri-apps/api/webviewWindow';
|
||||
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
|
||||
import { useEffect } from 'react';
|
||||
import { fallbackRequestName } from '../lib/fallbackRequestName';
|
||||
import { useActiveEnvironment } from './useActiveEnvironment';
|
||||
@@ -30,7 +30,7 @@ export function useSyncWorkspaceRequestTitle() {
|
||||
// TODO: This resets the stoplight position so we can't use it on macOS yet. So we send
|
||||
// a custom command instead
|
||||
if (osInfo?.osType !== 'macos') {
|
||||
getCurrent().setTitle(newTitle).catch(console.error);
|
||||
getCurrentWebviewWindow().setTitle(newTitle).catch(console.error);
|
||||
} else {
|
||||
emit('yaak_title_changed', newTitle).catch(console.error);
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getCurrent } from '@tauri-apps/api/webviewWindow';
|
||||
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
export function useWindowFocus() {
|
||||
@@ -6,7 +6,7 @@ export function useWindowFocus() {
|
||||
|
||||
useEffect(() => {
|
||||
let unsub: undefined | (() => void) = undefined;
|
||||
getCurrent()
|
||||
getCurrentWebviewWindow()
|
||||
.onFocusChanged((e) => {
|
||||
setVisible(e.payload);
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getCurrent } from '@tauri-apps/api/webviewWindow';
|
||||
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
|
||||
import type { Appearance } from './window';
|
||||
|
||||
export function getCSSAppearance(): Appearance {
|
||||
@@ -6,7 +6,7 @@ export function getCSSAppearance(): Appearance {
|
||||
}
|
||||
|
||||
export async function getWindowAppearance(): Promise<Appearance> {
|
||||
const a = await getCurrent().theme();
|
||||
const a = await getCurrentWebviewWindow().theme();
|
||||
return a ?? getCSSAppearance();
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ export function subscribeToWindowAppearanceChange(
|
||||
): () => void {
|
||||
const container = { unsubscribe: () => {} };
|
||||
|
||||
getCurrent()
|
||||
getCurrentWebviewWindow()
|
||||
.onThemeChanged((t) => {
|
||||
cb(t.payload);
|
||||
})
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getCurrent } from '@tauri-apps/api/webviewWindow';
|
||||
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow';
|
||||
import { type } from '@tauri-apps/plugin-os';
|
||||
import { StrictMode } from 'react';
|
||||
import { createRoot } from 'react-dom/client';
|
||||
@@ -15,7 +15,7 @@ pdfjs.GlobalWorkerOptions.workerSrc = new URL(
|
||||
// Hide decorations here because it doesn't work in Rust for some reason (bug?)
|
||||
const osType = await type();
|
||||
if (osType !== 'macos') {
|
||||
await getCurrent().setDecorations(false);
|
||||
await getCurrentWebviewWindow().setDecorations(false);
|
||||
}
|
||||
|
||||
await attachConsole();
|
||||
|
||||
Reference in New Issue
Block a user