x-essential-lib 0.9.22 → 0.9.24

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.
@@ -1,226 +0,0 @@
1
- import { getCurrentInstance as x, getCurrentScope as P, hasInjectionContext as k, inject as $, watch as E, shallowRef as b, watchEffect as R, toValue as p, computed as w, onMounted as L, unref as U } from "vue";
2
- const y = /* @__PURE__ */ new WeakMap(), B = /* @__NO_SIDE_EFFECTS__ */ (...e) => {
3
- var o;
4
- const r = e[0], n = (o = x()) === null || o === void 0 ? void 0 : o.proxy, t = n ?? P();
5
- if (t == null && !k()) throw new Error("injectLocal must be called in setup");
6
- return t && y.has(t) && r in y.get(t) ? y.get(t)[r] : $(...e);
7
- }, F = typeof window < "u" && typeof document < "u";
8
- typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
9
- const D = Object.prototype.toString, z = (e) => D.call(e) === "[object Object]";
10
- function T(e) {
11
- return e.endsWith("rem") ? Number.parseFloat(e) * 16 : Number.parseFloat(e);
12
- }
13
- function j(e) {
14
- return Array.isArray(e) ? e : [e];
15
- }
16
- function G(e, o, r) {
17
- return E(e, o, {
18
- ...r,
19
- immediate: !0
20
- });
21
- }
22
- const I = F ? window : void 0;
23
- function Q(e) {
24
- var o;
25
- const r = p(e);
26
- return (o = r?.$el) !== null && o !== void 0 ? o : r;
27
- }
28
- function V(...e) {
29
- const o = (n, t, c, i) => (n.addEventListener(t, c, i), () => n.removeEventListener(t, c, i)), r = w(() => {
30
- const n = j(p(e[0])).filter((t) => t != null);
31
- return n.every((t) => typeof t != "string") ? n : void 0;
32
- });
33
- return G(() => {
34
- var n, t;
35
- return [
36
- (n = (t = r.value) === null || t === void 0 ? void 0 : t.map((c) => Q(c))) !== null && n !== void 0 ? n : [I].filter((c) => c != null),
37
- j(p(r.value ? e[1] : e[0])),
38
- j(U(r.value ? e[2] : e[1])),
39
- p(r.value ? e[3] : e[2])
40
- ];
41
- }, ([n, t, c, i], u, l) => {
42
- if (!n?.length || !t?.length || !c?.length) return;
43
- const s = z(i) ? { ...i } : i, d = n.flatMap((a) => t.flatMap((m) => c.map((f) => o(a, m, f, s))));
44
- l(() => {
45
- d.forEach((a) => a());
46
- });
47
- }, { flush: "post" });
48
- }
49
- // @__NO_SIDE_EFFECTS__
50
- function H() {
51
- const e = b(!1), o = x();
52
- return o && L(() => {
53
- e.value = !0;
54
- }, o), e;
55
- }
56
- // @__NO_SIDE_EFFECTS__
57
- function J(e) {
58
- const o = /* @__PURE__ */ H();
59
- return w(() => (o.value, !!e()));
60
- }
61
- const K = /* @__PURE__ */ Symbol("vueuse-ssr-width");
62
- // @__NO_SIDE_EFFECTS__
63
- function N() {
64
- const e = k() ? /* @__PURE__ */ B(K, null) : null;
65
- return typeof e == "number" ? e : void 0;
66
- }
67
- function X(e, o = {}) {
68
- const { window: r = I, ssrWidth: n = /* @__PURE__ */ N() } = o, t = /* @__PURE__ */ J(() => r && "matchMedia" in r && typeof r.matchMedia == "function"), c = b(typeof n == "number"), i = b(), u = b(!1), l = (s) => {
69
- u.value = s.matches;
70
- };
71
- return R(() => {
72
- if (c.value) {
73
- c.value = !t.value, u.value = p(e).split(",").some((s) => {
74
- const d = s.includes("not all"), a = s.match(/\(\s*min-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/), m = s.match(/\(\s*max-width:\s*(-?\d+(?:\.\d*)?[a-z]+\s*)\)/);
75
- let f = !!(a || m);
76
- return a && f && (f = n >= T(a[1])), m && f && (f = n <= T(m[1])), d ? !f : f;
77
- });
78
- return;
79
- }
80
- t.value && (i.value = r.matchMedia(p(e)), u.value = i.value.matches);
81
- }), V(i, "change", l, { passive: !0 }), w(() => u.value);
82
- }
83
- // @__NO_SIDE_EFFECTS__
84
- function ge(e) {
85
- return X("(prefers-color-scheme: dark)", e);
86
- }
87
- function h(e) {
88
- for (var o = 1; o < arguments.length; o++) {
89
- var r = arguments[o];
90
- for (var n in r)
91
- e[n] = r[n];
92
- }
93
- return e;
94
- }
95
- var Y = {
96
- read: function(e) {
97
- return e[0] === '"' && (e = e.slice(1, -1)), e.replace(/(%[\dA-F]{2})+/gi, decodeURIComponent);
98
- },
99
- write: function(e) {
100
- return encodeURIComponent(e).replace(
101
- /%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,
102
- decodeURIComponent
103
- );
104
- }
105
- };
106
- function S(e, o) {
107
- function r(t, c, i) {
108
- if (!(typeof document > "u")) {
109
- i = h({}, o, i), typeof i.expires == "number" && (i.expires = new Date(Date.now() + i.expires * 864e5)), i.expires && (i.expires = i.expires.toUTCString()), t = encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g, decodeURIComponent).replace(/[()]/g, escape);
110
- var u = "";
111
- for (var l in i)
112
- i[l] && (u += "; " + l, i[l] !== !0 && (u += "=" + i[l].split(";")[0]));
113
- return document.cookie = t + "=" + e.write(c, t) + u;
114
- }
115
- }
116
- function n(t) {
117
- if (!(typeof document > "u" || arguments.length && !t)) {
118
- for (var c = document.cookie ? document.cookie.split("; ") : [], i = {}, u = 0; u < c.length; u++) {
119
- var l = c[u].split("="), s = l.slice(1).join("=");
120
- try {
121
- var d = decodeURIComponent(l[0]);
122
- if (i[d] = e.read(s, d), t === d)
123
- break;
124
- } catch {
125
- }
126
- }
127
- return t ? i[t] : i;
128
- }
129
- }
130
- return Object.create(
131
- {
132
- set: r,
133
- get: n,
134
- remove: function(t, c) {
135
- r(
136
- t,
137
- "",
138
- h({}, c, {
139
- expires: -1
140
- })
141
- );
142
- },
143
- withAttributes: function(t) {
144
- return S(this.converter, h({}, this.attributes, t));
145
- },
146
- withConverter: function(t) {
147
- return S(h({}, this.converter, t), this.attributes);
148
- }
149
- },
150
- {
151
- attributes: { value: Object.freeze(o) },
152
- converter: { value: Object.freeze(e) }
153
- }
154
- );
155
- }
156
- var he = S(Y, { path: "/" });
157
- function be(e) {
158
- return { all: e = e || /* @__PURE__ */ new Map(), on: function(o, r) {
159
- var n = e.get(o);
160
- n ? n.push(r) : e.set(o, [r]);
161
- }, off: function(o, r) {
162
- var n = e.get(o);
163
- n && (r ? n.splice(n.indexOf(r) >>> 0, 1) : e.set(o, []));
164
- }, emit: function(o, r) {
165
- var n = e.get(o);
166
- n && n.slice().map(function(t) {
167
- t(r);
168
- }), (n = e.get("*")) && n.slice().map(function(t) {
169
- t(o, r);
170
- });
171
- } };
172
- }
173
- var Z = typeof global == "object" && global && global.Object === Object && global, q = typeof self == "object" && self && self.Object === Object && self, _ = Z || q || Function("return this")(), v = _.Symbol, W = Object.prototype, ee = W.hasOwnProperty, te = W.toString, g = v ? v.toStringTag : void 0;
174
- function ne(e) {
175
- var o = ee.call(e, g), r = e[g];
176
- try {
177
- e[g] = void 0;
178
- var n = !0;
179
- } catch {
180
- }
181
- var t = te.call(e);
182
- return n && (o ? e[g] = r : delete e[g]), t;
183
- }
184
- var oe = Object.prototype, re = oe.toString;
185
- function ie(e) {
186
- return re.call(e);
187
- }
188
- var ce = "[object Null]", ue = "[object Undefined]", O = v ? v.toStringTag : void 0;
189
- function le(e) {
190
- return e == null ? e === void 0 ? ue : ce : O && O in Object(e) ? ne(e) : ie(e);
191
- }
192
- function se(e) {
193
- return e != null && typeof e == "object";
194
- }
195
- var ae = "[object Symbol]";
196
- function fe(e) {
197
- return typeof e == "symbol" || se(e) && le(e) == ae;
198
- }
199
- function de(e, o) {
200
- for (var r = -1, n = e == null ? 0 : e.length, t = Array(n); ++r < n; )
201
- t[r] = o(e[r], r, e);
202
- return t;
203
- }
204
- var pe = Array.isArray, C = v ? v.prototype : void 0, M = C ? C.toString : void 0;
205
- function A(e) {
206
- if (typeof e == "string")
207
- return e;
208
- if (pe(e))
209
- return de(e, A) + "";
210
- if (fe(e))
211
- return M ? M.call(e) : "";
212
- var o = e + "";
213
- return o == "0" && 1 / e == -1 / 0 ? "-0" : o;
214
- }
215
- function ve(e) {
216
- return e == null ? "" : A(e);
217
- }
218
- function ye(e) {
219
- return ve(e).toLowerCase();
220
- }
221
- export {
222
- he as a,
223
- be as m,
224
- ye as t,
225
- ge as u
226
- };