x-essential-lib 0.11.8 → 0.11.10
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 +12 -4
- package/dist/index.js +77 -53
- package/dist/{vendor.gz9a1xde.js → vendor.59wdpcv4.js} +568 -14
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as EventType, t as Emitter } from "./vendor.
|
|
1
|
+
import { n as EventType, t as Emitter } from "./vendor.59wdpcv4.js";
|
|
2
2
|
import { Ref } from "vue";
|
|
3
3
|
import { VuetifyOptions } from "vuetify";
|
|
4
4
|
import { AxiosInstance } from "axios";
|
|
@@ -174,11 +174,19 @@ export declare function usePermission(): {
|
|
|
174
174
|
};
|
|
175
175
|
//#endregion
|
|
176
176
|
//#region src/composables/system.d.ts
|
|
177
|
+
declare global {
|
|
178
|
+
interface Navigator {
|
|
179
|
+
Backbutton?: {
|
|
180
|
+
goHome: (p1: () => void, p2: () => void) => void;
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
}
|
|
177
184
|
export declare function useSystem(): {
|
|
178
|
-
sysBarAvail: import("vue").ComputedRef<boolean>;
|
|
179
|
-
compactWidth: import("vue").ComputedRef<string>;
|
|
180
|
-
isCurvedScreen: import("vue").ComputedRef<boolean>;
|
|
181
185
|
isMobile: () => boolean;
|
|
186
|
+
compactWidth: import("vue").ComputedRef<string>;
|
|
187
|
+
minimizeApp: () => Promise<void>;
|
|
188
|
+
insetTop: import("vue").Ref<number, number>;
|
|
189
|
+
insetBottom: import("vue").Ref<number, number>;
|
|
182
190
|
nameList: (entries: string[], instances?: string[]) => string;
|
|
183
191
|
sentenceOfAsk: (verb: string, object: string, name: string) => string;
|
|
184
192
|
};
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
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
|
|
3
|
-
import { Fragment, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, inject, isRef, normalizeStyle, onBeforeMount, onBeforeUnmount, onMounted, 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.59wdpcv4.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";
|
|
4
4
|
import { useI18n } from "vue-i18n";
|
|
5
5
|
import { useDisplay, useTheme } from "vuetify";
|
|
6
6
|
import axios from "axios";
|
|
@@ -689,11 +689,84 @@ function useGlobalStates(globalStates, base) {
|
|
|
689
689
|
});
|
|
690
690
|
}
|
|
691
691
|
|
|
692
|
+
//#endregion
|
|
693
|
+
//#region src/composables/system.ts
|
|
694
|
+
function useSystem() {
|
|
695
|
+
const { locale, t } = useI18n();
|
|
696
|
+
const display = useDisplay();
|
|
697
|
+
function isMobile() {
|
|
698
|
+
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
699
|
+
}
|
|
700
|
+
const compactWidth = computed(() => {
|
|
701
|
+
if (display.width.value <= 1280) return display.width.value + "px";
|
|
702
|
+
else if (display.width.value <= 1920) return "768px";
|
|
703
|
+
else return "1024px";
|
|
704
|
+
});
|
|
705
|
+
async function minimizeApp() {
|
|
706
|
+
navigator.Backbutton?.goHome(() => {}, () => {});
|
|
707
|
+
invoke("goHome");
|
|
708
|
+
}
|
|
709
|
+
const insetTop = ref(0);
|
|
710
|
+
const insetBottom = ref(0);
|
|
711
|
+
function getSafeAreaVar(name) {
|
|
712
|
+
const str = getComputedStyle(document.documentElement).getPropertyValue(name).trim();
|
|
713
|
+
return parseFloat(str) || 0;
|
|
714
|
+
}
|
|
715
|
+
function syncSafeArea() {
|
|
716
|
+
insetTop.value = getSafeAreaVar("--safe-top");
|
|
717
|
+
insetBottom.value = getSafeAreaVar("--safe-bottom");
|
|
718
|
+
}
|
|
719
|
+
const handleResize = debounce(() => {
|
|
720
|
+
syncSafeArea();
|
|
721
|
+
}, 250);
|
|
722
|
+
function onResize() {
|
|
723
|
+
handleResize();
|
|
724
|
+
}
|
|
725
|
+
onMounted(() => {
|
|
726
|
+
window.addEventListener("resize", onResize);
|
|
727
|
+
syncSafeArea();
|
|
728
|
+
});
|
|
729
|
+
onUnmounted(() => {
|
|
730
|
+
window.removeEventListener("resize", onResize);
|
|
731
|
+
handleResize.cancel();
|
|
732
|
+
});
|
|
733
|
+
function nameList(entries, instances) {
|
|
734
|
+
let name;
|
|
735
|
+
const names = entries.map((entry) => t(entry));
|
|
736
|
+
if (instances) name = `${names.join("/")} <${instances.join("/")}>`;
|
|
737
|
+
else if (locale.value === "en") name = names.join(" ");
|
|
738
|
+
else name = names.join("");
|
|
739
|
+
return name;
|
|
740
|
+
}
|
|
741
|
+
function sentenceOfAsk(verb, object, name) {
|
|
742
|
+
if (locale.value === "en") return t("x-essential-lib.dlg.ask", {
|
|
743
|
+
verb: toLower(t(verb)),
|
|
744
|
+
object: toLower(t(object)),
|
|
745
|
+
name
|
|
746
|
+
});
|
|
747
|
+
else return t("x-essential-lib.dlg.ask", {
|
|
748
|
+
verb: t(verb),
|
|
749
|
+
object: t(object),
|
|
750
|
+
name
|
|
751
|
+
});
|
|
752
|
+
}
|
|
753
|
+
return {
|
|
754
|
+
isMobile,
|
|
755
|
+
compactWidth,
|
|
756
|
+
minimizeApp,
|
|
757
|
+
insetTop,
|
|
758
|
+
insetBottom,
|
|
759
|
+
nameList,
|
|
760
|
+
sentenceOfAsk
|
|
761
|
+
};
|
|
762
|
+
}
|
|
763
|
+
|
|
692
764
|
//#endregion
|
|
693
765
|
//#region src/composables/microApp.ts
|
|
694
766
|
function useMicroApp(globalStates, customBack) {
|
|
695
767
|
const route = useRoute();
|
|
696
768
|
const router = useRouter();
|
|
769
|
+
const { minimizeApp } = useSystem();
|
|
697
770
|
useGlobalStates(globalStates);
|
|
698
771
|
const { activeOrg, views } = globalStates;
|
|
699
772
|
async function handleBack() {
|
|
@@ -703,7 +776,7 @@ function useMicroApp(globalStates, customBack) {
|
|
|
703
776
|
}
|
|
704
777
|
const routeMeta = matchRouteMeta(route.path);
|
|
705
778
|
if (!routeMeta) return;
|
|
706
|
-
if (routeMeta.level === 0)
|
|
779
|
+
if (routeMeta.level === 0) minimizeApp();
|
|
707
780
|
else if (customBack) customBack(routeMeta);
|
|
708
781
|
else {
|
|
709
782
|
let back;
|
|
@@ -801,55 +874,6 @@ function usePermission() {
|
|
|
801
874
|
return { verifyPermission: verifyPermission$1 };
|
|
802
875
|
}
|
|
803
876
|
|
|
804
|
-
//#endregion
|
|
805
|
-
//#region src/composables/system.ts
|
|
806
|
-
function useSystem() {
|
|
807
|
-
const { locale, t } = useI18n();
|
|
808
|
-
const sysBarAvail = computed(() => {
|
|
809
|
-
return !!window.cordova;
|
|
810
|
-
});
|
|
811
|
-
const display = useDisplay();
|
|
812
|
-
const compactWidth = computed(() => {
|
|
813
|
-
if (display.width.value <= 1280) return display.width.value + "px";
|
|
814
|
-
else if (display.width.value <= 1920) return "768px";
|
|
815
|
-
else return "1024px";
|
|
816
|
-
});
|
|
817
|
-
const isCurvedScreen = computed(() => {
|
|
818
|
-
return false;
|
|
819
|
-
});
|
|
820
|
-
function isMobile() {
|
|
821
|
-
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
822
|
-
}
|
|
823
|
-
function nameList(entries, instances) {
|
|
824
|
-
let name;
|
|
825
|
-
const names = entries.map((entry) => t(entry));
|
|
826
|
-
if (instances) name = `${names.join("/")} <${instances.join("/")}>`;
|
|
827
|
-
else if (locale.value === "en") name = names.join(" ");
|
|
828
|
-
else name = names.join("");
|
|
829
|
-
return name;
|
|
830
|
-
}
|
|
831
|
-
function sentenceOfAsk(verb, object, name) {
|
|
832
|
-
if (locale.value === "en") return t("x-essential-lib.dlg.ask", {
|
|
833
|
-
verb: toLower(t(verb)),
|
|
834
|
-
object: toLower(t(object)),
|
|
835
|
-
name
|
|
836
|
-
});
|
|
837
|
-
else return t("x-essential-lib.dlg.ask", {
|
|
838
|
-
verb: t(verb),
|
|
839
|
-
object: t(object),
|
|
840
|
-
name
|
|
841
|
-
});
|
|
842
|
-
}
|
|
843
|
-
return {
|
|
844
|
-
sysBarAvail,
|
|
845
|
-
compactWidth,
|
|
846
|
-
isCurvedScreen,
|
|
847
|
-
isMobile,
|
|
848
|
-
nameList,
|
|
849
|
-
sentenceOfAsk
|
|
850
|
-
};
|
|
851
|
-
}
|
|
852
|
-
|
|
853
877
|
//#endregion
|
|
854
878
|
//#region src/composables/viewStack.ts
|
|
855
879
|
function useViewStack(name, openHook, closeHook) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Fragment, computed, defineComponent, getCurrentInstance, getCurrentScope, hasInjectionContext, inject, isRef, onBeforeMount, onBeforeUnmount, onMounted, provide, ref, shallowRef, toValue, unref, watch, watchEffect } from "vue";
|
|
1
|
+
import { Fragment, computed, defineComponent, getCurrentInstance, getCurrentScope, hasInjectionContext, inject, isRef, onBeforeMount, onBeforeUnmount, onMounted, onUnmounted, provide, 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();
|
|
@@ -25,7 +25,7 @@ const injectLocal = (...args) => {
|
|
|
25
25
|
const isClient = typeof window !== "undefined" && typeof document !== "undefined";
|
|
26
26
|
const isWorker = typeof WorkerGlobalScope !== "undefined" && globalThis instanceof WorkerGlobalScope;
|
|
27
27
|
const toString$1 = Object.prototype.toString;
|
|
28
|
-
const isObject$
|
|
28
|
+
const isObject$2 = (val) => toString$1.call(val) === "[object Object]";
|
|
29
29
|
/**
|
|
30
30
|
* Get a px value for SSR use, do not rely on this method outside of SSR as REM unit is assumed at 16px, which might not be the case on the client
|
|
31
31
|
*/
|
|
@@ -94,7 +94,7 @@ function useEventListener(...args) {
|
|
|
94
94
|
];
|
|
95
95
|
}, ([raw_targets, raw_events, raw_listeners, raw_options], _, onCleanup) => {
|
|
96
96
|
if (!(raw_targets === null || raw_targets === void 0 ? void 0 : raw_targets.length) || !(raw_events === null || raw_events === void 0 ? void 0 : raw_events.length) || !(raw_listeners === null || raw_listeners === void 0 ? void 0 : raw_listeners.length)) return;
|
|
97
|
-
const optionsClone = isObject$
|
|
97
|
+
const optionsClone = isObject$2(raw_options) ? { ...raw_options } : raw_options;
|
|
98
98
|
const cleanups = raw_targets.flatMap((el) => raw_events.flatMap((event) => raw_listeners.map((listener) => register(el, event, listener, optionsClone))));
|
|
99
99
|
onCleanup(() => {
|
|
100
100
|
cleanups.forEach((fn) => fn());
|
|
@@ -322,16 +322,16 @@ function slugify(input) {
|
|
|
322
322
|
return input.toLowerCase().trim().replace(/[^\w\s-]/g, "").replace(/[\s_-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
323
323
|
}
|
|
324
324
|
const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {};
|
|
325
|
-
function isObject(data) {
|
|
325
|
+
function isObject$1(data) {
|
|
326
326
|
return typeof data === "object" && data !== null && !Array.isArray(data);
|
|
327
327
|
}
|
|
328
328
|
function isPlainObject(o) {
|
|
329
|
-
if (isObject(o) === false) return false;
|
|
329
|
+
if (isObject$1(o) === false) return false;
|
|
330
330
|
const ctor = o.constructor;
|
|
331
331
|
if (ctor === void 0) return true;
|
|
332
332
|
if (typeof ctor !== "function") return true;
|
|
333
333
|
const prot = ctor.prototype;
|
|
334
|
-
if (isObject(prot) === false) return false;
|
|
334
|
+
if (isObject$1(prot) === false) return false;
|
|
335
335
|
if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) return false;
|
|
336
336
|
return true;
|
|
337
337
|
}
|
|
@@ -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. */
|
|
@@ -4601,6 +4890,119 @@ function baseToString(value) {
|
|
|
4601
4890
|
return result == "0" && 1 / value == -INFINITY ? "-0" : result;
|
|
4602
4891
|
}
|
|
4603
4892
|
|
|
4893
|
+
//#endregion
|
|
4894
|
+
//#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js
|
|
4895
|
+
/** Used to match a single whitespace character. */
|
|
4896
|
+
var reWhitespace = /\s/;
|
|
4897
|
+
/**
|
|
4898
|
+
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
|
|
4899
|
+
* character of `string`.
|
|
4900
|
+
*
|
|
4901
|
+
* @private
|
|
4902
|
+
* @param {string} string The string to inspect.
|
|
4903
|
+
* @returns {number} Returns the index of the last non-whitespace character.
|
|
4904
|
+
*/
|
|
4905
|
+
function trimmedEndIndex(string) {
|
|
4906
|
+
var index = string.length;
|
|
4907
|
+
while (index-- && reWhitespace.test(string.charAt(index)));
|
|
4908
|
+
return index;
|
|
4909
|
+
}
|
|
4910
|
+
|
|
4911
|
+
//#endregion
|
|
4912
|
+
//#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js
|
|
4913
|
+
/** Used to match leading whitespace. */
|
|
4914
|
+
var reTrimStart = /^\s+/;
|
|
4915
|
+
/**
|
|
4916
|
+
* The base implementation of `_.trim`.
|
|
4917
|
+
*
|
|
4918
|
+
* @private
|
|
4919
|
+
* @param {string} string The string to trim.
|
|
4920
|
+
* @returns {string} Returns the trimmed string.
|
|
4921
|
+
*/
|
|
4922
|
+
function baseTrim(string) {
|
|
4923
|
+
return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
|
|
4924
|
+
}
|
|
4925
|
+
|
|
4926
|
+
//#endregion
|
|
4927
|
+
//#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isObject.js
|
|
4928
|
+
/**
|
|
4929
|
+
* Checks if `value` is the
|
|
4930
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
4931
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
4932
|
+
*
|
|
4933
|
+
* @static
|
|
4934
|
+
* @memberOf _
|
|
4935
|
+
* @since 0.1.0
|
|
4936
|
+
* @category Lang
|
|
4937
|
+
* @param {*} value The value to check.
|
|
4938
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
4939
|
+
* @example
|
|
4940
|
+
*
|
|
4941
|
+
* _.isObject({});
|
|
4942
|
+
* // => true
|
|
4943
|
+
*
|
|
4944
|
+
* _.isObject([1, 2, 3]);
|
|
4945
|
+
* // => true
|
|
4946
|
+
*
|
|
4947
|
+
* _.isObject(_.noop);
|
|
4948
|
+
* // => true
|
|
4949
|
+
*
|
|
4950
|
+
* _.isObject(null);
|
|
4951
|
+
* // => false
|
|
4952
|
+
*/
|
|
4953
|
+
function isObject(value) {
|
|
4954
|
+
var type = typeof value;
|
|
4955
|
+
return value != null && (type == "object" || type == "function");
|
|
4956
|
+
}
|
|
4957
|
+
|
|
4958
|
+
//#endregion
|
|
4959
|
+
//#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js
|
|
4960
|
+
/** Used as references for various `Number` constants. */
|
|
4961
|
+
var NAN = NaN;
|
|
4962
|
+
/** Used to detect bad signed hexadecimal string values. */
|
|
4963
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
4964
|
+
/** Used to detect binary string values. */
|
|
4965
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
4966
|
+
/** Used to detect octal string values. */
|
|
4967
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
4968
|
+
/** Built-in method references without a dependency on `root`. */
|
|
4969
|
+
var freeParseInt = parseInt;
|
|
4970
|
+
/**
|
|
4971
|
+
* Converts `value` to a number.
|
|
4972
|
+
*
|
|
4973
|
+
* @static
|
|
4974
|
+
* @memberOf _
|
|
4975
|
+
* @since 4.0.0
|
|
4976
|
+
* @category Lang
|
|
4977
|
+
* @param {*} value The value to process.
|
|
4978
|
+
* @returns {number} Returns the number.
|
|
4979
|
+
* @example
|
|
4980
|
+
*
|
|
4981
|
+
* _.toNumber(3.2);
|
|
4982
|
+
* // => 3.2
|
|
4983
|
+
*
|
|
4984
|
+
* _.toNumber(Number.MIN_VALUE);
|
|
4985
|
+
* // => 5e-324
|
|
4986
|
+
*
|
|
4987
|
+
* _.toNumber(Infinity);
|
|
4988
|
+
* // => Infinity
|
|
4989
|
+
*
|
|
4990
|
+
* _.toNumber('3.2');
|
|
4991
|
+
* // => 3.2
|
|
4992
|
+
*/
|
|
4993
|
+
function toNumber(value) {
|
|
4994
|
+
if (typeof value == "number") return value;
|
|
4995
|
+
if (isSymbol(value)) return NAN;
|
|
4996
|
+
if (isObject(value)) {
|
|
4997
|
+
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
4998
|
+
value = isObject(other) ? other + "" : other;
|
|
4999
|
+
}
|
|
5000
|
+
if (typeof value != "string") return value === 0 ? value : +value;
|
|
5001
|
+
value = baseTrim(value);
|
|
5002
|
+
var isBinary = reIsBinary.test(value);
|
|
5003
|
+
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
5004
|
+
}
|
|
5005
|
+
|
|
4604
5006
|
//#endregion
|
|
4605
5007
|
//#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toString.js
|
|
4606
5008
|
/**
|
|
@@ -4628,6 +5030,158 @@ function toString(value) {
|
|
|
4628
5030
|
return value == null ? "" : baseToString(value);
|
|
4629
5031
|
}
|
|
4630
5032
|
|
|
5033
|
+
//#endregion
|
|
5034
|
+
//#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/now.js
|
|
5035
|
+
/**
|
|
5036
|
+
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
5037
|
+
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
5038
|
+
*
|
|
5039
|
+
* @static
|
|
5040
|
+
* @memberOf _
|
|
5041
|
+
* @since 2.4.0
|
|
5042
|
+
* @category Date
|
|
5043
|
+
* @returns {number} Returns the timestamp.
|
|
5044
|
+
* @example
|
|
5045
|
+
*
|
|
5046
|
+
* _.defer(function(stamp) {
|
|
5047
|
+
* console.log(_.now() - stamp);
|
|
5048
|
+
* }, _.now());
|
|
5049
|
+
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
5050
|
+
*/
|
|
5051
|
+
var now = function() {
|
|
5052
|
+
return root.Date.now();
|
|
5053
|
+
};
|
|
5054
|
+
|
|
5055
|
+
//#endregion
|
|
5056
|
+
//#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/debounce.js
|
|
5057
|
+
/** Error message constants. */
|
|
5058
|
+
var FUNC_ERROR_TEXT = "Expected a function";
|
|
5059
|
+
var nativeMax = Math.max;
|
|
5060
|
+
var nativeMin = Math.min;
|
|
5061
|
+
/**
|
|
5062
|
+
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
5063
|
+
* milliseconds have elapsed since the last time the debounced function was
|
|
5064
|
+
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
5065
|
+
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
5066
|
+
* Provide `options` to indicate whether `func` should be invoked on the
|
|
5067
|
+
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
5068
|
+
* with the last arguments provided to the debounced function. Subsequent
|
|
5069
|
+
* calls to the debounced function return the result of the last `func`
|
|
5070
|
+
* invocation.
|
|
5071
|
+
*
|
|
5072
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
5073
|
+
* invoked on the trailing edge of the timeout only if the debounced function
|
|
5074
|
+
* is invoked more than once during the `wait` timeout.
|
|
5075
|
+
*
|
|
5076
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
5077
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
5078
|
+
*
|
|
5079
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
5080
|
+
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
5081
|
+
*
|
|
5082
|
+
* @static
|
|
5083
|
+
* @memberOf _
|
|
5084
|
+
* @since 0.1.0
|
|
5085
|
+
* @category Function
|
|
5086
|
+
* @param {Function} func The function to debounce.
|
|
5087
|
+
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
5088
|
+
* @param {Object} [options={}] The options object.
|
|
5089
|
+
* @param {boolean} [options.leading=false]
|
|
5090
|
+
* Specify invoking on the leading edge of the timeout.
|
|
5091
|
+
* @param {number} [options.maxWait]
|
|
5092
|
+
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
5093
|
+
* @param {boolean} [options.trailing=true]
|
|
5094
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
5095
|
+
* @returns {Function} Returns the new debounced function.
|
|
5096
|
+
* @example
|
|
5097
|
+
*
|
|
5098
|
+
* // Avoid costly calculations while the window size is in flux.
|
|
5099
|
+
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
5100
|
+
*
|
|
5101
|
+
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
5102
|
+
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
5103
|
+
* 'leading': true,
|
|
5104
|
+
* 'trailing': false
|
|
5105
|
+
* }));
|
|
5106
|
+
*
|
|
5107
|
+
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
5108
|
+
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
5109
|
+
* var source = new EventSource('/stream');
|
|
5110
|
+
* jQuery(source).on('message', debounced);
|
|
5111
|
+
*
|
|
5112
|
+
* // Cancel the trailing debounced invocation.
|
|
5113
|
+
* jQuery(window).on('popstate', debounced.cancel);
|
|
5114
|
+
*/
|
|
5115
|
+
function debounce(func, wait, options) {
|
|
5116
|
+
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
5117
|
+
if (typeof func != "function") throw new TypeError(FUNC_ERROR_TEXT);
|
|
5118
|
+
wait = toNumber(wait) || 0;
|
|
5119
|
+
if (isObject(options)) {
|
|
5120
|
+
leading = !!options.leading;
|
|
5121
|
+
maxing = "maxWait" in options;
|
|
5122
|
+
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
5123
|
+
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
5124
|
+
}
|
|
5125
|
+
function invokeFunc(time) {
|
|
5126
|
+
var args = lastArgs, thisArg = lastThis;
|
|
5127
|
+
lastArgs = lastThis = void 0;
|
|
5128
|
+
lastInvokeTime = time;
|
|
5129
|
+
result = func.apply(thisArg, args);
|
|
5130
|
+
return result;
|
|
5131
|
+
}
|
|
5132
|
+
function leadingEdge(time) {
|
|
5133
|
+
lastInvokeTime = time;
|
|
5134
|
+
timerId = setTimeout(timerExpired, wait);
|
|
5135
|
+
return leading ? invokeFunc(time) : result;
|
|
5136
|
+
}
|
|
5137
|
+
function remainingWait(time) {
|
|
5138
|
+
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
|
|
5139
|
+
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
|
|
5140
|
+
}
|
|
5141
|
+
function shouldInvoke(time) {
|
|
5142
|
+
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
|
|
5143
|
+
return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
|
|
5144
|
+
}
|
|
5145
|
+
function timerExpired() {
|
|
5146
|
+
var time = now();
|
|
5147
|
+
if (shouldInvoke(time)) return trailingEdge(time);
|
|
5148
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
5149
|
+
}
|
|
5150
|
+
function trailingEdge(time) {
|
|
5151
|
+
timerId = void 0;
|
|
5152
|
+
if (trailing && lastArgs) return invokeFunc(time);
|
|
5153
|
+
lastArgs = lastThis = void 0;
|
|
5154
|
+
return result;
|
|
5155
|
+
}
|
|
5156
|
+
function cancel() {
|
|
5157
|
+
if (timerId !== void 0) clearTimeout(timerId);
|
|
5158
|
+
lastInvokeTime = 0;
|
|
5159
|
+
lastArgs = lastCallTime = lastThis = timerId = void 0;
|
|
5160
|
+
}
|
|
5161
|
+
function flush() {
|
|
5162
|
+
return timerId === void 0 ? result : trailingEdge(now());
|
|
5163
|
+
}
|
|
5164
|
+
function debounced() {
|
|
5165
|
+
var time = now(), isInvoking = shouldInvoke(time);
|
|
5166
|
+
lastArgs = arguments;
|
|
5167
|
+
lastThis = this;
|
|
5168
|
+
lastCallTime = time;
|
|
5169
|
+
if (isInvoking) {
|
|
5170
|
+
if (timerId === void 0) return leadingEdge(lastCallTime);
|
|
5171
|
+
if (maxing) {
|
|
5172
|
+
clearTimeout(timerId);
|
|
5173
|
+
timerId = setTimeout(timerExpired, wait);
|
|
5174
|
+
return invokeFunc(lastCallTime);
|
|
5175
|
+
}
|
|
5176
|
+
}
|
|
5177
|
+
if (timerId === void 0) timerId = setTimeout(timerExpired, wait);
|
|
5178
|
+
return result;
|
|
5179
|
+
}
|
|
5180
|
+
debounced.cancel = cancel;
|
|
5181
|
+
debounced.flush = flush;
|
|
5182
|
+
return debounced;
|
|
5183
|
+
}
|
|
5184
|
+
|
|
4631
5185
|
//#endregion
|
|
4632
5186
|
//#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toLower.js
|
|
4633
5187
|
/**
|
|
@@ -4658,12 +5212,12 @@ function toLower(value) {
|
|
|
4658
5212
|
//#endregion
|
|
4659
5213
|
//#region node_modules/.pnpm/mitt@3.0.1/node_modules/mitt/index.d.ts
|
|
4660
5214
|
var [EventType] = [
|
|
4661
|
-
|
|
5215
|
+
68,
|
|
4662
5216
|
() => [],
|
|
4663
5217
|
[]
|
|
4664
5218
|
];
|
|
4665
5219
|
var [Handler] = [
|
|
4666
|
-
|
|
5220
|
+
69,
|
|
4667
5221
|
(T) => [T],
|
|
4668
5222
|
[
|
|
4669
5223
|
"",
|
|
@@ -4672,7 +5226,7 @@ var [Handler] = [
|
|
|
4672
5226
|
]
|
|
4673
5227
|
];
|
|
4674
5228
|
var [WildcardHandler] = [
|
|
4675
|
-
|
|
5229
|
+
70,
|
|
4676
5230
|
(T) => [
|
|
4677
5231
|
Record,
|
|
4678
5232
|
T,
|
|
@@ -4690,7 +5244,7 @@ var [WildcardHandler] = [
|
|
|
4690
5244
|
]
|
|
4691
5245
|
];
|
|
4692
5246
|
var [EventHandlerList] = [
|
|
4693
|
-
|
|
5247
|
+
71,
|
|
4694
5248
|
(T) => [
|
|
4695
5249
|
T,
|
|
4696
5250
|
Handler,
|
|
@@ -4704,7 +5258,7 @@ var [EventHandlerList] = [
|
|
|
4704
5258
|
]
|
|
4705
5259
|
];
|
|
4706
5260
|
var [WildCardEventHandlerList] = [
|
|
4707
|
-
|
|
5261
|
+
72,
|
|
4708
5262
|
(T) => [
|
|
4709
5263
|
Record,
|
|
4710
5264
|
T,
|
|
@@ -4720,7 +5274,7 @@ var [WildCardEventHandlerList] = [
|
|
|
4720
5274
|
]
|
|
4721
5275
|
];
|
|
4722
5276
|
var [EventHandlerMap] = [
|
|
4723
|
-
|
|
5277
|
+
73,
|
|
4724
5278
|
(Events) => [
|
|
4725
5279
|
EventType,
|
|
4726
5280
|
Record,
|
|
@@ -4746,7 +5300,7 @@ var [EventHandlerMap] = [
|
|
|
4746
5300
|
]
|
|
4747
5301
|
];
|
|
4748
5302
|
var [Emitter] = [
|
|
4749
|
-
|
|
5303
|
+
74,
|
|
4750
5304
|
(Key, Events) => [
|
|
4751
5305
|
EventType,
|
|
4752
5306
|
Record,
|
|
@@ -4829,4 +5383,4 @@ var [Emitter] = [
|
|
|
4829
5383
|
];
|
|
4830
5384
|
|
|
4831
5385
|
//#endregion
|
|
4832
|
-
export {
|
|
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.
|
|
3
|
+
"version": "0.11.10",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"prepare": "husky"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
+
"@tauri-apps/api": "^2.12.1",
|
|
29
30
|
"@types/js-cookie": "^3.0.6",
|
|
30
31
|
"@types/lodash-es": "^4.17.12",
|
|
31
32
|
"@types/node": "^26.0.0",
|