Veröffentlichte Quellen
Quellen als ZIP herunterladen
CH-J Tools
Durchsuchen Sie Verzeichnisse und Dateien einer bestimmten Anwendungsausgabe.
CH-J / Server Manager
1704 Dateien
0.1.2-beta
Hinzugefügt: · Erstellt:
1
"use strict";2
(() => {3
// node_modules/@tauri-apps/api/external/tslib/tslib.es6.js4
function __classPrivateFieldGet(receiver, state, kind, f) {5
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");6
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");7
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);8
}9
function __classPrivateFieldSet(receiver, state, value, kind, f) {10
if (kind === "m") throw new TypeError("Private method is not writable");11
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");12
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");13
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;14
}16
// node_modules/@tauri-apps/api/core.js17
var _Channel_instances;18
var _Channel_onmessage;19
var _Channel_nextMessageIndex;20
var _Channel_pendingMessages;21
var _Channel_messageEndIndex;22
var _Channel_deliver;23
var _Resource_rid;24
var SERIALIZE_TO_IPC_FN = "__TAURI_TO_IPC_KEY__";25
function transformCallback(callback, once2 = false) {26
return window.__TAURI_INTERNALS__.transformCallback(callback, once2);27
}28
var Channel = class {29
constructor(onmessage) {30
_Channel_instances.add(this);31
_Channel_onmessage.set(this, void 0);32
_Channel_nextMessageIndex.set(this, 0);33
_Channel_pendingMessages.set(this, []);34
_Channel_messageEndIndex.set(this, void 0);35
__classPrivateFieldSet(this, _Channel_onmessage, onmessage || (() => {36
}), "f");37
this.id = transformCallback((rawMessage) => {38
const index = rawMessage.index;39
if ("end" in rawMessage) {40
if (index == __classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")) {41
this.cleanupCallback();42
} else {43
__classPrivateFieldSet(this, _Channel_messageEndIndex, index, "f");44
}45
return;46
}47
const message = rawMessage.message;48
if (index == __classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")) {49
__classPrivateFieldGet(this, _Channel_instances, "m", _Channel_deliver).call(this, message);50
__classPrivateFieldSet(this, _Channel_nextMessageIndex, __classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") + 1, "f");51
while (__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") in __classPrivateFieldGet(this, _Channel_pendingMessages, "f")) {52
const message2 = __classPrivateFieldGet(this, _Channel_pendingMessages, "f")[__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")];53
__classPrivateFieldGet(this, _Channel_instances, "m", _Channel_deliver).call(this, message2);54
delete __classPrivateFieldGet(this, _Channel_pendingMessages, "f")[__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")];55
__classPrivateFieldSet(this, _Channel_nextMessageIndex, __classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") + 1, "f");56
}57
if (__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") === __classPrivateFieldGet(this, _Channel_messageEndIndex, "f")) {58
this.cleanupCallback();59
}60
} else {61
__classPrivateFieldGet(this, _Channel_pendingMessages, "f")[index] = message;62
}63
});64
}65
cleanupCallback() {66
window.__TAURI_INTERNALS__.unregisterCallback(this.id);67
}68
/**69
* The handler called for every message sent by the Rust side of this channel.70
*71
* Assigning a new handler replaces the previous one; messages that arrived72
* before a handler was set are not replayed, so set it (or pass it to the73
* constructor) before sending the channel to the backend.74
*/75
set onmessage(handler) {76
__classPrivateFieldSet(this, _Channel_onmessage, handler, "f");77
}78
get onmessage() {79
return __classPrivateFieldGet(this, _Channel_onmessage, "f");80
}81
[(_Channel_onmessage = /* @__PURE__ */ new WeakMap(), _Channel_nextMessageIndex = /* @__PURE__ */ new WeakMap(), _Channel_pendingMessages = /* @__PURE__ */ new WeakMap(), _Channel_messageEndIndex = /* @__PURE__ */ new WeakMap(), _Channel_instances = /* @__PURE__ */ new WeakSet(), _Channel_deliver = function _Channel_deliver2(message) {82
try {83
__classPrivateFieldGet(this, _Channel_onmessage, "f").call(this, message);84
} catch (error) {85
queueMicrotask(() => {86
throw error;87
});88
}89
}, SERIALIZE_TO_IPC_FN)]() {90
return `__CHANNEL__:${this.id}`;91
}92
toJSON() {93
return this[SERIALIZE_TO_IPC_FN]();94
}95
};96
async function invoke(cmd, args = {}, options) {97
return window.__TAURI_INTERNALS__.invoke(cmd, args, options);98
}99
var Resource = class {100
get rid() {101
return __classPrivateFieldGet(this, _Resource_rid, "f");102
}103
constructor(rid) {104
_Resource_rid.set(this, void 0);105
__classPrivateFieldSet(this, _Resource_rid, rid, "f");106
}107
/**108
* Destroys and cleans up this resource from memory.109
* **You should not call any method on this object anymore and should drop any reference to it.**110
*111
* @remarks Uses the `core:resources:allow-close` permission, which is part of112
* the `core:resources:default` permission set enabled by default.113
*/114
async close() {115
return invoke("plugin:resources|close", {116
rid: this.rid117
});118
}119
async [(_Resource_rid = /* @__PURE__ */ new WeakMap(), Symbol.asyncDispose)]() {120
await this.close();121
}122
};124
// node_modules/@tauri-apps/api/event.js125
var TauriEvent;126
(function(TauriEvent2) {127
TauriEvent2["WINDOW_RESIZED"] = "tauri://resize";128
TauriEvent2["WINDOW_MOVED"] = "tauri://move";129
TauriEvent2["WINDOW_CLOSE_REQUESTED"] = "tauri://close-requested";130
TauriEvent2["WINDOW_DESTROYED"] = "tauri://destroyed";131
TauriEvent2["WINDOW_FOCUS"] = "tauri://focus";132
TauriEvent2["WINDOW_BLUR"] = "tauri://blur";133
TauriEvent2["WINDOW_SCALE_FACTOR_CHANGED"] = "tauri://scale-change";134
TauriEvent2["WINDOW_THEME_CHANGED"] = "tauri://theme-changed";135
TauriEvent2["WINDOW_CREATED"] = "tauri://window-created";136
TauriEvent2["WINDOW_SUSPENDED"] = "tauri://suspended";137
TauriEvent2["WINDOW_RESUMED"] = "tauri://resumed";138
TauriEvent2["WEBVIEW_CREATED"] = "tauri://webview-created";139
TauriEvent2["DRAG_ENTER"] = "tauri://drag-enter";140
TauriEvent2["DRAG_OVER"] = "tauri://drag-over";141
TauriEvent2["DRAG_DROP"] = "tauri://drag-drop";142
TauriEvent2["DRAG_LEAVE"] = "tauri://drag-leave";143
})(TauriEvent || (TauriEvent = {}));144
async function _unlisten(event, eventId) {145
window.__TAURI_EVENT_PLUGIN_INTERNALS__.unregisterListener(event, eventId);146
await invoke("plugin:event|unlisten", {147
event,148
eventId149
});150
}151
async function listen(event, handler, options) {152
var _a;153
const target = typeof (options === null || options === void 0 ? void 0 : options.target) === "string" ? { kind: "AnyLabel", label: options.target } : (_a = options === null || options === void 0 ? void 0 : options.target) !== null && _a !== void 0 ? _a : { kind: "Any" };154
return invoke("plugin:event|listen", {155
event,156
target,157
handler: transformCallback(handler)158
}).then((eventId) => {159
return async () => _unlisten(event, eventId);160
});161
}162
async function once(event, handler, options) {163
return listen(event, (eventData) => {164
void _unlisten(event, eventData.id);165
handler(eventData);166
}, options);167
}168
async function emit(event, payload) {169
await invoke("plugin:event|emit", {170
event,171
payload172
});173
}174
async function emitTo(target, event, payload) {175
const eventTarget = typeof target === "string" ? { kind: "AnyLabel", label: target } : target;176
await invoke("plugin:event|emit_to", {177
target: eventTarget,178
event,179
payload180
});181
}183
// node_modules/@tauri-apps/api/dpi.js184
var LogicalSize = class {185
constructor(...args) {186
this.type = "Logical";187
if (args.length === 1) {188
if ("Logical" in args[0]) {189
this.width = args[0].Logical.width;190
this.height = args[0].Logical.height;191
} else {192
this.width = args[0].width;193
this.height = args[0].height;194
}195
} else {196
this.width = args[0];197
this.height = args[1];198
}199
}200
/**201
* Converts the logical size to a physical one.202
* @example203
* ```typescript204
* import { LogicalSize } from '@tauri-apps/api/dpi';205
* import { getCurrentWindow } from '@tauri-apps/api/window';206
*207
* const appWindow = getCurrentWindow();208
* const factor = await appWindow.scaleFactor();209
* const size = new LogicalSize(400, 500);210
* const physical = size.toPhysical(factor);211
* ```212
*213
* @since 2.0.0214
*/215
toPhysical(scaleFactor) {216
return new PhysicalSize(this.width * scaleFactor, this.height * scaleFactor);217
}218
[SERIALIZE_TO_IPC_FN]() {219
return {220
width: this.width,221
height: this.height222
};223
}224
toJSON() {225
return this[SERIALIZE_TO_IPC_FN]();226
}227
};228
var PhysicalSize = class {229
constructor(...args) {230
this.type = "Physical";231
if (args.length === 1) {232
if ("Physical" in args[0]) {233
this.width = args[0].Physical.width;234
this.height = args[0].Physical.height;235
} else {236
this.width = args[0].width;237
this.height = args[0].height;238
}239
} else {240
this.width = args[0];241
this.height = args[1];242
}243
}244
/**245
* Converts the physical size to a logical one.246
* @example247
* ```typescript248
* import { getCurrentWindow } from '@tauri-apps/api/window';249
* const appWindow = getCurrentWindow();250
* const factor = await appWindow.scaleFactor();251
* const size = await appWindow.innerSize(); // PhysicalSize252
* const logical = size.toLogical(factor);253
* ```254
*255
* @since 2.0.0256
*/257
toLogical(scaleFactor) {258
return new LogicalSize(this.width / scaleFactor, this.height / scaleFactor);259
}260
[SERIALIZE_TO_IPC_FN]() {261
return {262
width: this.width,263
height: this.height264
};265
}266
toJSON() {267
return this[SERIALIZE_TO_IPC_FN]();268
}269
};270
var Size = class {271
constructor(size) {272
this.size = size;273
}274
/**275
* Converts the wrapped size to a logical one.276
*277
* Returns the inner value untouched when it already is a {@linkcode LogicalSize}.278
*279
* @param scaleFactor The monitor scale factor, e.g. `await appWindow.scaleFactor()`.280
*281
* @since 2.1.0282
*/283
toLogical(scaleFactor) {284
return this.size instanceof LogicalSize ? this.size : this.size.toLogical(scaleFactor);285
}286
/**287
* Converts the wrapped size to a physical one.288
*289
* Returns the inner value untouched when it already is a {@linkcode PhysicalSize}.290
*291
* @param scaleFactor The monitor scale factor, e.g. `await appWindow.scaleFactor()`.292
*293
* @since 2.1.0294
*/295
toPhysical(scaleFactor) {296
return this.size instanceof PhysicalSize ? this.size : this.size.toPhysical(scaleFactor);297
}298
[SERIALIZE_TO_IPC_FN]() {299
return {300
[`${this.size.type}`]: {301
width: this.size.width,302
height: this.size.height303
}304
};305
}306
toJSON() {307
return this[SERIALIZE_TO_IPC_FN]();308
}309
};310
var LogicalPosition = class {311
constructor(...args) {312
this.type = "Logical";313
if (args.length === 1) {314
if ("Logical" in args[0]) {315
this.x = args[0].Logical.x;316
this.y = args[0].Logical.y;317
} else {318
this.x = args[0].x;319
this.y = args[0].y;320
}321
} else {322
this.x = args[0];323
this.y = args[1];324
}325
}326
/**327
* Converts the logical position to a physical one.328
* @example329
* ```typescript330
* import { LogicalPosition } from '@tauri-apps/api/dpi';331
* import { getCurrentWindow } from '@tauri-apps/api/window';332
*333
* const appWindow = getCurrentWindow();334
* const factor = await appWindow.scaleFactor();335
* const position = new LogicalPosition(400, 500);336
* const physical = position.toPhysical(factor);337
* ```338
*339
* @since 2.0.0340
*/341
toPhysical(scaleFactor) {342
return new PhysicalPosition(this.x * scaleFactor, this.y * scaleFactor);343
}344
[SERIALIZE_TO_IPC_FN]() {345
return {346
x: this.x,347
y: this.y348
};349
}350
toJSON() {351
return this[SERIALIZE_TO_IPC_FN]();352
}353
};354
var PhysicalPosition = class {355
constructor(...args) {356
this.type = "Physical";357
if (args.length === 1) {358
if ("Physical" in args[0]) {359
this.x = args[0].Physical.x;360
this.y = args[0].Physical.y;361
} else {362
this.x = args[0].x;363
this.y = args[0].y;364
}365
} else {366
this.x = args[0];367
this.y = args[1];368
}369
}370
/**371
* Converts the physical position to a logical one.372
* @example373
* ```typescript374
* import { PhysicalPosition } from '@tauri-apps/api/dpi';375
* import { getCurrentWindow } from '@tauri-apps/api/window';376
*377
* const appWindow = getCurrentWindow();378
* const factor = await appWindow.scaleFactor();379
* const position = new PhysicalPosition(400, 500);380
* const logical = position.toLogical(factor);381
* ```382
*383
* @since 2.0.0384
*/385
toLogical(scaleFactor) {386
return new LogicalPosition(this.x / scaleFactor, this.y / scaleFactor);387
}388
[SERIALIZE_TO_IPC_FN]() {389
return {390
x: this.x,391
y: this.y392
};393
}394
toJSON() {395
return this[SERIALIZE_TO_IPC_FN]();396
}397
};398
var Position = class {399
constructor(position) {400
this.position = position;401
}402
/**403
* Converts the wrapped position to a logical one.404
*405
* Returns the inner value untouched when it already is a {@linkcode LogicalPosition}.406
*407
* @param scaleFactor The monitor scale factor, e.g. `await appWindow.scaleFactor()`.408
*409
* @since 2.1.0410
*/411
toLogical(scaleFactor) {412
return this.position instanceof LogicalPosition ? this.position : this.position.toLogical(scaleFactor);413
}414
/**415
* Converts the wrapped position to a physical one.416
*417
* Returns the inner value untouched when it already is a {@linkcode PhysicalPosition}.418
*419
* @param scaleFactor The monitor scale factor, e.g. `await appWindow.scaleFactor()`.420
*421
* @since 2.1.0422
*/423
toPhysical(scaleFactor) {424
return this.position instanceof PhysicalPosition ? this.position : this.position.toPhysical(scaleFactor);425
}426
[SERIALIZE_TO_IPC_FN]() {427
return {428
[`${this.position.type}`]: {429
x: this.position.x,430
y: this.position.y431
}432
};433
}434
toJSON() {435
return this[SERIALIZE_TO_IPC_FN]();436
}437
};439
// node_modules/@tauri-apps/api/image.js440
var Image = class _Image extends Resource {441
/**442
* Creates an Image from a resource ID. For internal use only.443
*444
* @ignore445
*/446
constructor(rid) {447
super(rid);448
}449
/**450
* Creates a new Image using RGBA data, in row-major order from top to bottom, and with specified width and height.451
*452
* The buffer must contain exactly `width * height * 4` bytes.453
* Unlike {@linkcode Image.fromBytes} and {@linkcode Image.fromPath} this does not454
* decode an image format, so it requires no extra Cargo feature.455
*456
* @example457
* ```typescript458
* import { Image } from '@tauri-apps/api/image';459
*460
* // a 1x1 opaque red image461
* const image = await Image.new(new Uint8Array([255, 0, 0, 255]), 1, 1);462
* ```463
*464
* @since 2.0.0465
*/466
static async new(rgba, width, height) {467
return invoke("plugin:image|new", {468
rgba,469
width,470
height471
}).then((rid) => new _Image(rid));472
}473
/**474
* Creates a new image using the provided bytes by inferring the file format.475
*476
* Only `ico` and `png` are supported (based on activated feature flag).477
*478
* Note that you need the `image-ico` or `image-png` Cargo features to use this API.479
* To enable it, change your Cargo.toml file:480
* ```toml481
* [dependencies]482
* tauri = { version = "...", features = ["...", "image-png"] }483
* ```484
*485
* @example486
* ```typescript487
* import { Image } from '@tauri-apps/api/image';488
*489
* const bytes = await fetch('/icon.png').then((r) => r.arrayBuffer());490
* const image = await Image.fromBytes(bytes);491
* ```492
*493
* @since 2.0.0494
*/495
static async fromBytes(bytes) {496
return invoke("plugin:image|from_bytes", {497
bytes498
}).then((rid) => new _Image(rid));499
}500
/**501
* Creates a new image using the provided path.502
*503
* Only `ico` and `png` are supported (based on activated feature flag).504
*505
* Note that you need the `image-ico` or `image-png` Cargo features to use this API.506
* To enable it, change your Cargo.toml file:507
* ```toml508
* [dependencies]509
* tauri = { version = "...", features = ["...", "image-png"] }510
* ```511
*512
* The path is resolved on the Rust side, so it must be a path on the user's513
* machine (for example one returned by the path APIs or a bundled resource514
* resolved with `resolveResource`), not a frontend asset URL.515
*516
* @example517
* ```typescript518
* import { Image } from '@tauri-apps/api/image';519
* import { resolveResource } from '@tauri-apps/api/path';520
*521
* const image = await Image.fromPath(await resolveResource('icons/icon.png'));522
* ```523
*524
* @since 2.0.0525
*/526
static async fromPath(path) {527
return invoke("plugin:image|from_path", { path }).then((rid) => new _Image(rid));528
}529
/**530
* Returns the RGBA data for this image, in row-major order from top to bottom.531
*532
* The returned buffer has `width * height * 4` bytes, see {@linkcode Image.size}.533
*534
* @example535
* ```typescript536
* import { Image } from '@tauri-apps/api/image';537
*538
* const image = await Image.fromPath('icons/icon.png');539
* const rgba = await image.rgba();540
* ```541
*542
* @since 2.0.0543
*/544
async rgba() {545
return invoke("plugin:image|rgba", {546
rid: this.rid547
}).then((buffer) => new Uint8Array(buffer));548
}549
/**550
* Returns the size of this image, in pixels.551
*552
* @example553
* ```typescript554
* import { Image } from '@tauri-apps/api/image';555
*556
* const image = await Image.fromPath('icons/icon.png');557
* const { width, height } = await image.size();558
* ```559
*560
* @since 2.0.0561
*/562
async size() {563
return invoke("plugin:image|size", { rid: this.rid });564
}565
};566
function transformImage(image) {567
const ret = image == null ? null : typeof image === "string" ? image : image instanceof Image ? image.rid : image;568
return ret;569
}571
// node_modules/@tauri-apps/api/window.js572
var UserAttentionType;573
(function(UserAttentionType2) {574
UserAttentionType2[UserAttentionType2["Critical"] = 1] = "Critical";575
UserAttentionType2[UserAttentionType2["Informational"] = 2] = "Informational";576
})(UserAttentionType || (UserAttentionType = {}));577
var CloseRequestedEvent = class {578
constructor(event) {579
this._preventDefault = false;580
this.event = event.event;581
this.id = event.id;582
}583
/**584
* Prevents the window from being closed.585
*586
* Must be called before the handler returns (await anything you need first),587
* otherwise the window is destroyed as usual.588
*/589
preventDefault() {590
this._preventDefault = true;591
}592
/** Whether {@link CloseRequestedEvent.preventDefault} was called on this event. */593
isPreventDefault() {594
return this._preventDefault;595
}596
};597
var ProgressBarStatus;598
(function(ProgressBarStatus2) {599
ProgressBarStatus2["None"] = "none";600
ProgressBarStatus2["Normal"] = "normal";601
ProgressBarStatus2["Indeterminate"] = "indeterminate";602
ProgressBarStatus2["Paused"] = "paused";603
ProgressBarStatus2["Error"] = "error";604
})(ProgressBarStatus || (ProgressBarStatus = {}));605
function getCurrentWindow() {606
return new Window(window.__TAURI_INTERNALS__.metadata.currentWindow.label, {607
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor608
skip: true609
});610
}611
async function getAllWindows() {612
return invoke("plugin:window|get_all_windows").then((windows) => windows.map((w) => new Window(w, {613
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor614
skip: true615
})));616
}617
var localTauriEvents = ["tauri://created", "tauri://error"];618
var Window = class {619
/**620
* Creates a new Window.621
* @example622
* ```typescript623
* import { Window } from '@tauri-apps/api/window';624
* const appWindow = new Window('my-label');625
* appWindow.once('tauri://created', function () {626
* // window successfully created627
* });628
* appWindow.once('tauri://error', function (e) {629
* // an error happened creating the window630
* });631
* ```632
*633
* @param label The unique window label. Must be alphanumeric: `a-zA-Z-/:_`.634
* @param options The window configuration, see {@link WindowOptions}.635
* @returns The {@link Window} instance to communicate with the window.636
*637
* @remarks Requires the `core:window:allow-create` permission (not included in638
* `core:window:default`).639
*/640
constructor(label, options = {}) {641
var _a;642
this.label = label;643
this.listeners = /* @__PURE__ */ Object.create(null);644
if (!(options === null || options === void 0 ? void 0 : options.skip)) {645
invoke("plugin:window|create", {646
options: {647
...options,648
parent: typeof options.parent === "string" ? options.parent : (_a = options.parent) === null || _a === void 0 ? void 0 : _a.label,649
label650
}651
}).then(async () => this.emit("tauri://created")).catch(async (e) => this.emit("tauri://error", e));652
}653
}654
/**655
* Gets the Window associated with the given label.656
* @example657
* ```typescript658
* import { Window } from '@tauri-apps/api/window';659
* const mainWindow = Window.getByLabel('main');660
* ```661
*662
* @param label The window label.663
* @returns The Window instance to communicate with the window or null if the window doesn't exist.664
*/665
static async getByLabel(label) {666
var _a;667
return (_a = (await getAllWindows()).find((w) => w.label === label)) !== null && _a !== void 0 ? _a : null;668
}669
/**670
* Get an instance of `Window` for the current window.671
*/672
static getCurrent() {673
return getCurrentWindow();674
}675
/**676
* Gets a list of instances of `Window` for all available windows.677
*/678
static async getAll() {679
return getAllWindows();680
}681
/**682
* Gets the focused window.683
* @example684
* ```typescript685
* import { Window } from '@tauri-apps/api/window';686
* const focusedWindow = Window.getFocusedWindow();687
* ```688
*689
* @returns The Window instance or `undefined` if there is not any focused window.690
*/691
static async getFocusedWindow() {692
for (const w of await getAllWindows()) {693
if (await w.isFocused()) {694
return w;695
}696
}697
return null;698
}699
/**700
* Listen to an emitted event on this window.701
*702
* @example703
* ```typescript704
* import { getCurrentWindow } from '@tauri-apps/api/window';705
* const unlisten = await getCurrentWindow().listen<string>('state-changed', (event) => {706
* console.log(`Got error: ${payload}`);707
* });708
*709
* // call unlisten when your handler goes out of scope e.g. the component is unmounted710
* unlisten();711
* ```712
*713
* @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.714
* @param handler Event handler.715
* @returns A promise resolving to a function to unlisten to the event.716
*717
* @remarks The listener is removed automatically when this window is destroyed,718
* so you do not need to unlisten just because the window is closing. Do call the719
* returned function when the listener's own scope ends, e.g. on page navigation720
* or when a component unmounts.721
*/722
async listen(event, handler) {723
if (this._handleTauriEvent(event, handler)) {724
return () => {725
const listeners = this.listeners[event];726
listeners.splice(listeners.indexOf(handler), 1);727
};728
}729
return listen(event, handler, {730
target: { kind: "Window", label: this.label }731
});732
}733
/**734
* Listen to an emitted event on this window only once.735
*736
* @example737
* ```typescript738
* import { getCurrentWindow } from '@tauri-apps/api/window';739
* const unlisten = await getCurrentWindow().once<null>('initialized', (event) => {740
* console.log(`Window initialized!`);741
* });742
*743
* // call unlisten when your handler goes out of scope e.g. the component is unmounted744
* unlisten();745
* ```746
*747
* @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.748
* @param handler Event handler.749
* @returns A promise resolving to a function to unlisten to the event.750
*751
* @remarks The listener removes itself after the first event and is also removed752
* automatically when this window is destroyed. Do call the returned function if753
* the listener's own scope ends before the event arrives.754
*/755
async once(event, handler) {756
if (this._handleTauriEvent(event, handler)) {757
return () => {758
const listeners = this.listeners[event];759
listeners.splice(listeners.indexOf(handler), 1);760
};761
}762
return once(event, handler, {763
target: { kind: "Window", label: this.label }764
});765
}766
/**767
* Emits an event to all {@link EventTarget|targets}.768
* @example769
* ```typescript770
* import { getCurrentWindow } from '@tauri-apps/api/window';771
* await getCurrentWindow().emit('window-loaded', { loggedIn: true, token: 'authToken' });772
* ```773
*774
* @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.775
* @param payload Event payload.776
*/777
async emit(event, payload) {778
if (localTauriEvents.includes(event)) {779
for (const handler of this.listeners[event] || []) {780
handler({781
event,782
id: -1,783
payload784
});785
}786
return;787
}788
return emit(event, payload);789
}790
/**791
* Emits an event to all {@link EventTarget|targets} matching the given target.792
*793
* @example794
* ```typescript795
* import { getCurrentWindow } from '@tauri-apps/api/window';796
* await getCurrentWindow().emitTo('main', 'window-loaded', { loggedIn: true, token: 'authToken' });797
* ```798
* @param target Label of the target Window/Webview/WebviewWindow or raw {@link EventTarget} object.799
* @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.800
* @param payload Event payload.801
*/802
async emitTo(target, event, payload) {803
if (localTauriEvents.includes(event)) {804
for (const handler of this.listeners[event] || []) {805
handler({806
event,807
id: -1,808
payload809
});810
}811
return;812
}813
return emitTo(target, event, payload);814
}815
/** @ignore */816
_handleTauriEvent(event, handler) {817
if (localTauriEvents.includes(event)) {818
if (!(event in this.listeners)) {819
this.listeners[event] = [handler];820
} else {821
this.listeners[event].push(handler);822
}823
return true;824
}825
return false;826
}827
// Getters828
/**829
* The scale factor that can be used to map physical pixels to logical pixels.830
* @example831
* ```typescript832
* import { getCurrentWindow } from '@tauri-apps/api/window';833
* const factor = await getCurrentWindow().scaleFactor();834
* ```835
*836
* @returns The window's monitor scale factor.837
*/838
async scaleFactor() {839
return invoke("plugin:window|scale_factor", {840
label: this.label841
});842
}843
/**844
* The position of the top-left hand corner of the window's client area relative to the top-left hand corner of the desktop.845
* @example846
* ```typescript847
* import { getCurrentWindow } from '@tauri-apps/api/window';848
* const position = await getCurrentWindow().innerPosition();849
* ```850
*851
* @returns The window's inner position.852
*/853
async innerPosition() {854
return invoke("plugin:window|inner_position", {855
label: this.label856
}).then((p) => new PhysicalPosition(p));857
}858
/**859
* The position of the top-left hand corner of the window relative to the top-left hand corner of the desktop.860
* @example861
* ```typescript862
* import { getCurrentWindow } from '@tauri-apps/api/window';863
* const position = await getCurrentWindow().outerPosition();864
* ```865
*866
* @returns The window's outer position.867
*/868
async outerPosition() {869
return invoke("plugin:window|outer_position", {870
label: this.label871
}).then((p) => new PhysicalPosition(p));872
}873
/**874
* The physical size of the window's client area.875
* The client area is the content of the window, excluding the title bar and borders.876
* @example877
* ```typescript878
* import { getCurrentWindow } from '@tauri-apps/api/window';879
* const size = await getCurrentWindow().innerSize();880
* ```881
*882
* @returns The window's inner size.883
*/884
async innerSize() {885
return invoke("plugin:window|inner_size", {886
label: this.label887
}).then((s) => new PhysicalSize(s));888
}889
/**890
* The physical size of the entire window.891
* These dimensions include the title bar and borders. If you don't want that (and you usually don't), use inner_size instead.892
* @example893
* ```typescript894
* import { getCurrentWindow } from '@tauri-apps/api/window';895
* const size = await getCurrentWindow().outerSize();896
* ```897
*898
* @returns The window's outer size.899
*/900
async outerSize() {901
return invoke("plugin:window|outer_size", {902
label: this.label903
}).then((s) => new PhysicalSize(s));904
}905
/**906
* Gets the window's current fullscreen state.907
* @example908
* ```typescript909
* import { getCurrentWindow } from '@tauri-apps/api/window';910
* const fullscreen = await getCurrentWindow().isFullscreen();911
* ```912
*913
* @returns Whether the window is in fullscreen mode or not.914
*/915
async isFullscreen() {916
return invoke("plugin:window|is_fullscreen", {917
label: this.label918
});919
}920
/**921
* Gets the window's current minimized state.922
* @example923
* ```typescript924
* import { getCurrentWindow } from '@tauri-apps/api/window';925
* const minimized = await getCurrentWindow().isMinimized();926
* ```927
*/928
async isMinimized() {929
return invoke("plugin:window|is_minimized", {930
label: this.label931
});932
}933
/**934
* Gets the window's current maximized state.935
* @example936
* ```typescript937
* import { getCurrentWindow } from '@tauri-apps/api/window';938
* const maximized = await getCurrentWindow().isMaximized();939
* ```940
*941
* @returns Whether the window is maximized or not.942
*/943
async isMaximized() {944
return invoke("plugin:window|is_maximized", {945
label: this.label946
});947
}948
/**949
* Gets the window's current focus state.950
* @example951
* ```typescript952
* import { getCurrentWindow } from '@tauri-apps/api/window';953
* const focused = await getCurrentWindow().isFocused();954
* ```955
*956
* @returns Whether the window is focused or not.957
*/958
async isFocused() {959
return invoke("plugin:window|is_focused", {960
label: this.label961
});962
}963
/**964
* Gets the window's current decorated state.965
* @example966
* ```typescript967
* import { getCurrentWindow } from '@tauri-apps/api/window';968
* const decorated = await getCurrentWindow().isDecorated();969
* ```970
*971
* @returns Whether the window is decorated or not.972
*/973
async isDecorated() {974
return invoke("plugin:window|is_decorated", {975
label: this.label976
});977
}978
/**979
* Gets the window's current resizable state.980
* @example981
* ```typescript982
* import { getCurrentWindow } from '@tauri-apps/api/window';983
* const resizable = await getCurrentWindow().isResizable();984
* ```985
*986
* @returns Whether the window is resizable or not.987
*/988
async isResizable() {989
return invoke("plugin:window|is_resizable", {990
label: this.label991
});992
}993
/**994
* Gets the window's native maximize button state.995
*996
* #### Platform-specific997
*998
* - **Linux / iOS / Android:** Unsupported.999
*1000
* @example1001
* ```typescript1002
* import { getCurrentWindow } from '@tauri-apps/api/window';1003
* const maximizable = await getCurrentWindow().isMaximizable();1004
* ```1005
*1006
* @returns Whether the window's native maximize button is enabled or not.1007
*/1008
async isMaximizable() {1009
return invoke("plugin:window|is_maximizable", {1010
label: this.label1011
});1012
}1013
/**1014
* Gets the window's native minimize button state.1015
*1016
* #### Platform-specific1017
*1018
* - **Linux / iOS / Android:** Unsupported.1019
*1020
* @example1021
* ```typescript1022
* import { getCurrentWindow } from '@tauri-apps/api/window';1023
* const minimizable = await getCurrentWindow().isMinimizable();1024
* ```1025
*1026
* @returns Whether the window's native minimize button is enabled or not.1027
*/1028
async isMinimizable() {1029
return invoke("plugin:window|is_minimizable", {1030
label: this.label1031
});1032
}1033
/**1034
* Gets the window's native close button state.1035
*1036
* #### Platform-specific1037
*1038
* - **iOS / Android:** Unsupported.1039
*1040
* @example1041
* ```typescript1042
* import { getCurrentWindow } from '@tauri-apps/api/window';1043
* const closable = await getCurrentWindow().isClosable();1044
* ```1045
*1046
* @returns Whether the window's native close button is enabled or not.1047
*/1048
async isClosable() {1049
return invoke("plugin:window|is_closable", {1050
label: this.label1051
});1052
}1053
/**1054
* Gets the window's current visible state.1055
* @example1056
* ```typescript1057
* import { getCurrentWindow } from '@tauri-apps/api/window';1058
* const visible = await getCurrentWindow().isVisible();1059
* ```1060
*1061
* @returns Whether the window is visible or not.1062
*/1063
async isVisible() {1064
return invoke("plugin:window|is_visible", {1065
label: this.label1066
});1067
}1068
/**1069
* Gets the window's current title.1070
* @example1071
* ```typescript1072
* import { getCurrentWindow } from '@tauri-apps/api/window';1073
* const title = await getCurrentWindow().title();1074
* ```1075
*/1076
async title() {1077
return invoke("plugin:window|title", {1078
label: this.label1079
});1080
}1081
/**1082
* Gets the window's current theme.1083
*1084
* #### Platform-specific1085
*1086
* - **macOS:** Theme was introduced on macOS 10.14. Returns `light` on macOS 10.13 and below.1087
*1088
* @example1089
* ```typescript1090
* import { getCurrentWindow } from '@tauri-apps/api/window';1091
* const theme = await getCurrentWindow().theme();1092
* ```1093
*1094
* @returns The window theme.1095
*/1096
async theme() {1097
return invoke("plugin:window|theme", {1098
label: this.label1099
});1100
}1101
/**1102
* Whether the window is configured to be always on top of other windows or not.1103
* @example1104
* ```typescript1105
* import { getCurrentWindow } from '@tauri-apps/api/window';1106
* const alwaysOnTop = await getCurrentWindow().isAlwaysOnTop();1107
* ```1108
*1109
* @returns Whether the window is visible or not.1110
*/1111
async isAlwaysOnTop() {1112
return invoke("plugin:window|is_always_on_top", {1113
label: this.label1114
});1115
}1116
/**1117
* The name of the Android activity hosting this window.1118
*1119
* On Android each window is backed by its own activity. Use this to tell windows1120
* apart from native code, or to match a window with the activity declared in your1121
* `AndroidManifest.xml`.1122
*1123
* #### Platform-specific1124
*1125
* - **Android:** Supported.1126
* - **Windows / Linux / macOS / iOS:** Unsupported, the call rejects because the1127
* command is not registered.1128
*1129
* See the [mobile multiwindow guide](https://tauri.app/learn/mobile-multiwindow/).1130
*1131
* @example1132
* ```typescript1133
* import { getCurrentWindow } from '@tauri-apps/api/window';1134
* const activity = await getCurrentWindow().activityName();1135
* ```1136
*1137
* @returns The activity name.1138
*1139
* @remarks Uses the `core:window:allow-activity-name` permission, which is part1140
* of `core:window:default`.1141
*1142
* @since 2.11.01143
*/1144
async activityName() {1145
return invoke("plugin:window|activity_name", {1146
label: this.label1147
});1148
}1149
/**1150
* The identifier of the iOS scene hosting this window.1151
*1152
* On iOS each window is backed by a `UIScene`. Use this to tell windows apart1153
* from native code, or to match a window with a scene configuration declared in1154
* your `Info.plist`.1155
*1156
* #### Platform-specific1157
*1158
* - **iOS:** Supported.1159
* - **Windows / Linux / macOS / Android:** Unsupported, the call rejects because1160
* the command is not registered.1161
*1162
* See the [mobile multiwindow guide](https://tauri.app/learn/mobile-multiwindow/).1163
*1164
* @example1165
* ```typescript1166
* import { getCurrentWindow } from '@tauri-apps/api/window';1167
* const scene = await getCurrentWindow().sceneIdentifier();1168
* ```1169
*1170
* @returns The scene identifier.1171
*1172
* @remarks Uses the `core:window:allow-scene-identifier` permission, which is part1173
* of `core:window:default`.1174
*1175
* @since 2.11.01176
*/1177
async sceneIdentifier() {1178
return invoke("plugin:window|scene_identifier", {1179
label: this.label1180
});1181
}1182
// Setters1183
/**1184
* Centers the window.1185
* @example1186
* ```typescript1187
* import { getCurrentWindow } from '@tauri-apps/api/window';1188
* await getCurrentWindow().center();1189
* ```1190
*1191
* @returns A promise indicating the success or failure of the operation.1192
*1193
* @remarks Requires the `core:window:allow-center` permission (not included1194
* in `core:window:default`).1195
*/1196
async center() {1197
return invoke("plugin:window|center", {1198
label: this.label1199
});1200
}1201
/**1202
* Requests user attention to the window, this has no effect if the application1203
* is already focused. How requesting for user attention manifests is platform dependent,1204
* see `UserAttentionType` for details.1205
*1206
* Providing `null` will unset the request for user attention. Unsetting the request for1207
* user attention might not be done automatically by the WM when the window receives input.1208
*1209
* #### Platform-specific1210
*1211
* - **macOS:** `null` has no effect.1212
* - **Linux:** Urgency levels have the same effect.1213
* @example1214
* ```typescript1215
* import { getCurrentWindow } from '@tauri-apps/api/window';1216
* await getCurrentWindow().requestUserAttention();1217
* ```1218
*1219
* @returns A promise indicating the success or failure of the operation.1220
*1221
* @remarks Requires the `core:window:allow-request-user-attention` permission (not included1222
* in `core:window:default`).1223
*/1224
async requestUserAttention(requestType) {1225
let requestType_ = null;1226
if (requestType) {1227
if (requestType === UserAttentionType.Critical) {1228
requestType_ = { type: "Critical" };1229
} else {1230
requestType_ = { type: "Informational" };1231
}1232
}1233
return invoke("plugin:window|request_user_attention", {1234
label: this.label,1235
value: requestType_1236
});1237
}1238
/**1239
* Updates the window resizable flag.1240
* @example1241
* ```typescript1242
* import { getCurrentWindow } from '@tauri-apps/api/window';1243
* await getCurrentWindow().setResizable(false);1244
* ```1245
*1246
* @returns A promise indicating the success or failure of the operation.1247
*1248
* @remarks Requires the `core:window:allow-set-resizable` permission (not included1249
* in `core:window:default`).1250
*/1251
async setResizable(resizable) {1252
return invoke("plugin:window|set_resizable", {1253
label: this.label,1254
value: resizable1255
});1256
}1257
/**1258
* Enable or disable the window.1259
* @example1260
* ```typescript1261
* import { getCurrentWindow } from '@tauri-apps/api/window';1262
* await getCurrentWindow().setEnabled(false);1263
* ```1264
*1265
* @returns A promise indicating the success or failure of the operation.1266
*1267
* @remarks Requires the `core:window:allow-set-enabled` permission (not included1268
* in `core:window:default`).1269
*1270
* @since 2.0.01271
*/1272
async setEnabled(enabled) {1273
return invoke("plugin:window|set_enabled", {1274
label: this.label,1275
value: enabled1276
});1277
}1278
/**1279
* Whether the window is enabled or disabled.1280
*1281
* A disabled window ignores all user input; see {@link Window.setEnabled}.1282
*1283
* @example1284
* ```typescript1285
* import { getCurrentWindow } from '@tauri-apps/api/window';1286
* const enabled = await getCurrentWindow().isEnabled();1287
* ```1288
*1289
* @returns `true` when the window accepts user input, `false` when it is disabled.1290
*1291
* @since 2.0.01292
*/1293
async isEnabled() {1294
return invoke("plugin:window|is_enabled", {1295
label: this.label1296
});1297
}1298
/**1299
* Sets whether the window's native maximize button is enabled or not.1300
* If resizable is set to false, this setting is ignored.1301
*1302
* #### Platform-specific1303
*1304
* - **macOS:** Disables the "zoom" button in the window titlebar, which is also used to enter fullscreen mode.1305
* - **Linux / iOS / Android:** Unsupported.1306
*1307
* @example1308
* ```typescript1309
* import { getCurrentWindow } from '@tauri-apps/api/window';1310
* await getCurrentWindow().setMaximizable(false);1311
* ```1312
*1313
* @returns A promise indicating the success or failure of the operation.1314
*1315
* @remarks Requires the `core:window:allow-set-maximizable` permission (not included1316
* in `core:window:default`).1317
*/1318
async setMaximizable(maximizable) {1319
return invoke("plugin:window|set_maximizable", {1320
label: this.label,1321
value: maximizable1322
});1323
}1324
/**1325
* Sets whether the window's native minimize button is enabled or not.1326
*1327
* #### Platform-specific1328
*1329
* - **Linux / iOS / Android:** Unsupported.1330
*1331
* @example1332
* ```typescript1333
* import { getCurrentWindow } from '@tauri-apps/api/window';1334
* await getCurrentWindow().setMinimizable(false);1335
* ```1336
*1337
* @returns A promise indicating the success or failure of the operation.1338
*1339
* @remarks Requires the `core:window:allow-set-minimizable` permission (not included1340
* in `core:window:default`).1341
*/1342
async setMinimizable(minimizable) {1343
return invoke("plugin:window|set_minimizable", {1344
label: this.label,1345
value: minimizable1346
});1347
}1348
/**1349
* Sets whether the window's native close button is enabled or not.1350
*1351
* #### Platform-specific1352
*1353
* - **Linux:** GTK+ will do its best to convince the window manager not to show a close button. Depending on the system, this function may not have any effect when called on a window that is already visible1354
* - **iOS / Android:** Unsupported.1355
*1356
* @example1357
* ```typescript1358
* import { getCurrentWindow } from '@tauri-apps/api/window';1359
* await getCurrentWindow().setClosable(false);1360
* ```1361
*1362
* @returns A promise indicating the success or failure of the operation.1363
*1364
* @remarks Requires the `core:window:allow-set-closable` permission (not included1365
* in `core:window:default`).1366
*/1367
async setClosable(closable) {1368
return invoke("plugin:window|set_closable", {1369
label: this.label,1370
value: closable1371
});1372
}1373
/**1374
* Sets the window title.1375
* @example1376
* ```typescript1377
* import { getCurrentWindow } from '@tauri-apps/api/window';1378
* await getCurrentWindow().setTitle('Tauri');1379
* ```1380
*1381
* @param title The new title1382
* @returns A promise indicating the success or failure of the operation.1383
*1384
* @remarks Requires the `core:window:allow-set-title` permission (not included1385
* in `core:window:default`).1386
*/1387
async setTitle(title) {1388
return invoke("plugin:window|set_title", {1389
label: this.label,1390
value: title1391
});1392
}1393
/**1394
* Maximizes the window.1395
* @example1396
* ```typescript1397
* import { getCurrentWindow } from '@tauri-apps/api/window';1398
* await getCurrentWindow().maximize();1399
* ```1400
*1401
* @returns A promise indicating the success or failure of the operation.1402
*1403
* @remarks Requires the `core:window:allow-maximize` permission (not included1404
* in `core:window:default`).1405
*/1406
async maximize() {1407
return invoke("plugin:window|maximize", {1408
label: this.label1409
});1410
}1411
/**1412
* Unmaximizes the window.1413
* @example1414
* ```typescript1415
* import { getCurrentWindow } from '@tauri-apps/api/window';1416
* await getCurrentWindow().unmaximize();1417
* ```1418
*1419
* @returns A promise indicating the success or failure of the operation.1420
*1421
* @remarks Requires the `core:window:allow-unmaximize` permission (not included1422
* in `core:window:default`).1423
*/1424
async unmaximize() {1425
return invoke("plugin:window|unmaximize", {1426
label: this.label1427
});1428
}1429
/**1430
* Toggles the window maximized state.1431
* @example1432
* ```typescript1433
* import { getCurrentWindow } from '@tauri-apps/api/window';1434
* await getCurrentWindow().toggleMaximize();1435
* ```1436
*1437
* @returns A promise indicating the success or failure of the operation.1438
*1439
* @remarks Requires the `core:window:allow-toggle-maximize` permission (not included1440
* in `core:window:default`).1441
*/1442
async toggleMaximize() {1443
return invoke("plugin:window|toggle_maximize", {1444
label: this.label1445
});1446
}1447
/**1448
* Minimizes the window.1449
* @example1450
* ```typescript1451
* import { getCurrentWindow } from '@tauri-apps/api/window';1452
* await getCurrentWindow().minimize();1453
* ```1454
*1455
* @returns A promise indicating the success or failure of the operation.1456
*1457
* @remarks Requires the `core:window:allow-minimize` permission (not included1458
* in `core:window:default`).1459
*/1460
async minimize() {1461
return invoke("plugin:window|minimize", {1462
label: this.label1463
});1464
}1465
/**1466
* Unminimizes the window.1467
* @example1468
* ```typescript1469
* import { getCurrentWindow } from '@tauri-apps/api/window';1470
* await getCurrentWindow().unminimize();1471
* ```1472
*1473
* @returns A promise indicating the success or failure of the operation.1474
*1475
* @remarks Requires the `core:window:allow-unminimize` permission (not included1476
* in `core:window:default`).1477
*/1478
async unminimize() {1479
return invoke("plugin:window|unminimize", {1480
label: this.label1481
});1482
}1483
/**1484
* Sets the window visibility to true.1485
* @example1486
* ```typescript1487
* import { getCurrentWindow } from '@tauri-apps/api/window';1488
* await getCurrentWindow().show();1489
* ```1490
*1491
* @returns A promise indicating the success or failure of the operation.1492
*1493
* @remarks Requires the `core:window:allow-show` permission (not included1494
* in `core:window:default`).1495
*/1496
async show() {1497
return invoke("plugin:window|show", {1498
label: this.label1499
});1500
}1501
/**1502
* Sets the window visibility to false.1503
* @example1504
* ```typescript1505
* import { getCurrentWindow } from '@tauri-apps/api/window';1506
* await getCurrentWindow().hide();1507
* ```1508
*1509
* @returns A promise indicating the success or failure of the operation.1510
*1511
* @remarks Requires the `core:window:allow-hide` permission (not included1512
* in `core:window:default`).1513
*/1514
async hide() {1515
return invoke("plugin:window|hide", {1516
label: this.label1517
});1518
}1519
/**1520
* Closes the window.1521
*1522
* Note this emits a closeRequested event so you can intercept it. To force window close, use {@link Window.destroy}.1523
* @example1524
* ```typescript1525
* import { getCurrentWindow } from '@tauri-apps/api/window';1526
* await getCurrentWindow().close();1527
* ```1528
*1529
* @returns A promise indicating the success or failure of the operation.1530
*1531
* @remarks Requires the `core:window:allow-close` permission (not included1532
* in `core:window:default`).1533
*/1534
async close() {1535
return invoke("plugin:window|close", {1536
label: this.label1537
});1538
}1539
/**1540
* Destroys the window. Behaves like {@link Window.close} but forces the window close instead of emitting a closeRequested event.1541
* @example1542
* ```typescript1543
* import { getCurrentWindow } from '@tauri-apps/api/window';1544
* await getCurrentWindow().destroy();1545
* ```1546
*1547
* @returns A promise indicating the success or failure of the operation.1548
*1549
* @remarks Requires the `core:window:allow-destroy` permission (not included1550
* in `core:window:default`).1551
*/1552
async destroy() {1553
return invoke("plugin:window|destroy", {1554
label: this.label1555
});1556
}1557
/**1558
* Whether the window should have borders and bars.1559
* @example1560
* ```typescript1561
* import { getCurrentWindow } from '@tauri-apps/api/window';1562
* await getCurrentWindow().setDecorations(false);1563
* ```1564
*1565
* @param decorations Whether the window should have borders and bars.1566
* @returns A promise indicating the success or failure of the operation.1567
*1568
* @remarks Requires the `core:window:allow-set-decorations` permission (not included1569
* in `core:window:default`).1570
*/1571
async setDecorations(decorations) {1572
return invoke("plugin:window|set_decorations", {1573
label: this.label,1574
value: decorations1575
});1576
}1577
/**1578
* Whether or not the window should have shadow.1579
*1580
* #### Platform-specific1581
*1582
* - **Windows:**1583
* - `false` has no effect on decorated window, shadows are always ON.1584
* - `true` will make undecorated window have a 1px white border,1585
* and on Windows 11, it will have a rounded corners.1586
* - **Linux:** Unsupported.1587
*1588
* @example1589
* ```typescript1590
* import { getCurrentWindow } from '@tauri-apps/api/window';1591
* await getCurrentWindow().setShadow(false);1592
* ```1593
*1594
* @returns A promise indicating the success or failure of the operation.1595
*1596
* @remarks Requires the `core:window:allow-set-shadow` permission (not included1597
* in `core:window:default`).1598
*/1599
async setShadow(enable) {1600
return invoke("plugin:window|set_shadow", {1601
label: this.label,1602
value: enable1603
});1604
}1605
/**1606
* Applies platform-specific window effects such as Mica, Acrylic, Blur or the1607
* macOS vibrancy materials.1608
*1609
* Requires the window to be transparent, so create it with `transparent: true`1610
* (or set `transparent` in `tauri.conf.json`). Give the page a transparent or1611
* translucent background as well, otherwise the effect is hidden behind your own1612
* background color.1613
*1614
* Conflicting effects are resolved by applying the first supported one and1615
* ignoring the rest, so you can list a Windows and a macOS effect together.1616
*1617
* #### Platform-specific1618
*1619
* - **Windows:** If the window uses decorations or shadows, you may need1620
* [this workaround](https://github.com/tauri-apps/tao/issues/72#issuecomment-975607891).1621
* - **Linux:** Unsupported.1622
*1623
* @example1624
* ```typescript1625
* import { getCurrentWindow, Effect, EffectState } from '@tauri-apps/api/window';1626
*1627
* await getCurrentWindow().setEffects({1628
* effects: [Effect.Mica, Effect.Acrylic, Effect.UnderWindowBackground],1629
* state: EffectState.Active,1630
* radius: 81631
* });1632
* ```1633
*1634
* @param effects The effects to apply, see {@link Effects}.1635
* @returns A promise indicating the success or failure of the operation.1636
*1637
* @remarks Requires the `core:window:allow-set-effects` permission (not included1638
* in `core:window:default`).1639
*1640
* @since 2.0.01641
*/1642
async setEffects(effects) {1643
return invoke("plugin:window|set_effects", {1644
label: this.label,1645
value: effects1646
});1647
}1648
/**1649
* Clear any applied effects if possible.1650
*1651
* @example1652
* ```typescript1653
* import { getCurrentWindow } from '@tauri-apps/api/window';1654
* await getCurrentWindow().clearEffects();1655
* ```1656
*1657
* @returns A promise indicating the success or failure of the operation.1658
*1659
* @remarks Requires the `core:window:allow-set-effects` permission (not included1660
* in `core:window:default`), the same one used by {@link Window.setEffects}.1661
*1662
* @since 2.0.01663
*/1664
async clearEffects() {1665
return invoke("plugin:window|set_effects", {1666
label: this.label,1667
value: null1668
});1669
}1670
/**1671
* Whether the window should always be on top of other windows.1672
* @example1673
* ```typescript1674
* import { getCurrentWindow } from '@tauri-apps/api/window';1675
* await getCurrentWindow().setAlwaysOnTop(true);1676
* ```1677
*1678
* @param alwaysOnTop Whether the window should always be on top of other windows or not.1679
* @returns A promise indicating the success or failure of the operation.1680
*1681
* @remarks Requires the `core:window:allow-set-always-on-top` permission (not included1682
* in `core:window:default`).1683
*/1684
async setAlwaysOnTop(alwaysOnTop) {1685
return invoke("plugin:window|set_always_on_top", {1686
label: this.label,1687
value: alwaysOnTop1688
});1689
}1690
/**1691
* Whether the window should always be below other windows.1692
* @example1693
* ```typescript1694
* import { getCurrentWindow } from '@tauri-apps/api/window';1695
* await getCurrentWindow().setAlwaysOnBottom(true);1696
* ```1697
*1698
* @param alwaysOnBottom Whether the window should always be below other windows or not.1699
* @returns A promise indicating the success or failure of the operation.1700
*1701
* @remarks Requires the `core:window:allow-set-always-on-bottom` permission (not included1702
* in `core:window:default`).1703
*/1704
async setAlwaysOnBottom(alwaysOnBottom) {1705
return invoke("plugin:window|set_always_on_bottom", {1706
label: this.label,1707
value: alwaysOnBottom1708
});1709
}1710
/**1711
* Prevents the window contents from being captured by other apps.1712
* @example1713
* ```typescript1714
* import { getCurrentWindow } from '@tauri-apps/api/window';1715
* await getCurrentWindow().setContentProtected(true);1716
* ```1717
*1718
* @returns A promise indicating the success or failure of the operation.1719
*1720
* @remarks Requires the `core:window:allow-set-content-protected` permission (not included1721
* in `core:window:default`).1722
*/1723
async setContentProtected(protected_) {1724
return invoke("plugin:window|set_content_protected", {1725
label: this.label,1726
value: protected_1727
});1728
}1729
/**1730
* Resizes the window with a new inner size.1731
* @example1732
* ```typescript1733
* import { getCurrentWindow, LogicalSize } from '@tauri-apps/api/window';1734
* await getCurrentWindow().setSize(new LogicalSize(600, 500));1735
* ```1736
*1737
* @param size The logical or physical inner size.1738
* @returns A promise indicating the success or failure of the operation.1739
*1740
* @remarks Requires the `core:window:allow-set-size` permission (not included1741
* in `core:window:default`).1742
*/1743
async setSize(size) {1744
return invoke("plugin:window|set_size", {1745
label: this.label,1746
value: size instanceof Size ? size : new Size(size)1747
});1748
}1749
/**1750
* Sets the window minimum inner size. If the `size` argument is not provided, the constraint is unset.1751
* @example1752
* ```typescript1753
* import { getCurrentWindow, PhysicalSize } from '@tauri-apps/api/window';1754
* await getCurrentWindow().setMinSize(new PhysicalSize(600, 500));1755
* ```1756
*1757
* @param size The logical or physical inner size, or `null` to unset the constraint.1758
* @returns A promise indicating the success or failure of the operation.1759
*1760
* @remarks Requires the `core:window:allow-set-min-size` permission (not included1761
* in `core:window:default`).1762
*/1763
async setMinSize(size) {1764
return invoke("plugin:window|set_min_size", {1765
label: this.label,1766
value: size instanceof Size ? size : size ? new Size(size) : null1767
});1768
}1769
/**1770
* Sets the window maximum inner size. If the `size` argument is undefined, the constraint is unset.1771
* @example1772
* ```typescript1773
* import { getCurrentWindow, LogicalSize } from '@tauri-apps/api/window';1774
* await getCurrentWindow().setMaxSize(new LogicalSize(600, 500));1775
* ```1776
*1777
* @param size The logical or physical inner size, or `null` to unset the constraint.1778
* @returns A promise indicating the success or failure of the operation.1779
*1780
* @remarks Requires the `core:window:allow-set-max-size` permission (not included1781
* in `core:window:default`).1782
*/1783
async setMaxSize(size) {1784
return invoke("plugin:window|set_max_size", {1785
label: this.label,1786
value: size instanceof Size ? size : size ? new Size(size) : null1787
});1788
}1789
/**1790
* Sets the window inner size constraints.1791
* @example1792
* ```typescript1793
* import { getCurrentWindow } from '@tauri-apps/api/window';1794
* await getCurrentWindow().setSizeConstraints({ minWidth: 300 });1795
* ```1796
*1797
* @param constraints The inner size constraints in **logical pixels**, or `null`1798
* to unset every constraint. Each field is optional and independent, so1799
* `{ minWidth: 300 }` constrains only the width.1800
* @returns A promise indicating the success or failure of the operation.1801
*1802
* @remarks Requires the `core:window:allow-set-size-constraints` permission (not included1803
* in `core:window:default`).1804
*/1805
async setSizeConstraints(constraints) {1806
function logical(pixel) {1807
return pixel ? { Logical: pixel } : null;1808
}1809
return invoke("plugin:window|set_size_constraints", {1810
label: this.label,1811
value: {1812
minWidth: logical(constraints === null || constraints === void 0 ? void 0 : constraints.minWidth),1813
minHeight: logical(constraints === null || constraints === void 0 ? void 0 : constraints.minHeight),1814
maxWidth: logical(constraints === null || constraints === void 0 ? void 0 : constraints.maxWidth),1815
maxHeight: logical(constraints === null || constraints === void 0 ? void 0 : constraints.maxHeight)1816
}1817
});1818
}1819
/**1820
* Sets the window outer position.1821
* @example1822
* ```typescript1823
* import { getCurrentWindow, LogicalPosition } from '@tauri-apps/api/window';1824
* await getCurrentWindow().setPosition(new LogicalPosition(600, 500));1825
* ```1826
*1827
* @param position The new position, in logical or physical pixels.1828
* @returns A promise indicating the success or failure of the operation.1829
*1830
* @remarks Requires the `core:window:allow-set-position` permission (not included1831
* in `core:window:default`).1832
*/1833
async setPosition(position) {1834
return invoke("plugin:window|set_position", {1835
label: this.label,1836
value: position instanceof Position ? position : new Position(position)1837
});1838
}1839
/**1840
* Sets the window fullscreen state.1841
* @example1842
* ```typescript1843
* import { getCurrentWindow } from '@tauri-apps/api/window';1844
* await getCurrentWindow().setFullscreen(true);1845
* ```1846
*1847
* @param fullscreen Whether the window should go to fullscreen or not.1848
* @returns A promise indicating the success or failure of the operation.1849
*1850
* @remarks Requires the `core:window:allow-set-fullscreen` permission (not included1851
* in `core:window:default`).1852
*/1853
async setFullscreen(fullscreen) {1854
return invoke("plugin:window|set_fullscreen", {1855
label: this.label,1856
value: fullscreen1857
});1858
}1859
/**1860
* Sets the window as fullscreen on the monitor that contains the given physical position.1861
*1862
* Does nothing if no monitor contains the position.1863
* @example1864
* ```typescript1865
* import { getCurrentWindow, availableMonitors } from '@tauri-apps/api/window';1866
* const monitors = await availableMonitors();1867
* if (monitors.length > 1) {1868
* await getCurrentWindow().setFullscreenOnMonitor(monitors[1].position);1869
* }1870
* ```1871
*1872
* @param position A physical position inside the target monitor, such as {@linkcode Monitor.position}.1873
* @returns A promise indicating the success or failure of the operation.1874
*1875
* @remarks Requires the `core:window:allow-set-fullscreen-on-monitor` permission (not included1876
* in `core:window:default`).1877
*1878
* @since 2.12.01879
*/1880
async setFullscreenOnMonitor(position) {1881
return invoke("plugin:window|set_fullscreen_on_monitor", {1882
label: this.label,1883
value: position1884
});1885
}1886
/**1887
* On macOS, Toggles a fullscreen mode that doesn’t require a new macOS space. Returns a boolean indicating whether the transition was successful (this won't work if the window was already in the native fullscreen).1888
* This is how fullscreen used to work on macOS in versions before Lion. And allows the user to have a fullscreen window without using another space or taking control over the entire monitor.1889
*1890
* On other platforms, this is the same as {@link Window.setFullscreen}.1891
*1892
* @example1893
* ```typescript1894
* import { getCurrentWindow } from '@tauri-apps/api/window';1895
* await getCurrentWindow().setSimpleFullscreen(true);1896
* ```1897
*1898
* @param fullscreen Whether the window should go to simple fullscreen or not.1899
* @returns A promise indicating the success or failure of the operation.1900
*1901
* @remarks Requires the `core:window:allow-set-simple-fullscreen` permission (not included1902
* in `core:window:default`).1903
*1904
* @since 2.8.01905
*/1906
async setSimpleFullscreen(fullscreen) {1907
return invoke("plugin:window|set_simple_fullscreen", {1908
label: this.label,1909
value: fullscreen1910
});1911
}1912
/**1913
* Bring the window to front and focus.1914
* @example1915
* ```typescript1916
* import { getCurrentWindow } from '@tauri-apps/api/window';1917
* await getCurrentWindow().setFocus();1918
* ```1919
*1920
* @returns A promise indicating the success or failure of the operation.1921
*1922
* @remarks Requires the `core:window:allow-set-focus` permission (not included1923
* in `core:window:default`).1924
*/1925
async setFocus() {1926
return invoke("plugin:window|set_focus", {1927
label: this.label1928
});1929
}1930
/**1931
* Sets whether the window can be focused.1932
*1933
* #### Platform-specific1934
*1935
* - **macOS**: If the window is already focused, it is not possible to unfocus it after calling `set_focusable(false)`.1936
* In this case, you might consider calling {@link Window.setFocus} but it will move the window to the back i.e. at the bottom in terms of z-order.1937
*1938
* @example1939
* ```typescript1940
* import { getCurrentWindow } from '@tauri-apps/api/window';1941
* await getCurrentWindow().setFocusable(true);1942
* ```1943
*1944
* @param focusable Whether the window can be focused.1945
* @returns A promise indicating the success or failure of the operation.1946
*1947
* @remarks Requires the `core:window:allow-set-focusable` permission (not included1948
* in `core:window:default`).1949
*/1950
async setFocusable(focusable) {1951
return invoke("plugin:window|set_focusable", {1952
label: this.label,1953
value: focusable1954
});1955
}1956
/**1957
* Sets the window icon.1958
* @example1959
* ```typescript1960
* import { getCurrentWindow } from '@tauri-apps/api/window';1961
* await getCurrentWindow().setIcon('/tauri/awesome.png');1962
* ```1963
*1964
* Note that you may need the `image-ico` or `image-png` Cargo features to use this API.1965
* To enable it, change your Cargo.toml file:1966
* ```toml1967
* [dependencies]1968
* tauri = { version = "...", features = ["...", "image-png"] }1969
* ```1970
*1971
* @param icon Icon bytes or path to the icon file.1972
* @returns A promise indicating the success or failure of the operation.1973
*1974
* @remarks Requires the `core:window:allow-set-icon` permission (not included1975
* in `core:window:default`).1976
*/1977
async setIcon(icon) {1978
return invoke("plugin:window|set_icon", {1979
label: this.label,1980
value: transformImage(icon)1981
});1982
}1983
/**1984
* Whether the window icon should be hidden from the taskbar or not.1985
*1986
* #### Platform-specific1987
*1988
* - **macOS:** Unsupported.1989
* @example1990
* ```typescript1991
* import { getCurrentWindow } from '@tauri-apps/api/window';1992
* await getCurrentWindow().setSkipTaskbar(true);1993
* ```1994
*1995
* @param skip true to hide window icon, false to show it.1996
* @returns A promise indicating the success or failure of the operation.1997
*1998
* @remarks Requires the `core:window:allow-set-skip-taskbar` permission (not included1999
* in `core:window:default`).2000
*/2001
async setSkipTaskbar(skip) {2002
return invoke("plugin:window|set_skip_taskbar", {2003
label: this.label,2004
value: skip2005
});2006
}2007
/**2008
* Grabs the cursor, preventing it from leaving the window.2009
*2010
* There's no guarantee that the cursor will be hidden. You should2011
* hide it by yourself if you want so.2012
*2013
* #### Platform-specific2014
*2015
* - **Linux:** Unsupported.2016
* - **macOS:** This locks the cursor in a fixed location, which looks visually awkward.2017
* @example2018
* ```typescript2019
* import { getCurrentWindow } from '@tauri-apps/api/window';2020
* await getCurrentWindow().setCursorGrab(true);2021
* ```2022
*2023
* @param grab `true` to grab the cursor icon, `false` to release it.2024
* @returns A promise indicating the success or failure of the operation.2025
*2026
* @remarks Requires the `core:window:allow-set-cursor-grab` permission (not included2027
* in `core:window:default`).2028
*/2029
async setCursorGrab(grab) {2030
return invoke("plugin:window|set_cursor_grab", {2031
label: this.label,2032
value: grab2033
});2034
}2035
/**2036
* Modifies the cursor's visibility.2037
*2038
* #### Platform-specific2039
*2040
* - **Windows:** The cursor is only hidden within the confines of the window.2041
* - **macOS:** The cursor is hidden as long as the window has input focus, even if the cursor is2042
* outside of the window.2043
* @example2044
* ```typescript2045
* import { getCurrentWindow } from '@tauri-apps/api/window';2046
* await getCurrentWindow().setCursorVisible(false);2047
* ```2048
*2049
* @param visible If `false`, this will hide the cursor. If `true`, this will show the cursor.2050
* @returns A promise indicating the success or failure of the operation.2051
*2052
* @remarks Requires the `core:window:allow-set-cursor-visible` permission (not included2053
* in `core:window:default`).2054
*/2055
async setCursorVisible(visible) {2056
return invoke("plugin:window|set_cursor_visible", {2057
label: this.label,2058
value: visible2059
});2060
}2061
/**2062
* Modifies the cursor icon of the window.2063
* @example2064
* ```typescript2065
* import { getCurrentWindow } from '@tauri-apps/api/window';2066
* await getCurrentWindow().setCursorIcon('help');2067
* ```2068
*2069
* @param icon The new cursor icon.2070
* @returns A promise indicating the success or failure of the operation.2071
*2072
* @remarks Requires the `core:window:allow-set-cursor-icon` permission (not included2073
* in `core:window:default`).2074
*/2075
async setCursorIcon(icon) {2076
return invoke("plugin:window|set_cursor_icon", {2077
label: this.label,2078
value: icon2079
});2080
}2081
/**2082
* Sets the window background color.2083
*2084
* #### Platform-specific:2085
*2086
* - **Windows:** alpha channel is ignored.2087
* - **iOS / Android:** Unsupported.2088
*2089
* This sets the color of the window itself, which is what you see while the2090
* webview is still loading or behind a transparent page. To also change the2091
* webview background use {@link WebviewWindow.setBackgroundColor}.2092
*2093
* @example2094
* ```typescript2095
* import { getCurrentWindow } from '@tauri-apps/api/window';2096
* await getCurrentWindow().setBackgroundColor('#2f2f2f');2097
* // also accepts an RGB/RGBA tuple or an object2098
* await getCurrentWindow().setBackgroundColor([47, 47, 47, 255]);2099
* ```2100
*2101
* @param color The new background color, see {@link Color}.2102
* @returns A promise indicating the success or failure of the operation.2103
*2104
* @remarks Requires the `core:window:allow-set-background-color` permission (not included2105
* in `core:window:default`).2106
*2107
* @since 2.1.02108
*/2109
async setBackgroundColor(color) {2110
return invoke("plugin:window|set_background_color", {2111
label: this.label,2112
value: color2113
});2114
}2115
/**2116
* Changes the position of the cursor in window coordinates.2117
* @example2118
* ```typescript2119
* import { getCurrentWindow, LogicalPosition } from '@tauri-apps/api/window';2120
* await getCurrentWindow().setCursorPosition(new LogicalPosition(600, 300));2121
* ```2122
*2123
* @param position The new cursor position.2124
* @returns A promise indicating the success or failure of the operation.2125
*2126
* @remarks Requires the `core:window:allow-set-cursor-position` permission (not included2127
* in `core:window:default`).2128
*/2129
async setCursorPosition(position) {2130
return invoke("plugin:window|set_cursor_position", {2131
label: this.label,2132
value: position instanceof Position ? position : new Position(position)2133
});2134
}2135
/**2136
* Changes the cursor events behavior.2137
*2138
* @example2139
* ```typescript2140
* import { getCurrentWindow } from '@tauri-apps/api/window';2141
* await getCurrentWindow().setIgnoreCursorEvents(true);2142
* ```2143
*2144
* @param ignore `true` to ignore the cursor events; `false` to process them as usual.2145
* @returns A promise indicating the success or failure of the operation.2146
*2147
* @remarks Requires the `core:window:allow-set-ignore-cursor-events` permission (not included2148
* in `core:window:default`).2149
*/2150
async setIgnoreCursorEvents(ignore) {2151
return invoke("plugin:window|set_ignore_cursor_events", {2152
label: this.label,2153
value: ignore2154
});2155
}2156
/**2157
* Starts dragging the window.2158
* @example2159
* ```typescript2160
* import { getCurrentWindow } from '@tauri-apps/api/window';2161
* await getCurrentWindow().startDragging();2162
* ```2163
*2164
* @return A promise indicating the success or failure of the operation.2165
*2166
* @remarks Requires the `core:window:allow-start-dragging` permission (not included2167
* in `core:window:default`).2168
*/2169
async startDragging() {2170
return invoke("plugin:window|start_dragging", {2171
label: this.label2172
});2173
}2174
/**2175
* Starts resize-dragging the window.2176
* @example2177
* ```typescript2178
* import { getCurrentWindow } from '@tauri-apps/api/window';2179
* await getCurrentWindow().startResizeDragging();2180
* ```2181
*2182
* @return A promise indicating the success or failure of the operation.2183
*2184
* @remarks Requires the `core:window:allow-start-resize-dragging` permission (not included2185
* in `core:window:default`).2186
*/2187
async startResizeDragging(direction) {2188
return invoke("plugin:window|start_resize_dragging", {2189
label: this.label,2190
value: direction2191
});2192
}2193
/**2194
* Sets the badge count. It is app wide and not specific to this window.2195
*2196
* #### Platform-specific2197
*2198
* - **Windows**: Unsupported. Use {@linkcode Window.setOverlayIcon} instead.2199
*2200
* @example2201
* ```typescript2202
* import { getCurrentWindow } from '@tauri-apps/api/window';2203
* await getCurrentWindow().setBadgeCount(5);2204
* ```2205
*2206
* @param count The badge count. Use `undefined` to remove the badge.2207
* @return A promise indicating the success or failure of the operation.2208
*2209
* @remarks Requires the `core:window:allow-set-badge-count` permission (not included2210
* in `core:window:default`).2211
*/2212
async setBadgeCount(count) {2213
return invoke("plugin:window|set_badge_count", {2214
label: this.label,2215
value: count2216
});2217
}2218
/**2219
* Sets the badge label shown on the app's dock icon. **macOS only**2220
*2221
* Unlike {@linkcode Window.setBadgeCount}, which takes a number, this shows2222
* arbitrary short text. It is app-wide and not specific to this window.2223
*2224
* @example2225
* ```typescript2226
* import { getCurrentWindow } from '@tauri-apps/api/window';2227
* await getCurrentWindow().setBadgeLabel("Hello");2228
* ```2229
*2230
* @param label The badge label. Use `undefined` to remove the badge.2231
* @return A promise indicating the success or failure of the operation.2232
*2233
* @remarks Requires the `core:window:allow-set-badge-label` permission (not included2234
* in `core:window:default`).2235
*/2236
async setBadgeLabel(label) {2237
return invoke("plugin:window|set_badge_label", {2238
label: this.label,2239
value: label2240
});2241
}2242
/**2243
* Sets the overlay icon. **Windows only**2244
* The overlay icon can be set for every window.2245
*2246
*2247
* Note that you may need the `image-ico` or `image-png` Cargo features to use this API.2248
* To enable it, change your Cargo.toml file:2249
*2250
* ```toml2251
* [dependencies]2252
* tauri = { version = "...", features = ["...", "image-png"] }2253
* ```2254
*2255
* @example2256
* ```typescript2257
* import { getCurrentWindow } from '@tauri-apps/api/window';2258
* await getCurrentWindow().setOverlayIcon("/tauri/awesome.png");2259
* ```2260
*2261
* @param icon Icon bytes or path to the icon file. Use `undefined` to remove the overlay icon.2262
* @return A promise indicating the success or failure of the operation.2263
*2264
* @remarks Requires the `core:window:allow-set-overlay-icon` permission (not included2265
* in `core:window:default`).2266
*/2267
async setOverlayIcon(icon) {2268
return invoke("plugin:window|set_overlay_icon", {2269
label: this.label,2270
value: icon ? transformImage(icon) : void 02271
});2272
}2273
/**2274
* Sets the taskbar progress state.2275
*2276
* #### Platform-specific2277
*2278
* - **Linux / macOS**: Progress bar is app-wide and not specific to this window.2279
* - **Linux**: Only supported desktop environments with `libunity` (e.g. GNOME).2280
*2281
* @example2282
* ```typescript2283
* import { getCurrentWindow, ProgressBarStatus } from '@tauri-apps/api/window';2284
* await getCurrentWindow().setProgressBar({2285
* status: ProgressBarStatus.Normal,2286
* progress: 50,2287
* });2288
* ```2289
*2290
* @return A promise indicating the success or failure of the operation.2291
*2292
* @remarks Requires the `core:window:allow-set-progress-bar` permission (not included2293
* in `core:window:default`).2294
*/2295
async setProgressBar(state) {2296
return invoke("plugin:window|set_progress_bar", {2297
label: this.label,2298
value: state2299
});2300
}2301
/**2302
* Sets whether the window should be visible on all workspaces or virtual desktops.2303
*2304
* #### Platform-specific2305
*2306
* - **Windows / iOS / Android:** Unsupported.2307
*2308
* @example2309
* ```typescript2310
* import { getCurrentWindow } from '@tauri-apps/api/window';2311
* await getCurrentWindow().setVisibleOnAllWorkspaces(true);2312
* ```2313
*2314
* @param visible Whether the window should follow the user across workspaces.2315
* @returns A promise indicating the success or failure of the operation.2316
*2317
* @remarks Requires the `core:window:allow-set-visible-on-all-workspaces` permission (not included2318
* in `core:window:default`).2319
*2320
* @since 2.0.02321
*/2322
async setVisibleOnAllWorkspaces(visible) {2323
return invoke("plugin:window|set_visible_on_all_workspaces", {2324
label: this.label,2325
value: visible2326
});2327
}2328
/**2329
* Sets the title bar style. **macOS only**.2330
*2331
* Use `transparent` or `overlay` to build a custom title bar: with `overlay` the2332
* page extends under the title bar and only the traffic lights remain, so leave2333
* room for them in your layout and pair it with {@link Window.startDragging} on a2334
* draggable region.2335
*2336
* @example2337
* ```typescript2338
* import { getCurrentWindow } from '@tauri-apps/api/window';2339
* await getCurrentWindow().setTitleBarStyle('overlay');2340
* ```2341
*2342
* @param style The new title bar style, see {@link TitleBarStyle}.2343
* @returns A promise indicating the success or failure of the operation.2344
*2345
* @remarks Requires the `core:window:allow-set-title-bar-style` permission (not included2346
* in `core:window:default`).2347
*2348
* @since 2.0.02349
*/2350
async setTitleBarStyle(style) {2351
return invoke("plugin:window|set_title_bar_style", {2352
label: this.label,2353
value: style2354
});2355
}2356
/**2357
* Set window theme, pass in `null` or `undefined` to follow system theme2358
*2359
* #### Platform-specific2360
*2361
* - **Linux / macOS**: Theme is app-wide and not specific to this window.2362
* - **iOS / Android:** Unsupported.2363
*2364
* Use {@link Window.theme} to read the effective theme and2365
* {@link Window.onThemeChanged} to react to changes.2366
*2367
* @example2368
* ```typescript2369
* import { getCurrentWindow } from '@tauri-apps/api/window';2370
* await getCurrentWindow().setTheme('dark');2371
* // follow the system theme again2372
* await getCurrentWindow().setTheme(null);2373
* ```2374
*2375
* @param theme The theme to apply, or `null`/`undefined` to follow the system theme.2376
* @returns A promise indicating the success or failure of the operation.2377
*2378
* @remarks Requires the `core:window:allow-set-theme` permission (not included2379
* in `core:window:default`).2380
*2381
* @since 2.0.02382
*/2383
async setTheme(theme) {2384
return invoke("plugin:window|set_theme", {2385
label: this.label,2386
value: theme2387
});2388
}2389
// Listeners2390
/**2391
* Listen to window resize.2392
*2393
* @example2394
* ```typescript2395
* import { getCurrentWindow } from "@tauri-apps/api/window";2396
* const unlisten = await getCurrentWindow().onResized(({ payload: size }) => {2397
* console.log('Window resized', size);2398
* });2399
*2400
* // call unlisten when your handler goes out of scope e.g. the component is unmounted2401
* unlisten();2402
* ```2403
*2404
* @returns A promise resolving to a function to unlisten to the event.2405
*2406
* @remarks The listener is removed automatically when this window is destroyed,2407
* so you do not need to unlisten just because the window is closing. Do call the2408
* returned function when the listener's own scope ends, e.g. on page navigation2409
* or when a component unmounts.2410
*/2411
async onResized(handler) {2412
return this.listen(TauriEvent.WINDOW_RESIZED, (e) => {2413
e.payload = new PhysicalSize(e.payload);2414
handler(e);2415
});2416
}2417
/**2418
* Listen to window move.2419
*2420
* @example2421
* ```typescript2422
* import { getCurrentWindow } from "@tauri-apps/api/window";2423
* const unlisten = await getCurrentWindow().onMoved(({ payload: position }) => {2424
* console.log('Window moved', position);2425
* });2426
*2427
* // call unlisten when your handler goes out of scope e.g. the component is unmounted2428
* unlisten();2429
* ```2430
*2431
* @returns A promise resolving to a function to unlisten to the event.2432
*2433
* @remarks The listener is removed automatically when this window is destroyed,2434
* so you do not need to unlisten just because the window is closing. Do call the2435
* returned function when the listener's own scope ends, e.g. on page navigation2436
* or when a component unmounts.2437
*/2438
async onMoved(handler) {2439
return this.listen(TauriEvent.WINDOW_MOVED, (e) => {2440
e.payload = new PhysicalPosition(e.payload);2441
handler(e);2442
});2443
}2444
/**2445
* Listen to window close requested. Emitted when the user requests to closes the window.2446
*2447
* @example2448
* ```typescript2449
* import { getCurrentWindow } from "@tauri-apps/api/window";2450
* // `confirm` comes from the dialog plugin, which you have to add separately:2451
* // `pnpm tauri add dialog`2452
* import { confirm } from '@tauri-apps/plugin-dialog';2453
* const unlisten = await getCurrentWindow().onCloseRequested(async (event) => {2454
* const confirmed = await confirm('Are you sure?');2455
* if (!confirmed) {2456
* // user did not confirm closing the window; let's prevent it2457
* event.preventDefault();2458
* }2459
* });2460
*2461
* // call unlisten when your handler goes out of scope e.g. the component is unmounted2462
* unlisten();2463
* ```2464
*2465
* @returns A promise resolving to a function to unlisten to the event.2466
*2467
* @remarks The listener is removed automatically when this window is destroyed,2468
* so you do not need to unlisten just because the window is closing. Do call the2469
* returned function when the listener's own scope ends, e.g. on page navigation2470
* or when a component unmounts.2471
*/2472
async onCloseRequested(handler) {2473
return this.listen(TauriEvent.WINDOW_CLOSE_REQUESTED, async (event) => {2474
const evt = new CloseRequestedEvent(event);2475
await handler(evt);2476
if (!evt.isPreventDefault()) {2477
await this.destroy();2478
}2479
});2480
}2481
/**2482
* Listen to a file drop event.2483
* The listener is triggered when the user hovers the selected files on the webview,2484
* drops the files or cancels the operation.2485
*2486
* @example2487
* ```typescript2488
* import { getCurrentWindow } from "@tauri-apps/api/window";2489
* const unlisten = await getCurrentWindow().onDragDropEvent((event) => {2490
* if (event.payload.type === 'over') {2491
* console.log('User hovering', event.payload.position);2492
* } else if (event.payload.type === 'drop') {2493
* console.log('User dropped', event.payload.paths);2494
* } else {2495
* console.log('File drop cancelled');2496
* }2497
* });2498
*2499
* // call unlisten when your handler goes out of scope e.g. the component is unmounted2500
* unlisten();2501
* ```2502
*2503
* @returns A promise resolving to a function to unlisten to the event.2504
*2505
* @remarks The listener is removed automatically when this window is destroyed,2506
* so you do not need to unlisten just because the window is closing. Do call the2507
* returned function when the listener's own scope ends, e.g. on page navigation2508
* or when a component unmounts.2509
*/2510
async onDragDropEvent(handler) {2511
const unlistenDrag = await this.listen(TauriEvent.DRAG_ENTER, (event) => {2512
handler({2513
...event,2514
payload: {2515
type: "enter",2516
paths: event.payload.paths,2517
position: new PhysicalPosition(event.payload.position)2518
}2519
});2520
});2521
const unlistenDragOver = await this.listen(TauriEvent.DRAG_OVER, (event) => {2522
handler({2523
...event,2524
payload: {2525
type: "over",2526
position: new PhysicalPosition(event.payload.position)2527
}2528
});2529
});2530
const unlistenDrop = await this.listen(TauriEvent.DRAG_DROP, (event) => {2531
handler({2532
...event,2533
payload: {2534
type: "drop",2535
paths: event.payload.paths,2536
position: new PhysicalPosition(event.payload.position)2537
}2538
});2539
});2540
const unlistenCancel = await this.listen(TauriEvent.DRAG_LEAVE, (event) => {2541
handler({ ...event, payload: { type: "leave" } });2542
});2543
return async () => {2544
await Promise.all([2545
unlistenDrag(),2546
unlistenDrop(),2547
unlistenDragOver(),2548
unlistenCancel()2549
]);2550
};2551
}2552
/**2553
* Listen to window focus change.2554
*2555
* @example2556
* ```typescript2557
* import { getCurrentWindow } from "@tauri-apps/api/window";2558
* const unlisten = await getCurrentWindow().onFocusChanged(({ payload: focused }) => {2559
* console.log('Focus changed, window is focused? ' + focused);2560
* });2561
*2562
* // call unlisten when your handler goes out of scope e.g. the component is unmounted2563
* unlisten();2564
* ```2565
*2566
* @returns A promise resolving to a function to unlisten to the event.2567
*2568
* @remarks The listener is removed automatically when this window is destroyed,2569
* so you do not need to unlisten just because the window is closing. Do call the2570
* returned function when the listener's own scope ends, e.g. on page navigation2571
* or when a component unmounts.2572
*/2573
async onFocusChanged(handler) {2574
const unlistenFocus = await this.listen(TauriEvent.WINDOW_FOCUS, (event) => {2575
handler({ ...event, payload: true });2576
});2577
const unlistenBlur = await this.listen(TauriEvent.WINDOW_BLUR, (event) => {2578
handler({ ...event, payload: false });2579
});2580
return async () => {2581
await Promise.all([unlistenFocus(), unlistenBlur()]);2582
};2583
}2584
/**2585
* Listen to window scale change. Emitted when the window's scale factor has changed.2586
* The following user actions can cause DPI changes:2587
* - Changing the display's resolution.2588
* - Changing the display's scale factor (e.g. in Control Panel on Windows).2589
* - Moving the window to a display with a different scale factor.2590
*2591
* @example2592
* ```typescript2593
* import { getCurrentWindow } from "@tauri-apps/api/window";2594
* const unlisten = await getCurrentWindow().onScaleChanged(({ payload }) => {2595
* console.log('Scale changed', payload.scaleFactor, payload.size);2596
* });2597
*2598
* // call unlisten when your handler goes out of scope e.g. the component is unmounted2599
* unlisten();2600
* ```2601
*2602
* @returns A promise resolving to a function to unlisten to the event.2603
*2604
* @remarks The listener is removed automatically when this window is destroyed,2605
* so you do not need to unlisten just because the window is closing. Do call the2606
* returned function when the listener's own scope ends, e.g. on page navigation2607
* or when a component unmounts.2608
*/2609
async onScaleChanged(handler) {2610
return this.listen(TauriEvent.WINDOW_SCALE_FACTOR_CHANGED, handler);2611
}2612
/**2613
* Listen to the system theme change.2614
*2615
* @example2616
* ```typescript2617
* import { getCurrentWindow } from "@tauri-apps/api/window";2618
* const unlisten = await getCurrentWindow().onThemeChanged(({ payload: theme }) => {2619
* console.log('New theme: ' + theme);2620
* });2621
*2622
* // call unlisten when your handler goes out of scope e.g. the component is unmounted2623
* unlisten();2624
* ```2625
*2626
* @returns A promise resolving to a function to unlisten to the event.2627
*2628
* @remarks The listener is removed automatically when this window is destroyed,2629
* so you do not need to unlisten just because the window is closing. Do call the2630
* returned function when the listener's own scope ends, e.g. on page navigation2631
* or when a component unmounts.2632
*/2633
async onThemeChanged(handler) {2634
return this.listen(TauriEvent.WINDOW_THEME_CHANGED, handler);2635
}2636
};2637
var BackgroundThrottlingPolicy;2638
(function(BackgroundThrottlingPolicy2) {2639
BackgroundThrottlingPolicy2["Disabled"] = "disabled";2640
BackgroundThrottlingPolicy2["Throttle"] = "throttle";2641
BackgroundThrottlingPolicy2["Suspend"] = "suspend";2642
})(BackgroundThrottlingPolicy || (BackgroundThrottlingPolicy = {}));2643
var ScrollBarStyle;2644
(function(ScrollBarStyle2) {2645
ScrollBarStyle2["Default"] = "default";2646
ScrollBarStyle2["FluentOverlay"] = "fluentOverlay";2647
})(ScrollBarStyle || (ScrollBarStyle = {}));2648
var Effect;2649
(function(Effect2) {2650
Effect2["AppearanceBased"] = "appearanceBased";2651
Effect2["Light"] = "light";2652
Effect2["Dark"] = "dark";2653
Effect2["MediumLight"] = "mediumLight";2654
Effect2["UltraDark"] = "ultraDark";2655
Effect2["Titlebar"] = "titlebar";2656
Effect2["Selection"] = "selection";2657
Effect2["Menu"] = "menu";2658
Effect2["Popover"] = "popover";2659
Effect2["Sidebar"] = "sidebar";2660
Effect2["HeaderView"] = "headerView";2661
Effect2["Sheet"] = "sheet";2662
Effect2["WindowBackground"] = "windowBackground";2663
Effect2["HudWindow"] = "hudWindow";2664
Effect2["FullScreenUI"] = "fullScreenUI";2665
Effect2["Tooltip"] = "tooltip";2666
Effect2["ContentBackground"] = "contentBackground";2667
Effect2["UnderWindowBackground"] = "underWindowBackground";2668
Effect2["UnderPageBackground"] = "underPageBackground";2669
Effect2["LiquidGlassRegular"] = "liquidGlassRegular";2670
Effect2["LiquidGlassClear"] = "liquidGlassClear";2671
Effect2["Mica"] = "mica";2672
Effect2["Blur"] = "blur";2673
Effect2["Acrylic"] = "acrylic";2674
Effect2["Tabbed"] = "tabbed";2675
Effect2["TabbedDark"] = "tabbedDark";2676
Effect2["TabbedLight"] = "tabbedLight";2677
})(Effect || (Effect = {}));2678
var EffectState;2679
(function(EffectState2) {2680
EffectState2["FollowsWindowActiveState"] = "followsWindowActiveState";2681
EffectState2["Active"] = "active";2682
EffectState2["Inactive"] = "inactive";2683
})(EffectState || (EffectState = {}));2685
// node_modules/@tauri-apps/api/webview.js2686
function getCurrentWebview() {2687
return new Webview(getCurrentWindow(), window.__TAURI_INTERNALS__.metadata.currentWebview.label, {2688
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor2689
skip: true2690
});2691
}2692
async function getAllWebviews() {2693
return invoke("plugin:webview|get_all_webviews").then((webviews) => webviews.map((w) => new Webview(new Window(w.windowLabel, {2694
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor2695
skip: true2696
}), w.label, {2697
// @ts-expect-error `skip` is not defined in the public API but it is handled by the constructor2698
skip: true2699
})));2700
}2701
var localTauriEvents2 = ["tauri://created", "tauri://error"];2702
var Webview = class {2703
/**2704
* Creates a new Webview.2705
* @example2706
* ```typescript2707
* import { Window } from '@tauri-apps/api/window'2708
* import { Webview } from '@tauri-apps/api/webview'2709
* const appWindow = new Window('my-label')2710
*2711
* appWindow.once('tauri://created', async function() {2712
* const webview = new Webview(appWindow, 'my-label', {2713
* url: 'https://github.com/tauri-apps/tauri',2714
*2715
* // create a webview with specific logical position and size2716
* x: 0,2717
* y: 0,2718
* width: 800,2719
* height: 600,2720
* });2721
*2722
* webview.once('tauri://created', function () {2723
* // webview successfully created2724
* });2725
* webview.once('tauri://error', function (e) {2726
* // an error happened creating the webview2727
* });2728
* });2729
* ```2730
*2731
* @param window the window to add this webview to.2732
* @param label The unique webview label. Must be alphanumeric: `a-zA-Z-/:_`.2733
* @param options The webview configuration, see {@link WebviewOptions}.2734
* @returns The {@link Webview} instance to communicate with the webview.2735
*2736
* @remarks Requires the `unstable` Cargo feature on the `tauri` crate2737
* (`tauri = { version = "2", features = ["unstable"] }`), otherwise the call2738
* rejects with an "unstable feature not supported" error. It also requires the2739
* `core:webview:allow-create-webview` permission, which is not included in2740
* `core:webview:default`.2741
*/2742
constructor(window2, label, options) {2743
this.window = window2;2744
this.label = label;2745
this.listeners = /* @__PURE__ */ Object.create(null);2746
if (!(options === null || options === void 0 ? void 0 : options.skip)) {2747
invoke("plugin:webview|create_webview", {2748
windowLabel: window2.label,2749
options: {2750
...options,2751
label2752
}2753
}).then(async () => this.emit("tauri://created")).catch(async (e) => this.emit("tauri://error", e));2754
}2755
}2756
/**2757
* Gets the Webview for the webview associated with the given label.2758
* @example2759
* ```typescript2760
* import { Webview } from '@tauri-apps/api/webview';2761
* const mainWebview = Webview.getByLabel('main');2762
* ```2763
*2764
* @param label The webview label.2765
* @returns The Webview instance to communicate with the webview or null if the webview doesn't exist.2766
*/2767
static async getByLabel(label) {2768
var _a;2769
return (_a = (await getAllWebviews()).find((w) => w.label === label)) !== null && _a !== void 0 ? _a : null;2770
}2771
/**2772
* Get an instance of `Webview` for the current webview.2773
*/2774
static getCurrent() {2775
return getCurrentWebview();2776
}2777
/**2778
* Gets a list of instances of `Webview` for all available webviews.2779
*/2780
static async getAll() {2781
return getAllWebviews();2782
}2783
/**2784
* Listen to an emitted event on this webview.2785
*2786
* @example2787
* ```typescript2788
* import { getCurrentWebview } from '@tauri-apps/api/webview';2789
* const unlisten = await getCurrentWebview().listen<string>('state-changed', (event) => {2790
* console.log(`Got error: ${payload}`);2791
* });2792
*2793
* // call unlisten when your handler goes out of scope e.g. the component is unmounted2794
* unlisten();2795
* ```2796
*2797
* @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.2798
* @param handler Event handler.2799
* @returns A promise resolving to a function to unlisten to the event.2800
*2801
* @remarks The listener is removed automatically when this webview is destroyed,2802
* so you do not need to unlisten just because the webview is closing. Do call the2803
* returned function when the listener's own scope ends, e.g. on page navigation2804
* or when a component unmounts.2805
*/2806
async listen(event, handler) {2807
if (this._handleTauriEvent(event, handler)) {2808
return () => {2809
const listeners = this.listeners[event];2810
listeners.splice(listeners.indexOf(handler), 1);2811
};2812
}2813
return listen(event, handler, {2814
target: { kind: "Webview", label: this.label }2815
});2816
}2817
/**2818
* Listen to an emitted event on this webview only once.2819
*2820
* @example2821
* ```typescript2822
* import { getCurrentWebview } from '@tauri-apps/api/webview';2823
* const unlisten = await getCurrentWebview().once<null>('initialized', (event) => {2824
* console.log(`Webview initialized!`);2825
* });2826
*2827
* // call unlisten when your handler goes out of scope e.g. the component is unmounted2828
* unlisten();2829
* ```2830
*2831
* @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.2832
* @param handler Event handler.2833
* @returns A promise resolving to a function to unlisten to the event.2834
*2835
* @remarks The listener removes itself after the first event and is also removed2836
* automatically when this webview is destroyed. Do call the returned function if2837
* the listener's own scope ends before the event arrives.2838
*/2839
async once(event, handler) {2840
if (this._handleTauriEvent(event, handler)) {2841
return () => {2842
const listeners = this.listeners[event];2843
listeners.splice(listeners.indexOf(handler), 1);2844
};2845
}2846
return once(event, handler, {2847
target: { kind: "Webview", label: this.label }2848
});2849
}2850
/**2851
* Emits an event to all {@link EventTarget|targets}.2852
*2853
* @example2854
* ```typescript2855
* import { getCurrentWebview } from '@tauri-apps/api/webview';2856
* await getCurrentWebview().emit('webview-loaded', { loggedIn: true, token: 'authToken' });2857
* ```2858
*2859
* @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.2860
* @param payload Event payload.2861
*/2862
async emit(event, payload) {2863
if (localTauriEvents2.includes(event)) {2864
for (const handler of this.listeners[event] || []) {2865
handler({2866
event,2867
id: -1,2868
payload2869
});2870
}2871
return;2872
}2873
return emit(event, payload);2874
}2875
/**2876
* Emits an event to all {@link EventTarget|targets} matching the given target.2877
*2878
* @example2879
* ```typescript2880
* import { getCurrentWebview } from '@tauri-apps/api/webview';2881
* await getCurrentWebview().emitTo('main', 'webview-loaded', { loggedIn: true, token: 'authToken' });2882
* ```2883
*2884
* @param target Label of the target Window/Webview/WebviewWindow or raw {@link EventTarget} object.2885
* @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.2886
* @param payload Event payload.2887
*/2888
async emitTo(target, event, payload) {2889
if (localTauriEvents2.includes(event)) {2890
for (const handler of this.listeners[event] || []) {2891
handler({2892
event,2893
id: -1,2894
payload2895
});2896
}2897
return;2898
}2899
return emitTo(target, event, payload);2900
}2901
/** @ignore */2902
_handleTauriEvent(event, handler) {2903
if (localTauriEvents2.includes(event)) {2904
if (!(event in this.listeners)) {2905
this.listeners[event] = [handler];2906
} else {2907
this.listeners[event].push(handler);2908
}2909
return true;2910
}2911
return false;2912
}2913
// Getters2914
/**2915
* The position of the top-left hand corner of the webview's client area relative to the top-left hand corner of the desktop.2916
* @example2917
* ```typescript2918
* import { getCurrentWebview } from '@tauri-apps/api/webview';2919
* const position = await getCurrentWebview().position();2920
* ```2921
*2922
* @returns The webview's position, in physical pixels.2923
*2924
* @remarks Uses the `core:webview:allow-webview-position` permission, which is2925
* part of `core:webview:default`.2926
*/2927
async position() {2928
return invoke("plugin:webview|webview_position", {2929
label: this.label2930
}).then((p) => new PhysicalPosition(p));2931
}2932
/**2933
* The physical size of the webview's client area.2934
* The client area is the content of the webview, excluding the title bar and borders.2935
* @example2936
* ```typescript2937
* import { getCurrentWebview } from '@tauri-apps/api/webview';2938
* const size = await getCurrentWebview().size();2939
* ```2940
*2941
* @returns The webview's size, in physical pixels.2942
*2943
* @remarks Uses the `core:webview:allow-webview-size` permission, which is part2944
* of `core:webview:default`.2945
*/2946
async size() {2947
return invoke("plugin:webview|webview_size", {2948
label: this.label2949
}).then((s) => new PhysicalSize(s));2950
}2951
// Setters2952
/**2953
* Closes the webview.2954
* @example2955
* ```typescript2956
* import { getCurrentWebview } from '@tauri-apps/api/webview';2957
* await getCurrentWebview().close();2958
* ```2959
*2960
* @returns A promise indicating the success or failure of the operation.2961
*2962
* @remarks Requires the `core:webview:allow-webview-close` permission (not2963
* included in `core:webview:default`).2964
*/2965
async close() {2966
return invoke("plugin:webview|webview_close", {2967
label: this.label2968
});2969
}2970
/**2971
* Resizes the webview.2972
* @example2973
* ```typescript2974
* import { getCurrentWebview } from '@tauri-apps/api/webview';2975
* import { LogicalSize } from '@tauri-apps/api/dpi';2976
* await getCurrentWebview().setSize(new LogicalSize(600, 500));2977
* ```2978
*2979
* @param size The logical or physical size.2980
* @returns A promise indicating the success or failure of the operation.2981
*2982
* @remarks Requires the `core:webview:allow-set-webview-size` permission (not2983
* included in `core:webview:default`).2984
*/2985
async setSize(size) {2986
return invoke("plugin:webview|set_webview_size", {2987
label: this.label,2988
value: size instanceof Size ? size : new Size(size)2989
});2990
}2991
/**2992
* Sets the webview position.2993
* @example2994
* ```typescript2995
* import { getCurrentWebview } from '@tauri-apps/api/webview';2996
* import { LogicalPosition } from '@tauri-apps/api/dpi';2997
* await getCurrentWebview().setPosition(new LogicalPosition(600, 500));2998
* ```2999
*3000
* @param position The new position, in logical or physical pixels, relative to3001
* the top-left corner of the hosting window.3002
* @returns A promise indicating the success or failure of the operation.3003
*3004
* @remarks Requires the `core:webview:allow-set-webview-position` permission (not3005
* included in `core:webview:default`).3006
*/3007
async setPosition(position) {3008
return invoke("plugin:webview|set_webview_position", {3009
label: this.label,3010
value: position instanceof Position ? position : new Position(position)3011
});3012
}3013
/**3014
* Bring the webview to front and focus.3015
* @example3016
* ```typescript3017
* import { getCurrentWebview } from '@tauri-apps/api/webview';3018
* await getCurrentWebview().setFocus();3019
* ```3020
*3021
* @returns A promise indicating the success or failure of the operation.3022
*3023
* @remarks Requires the `core:webview:allow-set-webview-focus` permission (not3024
* included in `core:webview:default`).3025
*/3026
async setFocus() {3027
return invoke("plugin:webview|set_webview_focus", {3028
label: this.label3029
});3030
}3031
/**3032
* Sets whether the webview should automatically grow and shrink its size and position when the parent window resizes.3033
* @example3034
* ```typescript3035
* import { getCurrentWebview } from '@tauri-apps/api/webview';3036
* await getCurrentWebview().setAutoResize(true);3037
* ```3038
*3039
* @returns A promise indicating the success or failure of the operation.3040
*3041
* @remarks Requires the `core:webview:allow-set-webview-auto-resize` permission3042
* (not included in `core:webview:default`).3043
*/3044
async setAutoResize(autoResize) {3045
return invoke("plugin:webview|set_webview_auto_resize", {3046
label: this.label,3047
value: autoResize3048
});3049
}3050
/**3051
* Hide the webview.3052
* @example3053
* ```typescript3054
* import { getCurrentWebview } from '@tauri-apps/api/webview';3055
* await getCurrentWebview().hide();3056
* ```3057
*3058
* @returns A promise indicating the success or failure of the operation.3059
*3060
* @remarks Requires the `core:webview:allow-webview-hide` permission (not3061
* included in `core:webview:default`).3062
*/3063
async hide() {3064
return invoke("plugin:webview|webview_hide", {3065
label: this.label3066
});3067
}3068
/**3069
* Show the webview.3070
* @example3071
* ```typescript3072
* import { getCurrentWebview } from '@tauri-apps/api/webview';3073
* await getCurrentWebview().show();3074
* ```3075
*3076
* @returns A promise indicating the success or failure of the operation.3077
*3078
* @remarks Requires the `core:webview:allow-webview-show` permission (not3079
* included in `core:webview:default`).3080
*/3081
async show() {3082
return invoke("plugin:webview|webview_show", {3083
label: this.label3084
});3085
}3086
/**3087
* Set webview zoom level.3088
* @example3089
* ```typescript3090
* import { getCurrentWebview } from '@tauri-apps/api/webview';3091
* await getCurrentWebview().setZoom(1.5);3092
* ```3093
*3094
* @param scaleFactor The zoom level, where `1` is 100%.3095
* @returns A promise indicating the success or failure of the operation.3096
*3097
* @remarks Requires the `core:webview:allow-set-webview-zoom` permission (not3098
* included in `core:webview:default`).3099
*/3100
async setZoom(scaleFactor) {3101
return invoke("plugin:webview|set_webview_zoom", {3102
label: this.label,3103
value: scaleFactor3104
});3105
}3106
/**3107
* Moves this webview to the window with the given label.3108
* @example3109
* ```typescript3110
* import { getCurrentWebview } from '@tauri-apps/api/webview';3111
* await getCurrentWebview().reparent('other-window');3112
* ```3113
*3114
* @param window The target window, or its label.3115
* @returns A promise indicating the success or failure of the operation.3116
*3117
* @remarks Requires the `core:webview:allow-reparent` permission (not included in3118
* `core:webview:default`).3119
*/3120
async reparent(window2) {3121
return invoke("plugin:webview|reparent", {3122
label: this.label,3123
window: typeof window2 === "string" ? window2 : window2.label3124
});3125
}3126
/**3127
* Clears all browsing data for this webview: cookies, localStorage, IndexedDB,3128
* caches and any other data the webview stores for the loaded origins.3129
* @example3130
* ```typescript3131
* import { getCurrentWebview } from '@tauri-apps/api/webview';3132
* await getCurrentWebview().clearAllBrowsingData();3133
* ```3134
*3135
* @returns A promise indicating the success or failure of the operation.3136
*3137
* @remarks Requires the `core:webview:allow-clear-all-browsing-data` permission3138
* (not included in `core:webview:default`).3139
*/3140
async clearAllBrowsingData() {3141
return invoke("plugin:webview|clear_all_browsing_data");3142
}3143
/**3144
* Specify the webview background color.3145
*3146
* #### Platform-specific:3147
*3148
* - **macOS / iOS**: Not implemented.3149
* - **Windows**:3150
* - On Windows 7, transparency is not supported and the alpha value will be ignored.3151
* - On Windows higher than 7: translucent colors are not supported so any alpha value other than `0` will be replaced by `255`3152
*3153
* @example3154
* ```typescript3155
* import { getCurrentWebview } from '@tauri-apps/api/webview';3156
* await getCurrentWebview().setBackgroundColor('#2f2f2f');3157
* // or with an RGBA tuple, or `null` to restore the default background3158
* await getCurrentWebview().setBackgroundColor([47, 47, 47, 255]);3159
* ```3160
*3161
* @param color The new background color, or `null` to reset it.3162
* @returns A promise indicating the success or failure of the operation.3163
*3164
* @remarks Requires the `core:webview:allow-set-webview-background-color`3165
* permission (not included in `core:webview:default`).3166
*3167
* @since 2.1.03168
*/3169
async setBackgroundColor(color) {3170
return invoke("plugin:webview|set_webview_background_color", {3171
label: this.label,3172
value: color3173
});3174
}3175
// Listeners3176
/**3177
* Listen to a file drop event.3178
* The listener is triggered when the user hovers the selected files on the webview,3179
* drops the files or cancels the operation.3180
*3181
* @example3182
* ```typescript3183
* import { getCurrentWebview } from "@tauri-apps/api/webview";3184
* const unlisten = await getCurrentWebview().onDragDropEvent((event) => {3185
* if (event.payload.type === 'over') {3186
* console.log('User hovering', event.payload.position);3187
* } else if (event.payload.type === 'drop') {3188
* console.log('User dropped', event.payload.paths);3189
* } else {3190
* console.log('File drop cancelled');3191
* }3192
* });3193
*3194
* // call unlisten when your handler goes out of scope e.g. the component is unmounted3195
* unlisten();3196
* ```3197
*3198
* When the debugger panel is open, the drop position of this event may be inaccurate due to a known limitation.3199
* To retrieve the correct drop position, please detach the debugger.3200
*3201
* @returns A promise resolving to a function to unlisten to the event.3202
*3203
* @remarks The listeners are removed automatically when this webview is3204
* destroyed. Do call the returned function when the listener's own scope ends,3205
* e.g. on page navigation or when a component unmounts.3206
*/3207
async onDragDropEvent(handler) {3208
const unlistenDragEnter = await this.listen(TauriEvent.DRAG_ENTER, (event) => {3209
handler({3210
...event,3211
payload: {3212
type: "enter",3213
paths: event.payload.paths,3214
position: new PhysicalPosition(event.payload.position)3215
}3216
});3217
});3218
const unlistenDragOver = await this.listen(TauriEvent.DRAG_OVER, (event) => {3219
handler({3220
...event,3221
payload: {3222
type: "over",3223
position: new PhysicalPosition(event.payload.position)3224
}3225
});3226
});3227
const unlistenDragDrop = await this.listen(TauriEvent.DRAG_DROP, (event) => {3228
handler({3229
...event,3230
payload: {3231
type: "drop",3232
paths: event.payload.paths,3233
position: new PhysicalPosition(event.payload.position)3234
}3235
});3236
});3237
const unlistenDragLeave = await this.listen(TauriEvent.DRAG_LEAVE, (event) => {3238
handler({ ...event, payload: { type: "leave" } });3239
});3240
return async () => {3241
await Promise.all([3242
unlistenDragEnter(),3243
unlistenDragDrop(),3244
unlistenDragOver(),3245
unlistenDragLeave()3246
]);3247
};3248
}3249
};3251
// src/api/transport.ts3252
function errorFrom(channel, reason) {3253
const payload = reason && typeof reason === "object" ? reason : { message: String(reason ?? "Unknown error") };3254
const message = typeof payload.message === "string" && payload.message ? payload.message : String(payload.code || "Operation failed.");3255
return new Error(`Error invoking remote method '${channel}': Error: ${message}`);3256
}3257
async function call(command5, channel, payload) {3258
try {3259
return await invoke(command5, payload === void 0 ? {} : { payload });3260
} catch (reason) {3261
throw errorFrom(channel, reason);3262
}3263
}3264
function send(command5, payload) {3265
void invoke(command5, { payload }).catch(() => {3266
});3267
}3268
function subscribe(event, callback) {3269
if (typeof callback !== "function") return () => {3270
};3271
let active = true;3272
let unlisten = null;3273
void listen(event, (message) => {3274
if (active) callback(message.payload);3275
}, { target: { kind: "AnyLabel", label: getCurrentWebview().label } }).then((fn) => {3276
if (active) unlisten = fn;3277
else fn();3278
}).catch(() => {3279
});3280
return () => {3281
active = false;3282
if (unlisten) {3283
unlisten();3284
unlisten = null;3285
}3286
};3287
}3288
function subscribeStrict(event, callback, what) {3289
if (typeof callback !== "function") throw new TypeError(`${what} callback must be a function.`);3290
return subscribe(event, callback);3291
}3293
// src/api/core/app.ts3294
var app = Object.freeze({3295
getInfo: () => call("core_get_info", "core:getInfo"),3296
openLegalDocument: (document2) => call("core_legal_open", "legal:open", { document: document2 }),3297
openExternal: (url) => call("core_open_external", "core:openExternal", { url })3298
});3300
// src/api/core/config.ts3301
var config = Object.freeze({3302
get: () => call("core_config_get", "config:get"),3303
update: (patch) => call("core_config_update", "config:update", patch),3304
languages: () => call("core_i18n_languages", "i18n:languages"),3305
/** Core, diagnostics and window-chrome catalogs of one language and its lookup chain. */3306
catalogs: (language) => call("core_i18n_catalogs", "i18n:catalogs", { language })3307
});3309
// src/api/core/vault.ts3310
async function unwrap(command5, channel) {3311
const result = await call(command5, channel);3312
if (!result.ok) throw Object.assign(new Error(result.error.message), { code: result.error.code });3313
return result.value;3314
}3315
var vault = Object.freeze({3316
status: () => call("core_vault_status", "vault:status"),3317
create: (password) => call("core_vault_create", "vault:create", { password }),3318
unlock: (password) => call("core_vault_unlock", "vault:unlock", { password }),3319
lock: () => call("core_vault_lock", "vault:lock"),3320
reset: (confirmation) => call("core_vault_reset", "vault:reset", { confirmation })3321
});3322
var biometrics = Object.freeze({3323
status: () => unwrap("core_biometrics_status", "biometrics:status"),3324
enable: () => unwrap("core_biometrics_enable", "biometrics:enable"),3325
disable: () => unwrap("core_biometrics_disable", "biometrics:disable"),3326
unlock: () => unwrap("core_biometrics_unlock", "biometrics:unlock"),3327
autoUnlock: () => unwrap("core_biometrics_auto_unlock", "biometrics:autoUnlock"),3328
authenticate: () => unwrap("core_biometrics_authenticate", "biometrics:authenticate")3329
});3331
// src/api/core/profiles.ts3332
var profiles = Object.freeze({3333
list: () => call("core_profiles_list", "profiles:list"),3334
save: (payload) => call("core_profiles_save", "profiles:save", payload),3335
delete: (id) => call("core_profiles_delete", "profiles:delete", { id }),3336
selectPrivateKey: () => call("core_profiles_select_private_key", "profiles:selectPrivateKey"),3337
export: (format, ids) => call("core_profiles_export", "profiles:export", { format, ids }),3338
previewImport: () => call("core_profiles_preview_import", "profiles:previewImport"),3339
commitImport: (token, policy) => call("core_profiles_commit_import", "profiles:commitImport", { token, policy }),3340
cancelImport: () => call("core_profiles_cancel_import", "profiles:cancelImport")3341
});3343
// src/api/core/availability.ts3344
var availability = Object.freeze({3345
list: () => call("core_availability_list", "availability:list"),3346
refresh: () => call("core_availability_refresh", "availability:refresh"),3347
onChanged: (callback) => subscribe("availability:changed", callback)3348
});3350
// src/api/core/ssh.ts3351
var ssh = Object.freeze({3352
list: () => call("core_ssh_list", "ssh:list"),3353
connect: (payload) => call("core_ssh_connect", "ssh:connect", payload),3354
trustHostKey: (payload) => call("core_ssh_trust_host_key", "ssh:trustHostKey", payload),3355
disconnect: (sessionId) => call("core_ssh_disconnect", "ssh:disconnect", { sessionId }),3356
resize: (sessionId, cols, rows) => call("core_ssh_resize", "ssh:resize", { sessionId, cols, rows }),3357
input: (sessionId, data) => send("core_ssh_input", { sessionId, data }),3358
suggest: (sessionId, input, repairPaths = true) => call("core_terminal_suggest", "ssh:suggest", { sessionId, input, repairPaths }),3359
dictionary: () => call("core_terminal_dictionary_get", "ssh:dictionary"),3360
saveDictionary: (payload) => call("core_terminal_dictionary_save", "ssh:saveDictionary", payload),3361
onData: (callback) => subscribe("ssh:data", callback),3362
onState: (callback) => subscribe("ssh:state", callback),3363
onError: (callback) => subscribe("ssh:error", callback)3364
});3366
// src/api/core/diagnostics.ts3367
var diagnostics = Object.freeze({3368
resolve: (options) => call("core_diagnostics_resolve", "diagnostics:resolve", options),3369
start: (options) => call("core_diagnostics_start", "diagnostics:start", options),3370
cancel: (id, tool) => call("core_diagnostics_cancel", "diagnostics:cancel", { id, tool }),3371
get: (id) => call("core_diagnostics_get", "diagnostics:get", { id }),3372
history: () => call("core_diagnostics_history", "diagnostics:history"),3373
removeHistory: (id) => call("core_diagnostics_remove_history", "diagnostics:removeHistory", { id }),3374
export: (id, format) => call("core_diagnostics_export", "diagnostics:export", { id, format }),3375
copy: (id, format = "txt") => call("core_diagnostics_copy", "diagnostics:copy", { id, format }),3376
import: () => call("core_diagnostics_import", "diagnostics:import"),3377
onProgress: (callback) => subscribe("diagnostics:progress", callback)3378
});3380
// src/api/core/updates.ts3381
var updates = Object.freeze({3382
getState: () => call("core_updates_get_state", "updates:getState"),3383
check: () => call("core_updates_check", "updates:check"),3384
select: (id) => call("core_updates_select", "updates:select", { id }),3385
download: () => call("core_updates_download", "updates:download"),3386
install: () => call("core_updates_install", "updates:install"),3387
reveal: () => call("core_updates_reveal", "updates:reveal"),3388
onState: (callback) => subscribe("core:updateState", callback)3389
});3391
// src/api/core/modules.ts3392
var modules = Object.freeze({3393
list: () => call("core_modules_list", "plugins:list"),3394
getState: () => call("core_modules_get_state", "plugins:getState"),3395
checkCatalog: () => call("core_modules_check_catalog", "plugins:checkCatalog"),3396
install: (releaseId) => call("core_modules_install", "plugins:install", { releaseId }),3397
uninstall: (moduleId) => call("core_modules_uninstall", "plugins:uninstall", { pluginId: moduleId }),3398
open: (moduleId) => call("core_modules_open", "plugins:open", { pluginId: moduleId }),3399
setArea: (area) => call("core_modules_set_area", "plugins:setArea", area ?? {}),3400
detach: (moduleId) => call("core_modules_detach", "plugins:detach", { pluginId: moduleId }),3401
collapse: (moduleId) => call("core_modules_collapse", "plugins:collapse", { pluginId: moduleId }),3402
close: (moduleId) => call("core_modules_close", "plugins:close", { pluginId: moduleId }),3403
onActivate: (callback) => subscribe("core:moduleActivate", callback),3404
onWindowState: (callback) => subscribe("core:pluginWindowState", callback)3405
});3407
// src/api/core/license.ts3408
var license = Object.freeze({3409
read: () => call("license_read", "license:read"),3410
showLicense: (payload) => call("license_show", "license:show", payload),3411
accept: (payload) => call("license_accept", "license:accept", payload),3412
decline: () => call("license_decline", "license:decline")3413
});3415
// src/api/core/window.ts3416
var windowControls = Object.freeze({3417
perform: (action) => call("window_control", "window:control", { action }),3418
isMaximized: () => call("window_is_maximized", "window:isMaximized")3419
});3421
// src/api/core/standby.ts3422
var standby = Object.freeze({3423
get: () => call("core_standby_get", "standby:get"),3424
set: (settings) => call("core_standby_set", "standby:set", settings)3425
});3427
// src/api/module/ui.ts3428
var info = () => call("module_get_info", "plugin:getInfo");3429
var close = () => call("module_close", "plugin:close");3430
var minimize = () => call("module_window_minimize", "plugin:window:minimize");3431
var host = Object.freeze({3432
state: () => call("module_host_state", "plugin:host:state"),3433
detach: () => call("module_host_detach", "plugin:host:detach"),3434
attach: () => call("module_host_attach", "plugin:host:attach")3435
});3436
var ui = Object.freeze({3437
getLanguage: () => call("module_ui_get_language", "plugin:ui:getLanguage"),3438
onLanguageChanged: (callback) => subscribeStrict("module:ui:languageChanged", callback, "Language")3439
});3441
// src/api/module/sessions.ts3442
function displayName(session) {3443
return (session.adhoc ? session.label : `${session.label} — ${session.username}@${session.host}`) + (session.slot ? ` · T${session.slot}` : "") + (session.jump?.length ? ` ⇢ ${session.jump[0].host}` : "");3444
}3445
function reconcile(previousId, list) {3446
const connected = list.filter((session) => session.state === "connected");3447
if (previousId) return connected.some((session) => session.sessionId === previousId) ? { id: previousId, reason: "keep" } : { id: "", reason: "gone" };3448
return connected.length === 1 ? { id: connected[0].sessionId, reason: "auto" } : { id: "", reason: "choose" };3449
}3450
var askedFor = "";3451
function offerChoice(select, list, title) {3452
const connected = list.filter((session) => session.state === "connected");3453
const key = connected.map((session) => session.sessionId).sort().join("|");3454
if (connected.length < 2 || select.value || key === askedFor || document.querySelector("dialog[open]")) return;3455
askedFor = key;3456
const dialog = document.createElement("dialog");3457
dialog.style.cssText = "min-width:340px;max-width:560px;padding:18px;border:1px solid rgba(151,183,218,.25);border-radius:12px;color:#edf6ff;background:#0c1a2a";3458
const heading = document.createElement("div");3459
heading.textContent = title;3460
heading.style.cssText = "margin-bottom:12px;font-size:14px;font-weight:600";3461
dialog.append(heading);3462
for (const session of connected) {3463
const button = document.createElement("button");3464
button.type = "button";3465
button.textContent = displayName(session);3466
button.style.cssText = "display:block;width:100%;margin-top:6px;padding:10px 12px;border:1px solid rgba(151,183,218,.25);border-radius:8px;color:inherit;background:rgba(255,255,255,.04);text-align:start;font:inherit;cursor:pointer";3467
button.addEventListener("click", () => {3468
dialog.close();3469
if (!select.value && [...select.options].some((option) => option.value === session.sessionId)) {3470
select.value = session.sessionId;3471
select.dispatchEvent(new Event("change", { bubbles: true }));3472
}3473
});3474
dialog.append(button);3475
}3476
dialog.addEventListener("close", () => dialog.remove());3477
document.body.append(dialog);3478
dialog.showModal();3479
}3480
var sessions = Object.freeze({3481
list: () => call("module_sessions_list", "plugin:sessions:list"),3482
displayName,3483
reconcile,3484
offerChoice3485
});3487
// src/api/module/system.ts3488
var system = Object.freeze({3489
readMetrics: (sessionId) => call("module_system_metrics", "plugin:system:metrics", { sessionId }),3490
virtualMemory: (sessionId, options = {}) => call("module_system_virtual_memory", "plugin:system:virtualMemory", { ...options, sessionId }),3491
manageVirtualMemory: (sessionId, payload) => call("module_system_manage_virtual_memory", "plugin:system:manageVirtualMemory", { ...payload, sessionId })3492
});3494
// src/api/module/disks.ts3495
var disks = Object.freeze({3496
inspect: (sessionId, options = {}) => call("module_disks_inspect", "plugin:disks:inspect", { ...options, sessionId }),3497
smart: (sessionId, device, options = {}) => call("module_disks_smart", "plugin:disks:smart", { ...options, sessionId, device }),3498
plan: (sessionId, operations, options = {}) => call("module_disks_plan", "plugin:disks:plan", { ...options, sessionId, operations }),3499
autoExpand: (sessionId, suggestionId, options = {}) => call("module_disks_auto_expand", "plugin:disks:autoExpand", { ...options, sessionId, suggestionId }),3500
cancelPlan: (planId) => call("module_disks_cancel_plan", "plugin:disks:cancelPlan", { planId }),3501
apply: (sessionId, planId, options = {}) => call("module_disks_apply", "plugin:disks:apply", { ...options, sessionId, planId }),3502
jobs: (sessionId, options = {}) => call("module_disks_jobs", "plugin:disks:jobs", { ...options, sessionId }),3503
jobStatus: (sessionId, jobId, offset = 0, options = {}) => call("module_disks_job_status", "plugin:disks:jobStatus", { ...options, sessionId, jobId, offset })3504
});3506
// src/api/module/keys.ts3507
var keys = Object.freeze({3508
edit: (payload) => call("module_keys_edit", "plugin:keys:edit", payload),3509
state: () => call("module_keys_state", "plugin:keys:state"),3510
onModeChanged: (callback) => subscribeStrict("module:keys:modeChanged", callback, "generator mode"),3511
saveArtifact: (generationId, index) => call("module_keys_save_artifact", "plugin:keys:saveArtifact", { generationId, index }),3512
saveBundle: (generationId) => call("module_keys_save_bundle", "plugin:keys:saveBundle", { generationId }),3513
storeKeychain: (generationId) => call("module_keys_store_keychain", "plugin:keys:storeKeychain", { generationId }),3514
generate: (payload) => call("module_keys_generate", "plugin:keys:generate", payload),3515
save: (generationId) => call("module_keys_save", "plugin:keys:save", { generationId }),3516
password: (options) => call("module_keys_password", "plugin:keys:password", options),3517
copyPassword: (passwordId) => call("module_keys_copy_password", "plugin:keys:copyPassword", { passwordId })3518
});3520
// src/api/module/logs.ts3521
var logs = Object.freeze({3522
read: (options) => call("module_logs_read", "plugin:logs:read", options ?? {})3523
});3525
// src/api/module/users.ts3526
var users = Object.freeze({3527
list: (sessionId) => call("module_users_list", "plugin:users:list", { sessionId }),3528
manage: (sessionId, payload) => call("module_users_manage", "plugin:users:manage", { ...payload, sessionId }),3529
privileges: (sessionId, refresh = false) => call("module_users_privileges", "plugin:users:privileges", { sessionId, refresh }),3530
inventory: (sessionId, options = {}) => call("module_users_inventory", "plugin:users:inventory", { ...options, sessionId }),3531
detail: (sessionId, username, options = {}) => call("module_users_detail", "plugin:users:detail", { ...options, sessionId, username }),3532
keys: (sessionId, payload) => call("module_users_keys", "plugin:users:keys", { ...payload, sessionId }),3533
sshPolicy: (sessionId, payload) => call("module_users_ssh_policy", "plugin:users:sshPolicy", { ...payload, sessionId }),3534
keychainPublicKeys: () => call("module_keychain_public_ssh", "plugin:keychain:publicSsh"),3535
sshPasswordOffAll: (sessionId, payload) => call("module_users_ssh_password_off_all", "plugin:users:sshPasswordOffAll", { ...payload, sessionId })3536
});3538
// src/api/module/apache.ts3539
var command = (name, action) => (sessionId, payload = {}) => call(`module_apache_${name}`, `plugin:apache:${action}`, { ...payload, sessionId });3540
var apache = Object.freeze({3541
inspect: (sessionId) => call("module_apache_inspect", "plugin:apache:inspect", { sessionId }),3542
inventory: command("inventory", "inventory"),3543
readLog: command("read_log", "readLog"),3544
probeBackends: command("probe_backends", "probeBackends"),3545
readFile: command("read_file", "readFile"),3546
backups: command("backups", "backups"),3547
readBackup: command("read_backup", "readBackup"),3548
planSite: command("plan_site", "planSite"),3549
planEdit: command("plan_edit", "planEdit"),3550
planFix: command("plan_fix", "planFix"),3551
saveFile: command("save_file", "saveFile"),3552
restoreBackup: command("restore_backup", "restoreBackup"),3553
createSite: command("create_site", "createSite"),3554
setSiteEnabled: command("set_site_enabled", "setSiteEnabled"),3555
adoptSite: command("adopt_site", "adoptSite"),3556
dropBrokenLink: command("drop_broken_link", "dropBrokenLink"),3557
setModule: command("set_module", "setModule"),3558
reload: command("reload", "reload"),3559
installCertbot: command("install_certbot", "installCertbot"),3560
issueCertificate: command("issue_certificate", "issueCertificate")3561
});3563
// src/api/module/rsync.ts3564
var command2 = (name, action) => (payload = {}) => call(`module_rsync_${name}`, `plugin:rsync:${action}`, payload);3565
var rsync = Object.freeze({3566
sshProfiles: command2("ssh_profiles", "sshProfiles"),3567
localProbe: command2("local_probe", "localProbe"),3568
remoteProbe: command2("remote_probe", "remoteProbe"),3569
inspect: command2("inspect", "inspect"),3570
jobs: command2("jobs", "jobs"),3571
job: command2("job", "job"),3572
describe: command2("describe", "describe"),3573
versions: command2("versions", "versions"),3574
profiles: command2("profiles", "profiles"),3575
history: command2("history", "history"),3576
scheduleList: command2("schedule_list", "scheduleList"),3577
discover: command2("discover", "discover"),3578
scheduleLog: command2("schedule_log", "scheduleLog"),3579
takeHandoff: command2("take_handoff", "takeHandoff"),3580
preview: command2("preview", "preview"),3581
run: command2("run", "run"),3582
cancel: command2("cancel", "cancel"),3583
install: command2("install", "install"),3584
connect: command2("connect", "connect"),3585
trustHost: command2("trust_host", "trustHost"),3586
disconnect: command2("disconnect", "disconnect"),3587
saveProfile: command2("save_profile", "saveProfile"),3588
deleteProfile: command2("delete_profile", "deleteProfile"),3589
clearHistory: command2("clear_history", "clearHistory"),3590
pruneVersions: command2("prune_versions", "pruneVersions"),3591
scheduleInstall: command2("schedule_install", "scheduleInstall"),3592
scheduleStart: command2("schedule_start", "scheduleStart"),3593
scheduleRemove: command2("schedule_remove", "scheduleRemove"),3594
openManager: command2("open_manager", "openManager")3595
});3597
// src/api/module/network.ts3598
var command3 = (name, action) => (payload = {}) => call(`module_network_${name}`, `plugin:network:${action}`, payload);3599
var network = Object.freeze({3600
inspect: command3("inspect", "inspect"),3601
pending: command3("pending", "pending"),3602
diagnose: command3("diagnose", "diagnose"),3603
planInterface: command3("plan_interface", "planInterface"),3604
planFirewall: command3("plan_firewall", "planFirewall"),3605
apply: command3("apply", "apply"),3606
verify: command3("verify", "verify"),3607
confirm: command3("confirm", "confirm"),3608
rollback: command3("rollback", "rollback"),3609
extend: command3("extend", "extend"),3610
transactionLog: command3("transaction_log", "transactionLog")3611
});3613
// src/api/module/nginx.ts3614
var command4 = (name, action) => (sessionId, payload = {}) => call(`module_nginx_${name}`, `plugin:nginx:${action}`, { ...payload, sessionId });3615
var nginx = Object.freeze({3616
inspect: (sessionId) => call("module_nginx_inspect", "plugin:nginx:inspect", { sessionId }),3617
readConfig: (sessionId, payload) => call("module_nginx_read_config", "plugin:nginx:readConfig", { ...payload, sessionId }),3618
dumpConfig: (sessionId, sudoPassword, rememberSudo = false) => call("module_nginx_dump_config", "plugin:nginx:dumpConfig", { sessionId, sudoPassword, rememberSudo }),3619
testConfig: (sessionId, sudoPassword, rememberSudo = false) => call("module_nginx_test_config", "plugin:nginx:testConfig", { sessionId, sudoPassword, rememberSudo }),3620
saveConfig: (sessionId, payload) => call("module_nginx_save_config", "plugin:nginx:saveConfig", { ...payload, sessionId }),3621
reload: (sessionId, sudoPassword, confirm = false, rememberSudo = false) => call("module_nginx_reload", "plugin:nginx:reload", { sessionId, sudoPassword, confirm, rememberSudo }),3622
sites: command4("sites", "sites"),3623
planSite: command4("plan_site", "planSite"),3624
createSite: command4("create_site", "createSite"),3625
setSiteEnabled: command4("set_site_enabled", "setSiteEnabled"),3626
adoptSite: command4("adopt_site", "adoptSite"),3627
dropBrokenLink: command4("drop_broken_link", "dropBrokenLink"),3628
planRoute: command4("plan_route", "planRoute"),3629
applyRoute: command4("apply_route", "applyRoute"),3630
diagnoseDomain: command4("diagnose_domain", "diagnoseDomain"),3631
planEdit: command4("plan_edit", "planEdit"),3632
backups: command4("backups", "backups"),3633
readBackup: command4("read_backup", "readBackup"),3634
restoreBackup: command4("restore_backup", "restoreBackup"),3635
certificates: command4("certificates", "certificates"),3636
installCertbot: command4("install_certbot", "installCertbot"),3637
issueCertificate: command4("issue_certificate", "issueCertificate"),3638
readLog: command4("read_log", "readLog"),3639
probeBackends: command4("probe_backends", "probeBackends")3640
});3642
// src/api/module/sftp.ts3643
var transfers = Object.freeze({3644
list: () => call("module_transfers_list", "plugin:files:transfers:list"),3645
planUpload: (sessionId, directory, options = {}) => call("module_transfers_plan_upload", "plugin:files:transfers:planUpload", { sessionId, directory, options }),3646
planCopy: (source, destination, options = {}) => call("module_transfers_plan_copy", "plugin:files:transfers:planCopy", { source, destination, options }),3647
planDownload: (sessionId, paths, options = {}) => call("module_transfers_plan_download", "plugin:files:transfers:planDownload", { sessionId, paths, options }),3648
start: (planId, options = {}) => call("module_transfers_start", "plugin:files:transfers:start", { planId, options }),3649
pause: (ids) => call("module_transfers_pause", "plugin:files:transfers:pause", { ids }),3650
resume: (ids, options = {}) => call("module_transfers_resume", "plugin:files:transfers:resume", { ids, options }),3651
retry: (ids, options = {}) => call("module_transfers_retry", "plugin:files:transfers:retry", { ids, options }),3652
cancel: (ids) => call("module_transfers_cancel", "plugin:files:transfers:cancel", { ids }),3653
remove: (ids) => call("module_transfers_remove", "plugin:files:transfers:remove", { ids }),3654
updateSettings: (settings) => call("module_transfers_settings", "plugin:files:transfers:settings", { settings }),3655
onUpdate: (callback) => subscribeStrict("module:files:transfers:update", callback, "Transfer")3656
});3657
var local = Object.freeze({3658
places: () => call("module_local_places", "plugin:files:local:places"),3659
list: (path) => call("module_local_list", "plugin:files:local:list", { path }),3660
mkdir: (parent, name) => call("module_local_mkdir", "plugin:files:local:mkdir", { parent, name }),3661
createFile: (parent, name) => call("module_local_create_file", "plugin:files:local:createFile", { parent, name }),3662
rename: (path, name) => call("module_local_rename", "plugin:files:local:rename", { path, name }),3663
remove: (paths) => call("module_local_remove", "plugin:files:local:remove", { paths })3664
});3665
var files = Object.freeze({3666
list: (sessionId, path, options = {}) => call("module_files_list", "plugin:files:list", { sessionId, path, options }),3667
privileges: (sessionId) => call("module_files_privileges", "plugin:files:privileges", { sessionId }),3668
readText: (sessionId, path, options = {}) => call("module_files_read_text", "plugin:files:readText", { sessionId, path, options }),3669
writeText: (sessionId, path, text, options = {}) => call("module_files_write_text", "plugin:files:writeText", { sessionId, path, text, options }),3670
saveText: (sessionId, path, text, options = {}) => call("module_files_save_text", "plugin:files:saveText", { sessionId, path, text, options }),3671
listRecovery: (sessionId, options = {}) => call("module_files_list_recovery", "plugin:files:listRecovery", { sessionId, options }),3672
readRecovery: (sessionId, recoveryId, options = {}) => call("module_files_read_recovery", "plugin:files:readRecovery", { sessionId, recoveryId, options }),3673
cleanupRecovery: (sessionId, recoveryId, options = {}) => call("module_files_cleanup_recovery", "plugin:files:cleanupRecovery", { sessionId, recoveryId, options }),3674
closeText: (editId) => call("module_files_close_text", "plugin:files:closeText", { editId }),3675
createFile: (sessionId, path, options = {}) => call("module_files_create_file", "plugin:files:createFile", { sessionId, path, options }),3676
mkdir: (sessionId, path, options = {}) => call("module_files_mkdir", "plugin:files:mkdir", { sessionId, path, options }),3677
rename: (sessionId, from, to, options = {}) => call("module_files_rename", "plugin:files:rename", { sessionId, from, to, options }),3678
remove: (sessionId, path, options = {}) => call("module_files_remove", "plugin:files:remove", { sessionId, path, options }),3679
removeMany: (sessionId, paths, recursive = false, options = {}) => call("module_files_remove_many", "plugin:files:removeMany", { sessionId, paths, recursive, options }),3680
upload: (sessionId, directory) => call("module_files_upload", "plugin:files:upload", { sessionId, directory }),3681
download: (sessionId, path) => call("module_files_download", "plugin:files:download", { sessionId, path }),3682
downloadMany: (sessionId, paths) => call("module_files_download_many", "plugin:files:downloadMany", { sessionId, paths }),3683
downloadArchive: (sessionId, paths, format) => call("module_files_download_archive", "plugin:files:downloadArchive", { sessionId, paths, format }),3684
transfers,3685
local3686
});3688
// src/api/module/hashing.ts3689
var hashing = Object.freeze({3690
getAlgorithms: () => call("module_hashing_algorithms", "plugin:hashing:algorithms"),3691
selectFiles: (multiple = false) => call("module_hashing_select_files", "plugin:hashing:selectFiles", { multiple }),3692
selectDirectory: () => call("module_hashing_select_directory", "plugin:hashing:selectDirectory"),3693
selectManifest: () => call("module_hashing_select_manifest", "plugin:hashing:selectManifest"),3694
selectManifestDestination: (suggestedName) => call("module_hashing_select_manifest_destination", "plugin:hashing:selectManifestDestination", { suggestedName }),3695
selectPgpFile: (kind) => call("module_hashing_select_pgp_file", "plugin:hashing:selectPgpFile", { kind }),3696
pgpVerify: (payload) => call("module_hashing_pgp_verify", "plugin:hashing:pgpVerify", payload),3697
pgpKeys: () => call("module_hashing_pgp_keys", "plugin:hashing:pgpKeys"),3698
pgpRemoveKey: (fingerprint) => call("module_hashing_pgp_remove_key", "plugin:hashing:pgpRemoveKey", { fingerprint }),3699
start: (payload) => call("module_hashing_start", "plugin:hashing:start", payload),3700
verify: (payload) => call("module_hashing_verify", "plugin:hashing:verify", payload),3701
compare: (payload) => call("module_hashing_compare", "plugin:hashing:compare", payload),3702
generateManifest: (payload) => call("module_hashing_generate_manifest", "plugin:hashing:generateManifest", payload),3703
verifyManifest: (payload) => call("module_hashing_verify_manifest", "plugin:hashing:verifyManifest", payload),3704
exportResults: (payload) => call("module_hashing_export_results", "plugin:hashing:exportResults", payload),3705
copyResult: (payload) => call("module_hashing_copy_result", "plugin:hashing:copyResult", payload),3706
status: (jobId) => call("module_hashing_status", "plugin:hashing:status", { jobId }),3707
cancel: (jobId) => call("module_hashing_cancel", "plugin:hashing:cancel", { jobId }),3708
onProgress: (callback) => subscribeStrict("module:hashing:progress", callback, "Progress")3709
});3711
// src/api/index.ts3712
var MODULE_API_VERSION = "1.16.0";3713
var core = Object.freeze({ app, config, vault, biometrics, profiles, availability, ssh, diagnostics, updates, modules, windowControls, standby });3714
var moduleApi = Object.freeze({3715
version: MODULE_API_VERSION,3716
getInfo: info,3717
close,3718
minimize,3719
host,3720
ui,3721
sessions,3722
system,3723
disks,3724
keys,3725
logs,3726
users,3727
apache,3728
rsync,3729
network,3730
nginx,3731
files,3732
hashing3733
});3735
// src/api/compat/boot.ts3736
function bootInfo() {3737
const value = globalThis.__CHJ_BOOT__;3738
return Object.freeze({ platform: String(value?.platform || "unknown"), window: String(value?.window || ""), moduleId: value?.moduleId });3739
}3741
// src/api/compat/windowChrome.ts3742
var CSS = `3743
chj-window-controls { position: fixed !important; top: 0 !important; right: 0 !important; height: 40px !important; z-index: 2147483647 !important; display: flex !important; }3744
chj-window-controls button { width: 46px; height: 40px; border: 0; margin: 0; padding: 0; display: grid; place-items: center; color: #d9eaff; background: transparent; cursor: default; -webkit-app-region: no-drag; }3745
chj-window-controls button:hover { background: rgba(217, 234, 255, .12); }3746
chj-window-controls button.close:hover { background: #c42b1c; color: #fff; }3747
chj-window-controls svg { width: 10px; height: 10px; stroke: currentColor; fill: none; stroke-width: 1.1; shape-rendering: crispEdges; }3748
`;3749
var ICONS = {3750
minimize: '<svg viewBox="0 0 10 10"><path d="M0 5.5h10"/></svg>',3751
toggleMaximize: '<svg viewBox="0 0 10 10"><rect x="0.5" y="0.5" width="9" height="9"/></svg>',3752
close: '<svg viewBox="0 0 10 10"><path d="M0 0l10 10M10 0L0 10"/></svg>'3753
};3754
function isDragTarget(target, selectors) {3755
if (!(target instanceof Element)) return false;3756
if (target.closest("button, a, input, select, textarea, [contenteditable], chj-window-controls")) return false;3757
return selectors.some((selector) => Boolean(target.closest(selector)));3758
}3759
var controlsEnabled = true;3760
var controlsHost = null;3761
function setWindowControlsEnabled(enabled) {3762
controlsEnabled = enabled;3763
if (!controlsHost) return;3764
if (enabled) {3765
if (!controlsHost.isConnected) document.body.append(controlsHost);3766
} else controlsHost.remove();3767
}3768
function installWindowChrome(platform, dragSelectors, dragRoots) {3769
window.addEventListener("chj:query-dirty", (event) => {3770
let dirty = true;3771
try {3772
const page = window;3773
const query = page.__CHJ_HAS_UNSAVED_CHANGES__ || (bootInfo().moduleId === "chj.nginx-manager" ? page.isDirty : void 0);3774
dirty = query ? Boolean(query()) : false;3775
} catch {3776
}3777
void call("window_control", "window:control", { action: "closeQueryReply", queryId: event.detail, dirty }).catch(() => {3778
});3779
});3780
if (platform !== "win32" && platform !== "linux") return;3781
const mount = () => {3782
if (document.querySelector("chj-window-controls")) return;3783
const host2 = document.createElement("chj-window-controls");3784
const shadow = host2.attachShadow({ mode: "closed" });3785
const css = CSS.replace(/chj-window-controls /g, ":host ").replace(/chj-window-controls \{/g, ":host {");3786
if ("CSSStyleSheet" in globalThis && "replaceSync" in CSSStyleSheet.prototype) {3787
const sheet = new CSSStyleSheet();3788
sheet.replaceSync(css);3789
shadow.adoptedStyleSheets = [sheet];3790
} else {3791
const style = document.createElement("style");3792
style.textContent = css;3793
shadow.append(style);3794
}3795
let language = document.documentElement.lang || "en";3796
let maximized = false;3797
const buttons = /* @__PURE__ */ new Map();3798
const translate = () => {3799
const catalogs = globalThis.__CHJ_I18N__?.catalogs?.chrome || {};3800
for (const [action, button] of buttons) {3801
const key = `chrome.${action === "toggleMaximize" ? maximized ? "restore" : "maximize" : action}`;3802
const label = catalogs[language]?.[key] || catalogs[language.split("-")[0]]?.[key] || catalogs.en?.[key] || key;3803
button.setAttribute("aria-label", label);3804
button.title = label;3805
if (action === "toggleMaximize") button.setAttribute("aria-pressed", String(maximized));3806
}3807
};3808
const updateMaximized = () => {3809
void windowControls.isMaximized().then((value) => {3810
maximized = value;3811
translate();3812
}).catch(() => {3813
});3814
};3815
subscribe("module:ui:languageChanged", (value) => {3816
language = value;3817
translate();3818
});3819
new MutationObserver(() => {3820
language = document.documentElement.lang || language;3821
translate();3822
}).observe(document.documentElement, { attributes: true, attributeFilter: ["lang"] });3823
window.addEventListener("resize", updateMaximized);3824
for (const action of ["minimize", "toggleMaximize", "close"]) {3825
const button = document.createElement("button");3826
button.type = "button";3827
button.className = action === "close" ? "close" : action;3828
buttons.set(action, button);3829
button.innerHTML = ICONS[action];3830
button.addEventListener("click", () => {3831
void windowControls.perform(action).then(updateMaximized).catch(() => {3832
});3833
});3834
shadow.append(button);3835
}3836
translate();3837
updateMaximized();3838
const outer = document.createElement("style");3839
outer.textContent = "chj-window-controls { position: fixed; top: 0; right: 0; height: 40px; z-index: 2147483647; display: flex; }";3840
document.head.append(outer);3841
controlsHost = host2;3842
setWindowControlsEnabled(controlsEnabled);3843
const handler = (event) => {3844
const mouse = event;3845
if (mouse.button !== 0 || !controlsEnabled) return;3846
const path = mouse.composedPath();3847
const target = path[0] || mouse.target;3848
if (!isDragTarget(target, dragSelectors)) return;3849
if (mouse.detail === 2) void windowControls.perform("toggleMaximize").catch(() => {3850
});3851
else void windowControls.perform("startDrag").catch(() => {3852
});3853
};3854
for (const root of dragRoots()) root.addEventListener("mousedown", handler);3855
};3856
if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", mount, { once: true });3857
else mount();3858
}3860
// src/api/compat/activity.ts3861
function installActivityReporter() {3862
let last = 0;3863
const report = () => {3864
const now = Date.now();3865
if (now - last < 2e3) return;3866
last = now;3867
send("window_activity", {});3868
};3869
for (const type of ["keydown", "mousedown", "mousemove", "wheel", "touchstart"]) {3870
window.addEventListener(type, report, { capture: true, passive: true });3871
}3872
}3874
// src/api/compat/module-bridge.ts3875
var boot = bootInfo();3876
var api = Object.freeze({3877
apiVersion: moduleApi.version,3878
getInfo: moduleApi.getInfo,3879
host: moduleApi.host,3880
ui: moduleApi.ui,3881
close: moduleApi.close,3882
sessions: moduleApi.sessions,3883
system: moduleApi.system,3884
disks: moduleApi.disks,3885
keys: moduleApi.keys,3886
logs: moduleApi.logs,3887
users: moduleApi.users,3888
apache: moduleApi.apache,3889
rsync: moduleApi.rsync,3890
network: moduleApi.network,3891
nginx: moduleApi.nginx,3892
files: moduleApi.files,3893
hashing: moduleApi.hashing3894
});3895
for (const name of ["chjModule", "chjPlugin"]) {3896
Object.defineProperty(window, name, { value: api, writable: false, configurable: false, enumerable: true });3897
}3898
function chromeCopy(language) {3899
const catalogs = globalThis.__CHJ_I18N__?.catalogs?.chrome || {};3900
const entry = catalogs[language] || catalogs.en || {};3901
return [entry["chrome.collapse"] || "Collapse", entry["chrome.collapseDescription"] || "Collapse into the application's bottom bar"];3902
}3903
var chromeRoot = null;3904
window.addEventListener("DOMContentLoaded", () => {3905
document.documentElement.toggleAttribute("data-chj-embedded", true);3906
const styleUrl = new URL("/__chj_core__/window-chrome.css", window.location.href).href;3907
const host2 = document.createElement("chj-plugin-chrome");3908
host2.id = "chj-plugin-window-chrome";3909
const shadow = host2.attachShadow({ mode: "open" });3910
chromeRoot = shadow;3911
let loaded = 0;3912
const theme = document.createElement("link");3913
theme.rel = "stylesheet";3914
theme.href = new URL("/__chj_core__/theme.css", window.location.href).href;3915
document.head.prepend(theme);3916
const stylesheet = () => {3917
const link = document.createElement("link");3918
link.rel = "stylesheet";3919
link.href = styleUrl;3920
link.addEventListener("load", () => {3921
if (++loaded === 2) host2.dataset.ready = "true";3922
});3923
return link;3924
};3925
document.head.append(stylesheet());3926
const header = document.createElement("header");3927
header.id = "chj-chrome-header";3928
if (boot.platform === "win32" || boot.platform === "linux") header.className = "native-controls";3929
const mark = document.createElement("span");3930
mark.id = "chj-chrome-mark";3931
mark.textContent = "CH-J";3932
const title = document.createElement("span");3933
title.id = "chj-chrome-title";3934
title.textContent = document.title || "CH-J Tools";3935
const collapse = document.createElement("button");3936
collapse.type = "button";3937
collapse.id = "chj-chrome-collapse";3938
const hostButton = document.createElement("button");3939
hostButton.type = "button";3940
hostButton.id = "chj-chrome-host";3941
let embedded = true;3942
let currentLanguage = "en";3943
const renderHost = () => {3944
const entry = globalThis.__CHJ_I18N__?.catalogs?.chrome?.[currentLanguage] || globalThis.__CHJ_I18N__?.catalogs?.chrome?.en || {};3945
const label = embedded ? entry["chrome.detach"] || "Open in a window" : entry["chrome.attach"] || "Return to the app";3946
hostButton.textContent = label;3947
hostButton.title = label;3948
hostButton.setAttribute("aria-label", label);3949
if (boot.platform === "win32" || boot.platform === "linux") header.classList.toggle("native-controls", !embedded);3950
setWindowControlsEnabled(!embedded);3951
document.documentElement.toggleAttribute("data-chj-embedded", embedded);3952
};3953
const applyHost = (state) => {3954
embedded = state.embedded !== false;3955
renderHost();3956
};3957
hostButton.addEventListener("click", () => {3958
void (embedded ? moduleApi.host.detach() : moduleApi.host.attach()).then(applyHost).catch((error) => console.error("Module window change failed.", error));3959
});3960
subscribe("module:ui:hostChanged", applyHost);3961
void moduleApi.host.state().then(applyHost).catch(() => {3962
});3963
const translate = (language) => {3964
currentLanguage = language;3965
renderHost();3966
const [label, description] = chromeCopy(language);3967
collapse.textContent = label;3968
collapse.title = description;3969
collapse.setAttribute("aria-label", description);3970
};3971
translate("en");3972
collapse.addEventListener("click", () => {3973
void moduleApi.minimize().catch((error) => console.error("Module collapse failed.", error));3974
});3975
subscribe("module:ui:languageChanged", translate);3976
void moduleApi.ui.getLanguage().then(translate).catch(() => {3977
});3978
void moduleApi.getInfo().then((manifest) => {3979
title.textContent = manifest.name;3980
}).catch(() => {3981
});3982
header.append(mark, title, hostButton, collapse);3983
shadow.append(stylesheet(), header);3984
document.body.prepend(host2);3985
});3986
installWindowChrome(boot.platform, ["#chj-chrome-header"], () => chromeRoot ? [document, chromeRoot] : [document]);3987
installActivityReporter();3988
})();SHA-256
e772865b354c0328e25b81c62f888d392c31a8a55d859e5a50ad264c9c982a69CH-J Proprietary Software License 1.14 · Die Quellen werden unter der CH-J Proprietary Software License 1.14 bereitgestellt. Ihre Verfügbarkeit ändert die Lizenzbedingungen nicht und gewährt keine zusätzlichen Rechte.
SHA-256 des Archivs
ac8fe790f4ba60fc098f8c985fc2656cfcc6cdc21fb34b30e308a2b54e62258f