diff --git a/tooling/api/README.md b/tooling/api/README.md index 81e8a2ffc..046832c1c 100644 --- a/tooling/api/README.md +++ b/tooling/api/README.md @@ -1,4 +1,4 @@ -# @tauri-apps/cli +# @tauri-apps/api [![status](https://img.shields.io/badge/Status-Beta-green.svg)](https://github.com/tauri-apps/tauri) @@ -12,9 +12,9 @@ [![https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg](https://good-labs.github.io/greater-good-affirmation/assets/images/badge.svg)](https://good-labs.github.io/greater-good-affirmation) [![support](https://img.shields.io/badge/sponsor-Opencollective-blue.svg)](https://opencollective.com/tauri) -| Component | Version | -| --------- | ------------------------------------------- | -| @tauri-apps/api | ![](https://img.shields.io/npm/v/@tauri-apps/api.svg) | +| Component | Version | +| --------------- | ----------------------------------------------------- | +| @tauri-apps/api | ![](https://img.shields.io/npm/v/@tauri-apps/api.svg) | ## About Tauri Tauri is a polyglot and generic system that is very composable and allows engineers to make a wide variety of applications. It is used for building applications for Desktop Computers using a combination of Rust tools and HTML rendered in a Webview. Apps built with Tauri can ship with any number of pieces of an optional JS API / Rust API so that webviews can control the system via message passing. In fact, developers can extend the default API with their own functionality and bridge the Webview and Rust-based backend easily. diff --git a/tooling/api/src/app.ts b/tooling/api/src/app.ts index 19551b7ab..61d487696 100644 --- a/tooling/api/src/app.ts +++ b/tooling/api/src/app.ts @@ -4,6 +4,7 @@ /** * Get application metadata. + * * This package is also accessible with `window.__TAURI__.app` when `tauri.conf.json > build > withGlobalTauri` is set to true. * @packageDocumentation */ diff --git a/tooling/api/src/cli.ts b/tooling/api/src/cli.ts index ba7450cc3..f1243af18 100644 --- a/tooling/api/src/cli.ts +++ b/tooling/api/src/cli.ts @@ -4,6 +4,7 @@ /** * Parse arguments from your Command Line Interface. + * * This package is also accessible with `window.__TAURI__.cli` when `tauri.conf.json > build > withGlobalTauri` is set to true. * @packageDocumentation */ diff --git a/tooling/api/src/dialog.ts b/tooling/api/src/dialog.ts index 5558b9bcf..584bc6702 100644 --- a/tooling/api/src/dialog.ts +++ b/tooling/api/src/dialog.ts @@ -4,7 +4,24 @@ /** * Native system dialogs for opening and saving files. + * * This package is also accessible with `window.__TAURI__.dialog` when `tauri.conf.json > build > withGlobalTauri` is set to true. + * + * The APIs must be allowlisted on `tauri.conf.json`: + * ```json + * { + * "tauri": { + * "allowlist": { + * "dialog": { + * "all": true, // enable all dialog APIs + * "open": true, // enable file open API + * "save": true // enable file save API + * } + * } + * } + * } + * ``` + * It is recommended to allowlist only the APIs you use for optimal bundle size and security. * @packageDocumentation */ diff --git a/tooling/api/src/event.ts b/tooling/api/src/event.ts index 593c66f81..1fc2415d0 100644 --- a/tooling/api/src/event.ts +++ b/tooling/api/src/event.ts @@ -4,6 +4,7 @@ /** * The event system allows you to emit events to the backend and listen to events from it. + * * This package is also accessible with `window.__TAURI__.event` when `tauri.conf.json > build > withGlobalTauri` is set to true. * @packageDocumentation */ diff --git a/tooling/api/src/fs.ts b/tooling/api/src/fs.ts index 6f01e45d5..9772f0a5a 100644 --- a/tooling/api/src/fs.ts +++ b/tooling/api/src/fs.ts @@ -4,7 +4,32 @@ /** * Access the file system. + * * This package is also accessible with `window.__TAURI__.fs` when `tauri.conf.json > build > withGlobalTauri` is set to true. + * + * The APIs must be allowlisted on `tauri.conf.json`: + * ```json + * { + * "tauri": { + * "allowlist": { + * "fs": { + * "all": true, // enable all FS APIs + * "readTextFile": true, + * "readBinaryFile": true, + * "writeFile": true, + * "writeBinaryFile": true, + * "readDir": true, + * "copyFile": true, + * "createDir": true, + * "removeDir": true, + * "removeFile": true, + * "renameFile": true + * } + * } + * } + * } + * ``` + * It is recommended to allowlist only the APIs you use for optimal bundle size and security. * @packageDocumentation */ diff --git a/tooling/api/src/globalShortcut.ts b/tooling/api/src/globalShortcut.ts index 645b927b0..8b66cefbe 100644 --- a/tooling/api/src/globalShortcut.ts +++ b/tooling/api/src/globalShortcut.ts @@ -4,7 +4,22 @@ /** * Register global shortcuts. + * * This package is also accessible with `window.__TAURI__.globalShortcut` when `tauri.conf.json > build > withGlobalTauri` is set to true. + * + * The APIs must be allowlisted on `tauri.conf.json`: + * ```json + * { + * "tauri": { + * "allowlist": { + * "globalShortcut": { + * "all": true // enable all global shortcut APIs + * } + * } + * } + * } + * ``` + * It is recommended to allowlist only the APIs you use for optimal bundle size and security. * @packageDocumentation */ diff --git a/tooling/api/src/http.ts b/tooling/api/src/http.ts index 1775a4ce0..b756f3746 100644 --- a/tooling/api/src/http.ts +++ b/tooling/api/src/http.ts @@ -4,7 +4,23 @@ /** * Access the HTTP client written in Rust. + * * This package is also accessible with `window.__TAURI__.http` when `tauri.conf.json > build > withGlobalTauri` is set to true. + * + * The APIs must be allowlisted on `tauri.conf.json`: + * ```json + * { + * "tauri": { + * "allowlist": { + * "http": { + * "all": true, // enable all http APIs + * "request": true // enable HTTP request API + * } + * } + * } + * } + * ``` + * It is recommended to allowlist only the APIs you use for optimal bundle size and security. * @packageDocumentation */ diff --git a/tooling/api/src/index.ts b/tooling/api/src/index.ts index fb0c5fca8..eef47f284 100644 --- a/tooling/api/src/index.ts +++ b/tooling/api/src/index.ts @@ -4,6 +4,7 @@ /** * The Tauri API allows you to interface with the backend layer. + * * This module exposes all other modules as an object where the key is the module name, and the value is the module exports. * @example * ```typescript diff --git a/tooling/api/src/notification.ts b/tooling/api/src/notification.ts index 47b1f9837..dc94222e2 100644 --- a/tooling/api/src/notification.ts +++ b/tooling/api/src/notification.ts @@ -4,7 +4,22 @@ /** * Send notifications to your user. Can also be used with the Notification Web API. + * * This package is also accessible with `window.__TAURI__.notification` when `tauri.conf.json > build > withGlobalTauri` is set to true. + * + * The APIs must be allowlisted on `tauri.conf.json`: + * ```json + * { + * "tauri": { + * "allowlist": { + * "notification": { + * "all": true // enable all notification APIs + * } + * } + * } + * } + * ``` + * It is recommended to allowlist only the APIs you use for optimal bundle size and security. * @packageDocumentation */ diff --git a/tooling/api/src/path.ts b/tooling/api/src/path.ts index 08c33de78..91ce94357 100644 --- a/tooling/api/src/path.ts +++ b/tooling/api/src/path.ts @@ -7,7 +7,23 @@ import { BaseDirectory } from './fs' /** * Read common system paths such as home, config and cache directories. + * * This package is also accessible with `window.__TAURI__.path` when `tauri.conf.json > build > withGlobalTauri` is set to true. + * + * The APIs must be allowlisted on `tauri.conf.json`: + * ```json + * { + * "tauri": { + * "allowlist": { + * "fs": { + * "all": true, // enable all FS APIs + * "path": true // enable path APIs + * } + * } + * } + * } + * ``` + * It is recommended to allowlist only the APIs you use for optimal bundle size and security. * @packageDocumentation */ diff --git a/tooling/api/src/process.ts b/tooling/api/src/process.ts index 849cc1aba..f407cc9b5 100644 --- a/tooling/api/src/process.ts +++ b/tooling/api/src/process.ts @@ -6,6 +6,7 @@ import { invokeTauriCommand } from './helpers/tauri' /** * Perform operations on the current process. + * * This package is also accessible with `window.__TAURI__.process` when `tauri.conf.json > build > withGlobalTauri` is set to true. * @packageDocumentation */ diff --git a/tooling/api/src/shell.ts b/tooling/api/src/shell.ts index 2cfa5f636..76d85e6b6 100644 --- a/tooling/api/src/shell.ts +++ b/tooling/api/src/shell.ts @@ -8,7 +8,24 @@ import { transformCallback } from './tauri' /** * Access the system shell. * Allows you to spawn child processes and manage files and URLs using their default application. + * * This package is also accessible with `window.__TAURI__.shell` when `tauri.conf.json > build > withGlobalTauri` is set to true. + * + * The APIs must be allowlisted on `tauri.conf.json`: + * ```json + * { + * "tauri": { + * "allowlist": { + * "shell": { + * "all": true, // enable all shell APIs + * "execute": true, // enable process spawn APIs + * "open": true // enable opening files/URLs using the default program + * } + * } + * } + * } + * ``` + * It is recommended to allowlist only the APIs you use for optimal bundle size and security. * @packageDocumentation */ diff --git a/tooling/api/src/tauri.ts b/tooling/api/src/tauri.ts index 4a1959ee4..7755388a9 100644 --- a/tooling/api/src/tauri.ts +++ b/tooling/api/src/tauri.ts @@ -4,6 +4,7 @@ /** * Invoke your custom commands. + * * This package is also accessible with `window.__TAURI__.tauri` when `tauri.conf.json > build > withGlobalTauri` is set to true. * @packageDocumentation */ diff --git a/tooling/api/src/updater.ts b/tooling/api/src/updater.ts index 9b27ef54e..d516bd09e 100644 --- a/tooling/api/src/updater.ts +++ b/tooling/api/src/updater.ts @@ -4,6 +4,7 @@ /** * Customize the auto updater flow. + * * This package is also accessible with `window.__TAURI__.updater` when `tauri.conf.json > build > withGlobalTauri` is set to true. * @packageDocumentation */ diff --git a/tooling/api/src/window.ts b/tooling/api/src/window.ts index bda22cb5d..a975d7a7c 100644 --- a/tooling/api/src/window.ts +++ b/tooling/api/src/window.ts @@ -4,7 +4,23 @@ /** * Provides APIs to create windows, communicate with other windows and manipulate the current window. + * * This package is also accessible with `window.__TAURI__.window` when `tauri.conf.json > build > withGlobalTauri` is set to true. + * + * The APIs must be allowlisted on `tauri.conf.json`: + * ```json + * { + * "tauri": { + * "allowlist": { + * "window": { + * "all": true, // enable all window APIs + * "create": true // enable window creation + * } + * } + * } + * } + * ``` + * It is recommended to allowlist only the APIs you use for optimal bundle size and security. * @packageDocumentation */