Przeglądaj źródła

feat: move app plugin back to core (#8039)

Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
Amr Bashir 1 rok temu
rodzic
commit
fb10b87970

+ 5 - 0
.changes/api-app.md

@@ -0,0 +1,5 @@
+---
+"@tauri-apps/api": 'minor:feat'
+---
+
+Add the `app` module back.

+ 1 - 1
.changes/api-window.md

@@ -2,4 +2,4 @@
 "@tauri-apps/api": 'minor:feat'
 ---
 
-Add the `window` module back
+Add the `window` module back.

+ 5 - 0
.changes/app-plugin-core.md

@@ -0,0 +1,5 @@
+---
+'tauri': patch:changes
+---
+
+Added the `app` plugin back into core.

+ 1 - 1
.changes/window-plugin-core.md

@@ -1,5 +1,5 @@
 ---
-"tauri": patch:changes
+'tauri': patch:changes
 ---
 
 Added the `window` plugin back into core.

Plik diff jest za duży
+ 0 - 0
core/tauri/scripts/bundle.global.js


+ 3 - 0
core/tauri/src/app.rs

@@ -56,6 +56,8 @@ use crate::runtime::RuntimeHandle;
 #[cfg(target_os = "macos")]
 use crate::ActivationPolicy;
 
+pub(crate) mod plugin;
+
 #[cfg(desktop)]
 pub(crate) type GlobalMenuEventListener<T> = Box<dyn Fn(&T, crate::menu::MenuEvent) + Send + Sync>;
 #[cfg(all(desktop, feature = "tray-icon"))]
@@ -808,6 +810,7 @@ impl<R: Runtime> App<R> {
     self.handle.plugin(crate::path::init())?;
     self.handle.plugin(crate::event::init())?;
     self.handle.plugin(crate::window::plugin::init())?;
+    self.handle.plugin(crate::app::plugin::init())?;
     Ok(())
   }
 

+ 52 - 0
core/tauri/src/app/plugin.rs

@@ -0,0 +1,52 @@
+// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-License-Identifier: MIT
+
+use crate::{
+  command,
+  plugin::{Builder, TauriPlugin},
+  AppHandle, Runtime,
+};
+
+#[command(root = "crate")]
+pub fn version<R: Runtime>(app: AppHandle<R>) -> String {
+  app.package_info().version.to_string()
+}
+
+#[command(root = "crate")]
+pub fn name<R: Runtime>(app: AppHandle<R>) -> String {
+  app.package_info().name.clone()
+}
+
+#[command(root = "crate")]
+pub fn tauri_version() -> &'static str {
+  crate::VERSION
+}
+
+#[command(root = "crate")]
+#[allow(unused_variables)]
+pub fn app_show<R: Runtime>(app: AppHandle<R>) -> crate::Result<()> {
+  #[cfg(target_os = "macos")]
+  app.show()?;
+  Ok(())
+}
+
+#[command(root = "crate")]
+#[allow(unused_variables)]
+pub fn app_hide<R: Runtime>(app: AppHandle<R>) -> crate::Result<()> {
+  #[cfg(target_os = "macos")]
+  app.hide()?;
+  Ok(())
+}
+
+pub fn init<R: Runtime>() -> TauriPlugin<R> {
+  Builder::new("app")
+    .invoke_handler(crate::generate_handler![
+      version,
+      name,
+      tauri_version,
+      app_show,
+      app_hide
+    ])
+    .build()
+}

+ 7 - 7
core/tauri/src/window/scripts/drag.js

@@ -2,16 +2,16 @@
 // SPDX-License-Identifier: Apache-2.0
 // SPDX-License-Identifier: MIT
 
