diff --git a/dist-js/index.cjs b/dist-js/index.cjs new file mode 100644 index 0000000..00299df --- /dev/null +++ b/dist-js/index.cjs @@ -0,0 +1,114 @@ +'use strict'; + +var primitives = require('@tauri-apps/api/primitives'); + +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT +/** + * Register global shortcuts. + * + * @module + */ +/** + * Register a global shortcut. + * @example + * ```typescript + * import { register } from '@tauri-apps/plugin-global-shortcut'; + * await register('CommandOrControl+Shift+C', () => { + * console.log('Shortcut triggered'); + * }); + * ``` + * + * @param shortcut Shortcut definition, modifiers and key separated by "+" e.g. CmdOrControl+Q + * @param handler Shortcut handler callback - takes the triggered shortcut as argument + * + * @since 2.0.0 + */ +async function register(shortcut, handler) { + const h = new primitives.Channel(); + h.onmessage = handler; + return await primitives.invoke("plugin:globalShortcut|register", { + shortcut, + handler: h, + }); +} +/** + * Register a collection of global shortcuts. + * @example + * ```typescript + * import { registerAll } from '@tauri-apps/plugin-global-shortcut'; + * await registerAll(['CommandOrControl+Shift+C', 'Ctrl+Alt+F12'], (shortcut) => { + * console.log(`Shortcut ${shortcut} triggered`); + * }); + * ``` + * + * @param shortcuts Array of shortcut definitions, modifiers and key separated by "+" e.g. CmdOrControl+Q + * @param handler Shortcut handler callback - takes the triggered shortcut as argument + * + * @since 2.0.0 + */ +async function registerAll(shortcuts, handler) { + const h = new primitives.Channel(); + h.onmessage = handler; + return await primitives.invoke("plugin:globalShortcut|register_all", { + shortcuts, + handler: h, + }); +} +/** + * Determines whether the given shortcut is registered by this application or not. + * + * If the shortcut is registered by another application, it will still return `false`. + * + * @example + * ```typescript + * import { isRegistered } from '@tauri-apps/plugin-global-shortcut'; + * const isRegistered = await isRegistered('CommandOrControl+P'); + * ``` + * + * @param shortcut shortcut definition, modifiers and key separated by "+" e.g. CmdOrControl+Q + * + * @since 2.0.0 + */ +async function isRegistered(shortcut) { + return await primitives.invoke("plugin:globalShortcut|is_registered", { + shortcut, + }); +} +/** + * Unregister a global shortcut. + * @example + * ```typescript + * import { unregister } from '@tauri-apps/plugin-global-shortcut'; + * await unregister('CmdOrControl+Space'); + * ``` + * + * @param shortcut shortcut definition, modifiers and key separated by "+" e.g. CmdOrControl+Q + * + * @since 2.0.0 + */ +async function unregister(shortcut) { + return await primitives.invoke("plugin:globalShortcut|unregister", { + shortcut, + }); +} +/** + * Unregisters all shortcuts registered by the application. + * @example + * ```typescript + * import { unregisterAll } from '@tauri-apps/plugin-global-shortcut'; + * await unregisterAll(); + * ``` + * + * @since 2.0.0 + */ +async function unregisterAll() { + return await primitives.invoke("plugin:globalShortcut|unregister_all"); +} + +exports.isRegistered = isRegistered; +exports.register = register; +exports.registerAll = registerAll; +exports.unregister = unregister; +exports.unregisterAll = unregisterAll; diff --git a/dist-js/index.mjs b/dist-js/index.js similarity index 98% rename from dist-js/index.mjs rename to dist-js/index.js index a7d4313..b30dc71 100644 --- a/dist-js/index.mjs +++ b/dist-js/index.js @@ -106,4 +106,3 @@ async function unregisterAll() { } export { isRegistered, register, registerAll, unregister, unregisterAll }; -//# sourceMappingURL=index.mjs.map diff --git a/dist-js/index.min.js b/dist-js/index.min.js deleted file mode 100644 index 1c6680f..0000000 --- a/dist-js/index.min.js +++ /dev/null @@ -1,204 +0,0 @@ -/****************************************************************************** -Copyright (c) Microsoft Corporation. - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, -INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM -LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR -OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THIS SOFTWARE. -***************************************************************************** */ -/* global Reflect, Promise, SuppressedError, Symbol */ - - -function __classPrivateFieldGet(receiver, state, kind, f) { - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); - return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); -} - -function __classPrivateFieldSet(receiver, state, value, kind, f) { - if (kind === "m") throw new TypeError("Private method is not writable"); - if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); - if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); - return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; -} - -typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) { - var e = new Error(message); - return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e; -}; - -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -var _Channel_onmessage; -/** - * Invoke your custom commands. - * - * This package is also accessible with `window.__TAURI__.tauri` when [`build.withGlobalTauri`](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in `tauri.conf.json` is set to `true`. - * @module - */ -/** - * Transforms a callback function to a string identifier that can be passed to the backend. - * The backend uses the identifier to `eval()` the callback. - * - * @return A unique identifier associated with the callback function. - * - * @since 1.0.0 - */ -function transformCallback(callback, once = false) { - return window.__TAURI_INTERNALS__.transformCallback(callback, once); -} -class Channel { - constructor() { - // @ts-expect-error field used by the IPC serializer - this.__TAURI_CHANNEL_MARKER__ = true; - _Channel_onmessage.set(this, () => { - // no-op - }); - this.id = transformCallback((response) => { - __classPrivateFieldGet(this, _Channel_onmessage, "f").call(this, response); - }); - } - set onmessage(handler) { - __classPrivateFieldSet(this, _Channel_onmessage, handler, "f"); - } - get onmessage() { - return __classPrivateFieldGet(this, _Channel_onmessage, "f"); - } - toJSON() { - return `__CHANNEL__:${this.id}`; - } -} -_Channel_onmessage = new WeakMap(); -/** - * Sends a message to the backend. - * @example - * ```typescript - * import { invoke } from '@tauri-apps/api/primitives'; - * await invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' }); - * ``` - * - * @param cmd The command name. - * @param args The optional arguments to pass to the command. - * @param options The request options. - * @return A promise resolving or rejecting to the backend response. - * - * @since 1.0.0 - */ -async function invoke(cmd, args = {}, options) { - return window.__TAURI_INTERNALS__.invoke(cmd, args, options); -} - -// Copyright 2019-2023 Tauri Programme within The Commons Conservancy -// SPDX-License-Identifier: Apache-2.0 -// SPDX-License-Identifier: MIT -/** - * Register global shortcuts. - * - * @module - */ -/** - * Register a global shortcut. - * @example - * ```typescript - * import { register } from '@tauri-apps/plugin-global-shortcut'; - * await register('CommandOrControl+Shift+C', () => { - * console.log('Shortcut triggered'); - * }); - * ``` - * - * @param shortcut Shortcut definition, modifiers and key separated by "+" e.g. CmdOrControl+Q - * @param handler Shortcut handler callback - takes the triggered shortcut as argument - * - * @since 2.0.0 - */ -async function register(shortcut, handler) { - const h = new Channel(); - h.onmessage = handler; - return await invoke("plugin:globalShortcut|register", { - shortcut, - handler: h, - }); -} -/** - * Register a collection of global shortcuts. - * @example - * ```typescript - * import { registerAll } from '@tauri-apps/plugin-global-shortcut'; - * await registerAll(['CommandOrControl+Shift+C', 'Ctrl+Alt+F12'], (shortcut) => { - * console.log(`Shortcut ${shortcut} triggered`); - * }); - * ``` - * - * @param shortcuts Array of shortcut definitions, modifiers and key separated by "+" e.g. CmdOrControl+Q - * @param handler Shortcut handler callback - takes the triggered shortcut as argument - * - * @since 2.0.0 - */ -async function registerAll(shortcuts, handler) { - const h = new Channel(); - h.onmessage = handler; - return await invoke("plugin:globalShortcut|register_all", { - shortcuts, - handler: h, - }); -} -/** - * Determines whether the given shortcut is registered by this application or not. - * - * If the shortcut is registered by another application, it will still return `false`. - * - * @example - * ```typescript - * import { isRegistered } from '@tauri-apps/plugin-global-shortcut'; - * const isRegistered = await isRegistered('CommandOrControl+P'); - * ``` - * - * @param shortcut shortcut definition, modifiers and key separated by "+" e.g. CmdOrControl+Q - * - * @since 2.0.0 - */ -async function isRegistered(shortcut) { - return await invoke("plugin:globalShortcut|is_registered", { - shortcut, - }); -} -/** - * Unregister a global shortcut. - * @example - * ```typescript - * import { unregister } from '@tauri-apps/plugin-global-shortcut'; - * await unregister('CmdOrControl+Space'); - * ``` - * - * @param shortcut shortcut definition, modifiers and key separated by "+" e.g. CmdOrControl+Q - * - * @since 2.0.0 - */ -async function unregister(shortcut) { - return await invoke("plugin:globalShortcut|unregister", { - shortcut, - }); -} -/** - * Unregisters all shortcuts registered by the application. - * @example - * ```typescript - * import { unregisterAll } from '@tauri-apps/plugin-global-shortcut'; - * await unregisterAll(); - * ``` - * - * @since 2.0.0 - */ -async function unregisterAll() { - return await invoke("plugin:globalShortcut|unregister_all"); -} - -export { isRegistered, register, registerAll, unregister, unregisterAll }; -//# sourceMappingURL=index.min.js.map diff --git a/dist-js/index.min.js.map b/dist-js/index.min.js.map deleted file mode 100644 index 8e75faa..0000000 --- a/dist-js/index.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.min.js","sources":["../../../node_modules/.pnpm/@tauri-apps+api@2.0.0-alpha.11/node_modules/@tauri-apps/api/external/tslib/tslib.es6.js","../../../node_modules/.pnpm/@tauri-apps+api@2.0.0-alpha.11/node_modules/@tauri-apps/api/primitives.js","../guest-js/index.ts"],"sourcesContent":["/******************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise, SuppressedError, Symbol */\r\n\r\n\r\nfunction __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nfunction __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n\r\ntypeof SuppressedError === \"function\" ? SuppressedError : function (error, suppressed, message) {\r\n var e = new Error(message);\r\n return e.name = \"SuppressedError\", e.error = error, e.suppressed = suppressed, e;\r\n};\n\nexport { __classPrivateFieldGet, __classPrivateFieldSet };\n","import { __classPrivateFieldGet, __classPrivateFieldSet } from './external/tslib/tslib.es6.js';\n\n// Copyright 2019-2023 Tauri Programme within The Commons Conservancy\n// SPDX-License-Identifier: Apache-2.0\n// SPDX-License-Identifier: MIT\nvar _Channel_onmessage;\n/**\n * Invoke your custom commands.\n *\n * This package is also accessible with `window.__TAURI__.tauri` when [`build.withGlobalTauri`](https://tauri.app/v1/api/config/#buildconfig.withglobaltauri) in `tauri.conf.json` is set to `true`.\n * @module\n */\n/**\n * Transforms a callback function to a string identifier that can be passed to the backend.\n * The backend uses the identifier to `eval()` the callback.\n *\n * @return A unique identifier associated with the callback function.\n *\n * @since 1.0.0\n */\nfunction transformCallback(callback, once = false) {\n return window.__TAURI_INTERNALS__.transformCallback(callback, once);\n}\nclass Channel {\n constructor() {\n // @ts-expect-error field used by the IPC serializer\n this.__TAURI_CHANNEL_MARKER__ = true;\n _Channel_onmessage.set(this, () => {\n // no-op\n });\n this.id = transformCallback((response) => {\n __classPrivateFieldGet(this, _Channel_onmessage, \"f\").call(this, response);\n });\n }\n set onmessage(handler) {\n __classPrivateFieldSet(this, _Channel_onmessage, handler, \"f\");\n }\n get onmessage() {\n return __classPrivateFieldGet(this, _Channel_onmessage, \"f\");\n }\n toJSON() {\n return `__CHANNEL__:${this.id}`;\n }\n}\n_Channel_onmessage = new WeakMap();\nclass PluginListener {\n constructor(plugin, event, channelId) {\n this.plugin = plugin;\n this.event = event;\n this.channelId = channelId;\n }\n async unregister() {\n return invoke(`plugin:${this.plugin}|remove_listener`, {\n event: this.event,\n channelId: this.channelId\n });\n }\n}\n/**\n * Adds a listener to a plugin event.\n *\n * @returns The listener object to stop listening to the events.\n *\n * @since 2.0.0\n */\nasync function addPluginListener(plugin, event, cb) {\n const handler = new Channel();\n handler.onmessage = cb;\n return invoke(`plugin:${plugin}|register_listener`, { event, handler }).then(() => new PluginListener(plugin, event, handler.id));\n}\n/**\n * Sends a message to the backend.\n * @example\n * ```typescript\n * import { invoke } from '@tauri-apps/api/primitives';\n * await invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });\n * ```\n *\n * @param cmd The command name.\n * @param args The optional arguments to pass to the command.\n * @param options The request options.\n * @return A promise resolving or rejecting to the backend response.\n *\n * @since 1.0.0\n */\nasync function invoke(cmd, args = {}, options) {\n return window.__TAURI_INTERNALS__.invoke(cmd, args, options);\n}\n/**\n * Convert a device file path to an URL that can be loaded by the webview.\n * Note that `asset:` and `http://asset.localhost` must be added to [`tauri.security.csp`](https://tauri.app/v1/api/config/#securityconfig.csp) in `tauri.conf.json`.\n * Example CSP value: `\"csp\": \"default-src 'self' ipc: http://ipc.localhost; img-src 'self' asset: http://asset.localhost\"` to use the asset protocol on image sources.\n *\n * Additionally, `asset` must be added to [`tauri.allowlist.protocol`](https://tauri.app/v1/api/config/#allowlistconfig.protocol)\n * in `tauri.conf.json` and its access scope must be defined on the `assetScope` array on the same `protocol` object.\n *\n * @param filePath The file path.\n * @param protocol The protocol to use. Defaults to `asset`. You only need to set this when using a custom protocol.\n * @example\n * ```typescript\n * import { appDataDir, join } from '@tauri-apps/api/path';\n * import { convertFileSrc } from '@tauri-apps/api/primitives';\n * const appDataDirPath = await appDataDir();\n * const filePath = await join(appDataDirPath, 'assets/video.mp4');\n * const assetUrl = convertFileSrc(filePath);\n *\n * const video = document.getElementById('my-video');\n * const source = document.createElement('source');\n * source.type = 'video/mp4';\n * source.src = assetUrl;\n * video.appendChild(source);\n * video.load();\n * ```\n *\n * @return the URL that can be used as source on the webview.\n *\n * @since 1.0.0\n */\nfunction convertFileSrc(filePath, protocol = 'asset') {\n return window.__TAURI_INTERNALS__.convertFileSrc(filePath, protocol);\n}\n\nexport { Channel, PluginListener, addPluginListener, convertFileSrc, invoke, transformCallback };\n",null],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,sBAAsB,CAAC,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,EAAE;AAC1D,IAAI,IAAI,IAAI,KAAK,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,IAAI,SAAS,CAAC,+CAA+C,CAAC,CAAC;AACjG,IAAI,IAAI,OAAO,KAAK,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ACL,CAAC;AAED;;;;;;;;;AASG;AACH,eAAe,aAAa,GAAA;AAC1B,IAAA,OAAO,MAAM,MAAM,CAAC,sCAAsC,CAAC,CAAC;AAC9D;;;;","x_google_ignoreList":[0,1]} \ No newline at end of file diff --git a/dist-js/index.mjs.map b/dist-js/index.mjs.map deleted file mode 100644 index 8bf424c..0000000 --- a/dist-js/index.mjs.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"index.mjs","sources":["../guest-js/index.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;AACA;AACA;AAEA;;;;AAIG;AAMH;;;;;;;;;;;;;;AAcG;AACH,eAAe,QAAQ,CACrB,QAAgB,EAChB,OAAwB,EAAA;AAExB,IAAA,MAAM,CAAC,GAAG,IAAI,OAAO,EAAU,CAAC;AAChC,IAAA,CAAC,CAAC,SAAS,GAAG,OAAO,CAAC;AAEtB,IAAA,OAAO,MAAM,MAAM,CAAC,gCAAgC,EAAE;QACpD,QAAQ;AACR,QAAA,OAAO,EAAE,CAAC;AACX,KAAA,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;AAcG;AACH,eAAe,WAAW,CACxB,SAAmB,EACnB,OAAwB,EAAA;AAExB,IAAA,MAAM,CAAC,GAAG,IAAI,OAAO,EAAU,CAAC;AAChC,IAAA,CAAC,CAAC,SAAS,GAAG,OAAO,CAAC;AAEtB,IAAA,OAAO,MAAM,MAAM,CAAC,oCAAoC,EAAE;QACxD,SAAS;AACT,QAAA,OAAO,EAAE,CAAC;AACX,KAAA,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;AAcG;AACH,eAAe,YAAY,CAAC,QAAgB,EAAA;AAC1C,IAAA,OAAO,MAAM,MAAM,CAAC,qCAAqC,EAAE;QACzD,QAAQ;AACT,KAAA,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;AAWG;AACH,eAAe,UAAU,CAAC,QAAgB,EAAA;AACxC,IAAA,OAAO,MAAM,MAAM,CAAC,kCAAkC,EAAE;QACtD,QAAQ;AACT,KAAA,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;AASG;AACH,eAAe,aAAa,GAAA;AAC1B,IAAA,OAAO,MAAM,MAAM,CAAC,sCAAsC,CAAC,CAAC;AAC9D;;;;"} \ No newline at end of file diff --git a/node_modules/tslib b/node_modules/tslib deleted file mode 120000 index cf5faee..0000000 --- a/node_modules/tslib +++ /dev/null @@ -1 +0,0 @@ -../../../node_modules/.pnpm/tslib@2.6.2/node_modules/tslib \ No newline at end of file diff --git a/package.json b/package.json index ba47e0e..b50150f 100644 --- a/package.json +++ b/package.json @@ -6,26 +6,19 @@ "Tauri Programme within The Commons Conservancy" ], "type": "module", - "browser": "dist-js/index.min.js", - "module": "dist-js/index.mjs", - "types": "dist-js/index.d.ts", "exports": { - "import": "./dist-js/index.mjs", "types": "./dist-js/index.d.ts", - "browser": "./dist-js/index.min.js" + "import": "./dist-js/index.js", + "require": "./dist-js/index.cjs" }, "scripts": { "build": "rollup -c" }, "files": [ "dist-js", - "!dist-js/**/*.map", "README.md", "LICENSE" ], - "devDependencies": { - "tslib": "^2.4.1" - }, "dependencies": { "@tauri-apps/api": "2.0.0-alpha.11" } diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 0000000..977dfac --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,7 @@ +// Copyright 2019-2023 Tauri Programme within The Commons Conservancy +// SPDX-License-Identifier: Apache-2.0 +// SPDX-License-Identifier: MIT + +import { createConfig } from "../../shared/rollup.config.js"; + +export default createConfig(); diff --git a/rollup.config.mjs b/rollup.config.mjs deleted file mode 100644 index 99a3dd3..0000000 --- a/rollup.config.mjs +++ /dev/null @@ -1,11 +0,0 @@ -import { readFileSync } from "fs"; - -import { createConfig } from "../../shared/rollup.config.mjs"; - -export default createConfig({ - input: "guest-js/index.ts", - pkg: JSON.parse( - readFileSync(new URL("./package.json", import.meta.url), "utf8"), - ), - external: [/^@tauri-apps\/api/], -}); diff --git a/src/api-iife.js b/src/api-iife.js index 934749c..a46308f 100644 --- a/src/api-iife.js +++ b/src/api-iife.js @@ -1 +1 @@ -if("__TAURI__"in window){var __TAURI_GLOBALSHORTCUT__=function(t){"use strict";function e(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)}var r;"function"==typeof SuppressedError&&SuppressedError;class n{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,r.set(this,(()=>{})),this.id=function(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}((t=>{e(this,r,"f").call(this,t)}))}set onmessage(t){!function(t,e,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?o.call(t,r):o?o.value=r:e.set(t,r)}(this,r,t,"f")}get onmessage(){return e(this,r,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}async function o(t,e={},r){return window.__TAURI_INTERNALS__.invoke(t,e,r)}return r=new WeakMap,t.isRegistered=async function(t){return await o("plugin:globalShortcut|is_registered",{shortcut:t})},t.register=async function(t,e){const r=new n;return r.onmessage=e,await o("plugin:globalShortcut|register",{shortcut:t,handler:r})},t.registerAll=async function(t,e){const r=new n;return r.onmessage=e,await o("plugin:globalShortcut|register_all",{shortcuts:t,handler:r})},t.unregister=async function(t){return await o("plugin:globalShortcut|unregister",{shortcut:t})},t.unregisterAll=async function(){return await o("plugin:globalShortcut|unregister_all")},t}({});Object.defineProperty(window.__TAURI__,"globalShortcut",{value:__TAURI_GLOBALSHORTCUT__})} +if("__TAURI__"in window){var __TAURI_PLUGIN_GLOBALSHORTCUT__=function(t){"use strict";function e(t,e,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof e?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(t):n?n.value:e.get(t)}var r;"function"==typeof SuppressedError&&SuppressedError;class n{constructor(){this.__TAURI_CHANNEL_MARKER__=!0,r.set(this,(()=>{})),this.id=function(t,e=!1){return window.__TAURI_INTERNALS__.transformCallback(t,e)}((t=>{e(this,r,"f").call(this,t)}))}set onmessage(t){!function(t,e,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof e?t!==e||!o:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");"a"===n?o.call(t,r):o?o.value=r:e.set(t,r)}(this,r,t,"f")}get onmessage(){return e(this,r,"f")}toJSON(){return`__CHANNEL__:${this.id}`}}async function o(t,e={},r){return window.__TAURI_INTERNALS__.invoke(t,e,r)}return r=new WeakMap,t.isRegistered=async function(t){return await o("plugin:globalShortcut|is_registered",{shortcut:t})},t.register=async function(t,e){const r=new n;return r.onmessage=e,await o("plugin:globalShortcut|register",{shortcut:t,handler:r})},t.registerAll=async function(t,e){const r=new n;return r.onmessage=e,await o("plugin:globalShortcut|register_all",{shortcuts:t,handler:r})},t.unregister=async function(t){return await o("plugin:globalShortcut|unregister",{shortcut:t})},t.unregisterAll=async function(){return await o("plugin:globalShortcut|unregister_all")},t}({});Object.defineProperty(window.__TAURI__,"globalShortcut",{value:__TAURI_PLUGIN_GLOBALSHORTCUT__})}