x-essential-lib 0.11.9 → 0.11.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { n as EventType, t as Emitter } from "./vendor.fpmj8dgj.js";
1
+ import { n as EventType, t as Emitter } from "./vendor.kpti1e1f.js";
2
2
  import { Ref } from "vue";
3
3
  import { VuetifyOptions } from "vuetify";
4
4
  import { AxiosInstance } from "axios";
@@ -185,8 +185,12 @@ export declare function useSystem(): {
185
185
  isMobile: () => boolean;
186
186
  compactWidth: import("vue").ComputedRef<string>;
187
187
  minimizeApp: () => Promise<void>;
188
- insetTop: import("vue").Ref<number, number>;
189
- insetBottom: import("vue").Ref<number, number>;
188
+ safeAreaInset: {
189
+ top: number;
190
+ bottom: number;
191
+ left: number;
192
+ right: number;
193
+ };
190
194
  nameList: (entries: string[], instances?: string[]) => string;
191
195
  sentenceOfAsk: (verb: string, object: string, name: string) => string;
192
196
  };
package/dist/index.js CHANGED
@@ -1,12 +1,11 @@
1
- (function(){try{document.getElementById(`x-essential-lib`)?.remove();const e = document.createElement(`style`);e.setAttribute(`id`, `x-essential-lib`);const t = document.createTextNode(`.fade-leave-active[data-v-x-essential-lib-c3545c8d]{transition:opacity .5s}.fade-leave-to[data-v-x-essential-lib-c3545c8d]{opacity:0}.x-cont[data-v-x-essential-lib-c3545c8d]{justify-content:center;align-items:center;display:flex;position:absolute;inset:0}.lds-spinner[data-v-x-essential-lib-c3545c8d]{color:official;width:40px;height:40px;display:inline-block;position:relative}.lds-spinner div[data-v-x-essential-lib-c3545c8d]{transform-origin:20px 20px;animation:1.2s linear infinite lds-spinner-x-essential-lib-c3545c8d}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:after{content:" ";background:#9e9e9e;border-radius:5%;width:2px;height:6px;display:block;position:absolute;top:3px;left:18px}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:first-child{animation-delay:-1.1s;transform:rotate(0)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(2){animation-delay:-1s;transform:rotate(30deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(3){animation-delay:-.9s;transform:rotate(60deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(4){animation-delay:-.8s;transform:rotate(90deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(5){animation-delay:-.7s;transform:rotate(120deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(6){animation-delay:-.6s;transform:rotate(150deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(7){animation-delay:-.5s;transform:rotate(180deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(8){animation-delay:-.4s;transform:rotate(210deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(9){animation-delay:-.3s;transform:rotate(240deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(10){animation-delay:-.2s;transform:rotate(270deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(11){animation-delay:-.1s;transform:rotate(300deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(12){animation-delay:0s;transform:rotate(330deg)}@keyframes lds-spinner-x-essential-lib-c3545c8d{0%{opacity:1}to{opacity:0}}.x-item[data-v-x-essential-lib-cfcda9d9]{width:600px}@media (width<=600px){.x-item[data-v-x-essential-lib-cfcda9d9]{width:calc(100vw - 16px)}}.x-cont[data-v-x-essential-lib-b973907d]{z-index:9999;position:fixed;bottom:50px;left:50%;transform:translate(-50%)}`);e.appendChild(t);document.head.appendChild(e);}catch(e){console.error('rolldown-plugin-inject-css', e);}})()
2
- import { a as custom, c as api, i as debounce, l as mitt_default, o as email$1, r as toLower, s as string, u as usePreferredDark } from "./vendor.fpmj8dgj.js";
3
- import { Fragment, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, isRef, normalizeStyle, onBeforeMount, onBeforeUnmount, onMounted, onUnmounted, openBlock, provide, ref, renderList, resolveComponent, toDisplayString, unref, useTemplateRef, watch, watchEffect, withCtx, withKeys, withModifiers } from "vue";
1
+ (function(){try{document.getElementById(`x-essential-lib`)?.remove();const e = document.createElement(`style`);e.setAttribute(`id`, `x-essential-lib`);const t = document.createTextNode(`.fade-leave-active[data-v-x-essential-lib-c3545c8d]{transition:opacity .5s}.fade-leave-to[data-v-x-essential-lib-c3545c8d]{opacity:0}.x-cont[data-v-x-essential-lib-c3545c8d]{justify-content:center;align-items:center;display:flex;position:absolute;inset:0;overflow:hidden}.lds-spinner[data-v-x-essential-lib-c3545c8d]{color:official;width:40px;height:40px;display:inline-block;position:relative}.lds-spinner div[data-v-x-essential-lib-c3545c8d]{transform-origin:20px 20px;animation:1.2s linear infinite lds-spinner-x-essential-lib-c3545c8d}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:after{content:" ";background:#9e9e9e;border-radius:5%;width:2px;height:6px;display:block;position:absolute;top:3px;left:18px}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:first-child{animation-delay:-1.1s;transform:rotate(0)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(2){animation-delay:-1s;transform:rotate(30deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(3){animation-delay:-.9s;transform:rotate(60deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(4){animation-delay:-.8s;transform:rotate(90deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(5){animation-delay:-.7s;transform:rotate(120deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(6){animation-delay:-.6s;transform:rotate(150deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(7){animation-delay:-.5s;transform:rotate(180deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(8){animation-delay:-.4s;transform:rotate(210deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(9){animation-delay:-.3s;transform:rotate(240deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(10){animation-delay:-.2s;transform:rotate(270deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(11){animation-delay:-.1s;transform:rotate(300deg)}.lds-spinner div[data-v-x-essential-lib-c3545c8d]:nth-child(12){animation-delay:0s;transform:rotate(330deg)}@keyframes lds-spinner-x-essential-lib-c3545c8d{0%{opacity:1}to{opacity:0}}.x-item[data-v-x-essential-lib-cfcda9d9]{width:600px}@media (width<=600px){.x-item[data-v-x-essential-lib-cfcda9d9]{width:calc(100vw - 16px)}}.x-cont[data-v-x-essential-lib-b973907d]{z-index:9999;position:fixed;bottom:50px;left:50%;transform:translate(-50%)}`);e.appendChild(t);document.head.appendChild(e);}catch(e){console.error('rolldown-plugin-inject-css', e);}})()
2
+ import { a as invoke, c as string, d as usePreferredDark, i as debounce, l as api, o as custom, r as toLower, s as email$1, u as mitt_default } from "./vendor.kpti1e1f.js";
3
+ import { Fragment, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, isRef, normalizeStyle, onBeforeMount, onBeforeUnmount, onMounted, onUnmounted, openBlock, provide, reactive, ref, renderList, resolveComponent, toDisplayString, unref, useTemplateRef, watch, watchEffect, withCtx, withKeys, withModifiers } from "vue";
4
4
  import { useI18n } from "vue-i18n";