-document.addEventListener("mousedown", (e) => {
-  if (e.target.hasAttribute("data-tauri-drag-region") && e.button === 0) {
+document.addEventListener('mousedown', (e) => {
+  if (e.target.hasAttribute('data-tauri-drag-region') && e.button === 0) {
     // prevents text cursor
-    e.preventDefault();
+    e.preventDefault()
     // fix #2549: double click on drag region edge causes content to maximize without window sizing change
     // https://github.com/tauri-apps/tauri/issues/2549#issuecomment-1250036908
-    e.stopImmediatePropagation();
+    e.stopImmediatePropagation()
 
     // start dragging if the element has a `tauri-drag-region` data attribute and maximize on double-clicking it
-    const cmd = e.detail === 2 ? "internal_toggle_maximize" : "start_dragging";
-    window.__TAURI_INVOKE__("plugin:window|" + cmd);
+    const cmd = e.detail === 2 ? 'internal_toggle_maximize' : 'start_dragging'
+    window.__TAURI_INTERNALS__.invoke('plugin:window|' + cmd)
   }
-});
+})

+ 2 - 2
core/tauri/src/window/scripts/print.js

@@ -3,5 +3,5 @@
 // SPDX-License-Identifier: MIT
 
 window.print = function () {
-  return window.__TAURI_INVOKE__("plugin:window|print");
-};
+  return window.__TAURI_INTERNALS__.invoke('plugin:window|print')
+}

+ 3 - 1
core/tauri/src/window/scripts/toggle-devtools.js

@@ -13,7 +13,9 @@
 
     document.addEventListener('keydown', (event) => {
       if (isHotkey(event)) {
-        window.__TAURI_INVOKE__('plugin:window|internal_toggle_devtools')
+        window.__TAURI_INTERNALS__.invoke(
+          'plugin:window|internal_toggle_devtools'
+        )
       }
     })
   }

Plik diff jest za duży
+ 0 - 0
examples/api/dist/assets/index.css


Plik diff jest za duży
+ 0 - 0
examples/api/dist/assets/index.js


+ 10 - 0
examples/api/src/App.svelte

@@ -7,6 +7,8 @@
   import Communication from './views/Communication.svelte'
   import Window from './views/Window.svelte'
   import WebRTC from './views/WebRTC.svelte'
+  import App from './views/App.svelte'
+
 
   document.addEventListener('keydown', (event) => {
     if (event.ctrlKey && event.key === 'b') {
@@ -14,6 +16,9 @@
     }
   })
 
