x-essential-lib 0.11.7 → 0.11.9
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,6 +1,6 @@
|
|
|
1
|
-
import { n as EventType, t as Emitter } from "./vendor.
|
|
1
|
+
import { n as EventType, t as Emitter } from "./vendor.fpmj8dgj.js";
|
|
2
2
|
import { Ref } from "vue";
|
|
3
|
-
import {
|
|
3
|
+
import { VuetifyOptions } from "vuetify";
|
|
4
4
|
import { AxiosInstance } from "axios";
|
|
5
5
|
//#region src/composables/color.d.ts
|
|
6
6
|
export declare function useColor(): {
|
|
@@ -142,7 +142,7 @@ export declare function popView(views: Ref<string[]>): void;
|
|
|
142
142
|
export declare function clearViews(views: Ref<string[]>): void;
|
|
143
143
|
//#endregion
|
|
144
144
|
//#region src/logic/vuetify/index.d.ts
|
|
145
|
-
export declare
|
|
145
|
+
export declare const baseVuetifyOptions: VuetifyOptions;
|
|
146
146
|
//#endregion
|
|
147
147
|
//#region src/composables/globalStates.d.ts
|
|
148
148
|
export interface GlobalStates {
|
|
@@ -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,14 +1,12 @@
|
|
|
1
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";
|
|
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";
|
|
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
|
-
import * as components from "vuetify/components";
|
|
9
|
-
import * as directives from "vuetify/directives";
|
|
10
|
-
import * as labsComponents from "vuetify/labs/components";
|
|
11
8
|
import { useRoute, useRouter } from "vue-router";
|
|
9
|
+
import { invoke } from "@tauri-apps/api/core";
|
|
12
10
|
|
|
13
11
|
//#region src/composables/color.ts
|
|
14
12
|
function useColor() {
|
|
@@ -611,28 +609,16 @@ function clearViews(views) {
|
|
|
611
609
|
|
|
612
610
|
//#endregion
|
|
613
611
|
//#region src/logic/vuetify/index.ts
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
}
|
|
621
|
-
|
|
622
|
-
}
|
|
623
|
-
|
|
624
|
-
...dynamicOptions,
|
|
625
|
-
locale: { adapter: localeAdapter },
|
|
626
|
-
defaults: {
|
|
627
|
-
VDataTable: { hover: true },
|
|
628
|
-
VDataTableServer: { hover: true },
|
|
629
|
-
VDataTableVirtual: { hover: true },
|
|
630
|
-
VDialog: { captureFocus: false },
|
|
631
|
-
VNavigationDrawer: { disableRouteWatcher: true }
|
|
632
|
-
},
|
|
633
|
-
icons: { defaultSet: "mdi" }
|
|
634
|
-
};
|
|
635
|
-
}
|
|
612
|
+
const baseVuetifyOptions = {
|
|
613
|
+
defaults: {
|
|
614
|
+
VDataTable: { hover: true },
|
|
615
|
+
VDataTableServer: { hover: true },
|
|
616
|
+
VDataTableVirtual: { hover: true },
|
|
617
|
+
VDialog: { captureFocus: false },
|
|
618
|
+
VNavigationDrawer: { disableRouteWatcher: true }
|
|
619
|
+
},
|
|
620
|
+
icons: { defaultSet: "mdi" }
|
|
621
|
+
};
|
|
636
622
|
|
|
637
623
|
//#endregion
|
|
638
624
|
//#region src/composables/globalStates.ts
|
|
@@ -704,11 +690,84 @@ function useGlobalStates(globalStates, base) {
|
|
|
704
690
|
});
|
|
705
691
|
}
|
|
706
692
|
|
|
693
|
+
//#endregion
|
|
694
|
+
//#region src/composables/system.ts
|
|
695
|
+
function useSystem() {
|
|
696
|
+
const { locale, t } = useI18n();
|
|
697
|
+
const display = useDisplay();
|
|
698
|
+
function isMobile() {
|
|
699
|
+
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
700
|
+
}
|
|
701
|
+
const compactWidth = computed(() => {
|
|
702
|
+
if (display.width.value <= 1280) return display.width.value + "px";
|
|
703
|
+
else if (display.width.value <= 1920) return "768px";
|
|
704
|
+
else return "1024px";
|
|
705
|
+
});
|
|
706
|
+
async function minimizeApp() {
|
|
707
|
+
navigator.Backbutton?.goHome(() => {}, () => {});
|
|
708
|
+
invoke("goHome");
|
|
709
|
+
}
|
|
710
|
+
const insetTop = ref(0);
|
|
711
|
+
const insetBottom = ref(0);
|
|
712
|
+
function getSafeAreaVar(name) {
|
|
713
|
+
const str = getComputedStyle(document.documentElement).getPropertyValue(name).trim();
|
|
714
|
+
return parseFloat(str) || 0;
|
|
715
|
+
}
|
|
716
|
+
function syncSafeArea() {
|
|
717
|
+
insetTop.value = getSafeAreaVar("--safe-top");
|
|
718
|
+
insetBottom.value = getSafeAreaVar("--safe-bottom");
|
|
719
|
+
}
|
|
720
|
+
const handleResize = debounce(() => {
|
|
721
|
+
syncSafeArea();
|
|
722
|
+
}, 250);
|
|
723
|
+
function onResize() {
|
|
724
|
+
handleResize();
|
|
725
|
+
}
|
|
726
|
+
onMounted(() => {
|
|
727
|
+
window.addEventListener("resize", onResize);
|
|
728
|
+
syncSafeArea();
|
|
729
|
+
});
|
|
730
|
+
onUnmounted(() => {
|
|
731
|
+
window.removeEventListener("resize", onResize);
|
|
732
|
+
handleResize.cancel();
|
|
733
|
+
});
|
|
734
|
+
function nameList(entries, instances) {
|
|
735
|
+
let name;
|
|
736
|
+
const names = entries.map((entry) => t(entry));
|
|
737
|
+
if (instances) name = `${names.join("/")} <${instances.join("/")}>`;
|
|
738
|
+
else if (locale.value === "en") name = names.join(" ");
|
|
739
|
+
else name = names.join("");
|
|
740
|
+
return name;
|
|
741
|
+
}
|
|
742
|
+
function sentenceOfAsk(verb, object, name) {
|
|
743
|
+
if (locale.value === "en") return t("x-essential-lib.dlg.ask", {
|
|
744
|
+
verb: toLower(t(verb)),
|
|
745
|
+
object: toLower(t(object)),
|
|
746
|
+
name
|
|
747
|
+
});
|
|
748
|
+
else return t("x-essential-lib.dlg.ask", {
|
|
749
|
+
verb: t(verb),
|
|
750
|
+
object: t(object),
|
|
751
|
+
name
|
|
752
|
+
});
|
|
753
|
+
}
|
|
754
|
+
return {
|
|
755
|
+
isMobile,
|
|
756
|
+
compactWidth,
|
|
757
|
+
minimizeApp,
|
|
758
|
+
insetTop,
|
|
759
|
+
insetBottom,
|
|
760
|
+
nameList,
|
|
761
|
+
sentenceOfAsk
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
|
|
707
765
|
//#endregion
|
|
708
766
|
//#region src/composables/microApp.ts
|
|
709
767
|
function useMicroApp(globalStates, customBack) {
|
|
710
768
|
const route = useRoute();
|
|
711
769
|
const router = useRouter();
|
|
770
|
+
const { minimizeApp } = useSystem();
|
|
712
771
|
useGlobalStates(globalStates);
|
|
713
772
|
const { activeOrg, views } = globalStates;
|
|
714
773
|
async function handleBack() {
|
|
@@ -718,7 +777,7 @@ function useMicroApp(globalStates, customBack) {
|
|
|
718
777
|
}
|
|
719
778
|
const routeMeta = matchRouteMeta(route.path);
|
|
720
779
|
if (!routeMeta) return;
|
|
721
|
-
if (routeMeta.level === 0)
|
|
780
|
+
if (routeMeta.level === 0) minimizeApp();
|
|
722
781
|
else if (customBack) customBack(routeMeta);
|
|
723
782
|
else {
|
|
724
783
|
let back;
|
|
@@ -816,55 +875,6 @@ function usePermission() {
|
|
|
816
875
|
return { verifyPermission: verifyPermission$1 };
|
|
817
876
|
}
|
|
818
877
|
|
|
819
|
-
//#endregion
|
|
820
|
-
//#region src/composables/system.ts
|
|
821
|
-
function useSystem() {
|
|
822
|
-
const { locale, t } = useI18n();
|
|
823
|
-
const sysBarAvail = computed(() => {
|
|
824
|
-
return !!window.cordova;
|
|
825
|
-
});
|
|
826
|
-
const display = useDisplay();
|
|
827
|
-
const compactWidth = computed(() => {
|
|
828
|
-
if (display.width.value <= 1280) return display.width.value + "px";
|
|
829
|
-
else if (display.width.value <= 1920) return "768px";
|
|
830
|
-
else return "1024px";
|
|
831
|
-
});
|
|
832
|
-
const isCurvedScreen = computed(() => {
|
|
833
|
-
return false;
|
|
834
|
-
});
|
|
835
|
-
function isMobile() {
|
|
836
|
-
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);
|
|
837
|
-
}
|
|
838
|
-
function nameList(entries, instances) {
|
|
839
|
-
let name;
|
|
840
|
-
const names = entries.map((entry) => t(entry));
|
|
841
|
-
if (instances) name = `${names.join("/")} <${instances.join("/")}>`;
|
|
842
|
-
else if (locale.value === "en") name = names.join(" ");
|
|
843
|
-
else name = names.join("");
|
|
844
|
-
return name;
|
|
845
|
-
}
|
|
846
|
-
function sentenceOfAsk(verb, object, name) {
|
|
847
|
-
if (locale.value === "en") return t("x-essential-lib.dlg.ask", {
|
|
848
|
-
verb: toLower(t(verb)),
|
|
849
|
-
object: toLower(t(object)),
|
|
850
|
-
name
|
|
851
|
-
});
|
|
852
|
-
else return t("x-essential-lib.dlg.ask", {
|
|
853
|
-
verb: t(verb),
|
|
854
|
-
object: t(object),
|
|
855
|
-
name
|
|
856
|
-
});
|
|
857
|
-
}
|
|
858
|
-
return {
|
|
859
|
-
sysBarAvail,
|
|
860
|
-
compactWidth,
|
|
861
|
-
isCurvedScreen,
|
|
862
|
-
isMobile,
|
|
863
|
-
nameList,
|
|
864
|
-
sentenceOfAsk
|
|
865
|
-
};
|
|
866
|
-
}
|
|
867
|
-
|
|
868
878
|
//#endregion
|
|
869
879
|
//#region src/composables/viewStack.ts
|
|
870
880
|
function useViewStack(name, openHook, closeHook) {
|
|
@@ -1570,7 +1580,7 @@ const install = (app) => {
|
|
|
1570
1580
|
//#endregion
|
|
1571
1581
|
//#region src/i18n/index.ts
|
|
1572
1582
|
async function loadLocaleMessageEssential(locale) {
|
|
1573
|
-
if (locale === "en") return (await import("./i18n-en.
|
|
1583
|
+
if (locale === "en") return (await import("./i18n-en.j7vfghgh.js").then((n) => n.t)).default;
|
|
1574
1584
|
else if (locale === "zhHans") return (await import("./i18n-zhHans.bl5d1n9h.js").then((n) => n.t)).default;
|
|
1575
1585
|
else throw new Error(`invalid locale=${locale}`);
|
|
1576
1586
|
}
|
|
@@ -1580,4 +1590,4 @@ async function loadLocaleMessageEssential(locale) {
|
|
|
1580
1590
|
var src_default = { install };
|
|
1581
1591
|
|
|
1582
1592
|
//#endregion
|
|
1583
|
-
export { addView, clearViews, closeWaitDlg, createAxios,
|
|
1593
|
+
export { addView, baseVuetifyOptions, clearViews, closeWaitDlg, createAxios, src_default as default, delView, email, eventBus, getErrorMessage, getTypeColor, getTypeDefault, globalObjects, hasView, injectDark, injectLocale, injectPermissionObjects, injectViews, isEmpty, isExist, lastView, length, loadLocaleMessageEssential, matchRouteMeta, maxLength, messageError, messageInfo, messageSuccess, messageWarning, minLength, onBeforeEnter, openConfirmDlg, openNumberDlg, openPromptDlg, openWaitDlg, popView, provideDark, provideLocale, providePermissionObjects, provideViews, required, routeTransName, toPermissionObjects, types, useColor, useGlobalStates, useMicroApp, usePageRoute, usePermission, useSystem, useViewStack, verifyPermission, waitMs, waitUtil };
|
|
@@ -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
|
}
|
|
@@ -4601,6 +4601,119 @@ function baseToString(value) {
|
|
|
4601
4601
|
return result == "0" && 1 / value == -INFINITY ? "-0" : result;
|
|
4602
4602
|
}
|
|
4603
4603
|
|
|
4604
|
+
//#endregion
|
|
4605
|
+
//#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_trimmedEndIndex.js
|
|
4606
|
+
/** Used to match a single whitespace character. */
|
|
4607
|
+
var reWhitespace = /\s/;
|
|
4608
|
+
/**
|
|
4609
|
+
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
|
|
4610
|
+
* character of `string`.
|
|
4611
|
+
*
|
|
4612
|
+
* @private
|
|
4613
|
+
* @param {string} string The string to inspect.
|
|
4614
|
+
* @returns {number} Returns the index of the last non-whitespace character.
|
|
4615
|
+
*/
|
|
4616
|
+
function trimmedEndIndex(string) {
|
|
4617
|
+
var index = string.length;
|
|
4618
|
+
while (index-- && reWhitespace.test(string.charAt(index)));
|
|
4619
|
+
return index;
|
|
4620
|
+
}
|
|
4621
|
+
|
|
4622
|
+
//#endregion
|
|
4623
|
+
//#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/_baseTrim.js
|
|
4624
|
+
/** Used to match leading whitespace. */
|
|
4625
|
+
var reTrimStart = /^\s+/;
|
|
4626
|
+
/**
|
|
4627
|
+
* The base implementation of `_.trim`.
|
|
4628
|
+
*
|
|
4629
|
+
* @private
|
|
4630
|
+
* @param {string} string The string to trim.
|
|
4631
|
+
* @returns {string} Returns the trimmed string.
|
|
4632
|
+
*/
|
|
4633
|
+
function baseTrim(string) {
|
|
4634
|
+
return string ? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, "") : string;
|
|
4635
|
+
}
|
|
4636
|
+
|
|
4637
|
+
//#endregion
|
|
4638
|
+
//#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/isObject.js
|
|
4639
|
+
/**
|
|
4640
|
+
* Checks if `value` is the
|
|
4641
|
+
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
|
|
4642
|
+
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
|
|
4643
|
+
*
|
|
4644
|
+
* @static
|
|
4645
|
+
* @memberOf _
|
|
4646
|
+
* @since 0.1.0
|
|
4647
|
+
* @category Lang
|
|
4648
|
+
* @param {*} value The value to check.
|
|
4649
|
+
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
|
|
4650
|
+
* @example
|
|
4651
|
+
*
|
|
4652
|
+
* _.isObject({});
|
|
4653
|
+
* // => true
|
|
4654
|
+
*
|
|
4655
|
+
* _.isObject([1, 2, 3]);
|
|
4656
|
+
* // => true
|
|
4657
|
+
*
|
|
4658
|
+
* _.isObject(_.noop);
|
|
4659
|
+
* // => true
|
|
4660
|
+
*
|
|
4661
|
+
* _.isObject(null);
|
|
4662
|
+
* // => false
|
|
4663
|
+
*/
|
|
4664
|
+
function isObject(value) {
|
|
4665
|
+
var type = typeof value;
|
|
4666
|
+
return value != null && (type == "object" || type == "function");
|
|
4667
|
+
}
|
|
4668
|
+
|
|
4669
|
+
//#endregion
|
|
4670
|
+
//#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toNumber.js
|
|
4671
|
+
/** Used as references for various `Number` constants. */
|
|
4672
|
+
var NAN = NaN;
|
|
4673
|
+
/** Used to detect bad signed hexadecimal string values. */
|
|
4674
|
+
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
|
4675
|
+
/** Used to detect binary string values. */
|
|
4676
|
+
var reIsBinary = /^0b[01]+$/i;
|
|
4677
|
+
/** Used to detect octal string values. */
|
|
4678
|
+
var reIsOctal = /^0o[0-7]+$/i;
|
|
4679
|
+
/** Built-in method references without a dependency on `root`. */
|
|
4680
|
+
var freeParseInt = parseInt;
|
|
4681
|
+
/**
|
|
4682
|
+
* Converts `value` to a number.
|
|
4683
|
+
*
|
|
4684
|
+
* @static
|
|
4685
|
+
* @memberOf _
|
|
4686
|
+
* @since 4.0.0
|
|
4687
|
+
* @category Lang
|
|
4688
|
+
* @param {*} value The value to process.
|
|
4689
|
+
* @returns {number} Returns the number.
|
|
4690
|
+
* @example
|
|
4691
|
+
*
|
|
4692
|
+
* _.toNumber(3.2);
|
|
4693
|
+
* // => 3.2
|
|
4694
|
+
*
|
|
4695
|
+
* _.toNumber(Number.MIN_VALUE);
|
|
4696
|
+
* // => 5e-324
|
|
4697
|
+
*
|
|
4698
|
+
* _.toNumber(Infinity);
|
|
4699
|
+
* // => Infinity
|
|
4700
|
+
*
|
|
4701
|
+
* _.toNumber('3.2');
|
|
4702
|
+
* // => 3.2
|
|
4703
|
+
*/
|
|
4704
|
+
function toNumber(value) {
|
|
4705
|
+
if (typeof value == "number") return value;
|
|
4706
|
+
if (isSymbol(value)) return NAN;
|
|
4707
|
+
if (isObject(value)) {
|
|
4708
|
+
var other = typeof value.valueOf == "function" ? value.valueOf() : value;
|
|
4709
|
+
value = isObject(other) ? other + "" : other;
|
|
4710
|
+
}
|
|
4711
|
+
if (typeof value != "string") return value === 0 ? value : +value;
|
|
4712
|
+
value = baseTrim(value);
|
|
4713
|
+
var isBinary = reIsBinary.test(value);
|
|
4714
|
+
return isBinary || reIsOctal.test(value) ? freeParseInt(value.slice(2), isBinary ? 2 : 8) : reIsBadHex.test(value) ? NAN : +value;
|
|
4715
|
+
}
|
|
4716
|
+
|
|
4604
4717
|
//#endregion
|
|
4605
4718
|
//#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toString.js
|
|
4606
4719
|
/**
|
|
@@ -4628,6 +4741,158 @@ function toString(value) {
|
|
|
4628
4741
|
return value == null ? "" : baseToString(value);
|
|
4629
4742
|
}
|
|
4630
4743
|
|
|
4744
|
+
//#endregion
|
|
4745
|
+
//#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/now.js
|
|
4746
|
+
/**
|
|
4747
|
+
* Gets the timestamp of the number of milliseconds that have elapsed since
|
|
4748
|
+
* the Unix epoch (1 January 1970 00:00:00 UTC).
|
|
4749
|
+
*
|
|
4750
|
+
* @static
|
|
4751
|
+
* @memberOf _
|
|
4752
|
+
* @since 2.4.0
|
|
4753
|
+
* @category Date
|
|
4754
|
+
* @returns {number} Returns the timestamp.
|
|
4755
|
+
* @example
|
|
4756
|
+
*
|
|
4757
|
+
* _.defer(function(stamp) {
|
|
4758
|
+
* console.log(_.now() - stamp);
|
|
4759
|
+
* }, _.now());
|
|
4760
|
+
* // => Logs the number of milliseconds it took for the deferred invocation.
|
|
4761
|
+
*/
|
|
4762
|
+
var now = function() {
|
|
4763
|
+
return root.Date.now();
|
|
4764
|
+
};
|
|
4765
|
+
|
|
4766
|
+
//#endregion
|
|
4767
|
+
//#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/debounce.js
|
|
4768
|
+
/** Error message constants. */
|
|
4769
|
+
var FUNC_ERROR_TEXT = "Expected a function";
|
|
4770
|
+
var nativeMax = Math.max;
|
|
4771
|
+
var nativeMin = Math.min;
|
|
4772
|
+
/**
|
|
4773
|
+
* Creates a debounced function that delays invoking `func` until after `wait`
|
|
4774
|
+
* milliseconds have elapsed since the last time the debounced function was
|
|
4775
|
+
* invoked. The debounced function comes with a `cancel` method to cancel
|
|
4776
|
+
* delayed `func` invocations and a `flush` method to immediately invoke them.
|
|
4777
|
+
* Provide `options` to indicate whether `func` should be invoked on the
|
|
4778
|
+
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
|
|
4779
|
+
* with the last arguments provided to the debounced function. Subsequent
|
|
4780
|
+
* calls to the debounced function return the result of the last `func`
|
|
4781
|
+
* invocation.
|
|
4782
|
+
*
|
|
4783
|
+
* **Note:** If `leading` and `trailing` options are `true`, `func` is
|
|
4784
|
+
* invoked on the trailing edge of the timeout only if the debounced function
|
|
4785
|
+
* is invoked more than once during the `wait` timeout.
|
|
4786
|
+
*
|
|
4787
|
+
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
|
|
4788
|
+
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
|
|
4789
|
+
*
|
|
4790
|
+
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
|
|
4791
|
+
* for details over the differences between `_.debounce` and `_.throttle`.
|
|
4792
|
+
*
|
|
4793
|
+
* @static
|
|
4794
|
+
* @memberOf _
|
|
4795
|
+
* @since 0.1.0
|
|
4796
|
+
* @category Function
|
|
4797
|
+
* @param {Function} func The function to debounce.
|
|
4798
|
+
* @param {number} [wait=0] The number of milliseconds to delay.
|
|
4799
|
+
* @param {Object} [options={}] The options object.
|
|
4800
|
+
* @param {boolean} [options.leading=false]
|
|
4801
|
+
* Specify invoking on the leading edge of the timeout.
|
|
4802
|
+
* @param {number} [options.maxWait]
|
|
4803
|
+
* The maximum time `func` is allowed to be delayed before it's invoked.
|
|
4804
|
+
* @param {boolean} [options.trailing=true]
|
|
4805
|
+
* Specify invoking on the trailing edge of the timeout.
|
|
4806
|
+
* @returns {Function} Returns the new debounced function.
|
|
4807
|
+
* @example
|
|
4808
|
+
*
|
|
4809
|
+
* // Avoid costly calculations while the window size is in flux.
|
|
4810
|
+
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
|
|
4811
|
+
*
|
|
4812
|
+
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
|
|
4813
|
+
* jQuery(element).on('click', _.debounce(sendMail, 300, {
|
|
4814
|
+
* 'leading': true,
|
|
4815
|
+
* 'trailing': false
|
|
4816
|
+
* }));
|
|
4817
|
+
*
|
|
4818
|
+
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
|
|
4819
|
+
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
|
|
4820
|
+
* var source = new EventSource('/stream');
|
|
4821
|
+
* jQuery(source).on('message', debounced);
|
|
4822
|
+
*
|
|
4823
|
+
* // Cancel the trailing debounced invocation.
|
|
4824
|
+
* jQuery(window).on('popstate', debounced.cancel);
|
|
4825
|
+
*/
|
|
4826
|
+
function debounce(func, wait, options) {
|
|
4827
|
+
var lastArgs, lastThis, maxWait, result, timerId, lastCallTime, lastInvokeTime = 0, leading = false, maxing = false, trailing = true;
|
|
4828
|
+
if (typeof func != "function") throw new TypeError(FUNC_ERROR_TEXT);
|
|
4829
|
+
wait = toNumber(wait) || 0;
|
|
4830
|
+
if (isObject(options)) {
|
|
4831
|
+
leading = !!options.leading;
|
|
4832
|
+
maxing = "maxWait" in options;
|
|
4833
|
+
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
|
|
4834
|
+
trailing = "trailing" in options ? !!options.trailing : trailing;
|
|
4835
|
+
}
|
|
4836
|
+
function invokeFunc(time) {
|
|
4837
|
+
var args = lastArgs, thisArg = lastThis;
|
|
4838
|
+
lastArgs = lastThis = void 0;
|
|
4839
|
+
lastInvokeTime = time;
|
|
4840
|
+
result = func.apply(thisArg, args);
|
|
4841
|
+
return result;
|
|
4842
|
+
}
|
|
4843
|
+
function leadingEdge(time) {
|
|
4844
|
+
lastInvokeTime = time;
|
|
4845
|
+
timerId = setTimeout(timerExpired, wait);
|
|
4846
|
+
return leading ? invokeFunc(time) : result;
|
|
4847
|
+
}
|
|
4848
|
+
function remainingWait(time) {
|
|
4849
|
+
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime, timeWaiting = wait - timeSinceLastCall;
|
|
4850
|
+
return maxing ? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke) : timeWaiting;
|
|
4851
|
+
}
|
|
4852
|
+
function shouldInvoke(time) {
|
|
4853
|
+
var timeSinceLastCall = time - lastCallTime, timeSinceLastInvoke = time - lastInvokeTime;
|
|
4854
|
+
return lastCallTime === void 0 || timeSinceLastCall >= wait || timeSinceLastCall < 0 || maxing && timeSinceLastInvoke >= maxWait;
|
|
4855
|
+
}
|
|
4856
|
+
function timerExpired() {
|
|
4857
|
+
var time = now();
|
|
4858
|
+
if (shouldInvoke(time)) return trailingEdge(time);
|
|
4859
|
+
timerId = setTimeout(timerExpired, remainingWait(time));
|
|
4860
|
+
}
|
|
4861
|
+
function trailingEdge(time) {
|
|
4862
|
+
timerId = void 0;
|
|
4863
|
+
if (trailing && lastArgs) return invokeFunc(time);
|
|
4864
|
+
lastArgs = lastThis = void 0;
|
|
4865
|
+
return result;
|
|
4866
|
+
}
|
|
4867
|
+
function cancel() {
|
|
4868
|
+
if (timerId !== void 0) clearTimeout(timerId);
|
|
4869
|
+
lastInvokeTime = 0;
|
|
4870
|
+
lastArgs = lastCallTime = lastThis = timerId = void 0;
|
|
4871
|
+
}
|
|
4872
|
+
function flush() {
|
|
4873
|
+
return timerId === void 0 ? result : trailingEdge(now());
|
|
4874
|
+
}
|
|
4875
|
+
function debounced() {
|
|
4876
|
+
var time = now(), isInvoking = shouldInvoke(time);
|
|
4877
|
+
lastArgs = arguments;
|
|
4878
|
+
lastThis = this;
|
|
4879
|
+
lastCallTime = time;
|
|
4880
|
+
if (isInvoking) {
|
|
4881
|
+
if (timerId === void 0) return leadingEdge(lastCallTime);
|
|
4882
|
+
if (maxing) {
|
|
4883
|
+
clearTimeout(timerId);
|
|
4884
|
+
timerId = setTimeout(timerExpired, wait);
|
|
4885
|
+
return invokeFunc(lastCallTime);
|
|
4886
|
+
}
|
|
4887
|
+
}
|
|
4888
|
+
if (timerId === void 0) timerId = setTimeout(timerExpired, wait);
|
|
4889
|
+
return result;
|
|
4890
|
+
}
|
|
4891
|
+
debounced.cancel = cancel;
|
|
4892
|
+
debounced.flush = flush;
|
|
4893
|
+
return debounced;
|
|
4894
|
+
}
|
|
4895
|
+
|
|
4631
4896
|
//#endregion
|
|
4632
4897
|
//#region node_modules/.pnpm/lodash-es@4.18.1/node_modules/lodash-es/toLower.js
|
|
4633
4898
|
/**
|
|
@@ -4658,12 +4923,12 @@ function toLower(value) {
|
|
|
4658
4923
|
//#endregion
|
|
4659
4924
|
//#region node_modules/.pnpm/mitt@3.0.1/node_modules/mitt/index.d.ts
|
|
4660
4925
|
var [EventType] = [
|
|
4661
|
-
|
|
4926
|
+
68,
|
|
4662
4927
|
() => [],
|
|
4663
4928
|
[]
|
|
4664
4929
|
];
|
|
4665
4930
|
var [Handler] = [
|
|
4666
|
-
|
|
4931
|
+
69,
|
|
4667
4932
|
(T) => [T],
|
|
4668
4933
|
[
|
|
4669
4934
|
"",
|
|
@@ -4672,7 +4937,7 @@ var [Handler] = [
|
|
|
4672
4937
|
]
|
|
4673
4938
|
];
|
|
4674
4939
|
var [WildcardHandler] = [
|
|
4675
|
-
|
|
4940
|
+
70,
|
|
4676
4941
|
(T) => [
|
|
4677
4942
|
Record,
|
|
4678
4943
|
T,
|
|
@@ -4690,7 +4955,7 @@ var [WildcardHandler] = [
|
|
|
4690
4955
|
]
|
|
4691
4956
|
];
|
|
4692
4957
|
var [EventHandlerList] = [
|
|
4693
|
-
|
|
4958
|
+
71,
|
|
4694
4959
|
(T) => [
|
|
4695
4960
|
T,
|
|
4696
4961
|
Handler,
|
|
@@ -4704,7 +4969,7 @@ var [EventHandlerList] = [
|
|
|
4704
4969
|
]
|
|
4705
4970
|
];
|
|
4706
4971
|
var [WildCardEventHandlerList] = [
|
|
4707
|
-
|
|
4972
|
+
72,
|
|
4708
4973
|
(T) => [
|
|
4709
4974
|
Record,
|
|
4710
4975
|
T,
|
|
@@ -4720,7 +4985,7 @@ var [WildCardEventHandlerList] = [
|
|
|
4720
4985
|
]
|
|
4721
4986
|
];
|
|
4722
4987
|
var [EventHandlerMap] = [
|
|
4723
|
-
|
|
4988
|
+
73,
|
|
4724
4989
|
(Events) => [
|
|
4725
4990
|
EventType,
|
|
4726
4991
|
Record,
|
|
@@ -4746,7 +5011,7 @@ var [EventHandlerMap] = [
|
|
|
4746
5011
|
]
|
|
4747
5012
|
];
|
|
4748
5013
|
var [Emitter] = [
|
|
4749
|
-
|
|
5014
|
+
74,
|
|
4750
5015
|
(Key, Events) => [
|
|
4751
5016
|
EventType,
|
|
4752
5017
|
Record,
|
|
@@ -4829,4 +5094,4 @@ var [Emitter] = [
|
|
|
4829
5094
|
];
|
|
4830
5095
|
|
|
4831
5096
|
//#endregion
|
|
4832
|
-
export {
|
|
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 };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "x-essential-lib",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.9",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"registry": "https://registry.npmjs.org"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
|
-
"sync": "git submodule update --remote",
|
|
18
|
+
"sync": "git submodule update --init --remote",
|
|
19
19
|
"gen": "buf generate --clean",
|
|
20
20
|
"play": "vite",
|
|
21
21
|
"test": "vitest",
|
|
@@ -25,6 +25,9 @@
|
|
|
25
25
|
"lint-staged": "lint-staged",
|
|
26
26
|
"prepare": "husky"
|
|
27
27
|
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@tauri-apps/api": "^2.12.1"
|
|
30
|
+
},
|
|
28
31
|
"devDependencies": {
|
|
29
32
|
"@types/js-cookie": "^3.0.6",
|
|
30
33
|
"@types/lodash-es": "^4.17.12",
|
|
@@ -45,7 +48,7 @@
|
|
|
45
48
|
"typescript": "^6.0.3",
|
|
46
49
|
"vite": "^8.3.0",
|
|
47
50
|
"vue-tsc": "^3.3.11",
|
|
48
|
-
"x-config-lib": "^0.1.
|
|
51
|
+
"x-config-lib": "^0.1.8",
|
|
49
52
|
"x-config-oxfmt": "^0.1.6",
|
|
50
53
|
"x-config-oxlint": "^0.1.7",
|
|
51
54
|
"zod": "^4.6.5"
|