5
5
  import { useDisplay, useTheme } from "vuetify";
6
6
  import axios from "axios";
7
7
  import { globalObjects as globalObjects$1 } from "x-essential-lib";
8
8
  import { useRoute, useRouter } from "vue-router";
9
- import { invoke } from "@tauri-apps/api/core";
10
9
 
11
10
  //#region src/composables/color.ts
12
11
  function useColor() {
@@ -707,15 +706,21 @@ function useSystem() {
707
706
  navigator.Backbutton?.goHome(() => {}, () => {});
708
707
  invoke("goHome");
709
708
  }
710
- const insetTop = ref(0);
711
- const insetBottom = ref(0);
709
+ const safeAreaInset = reactive({
710
+ top: 0,
711
+ bottom: 0,
712
+ left: 0,
713
+ right: 0
714
+ });
712
715
  function getSafeAreaVar(name) {
713
716
  const str = getComputedStyle(document.documentElement).getPropertyValue(name).trim();
714
717
  return parseFloat(str) || 0;
715
718
  }
716
719
  function syncSafeArea() {
717
- insetTop.value = getSafeAreaVar("--safe-top");
718
- insetBottom.value = getSafeAreaVar("--safe-bottom");
720
+ safeAreaInset.top = getSafeAreaVar("--safe-area-inset-top");
721
+ safeAreaInset.bottom = getSafeAreaVar("--safe-area-inset-bottom");
722
+ safeAreaInset.left = getSafeAreaVar("--safe-area-inset-left");
723
+ safeAreaInset.right = getSafeAreaVar("--safe-area-inset-right");
719
724
  }
720
725
  const handleResize = debounce(() => {
721
726
  syncSafeArea();
@@ -755,8 +760,7 @@ function useSystem() {
755
760
  isMobile,
756
761
  compactWidth,
757
762
  minimizeApp,
758
- insetTop,
759
- insetBottom,
763
+ safeAreaInset,
760
764
  nameList,
761
765
  sentenceOfAsk
762
766
  };
@@ -1,4 +1,4 @@
1
- import { Fragment, computed, defineComponent, getCurrentInstance, getCurrentScope, hasInjectionContext, inject, isRef, onBeforeMount, onBeforeUnmount, onMounted, onUnmounted, provide, ref, shallowRef, toValue, unref, watch, watchEffect } from "vue";
1
+ import { Fragment, computed, defineComponent, getCurrentInstance, getCurrentScope, hasInjectionContext, inject, isRef, onBeforeMount, onBeforeUnmount, onMounted, onUnmounted, provide, reactive, ref, shallowRef, toValue, unref, watch, watchEffect } from "vue";
2
2
 
3
3
  //#region node_modules/.pnpm/@vueuse+shared@14.4.0_vue@3.5.43_typescript@6.0.3_/node_modules/@vueuse/shared/dist/index.js
4
4
  const localProvidedStateMap = /* @__PURE__ */ new WeakMap();
@@ -4389,6 +4389,295 @@ function superRefine(fn, params) {
4389
4389
  return _superRefine(fn, params);
4390
4390
  }
4391
4391
 
4392
+ //#endregion
4393
+ //#region node_modules/.pnpm/@tauri-apps+api@2.12.1/node_modules/@tauri-apps/api/external/tslib/tslib.es6.js
4394
+ /******************************************************************************
4395
+ Copyright (c) Microsoft Corporation.
4396
+
4397
+ Permission to use, copy, modify, and/or distribute this software for any
4398
+ purpose with or without fee is hereby granted.
4399
+
4400
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
4401
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
4402
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
4403
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
4404
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
4405
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
4406
+ PERFORMANCE OF THIS SOFTWARE.
4407
+ ***************************************************************************** */
4408
+ function __classPrivateFieldGet(receiver, state, kind, f) {
4409
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
4410
+ 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");
4411
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
4412
+ }
4413
+ function __classPrivateFieldSet(receiver, state, value, kind, f) {
4414
+ if (kind === "m") throw new TypeError("Private method is not writable");
4415
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4416
+ 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");
4417
+ return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
4418
+ }
4419
+
4420
+ //#endregion
4421
+ //#region node_modules/.pnpm/@tauri-apps+api@2.12.1/node_modules/@tauri-apps/api/core.js
4422
+ var _Channel_onmessage;
4423
+ var _Channel_nextMessageIndex;
4424
+ var _Channel_pendingMessages;
4425
+ var _Channel_messageEndIndex;
4426
+ var _Resource_rid;
4427
+ /**
4428
+ * Invoke your custom commands.
4429
+ *
4430
+ * This package is also accessible with `window.__TAURI__.core` when [`app.withGlobalTauri`](https://v2.tauri.app/reference/config/#withglobaltauri) in `tauri.conf.json` is set to `true`.
4431
+ * @module
4432
+ */
4433
+ /**
4434
+ * A key to be used to implement a special function
4435
+ * on your types that define how your type should be serialized
4436
+ * when passing across the IPC.
4437
+ * @example
4438
+ * Given a type in Rust that looks like this
4439
+ * ```rs
4440
+ * #[derive(serde::Serialize, serde::Deserialize)
4441
+ * enum UserId {
4442
+ * String(String),
4443
+ * Number(u32),
4444
+ * }
4445
+ * ```
4446
+ * `UserId::String("id")` would be serialized into `{ String: "id" }`
4447
+ * and so we need to pass the same structure back to Rust
4448
+ * ```ts
4449
+ * import { SERIALIZE_TO_IPC_FN } from "@tauri-apps/api/core"
4450
+ *
4451
+ * class UserIdString {
4452
+ * id
4453
+ * constructor(id) {
4454
+ * this.id = id
4455
+ * }
4456
+ *
4457
+ * [SERIALIZE_TO_IPC_FN]() {
4458
+ * return { String: this.id }
4459
+ * }
4460
+ * }
4461
+ *
4462
+ * class UserIdNumber {
4463
+ * id
4464
+ * constructor(id) {
4465
+ * this.id = id
4466
+ * }
4467
+ *
4468
+ * [SERIALIZE_TO_IPC_FN]() {
4469
+ * return { Number: this.id }
4470
+ * }
4471
+ * }
4472
+ *
4473
+ * type UserId = UserIdString | UserIdNumber
4474
+ * ```
4475
+ *
4476
+ */
4477
+ const SERIALIZE_TO_IPC_FN = "__TAURI_TO_IPC_KEY__";
4478
+ /**
4479
+ * Stores the callback in a known location, and returns an identifier that can be passed to the backend.
4480
+ * The backend uses the identifier to `eval()` the callback.
4481
+ *
4482
+ * @return An unique identifier associated with the callback function.
4483
+ *
4484
+ * @since 1.0.0
4485
+ */
4486
+ function transformCallback(callback, once = false) {
4487
+ return window.__TAURI_INTERNALS__.transformCallback(callback, once);
4488
+ }
4489
+ /**
4490
+ * A message channel used to stream values from Rust to the frontend.
4491
+ *
4492
+ * A `Channel` is the JavaScript counterpart of [`tauri::ipc::Channel`](https://docs.rs/tauri/2/tauri/ipc/struct.Channel.html).
4493
+ * Pass an instance as a command argument and the Rust command can declare a
4494
+ * `tauri::ipc::Channel<T>` parameter with the same name; every value sent from
4495
+ * Rust is then delivered to {@linkcode Channel.onmessage}. Messages are delivered
4496
+ * in the order they were sent, even when they arrive out of order.
4497
+ *
4498
+ * The channel stays alive until the Rust `Channel` is dropped, so it can be used
4499
+ * for long-running work such as download progress or log streaming.
4500
+ *
4501
+ * Raw byte payloads are delivered to the frontend as an `ArrayBuffer` rather than
4502
+ * a JSON value, so declare the channel as `Channel<ArrayBuffer>` when the Rust
4503
+ * side sends `tauri::ipc::InvokeResponseBody::Raw` — for example through a
4504
+ * `Channel<tauri::ipc::Response>` whose values are built with
4505
+ * `tauri::ipc::Response::new(bytes)`.
4506
+ *
4507
+ * @example
4508
+ * ```typescript
4509
+ * import { Channel, invoke } from '@tauri-apps/api/core';
4510
+ *
4511
+ * const onEvent = new Channel<string>();
4512
+ * onEvent.onmessage = (message) => {
4513
+ * console.log(`got download event ${message}`);
4514
+ * };
4515
+ *
4516
+ * await invoke('download', { url: 'https://tauri.app', onEvent });
4517
+ * ```
4518
+ *
4519
+ * The matching Rust command:
4520
+ * ```rust
4521
+ * #[tauri::command]
4522
+ * async fn download(url: String, on_event: tauri::ipc::Channel<String>) -> tauri::Result<()> {
4523
+ * on_event.send("started".to_string())?;
4524
+ * on_event.send("finished".to_string())?;
4525
+ * Ok(())
4526
+ * }
4527
+ * ```
4528
+ *
4529
+ * @since 2.0.0
4530
+ */
4531
+ var Channel = class {
4532
+ constructor(onmessage) {
4533
+ _Channel_onmessage.set(this, void 0);
4534
+ _Channel_nextMessageIndex.set(this, 0);
4535
+ _Channel_pendingMessages.set(this, []);
4536
+ _Channel_messageEndIndex.set(this, void 0);
4537
+ __classPrivateFieldSet(this, _Channel_onmessage, onmessage || (() => {}), "f");
4538
+ this.id = transformCallback((rawMessage) => {
4539
+ const index = rawMessage.index;
4540
+ if ("end" in rawMessage) {
4541
+ if (index == __classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")) this.cleanupCallback();
4542
+ else __classPrivateFieldSet(this, _Channel_messageEndIndex, index, "f");
4543
+ return;
4544
+ }
4545
+ const message = rawMessage.message;
4546
+ if (index == __classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")) {
4547
+ __classPrivateFieldGet(this, _Channel_onmessage, "f").call(this, message);
4548
+ __classPrivateFieldSet(this, _Channel_nextMessageIndex, __classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") + 1, "f");
4549
+ while (__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") in __classPrivateFieldGet(this, _Channel_pendingMessages, "f")) {
4550
+ const message = __classPrivateFieldGet(this, _Channel_pendingMessages, "f")[__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")];
4551
+ __classPrivateFieldGet(this, _Channel_onmessage, "f").call(this, message);
4552
+ delete __classPrivateFieldGet(this, _Channel_pendingMessages, "f")[__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f")];
4553
+ __classPrivateFieldSet(this, _Channel_nextMessageIndex, __classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") + 1, "f");
4554
+ }
4555
+ if (__classPrivateFieldGet(this, _Channel_nextMessageIndex, "f") === __classPrivateFieldGet(this, _Channel_messageEndIndex, "f")) this.cleanupCallback();
4556
+ } else __classPrivateFieldGet(this, _Channel_pendingMessages, "f")[index] = message;
4557
+ });
4558
+ }
4559
+ cleanupCallback() {
4560
+ window.__TAURI_INTERNALS__.unregisterCallback(this.id);
4561
+ }
4562
+ /**
4563
+ * The handler called for every message sent by the Rust side of this channel.
4564
+ *
4565
+ * Assigning a new handler replaces the previous one; messages that arrived
4566
+ * before a handler was set are not replayed, so set it (or pass it to the
4567
+ * constructor) before sending the channel to the backend.
4568
+ */
4569
+ set onmessage(handler) {
4570
+ __classPrivateFieldSet(this, _Channel_onmessage, handler, "f");
4571
+ }
4572
+ get onmessage() {
4573
+ return __classPrivateFieldGet(this, _Channel_onmessage, "f");
4574
+ }
4575
+ [(_Channel_onmessage = /* @__PURE__ */ new WeakMap(), _Channel_nextMessageIndex = /* @__PURE__ */ new WeakMap(), _Channel_pendingMessages = /* @__PURE__ */ new WeakMap(), _Channel_messageEndIndex = /* @__PURE__ */ new WeakMap(), SERIALIZE_TO_IPC_FN)]() {
4576
+ return `__CHANNEL__:${this.id}`;
4577
+ }
4578
+ toJSON() {
4579
+ return this[SERIALIZE_TO_IPC_FN]();
4580
+ }
4581
+ };
4582
+ /**
4583
+ * Sends a message to the backend.
4584
+ * @example
4585
+ * ```typescript
4586
+ * import { invoke } from '@tauri-apps/api/core';
4587
+ * await invoke('login', { user: 'tauri', password: 'poiwe3h4r5ip3yrhtew9ty' });
4588
+ * ```
4589
+ *
4590
+ * @param cmd The command name.
4591
+ * @param args The optional arguments to pass to the command.
4592
+ * @param options The request options.
4593
+ * @return A promise resolving or rejecting to the backend response.
4594
+ *
4595
+ * @since 1.0.0
4596
+ */
4597
+ async function invoke(cmd, args = {}, options) {
4598
+ return window.__TAURI_INTERNALS__.invoke(cmd, args, options);
4599
+ }
4600
+ /**
4601
+ * A rust-backed resource stored through `tauri::Manager::resources_table` API.
4602
+ *
4603
+ * The resource lives in the main process and does not exist
4604
+ * in the Javascript world, and thus will not be cleaned up automatically
4605
+ * except on application exit. If you want to clean it up early, call {@linkcode Resource.close} or use [Explicit Resource Management].
4606
+ *
4607
+ * Several API types are resources and inherit this behavior, among them `Menu`,
4608
+ * `TrayIcon`, `Image`, `Webview` and the menu item classes.
4609
+ *
4610
+ * To support older browsers with [Explicit Resource Management], use a supported compiler (e.g. tsc) or bundler (e.g. rollup).
4611
+ *
4612
+ * @example
4613
+ * ```typescript
4614
+ * import { Resource, invoke } from '@tauri-apps/api/core';
4615
+ *
4616
+ * export class DatabaseHandle extends Resource {
4617
+ * static async open(path: string): Promise<DatabaseHandle> {
4618
+ * const rid: number = await invoke('open_db', { path });
4619
+ * return new DatabaseHandle(rid);
4620
+ * }
4621
+ *
4622
+ * async execute(sql: string): Promise<void> {
4623
+ * await invoke('execute_sql', { rid: this.rid, sql });
4624
+ * }
4625
+ * }
4626
+ * ```
4627
+ *
4628
+ * Only asynchronous disposal is implemented (`Symbol.asyncDispose`), because closing
4629
+ * a resource is an IPC call. Use `await using`; the synchronous `using` form does
4630
+ * **not** work with resources.
4631
+ *
4632
+ * @example
4633
+ * ```
4634
+ * await using db = await DatabaseHandle.open('test.db');
4635
+ * await db.execute('SELECT *');
4636
+ * // `db` is closed here, by awaiting `db[Symbol.asyncDispose]()`
4637
+ * ```
4638
+ *
4639
+ * To support older browsers, add the following to the globals (e.g. adding to the HTML file):
4640
+ *
4641
+ * ```javascript
4642
+ * Symbol.asyncDispose ??= Symbol("Symbol.asyncDispose");
4643
+ * ```
4644
+ *
4645
+ * And for the compiler, for example `tsc`, `rollup`, `vite`, add the following to `tsconfig.json`:
4646
+ *
4647
+ * ```json
4648
+ * {
4649
+ * "compilerOptions": {
4650
+ * "target": "es2022",
4651
+ * "lib": ["es2022", "esnext.disposable", "dom"]
4652
+ * }
4653
+ * }
4654
+ * ```
4655
+ *
4656
+ * [Explicit Resource Management]: https://github.com/tc39/proposal-explicit-resource-management
4657
+ */
4658
+ var Resource = class {
4659
+ get rid() {
4660
+ return __classPrivateFieldGet(this, _Resource_rid, "f");
4661
+ }
4662
+ constructor(rid) {
4663
+ _Resource_rid.set(this, void 0);
4664
+ __classPrivateFieldSet(this, _Resource_rid, rid, "f");
4665
+ }
4666
+ /**
4667
+ * Destroys and cleans up this resource from memory.
4668
+ * **You should not call any method on this object anymore and should drop any reference to it.**
4669
+ *
4670
+ * @remarks Uses the `core:resources:allow-close` permission, which is part of
4671
+ * the `core:resources:default` permission set enabled by default.
4672
+ */
4673
+ async close() {
4674
+ return invoke("plugin:resources|close", { rid: this.rid });
4675
+ }
4676
+ async [(_Resource_rid = /* @__PURE__ */ new WeakMap(), Symbol.asyncDispose)]() {
4677
+ await this.close();
4678
+ }
4679
+ };
4680
+
4392
4681
  //#endregion
4393
4682
  //#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_freeGlobal.js
4394
4683
  /** Detect free variable `global` from Node.js. */
@@ -5094,4 +5383,4 @@ var [Emitter] = [
5094
5383
  ];
5095
5384
 
5096
5385
  //#endregion
5097
- export { custom as a, api as c, debounce as i, mitt_default as l, EventType as n, email as o, toLower as r, string as s, Emitter as t, usePreferredDark as u };
5386
+ export { invoke as a, string as c, usePreferredDark as d, debounce as i, api as l, EventType as n, custom as o, toLower as r, email as s, Emitter as t, mitt_default as u };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x-essential-lib",
3
- "version": "0.11.9",
3
+ "version": "0.11.11",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -25,10 +25,8 @@
25
25
  "lint-staged": "lint-staged",
26
26
  "prepare": "husky"
27
27
  },
28
- "dependencies": {
29
- "@tauri-apps/api": "^2.12.1"
30
- },
31
28
  "devDependencies": {
29
+ "@tauri-apps/api": "^2.12.1",
32
30
  "@types/js-cookie": "^3.0.6",
33
31
  "@types/lodash-es": "^4.17.12",
34
32
  "@types/node": "^26.0.0",