+  const userAgent = navigator.userAgent.toLowerCase()
+  const isMobile = userAgent.includes('android') || userAgent.includes('iphone')
+
   const views = [
     {
       label: 'Welcome',
@@ -25,6 +30,11 @@
       component: Communication,
       icon: 'i-codicon-radio-tower'
     },
+    !isMobile && {
+      label: 'App',
+      component: App,
+      icon: 'i-codicon-hubot'
+    },
     {
       label: 'Window',
       component: Window,

+ 33 - 0
examples/api/src/views/App.svelte

@@ -0,0 +1,33 @@
+<script>
+  import { show, hide } from '@tauri-apps/api/app'
+
+  export let onMessage
+
+  function showApp() {
+    hideApp()
+      .then(() => {
+        setTimeout(() => {
+          show()
+            .then(() => onMessage('Shown app'))
+            .catch(onMessage)
+        }, 2000)
+      })
+      .catch(onMessage)
+  }
+
+  function hideApp() {
+    return hide()
+      .then(() => onMessage('Hide app'))
+      .catch(onMessage)
+  }
+</script>
+
+<div>
+  <button
+    class="btn"
+    id="show"
+    title="Hides and shows the app after 2 seconds"
+    on:click={showApp}>Show</button
+  >
+  <button class="btn" id="hide" on:click={hideApp}>Hide</button>
+</div>

+ 23 - 0
examples/api/src/views/Welcome.svelte

@@ -1,5 +1,20 @@
 <script>
   import { invoke } from '@tauri-apps/api/primitives'
+  import { getName, getVersion, getTauriVersion } from '@tauri-apps/api/app'
+
+  let version = '1.0.0'
+  let tauriVersion = '1.0.0'
+  let appName = 'Unknown'
+
+  getName().then((n) => {
+    appName = n
+  })
+  getVersion().then((v) => {
+    version = v
+  })
+  getTauriVersion().then((v) => {
+    tauriVersion = v
+  })
 
   function contextMenu() {
     invoke('popup_context_menu')
@@ -14,6 +29,14 @@
     development process. In the future, this app will be used on Tauri's integration
     tests.
   </p>
+  <br />
+  <br />
+  <pre>
+    App name: <code>{appName}</code>
+    App version: <code>{version}</code>
+    Tauri version: <code>{tauriVersion}</code>
+  </pre>
+  <br />
 
   <button class="btn" on:click={contextMenu}>Context menu</button>
 </div>

Plik diff jest za duży
+ 0 - 0
tooling/api/docs/js-api.json


+ 86 - 0
tooling/api/src/app.ts

@@ -0,0 +1,86 @@
+// Copyright 2019-2023 Tauri Programme within The Commons Conservancy
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-License-Identifier: MIT
+
+import { invoke } from './primitives'
+
+/**
+ * Application metadata and related APIs.
+ *
+ * @module
+ */
+
+/**
+ * Gets the application version.
+ * @example
+ * ```typescript
+ * import { getVersion } from '@tauri-apps/api/app';
+ * const appVersion = await getVersion();
+ * ```
+ *
+ * @since 1.0.0
+ */
+async function getVersion(): Promise<string> {
+  return invoke('plugin:app|version')
+}
+
+/**
+ * Gets the application name.
+ * @example
+ * ```typescript
+ * import { getName } from '@tauri-apps/api/app';
+ * const appName = await getName();
+ * ```
+ *
+ * @since 1.0.0
+ */
+async function getName(): Promise<string> {
+  return invoke('plugin:app|name')
+}
+
+/**
+ * Gets the Tauri version.
+ *
+ * @example
+ * ```typescript
+ * import { getTauriVersion } from '@tauri-apps/api/app';
+ * const tauriVersion = await getTauriVersion();
+ * ```
+ *
+ * @since 1.0.0
+ */
+async function getTauriVersion(): Promise<string> {
+  return invoke('plugin:app|tauri_version')
+}
+
+/**
+ * Shows the application on macOS. This function does not automatically focus any specific app window.
+ *
+ * @example
+ * ```typescript
+ * import { show } from '@tauri-apps/api/app';
+ * await show();
+ * ```
+ *
+ * @since 1.2.0
+ */
+async function show(): Promise<void> {
+  return invoke('plugin:app|app_show')
+}
+
+/**
+ * Hides the application on macOS.
+ *
+ * @example
+ * ```typescript
+ * import { hide } from '@tauri-apps/api/app';
+ * await hide();
+ * ```
+ *
+ * @since 1.2.0
+ */
+async function hide(): Promise<void> {
+  return invoke('plugin:app|app_hide')
+}
+
+export { getName, getVersion, getTauriVersion, show, hide }

+ 2 - 1
tooling/api/src/index.ts

@@ -13,10 +13,11 @@
  * @module
  */
 
+import * as app from './app'
 import * as event from './event'
 import * as primitives from './primitives'
 import * as window from './window'
 import * as path from './path'
 import * as dpi from './dpi'
 
-export { dpi, event, path, primitives, window }
+export { app, dpi, event, path, primitives, window }

+ 28 - 156
tooling/api/src/window.ts

@@ -29,7 +29,7 @@ import { invoke } from './primitives'
 /**
  * Allows you to retrieve information about a given monitor.
  *
- * @since 2.0.0
+ * @since 1.0.0
  */
 export interface Monitor {
   /** Human-readable name of the monitor */
@@ -48,7 +48,7 @@ type TitleBarStyle = 'visible' | 'transparent' | 'overlay'
 /**
  * The payload for the `scaleChange` event.
  *
- * @since 2.0.0
+ * @since 1.0.2
  */
 interface ScaleFactorChanged {
   /** The new window scale factor. */
@@ -66,7 +66,7 @@ type FileDropEvent =
 /**
  * Attention type to request on a window.
  *
- * @since 2.0.0
+ * @since 1.0.0
  */
 enum UserAttentionType {
   /**
@@ -151,7 +151,7 @@ export type CursorIcon =
 /**
  * Get an instance of `Window` for the current window.
  *
- * @since 2.0.0
+ * @since 1.0.0
  */
 function getCurrent(): Window {
   return new Window(window.__TAURI_INTERNALS__.metadata.currentWindow.label, {
@@ -163,7 +163,7 @@ function getCurrent(): Window {
 /**
  * Gets a list of instances of `Window` for all available windows.
  *
- * @since 2.0.0
+ * @since 1.0.0
  */
 function getAll(): Window[] {
   return window.__TAURI_INTERNALS__.metadata.windows.map(
@@ -239,8 +239,6 @@ class Window {
    *
    * @param label The unique webview window label. Must be alphanumeric: `a-zA-Z-/:_`.
    * @returns The {@link Window} instance to communicate with the webview.
-   *
-   * @since 2.0.0
    */
   constructor(label: WindowLabel, options: WindowOptions = {}) {
     this.label = label
@@ -270,8 +268,6 @@ class Window {
    *
    * @param label The webview window label.
    * @returns The Window instance to communicate with the webview or null if the webview doesn't exist.
-   *
-   * @since 2.0.0
    */
   static getByLabel(label: string): Window | null {
     if (getAll().some((w) => w.label === label)) {
@@ -283,8 +279,6 @@ class Window {
 
   /**
    * Get an instance of `Window` for the current window.
-   *
-   * @since 2.0.0
    */
   static getCurrent(): Window {
     return getCurrent()
@@ -292,8 +286,6 @@ class Window {
 
   /**
    * Gets a list of instances of `Window` for all available windows.
-   *
-   * @since 2.0.0
    */
   static getAll(): Window[] {
     return getAll()
@@ -308,8 +300,6 @@ class Window {
    * ```
    *
    * @returns The Window instance to communicate with the webview or `undefined` if there is not any focused window.
-   *
-   * @since 1.4
    */
   static async getFocusedWindow(): Promise<Window | null> {
     for (const w of getAll()) {
@@ -338,8 +328,6 @@ class Window {
    * @param handler Event handler.
    * @returns A promise resolving to a function to unlisten to the event.
    * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
-   *
-   * @since 2.0.0
    */
   async listen<T>(
     event: EventName,
@@ -373,8 +361,6 @@ class Window {
    * @param handler Event handler.
    * @returns A promise resolving to a function to unlisten to the event.
    * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
-   *
-   * @since 2.0.0
    */
   async once<T>(event: string, handler: EventCallback<T>): Promise<UnlistenFn> {
     if (this._handleTauriEvent(event, handler)) {
@@ -434,9 +420,7 @@ class Window {
    * ```
    *
    * @returns The window's monitor scale factor.
-   *
-   * @since 2.0.0
-   * */
+   */
   async scaleFactor(): Promise<number> {
     return invoke('plugin:window|scale_factor', {
       label: this.label
@@ -452,9 +436,7 @@ class Window {
    * ```
    *
    * @returns The window's inner position.
-   *
-   * @since 2.0.0
-   *  */
+   */
   async innerPosition(): Promise<PhysicalPosition> {
     return invoke<{ x: number; y: number }>('plugin:window|inner_position', {
       label: this.label
@@ -470,9 +452,7 @@ class Window {
    * ```
    *
    * @returns The window's outer position.
-   *
-   * @since 2.0.0
-   *  */
+   */
   async outerPosition(): Promise<PhysicalPosition> {
     return invoke<{ x: number; y: number }>('plugin:window|outer_position', {
       label: this.label
@@ -489,8 +469,6 @@ class Window {
    * ```
    *
    * @returns The window's inner size.
-   *
-   * @since 2.0.0
    */
   async innerSize(): Promise<PhysicalSize> {
     return invoke<{ width: number; height: number }>(
@@ -511,8 +489,6 @@ class Window {
    * ```
    *
    * @returns The window's outer size.
-   *
-   * @since 2.0.0
    */
   async outerSize(): Promise<PhysicalSize> {
     return invoke<{ width: number; height: number }>(
@@ -532,9 +508,7 @@ class Window {
    * ```
    *
    * @returns Whether the window is in fullscreen mode or not.
-   *
-   * @since 2.0.0
-   *  */
+   */
   async isFullscreen(): Promise<boolean> {
     return invoke('plugin:window|is_fullscreen', {
       label: this.label
@@ -548,9 +522,7 @@ class Window {
    * import { getCurrent } from '@tauri-apps/api/window';
    * const minimized = await getCurrent().isMinimized();
    * ```
-   *
-   * @since 2.0.0
-   * */
+   */
   async isMinimized(): Promise<boolean> {
     return invoke('plugin:window|is_minimized', {
       label: this.label
@@ -566,9 +538,7 @@ class Window {
    * ```
    *
    * @returns Whether the window is maximized or not.
-   *
-   * @since 2.0.0
-   * */
+   */
   async isMaximized(): Promise<boolean> {
     return invoke('plugin:window|is_maximized', {
       label: this.label
@@ -584,9 +554,7 @@ class Window {
    * ```
    *
    * @returns Whether the window is focused or not.
-   *
-   * @since 2.0.0
-   * */
+   */
   async isFocused(): Promise<boolean> {
     return invoke('plugin:window|is_focused', {
       label: this.label
@@ -602,9 +570,7 @@ class Window {
    * ```
    *
    * @returns Whether the window is decorated or not.
-   *
-   * @since 2.0.0
-   *  */
+   */
   async isDecorated(): Promise<boolean> {
     return invoke('plugin:window|is_decorated', {
       label: this.label
@@ -620,9 +586,7 @@ class Window {
    * ```
    *
    * @returns Whether the window is resizable or not.
-   *
-   * @since 2.0.0
-   *  */
+   */
   async isResizable(): Promise<boolean> {
     return invoke('plugin:window|is_resizable', {
       label: this.label
@@ -643,7 +607,7 @@ class Window {
    * ```
    *
    * @returns Whether the window's native maximize button is enabled or not.
-   *  */
+   */
   async isMaximizable(): Promise<boolean> {
     return invoke('plugin:window|is_maximizable', {
       label: this.label
@@ -664,7 +628,7 @@ class Window {
    * ```
    *
    * @returns Whether the window's native minimize button is enabled or not.
-   *  */
+   */
   async isMinimizable(): Promise<boolean> {
     return invoke('plugin:window|is_minimizable', {
       label: this.label
@@ -685,7 +649,7 @@ class Window {
    * ```
    *
    * @returns Whether the window's native close button is enabled or not.
-   *  */
+   */
   async isClosable(): Promise<boolean> {
     return invoke('plugin:window|is_closable', {
       label: this.label
@@ -701,9 +665,7 @@ class Window {
    * ```
    *
    * @returns Whether the window is visible or not.
-   *
-   * @since 2.0.0
-   *  */
+   */
   async isVisible(): Promise<boolean> {
     return invoke('plugin:window|is_visible', {
       label: this.label
@@ -717,9 +679,7 @@ class Window {
    * import { getCurrent } from '@tauri-apps/api/window';
    * const title = await getCurrent().title();
    * ```
-   *
-   * @since 2.0.0
-   * */
+   */
   async title(): Promise<string> {
     return invoke('plugin:window|title', {
       label: this.label
@@ -740,9 +700,7 @@ class Window {
    * ```
    *
    * @returns The window theme.
-   *
-   * @since 2.0.0
-   * */
+   */
   async theme(): Promise<Theme | null> {
     return invoke('plugin:window|theme', {
       label: this.label
@@ -759,10 +717,7 @@ class Window {
    * await getCurrent().center();
    * ```
    *
-   * @param resizable
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async center(): Promise<void> {
     return invoke('plugin:window|center', {
@@ -788,10 +743,7 @@ class Window {
    * await getCurrent().requestUserAttention();
    * ```
    *
-   * @param requestType
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async requestUserAttention(
     requestType: UserAttentionType | null
@@ -819,10 +771,7 @@ class Window {
    * await getCurrent().setResizable(false);
    * ```
    *
-   * @param resizable
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async setResizable(resizable: boolean): Promise<void> {
     return invoke('plugin:window|set_resizable', {
@@ -846,7 +795,6 @@ class Window {
    * await getCurrent().setMaximizable(false);
    * ```
    *
-   * @param maximizable
    * @returns A promise indicating the success or failure of the operation.
    */
   async setMaximizable(maximizable: boolean): Promise<void> {
@@ -869,7 +817,6 @@ class Window {
    * await getCurrent().setMinimizable(false);
    * ```
    *
-   * @param minimizable
    * @returns A promise indicating the success or failure of the operation.
    */
   async setMinimizable(minimizable: boolean): Promise<void> {
@@ -893,7 +840,6 @@ class Window {
    * await getCurrent().setClosable(false);
    * ```
    *
-   * @param closable
    * @returns A promise indicating the success or failure of the operation.
    */
   async setClosable(closable: boolean): Promise<void> {
@@ -913,8 +859,6 @@ class Window {
    *
    * @param title The new title
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async setTitle(title: string): Promise<void> {
     return invoke('plugin:window|set_title', {
@@ -932,8 +876,6 @@ class Window {
    * ```
    *
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async maximize(): Promise<void> {
     return invoke('plugin:window|maximize', {
@@ -950,8 +892,6 @@ class Window {
    * ```
    *
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async unmaximize(): Promise<void> {
     return invoke('plugin:window|unmaximize', {
@@ -968,8 +908,6 @@ class Window {
    * ```
    *
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async toggleMaximize(): Promise<void> {
     return invoke('plugin:window|toggle_maximize', {
@@ -986,8 +924,6 @@ class Window {
    * ```
    *
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async minimize(): Promise<void> {
     return invoke('plugin:window|minimize', {
@@ -1004,8 +940,6 @@ class Window {
    * ```
    *
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async unminimize(): Promise<void> {
     return invoke('plugin:window|unminimize', {
@@ -1022,8 +956,6 @@ class Window {
    * ```
    *
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async show(): Promise<void> {
     return invoke('plugin:window|show', {
@@ -1040,8 +972,6 @@ class Window {
    * ```
    *
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async hide(): Promise<void> {
     return invoke('plugin:window|hide', {
@@ -1058,8 +988,6 @@ class Window {
    * ```
    *
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async close(): Promise<void> {
     return invoke('plugin:window|close', {
@@ -1077,8 +1005,6 @@ class Window {
    *
    * @param decorations Whether the window should have borders and bars.
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async setDecorations(decorations: boolean): Promise<void> {
     return invoke('plugin:window|set_decorations', {
@@ -1105,8 +1031,6 @@ class Window {
    * ```
    *
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async setShadow(enable: boolean): Promise<void> {
     return invoke('plugin:window|set_shadow', {
@@ -1117,8 +1041,6 @@ class Window {
 
   /**
    * Set window effects.
-   *
-   * @since 2.0
    */
   async setEffects(effects: Effects): Promise<void> {
     return invoke('plugin:window|set_effects', {
@@ -1129,8 +1051,6 @@ class Window {
 
   /**
    * Clear any applied effects if possible.
-   *
-   * @since 2.0
    */
   async clearEffects(): Promise<void> {
     return invoke('plugin:window|set_effects', {
@@ -1149,8 +1069,6 @@ class Window {
    *
    * @param alwaysOnTop Whether the window should always be on top of other windows or not.
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async setAlwaysOnTop(alwaysOnTop: boolean): Promise<void> {
     return invoke('plugin:window|set_always_on_top', {
@@ -1168,8 +1086,6 @@ class Window {
    * ```
    *
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async setContentProtected(protected_: boolean): Promise<void> {
     return invoke('plugin:window|set_content_protected', {
@@ -1188,8 +1104,6 @@ class Window {
    *
    * @param size The logical or physical inner size.
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async setSize(size: LogicalSize | PhysicalSize): Promise<void> {
     if (!size || (size.type !== 'Logical' && size.type !== 'Physical')) {
@@ -1220,8 +1134,6 @@ class Window {
    *
    * @param size The logical or physical inner size, or `null` to unset the constraint.
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async setMinSize(
     size: LogicalSize | PhysicalSize | null | undefined
@@ -1256,8 +1168,6 @@ class Window {
    *
    * @param size The logical or physical inner size, or `null` to unset the constraint.
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async setMaxSize(
     size: LogicalSize | PhysicalSize | null | undefined
@@ -1292,8 +1202,6 @@ class Window {
    *
    * @param position The new position, in logical or physical pixels.
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async setPosition(
     position: LogicalPosition | PhysicalPosition
@@ -1329,8 +1237,6 @@ class Window {
    *
    * @param fullscreen Whether the window should go to fullscreen or not.
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async setFullscreen(fullscreen: boolean): Promise<void> {
     return invoke('plugin:window|set_fullscreen', {
@@ -1348,8 +1254,6 @@ class Window {
    * ```
    *
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async setFocus(): Promise<void> {
     return invoke('plugin:window|set_focus', {
@@ -1374,8 +1278,6 @@ class Window {
    *
    * @param icon Icon bytes or path to the icon file.
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async setIcon(icon: string | Uint8Array): Promise<void> {
     return invoke('plugin:window|set_icon', {
@@ -1398,8 +1300,6 @@ class Window {
    *
    * @param skip true to hide window icon, false to show it.
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async setSkipTaskbar(skip: boolean): Promise<void> {
     return invoke('plugin:window|set_skip_taskbar', {
@@ -1426,8 +1326,6 @@ class Window {
    *
    * @param grab `true` to grab the cursor icon, `false` to release it.
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async setCursorGrab(grab: boolean): Promise<void> {
     return invoke('plugin:window|set_cursor_grab', {
@@ -1452,8 +1350,6 @@ class Window {
    *
    * @param visible If `false`, this will hide the cursor. If `true`, this will show the cursor.
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async setCursorVisible(visible: boolean): Promise<void> {
     return invoke('plugin:window|set_cursor_visible', {
@@ -1472,8 +1368,6 @@ class Window {
    *
    * @param icon The new cursor icon.
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async setCursorIcon(icon: CursorIcon): Promise<void> {
     return invoke('plugin:window|set_cursor_icon', {
@@ -1492,8 +1386,6 @@ class Window {
    *
    * @param position The new cursor position.
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async setCursorPosition(
     position: LogicalPosition | PhysicalPosition
@@ -1530,8 +1422,6 @@ class Window {
    *
    * @param ignore `true` to ignore the cursor events; `false` to process them as usual.
    * @returns A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async setIgnoreCursorEvents(ignore: boolean): Promise<void> {
     return invoke('plugin:window|set_ignore_cursor_events', {
@@ -1549,8 +1439,6 @@ class Window {
    * ```
    *
    * @return A promise indicating the success or failure of the operation.
-   *
-   * @since 2.0.0
    */
   async startDragging(): Promise<void> {
     return invoke('plugin:window|start_dragging', {
@@ -1576,8 +1464,6 @@ class Window {
    *
    * @returns A promise resolving to a function to unlisten to the event.
    * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
-   *
-   * @since 2.0.0
    */
   async onResized(handler: EventCallback<PhysicalSize>): Promise<UnlistenFn> {
     return this.listen<PhysicalSize>(TauriEvent.WINDOW_RESIZED, (e) => {
@@ -1602,8 +1488,6 @@ class Window {
    *
    * @returns A promise resolving to a function to unlisten to the event.
    * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
-   *
-   * @since 2.0.0
    */
   async onMoved(handler: EventCallback<PhysicalPosition>): Promise<UnlistenFn> {
     return this.listen<PhysicalPosition>(TauriEvent.WINDOW_MOVED, (e) => {
@@ -1633,8 +1517,6 @@ class Window {
    *
    * @returns A promise resolving to a function to unlisten to the event.
    * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
-   *
-   * @since 2.0.0
    */
   /* eslint-disable @typescript-eslint/promise-function-async */
   async onCloseRequested(
@@ -1667,8 +1549,6 @@ class Window {
    *
    * @returns A promise resolving to a function to unlisten to the event.
    * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
-   *
-   * @since 2.0.0
    */
   async onFocusChanged(handler: EventCallback<boolean>): Promise<UnlistenFn> {
     const unlistenFocus = await this.listen<PhysicalPosition>(
@@ -1709,8 +1589,6 @@ class Window {
    *
    * @returns A promise resolving to a function to unlisten to the event.
    * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
-   *
-   * @since 2.0.0
    */
   async onScaleChanged(
     handler: EventCallback<ScaleFactorChanged>
@@ -1737,8 +1615,6 @@ class Window {
    *
    * @returns A promise resolving to a function to unlisten to the event.
    * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
-   *
-   * @since 2.0.0
    */
   async onMenuClicked(handler: EventCallback<string>): Promise<UnlistenFn> {
     return this.listen<string>(TauriEvent.MENU, handler)
@@ -1768,8 +1644,6 @@ class Window {
    *
    * @returns A promise resolving to a function to unlisten to the event.
    * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
-   *
-   * @since 2.0.0
    */
   async onFileDropEvent(
     handler: EventCallback<FileDropEvent>
@@ -1818,8 +1692,6 @@ class Window {
    *
    * @returns A promise resolving to a function to unlisten to the event.
    * Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
-   *
-   * @since 2.0.0
    */
   async onThemeChanged(handler: EventCallback<Theme>): Promise<UnlistenFn> {
     return this.listen<Theme>(TauriEvent.WINDOW_THEME_CHANGED, handler)
@@ -1829,14 +1701,14 @@ class Window {
 /**
  * an array RGBA colors. Each value has minimum of 0 and maximum of 255.
  *
- * @since 2.0
+ * @since 2.0.0
  */
 type Color = [number, number, number, number]
 
 /**
  * Platform-specific window effects
  *
- * @since 2.0
+ * @since 2.0.0
  */
 enum Effect {
   /**
@@ -1964,7 +1836,7 @@ enum Effect {
  *
  * @see https://developer.apple.com/documentation/appkit/nsvisualeffectview/state
  *
- * @since 2.0
+ * @since 2.0.0
  */
 enum EffectState {
   /**
@@ -1983,7 +1855,7 @@ enum EffectState {
 
 /** The window effects configuration object
  *
- * @since 2.0
+ * @since 2.0.0
  */
 interface Effects {
   /**
@@ -2009,7 +1881,7 @@ interface Effects {
 /**
  * Configuration for the window to create.
  *
- * @since 2.0.0
+ * @since 1.0.0
  */
 interface WindowOptions {
   /**
@@ -2163,7 +2035,7 @@ function mapPhysicalSize(m: PhysicalSize): PhysicalSize {
  * const monitor = currentMonitor();
  * ```
  *
- * @since 2.0.0
+ * @since 1.0.0
  */
 async function currentMonitor(): Promise<Monitor | null> {
   return invoke<Monitor | null>('plugin:window|current_monitor').then(
@@ -2180,7 +2052,7 @@ async function currentMonitor(): Promise<Monitor | null> {
  * const monitor = primaryMonitor();
  * ```
  *
- * @since 2.0.0
+ * @since 1.0.0
  */
 async function primaryMonitor(): Promise<Monitor | null> {
   return invoke<Monitor | null>('plugin:window|primary_monitor').then(
@@ -2196,7 +2068,7 @@ async function primaryMonitor(): Promise<Monitor | null> {
  * const monitors = availableMonitors();
  * ```
  *
- * @since 2.0.0
+ * @since 1.0.0
  */
 async function availableMonitors(): Promise<Monitor[]> {
   return invoke<Monitor[]>('plugin:window|available_monitors').then(

+ 2 - 1
tooling/api/typedoc.json

@@ -5,7 +5,8 @@
     "src/mocks.ts",
     "src/path.ts",
     "src/primitives.ts",
-    "src/window.ts"
+    "src/window.ts",
+    "src/app.ts"
   ],
   "githubPages": false,
   "readme": "none",

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików