@tauri-apps/api
Advanced tools
Comparing version
{ | ||
"name": "@tauri-apps/api", | ||
"version": "2.0.0-beta.15", | ||
"version": "2.0.0-beta.16", | ||
"description": "Tauri API definitions", | ||
@@ -5,0 +5,0 @@ "funding": { |
@@ -422,3 +422,3 @@ import { PhysicalPosition, PhysicalSize } from './dpi.js'; | ||
async reparent(window) { | ||
return invoke('plugin:webview|set_webview_focus', { | ||
return invoke('plugin:webview|reparent', { | ||
label: this.label, | ||
@@ -425,0 +425,0 @@ window: typeof window === 'string' ? window : window.label |
@@ -101,2 +101,8 @@ /** | ||
} | ||
export interface WindowSizeConstraints { | ||
minWidth?: number; | ||
minHeight?: number; | ||
maxWidth?: number; | ||
maxHeight?: number; | ||
} | ||
export interface ProgressBarState { | ||
@@ -799,2 +805,14 @@ /** | ||
/** | ||
* Sets the window inner size constraints. | ||
* @example | ||
* ```typescript | ||
* import { getCurrentWindow } from '@tauri-apps/api/window'; | ||
* await getCurrentWindow().setSizeConstraints({ minWidth: 300 }); | ||
* ``` | ||
* | ||
* @param constraints The logical or physical inner size, or `null` to unset the constraint. | ||
* @returns A promise indicating the success or failure of the operation. | ||
*/ | ||
setSizeConstraints(constraints: WindowSizeConstraints | null | undefined): Promise<void>; | ||
/** | ||
* Sets the window outer position. | ||
@@ -801,0 +819,0 @@ * @example |
@@ -1096,2 +1096,27 @@ import { PhysicalPosition, PhysicalSize } from './dpi.js'; | ||
/** | ||
* Sets the window inner size constraints. | ||
* @example | ||
* ```typescript | ||
* import { getCurrentWindow } from '@tauri-apps/api/window'; | ||
* await getCurrentWindow().setSizeConstraints({ minWidth: 300 }); | ||
* ``` | ||
* | ||
* @param constraints The logical or physical inner size, or `null` to unset the constraint. | ||
* @returns A promise indicating the success or failure of the operation. | ||
*/ | ||
async setSizeConstraints(constraints) { | ||
function logical(pixel) { | ||
return pixel ? { Logical: pixel } : null; | ||
} | ||
return invoke('plugin:window|set_size_constraints', { | ||
label: this.label, | ||
value: { | ||
minWidth: logical(constraints === null || constraints === void 0 ? void 0 : constraints.minWidth), | ||
minHeight: logical(constraints === null || constraints === void 0 ? void 0 : constraints.minHeight), | ||
maxWidth: logical(constraints === null || constraints === void 0 ? void 0 : constraints.maxWidth), | ||
maxHeight: logical(constraints === null || constraints === void 0 ? void 0 : constraints.maxHeight) | ||
} | ||
}); | ||
} | ||
/** | ||
* Sets the window outer position. | ||
@@ -1098,0 +1123,0 @@ * @example |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
569268
0.76%13969
0.49%