@pinia/colada-devtools 0.0.1 → 0.0.2
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.js +353 -254
- package/dist/index.js.map +1 -1
- package/dist-panel/{_queryId_-hQFnZzX2.js → _queryId_-dahx0N-a.js} +16 -16
- package/dist-panel/{_queryId_-hQFnZzX2.js.map → _queryId_-dahx0N-a.js.map} +1 -1
- package/dist-panel/{index-BVvWMadg.js → index-BkrEntNA.js} +3 -3
- package/dist-panel/{index-BVvWMadg.js.map → index-BkrEntNA.js.map} +1 -1
- package/dist-panel/{index-B2dJ1q6y.js → index-BoUh47CR.js} +2 -2
- package/dist-panel/{index-B2dJ1q6y.js.map → index-BoUh47CR.js.map} +1 -1
- package/dist-panel/{index-DfIXa7Jb.js → index-Covr4drg.js} +693 -713
- package/dist-panel/{index-DfIXa7Jb.js.map → index-Covr4drg.js.map} +1 -1
- package/dist-panel/index.js +1 -1
- package/dist-panel/{loader-B7hpsxwv.js → loader-CuAz6irK.js} +2 -2
- package/dist-panel/loader-CuAz6irK.js.map +1 -0
- package/dist-panel/{mouse-pointer-click-C8Q9Aulw.js → mouse-pointer-click-BRg0nGpd.js} +2 -2
- package/dist-panel/mouse-pointer-click-BRg0nGpd.js.map +1 -0
- package/dist-panel/{mutations-DqlFNONQ.js → mutations-ComK9mEg.js} +2 -2
- package/dist-panel/{mutations-DqlFNONQ.js.map → mutations-ComK9mEg.js.map} +1 -1
- package/dist-panel/{queries-DPJvb6qB.js → queries-C8H8bbDX.js} +85 -88
- package/dist-panel/{queries-DPJvb6qB.js.map → queries-C8H8bbDX.js.map} +1 -1
- package/dist-panel/{settings-DiWRvbPR.js → settings-DoijmHf7.js} +2 -2
- package/dist-panel/{settings-DiWRvbPR.js.map → settings-DoijmHf7.js.map} +1 -1
- package/dist-shared/index.d.ts +0 -15
- package/dist-shared/index.js +51 -152
- package/dist-shared/index.js.map +1 -1
- package/package.json +2 -2
- package/dist-panel/loader-B7hpsxwv.js.map +0 -1
- package/dist-panel/mouse-pointer-click-C8Q9Aulw.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,305 +1,404 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useQueryCache as
|
|
3
|
-
import {
|
|
4
|
-
const ve = /* @__PURE__ */
|
|
1
|
+
import { defineComponent as $, ref as R, onMounted as L, renderSlot as ne, createCommentVNode as M, toValue as C, getCurrentScope as J, onScopeDispose as Q, useTemplateRef as oe, shallowRef as N, watch as P, onBeforeUnmount as ie, createBlock as W, openBlock as x, Teleport as re, createElementVNode as se, nextTick as G, readonly as K, getCurrentInstance as ae, toRef as le, customRef as ue, computed as U, unref as F, withCtx as ce, createElementBlock as de } from "vue";
|
|
2
|
+
import { useQueryCache as fe } from "@pinia/colada";
|
|
3
|
+
import { DEVTOOLS_INFO_KEY as p, DuplexChannel as pe } from "@pinia/colada-devtools/shared";
|
|
4
|
+
const ve = /* @__PURE__ */ $({
|
|
5
5
|
__name: "ClientOnly",
|
|
6
6
|
setup(e) {
|
|
7
|
-
const t =
|
|
8
|
-
return
|
|
7
|
+
const t = R(!1);
|
|
8
|
+
return L(() => {
|
|
9
9
|
t.value = !0;
|
|
10
|
-
}), (
|
|
10
|
+
}), (o, l) => t.value ? ne(o.$slots, "default", { key: 0 }) : M("", !0);
|
|
11
11
|
}
|
|
12
|
-
}),
|
|
12
|
+
}), b = () => performance.timeOrigin + performance.now();
|
|
13
|
+
function me(e) {
|
|
14
|
+
I.has(e) || (I.set(e, !0), e.$onAction(({ name: t, args: o, after: l, onError: s }) => {
|
|
15
|
+
var c, y;
|
|
16
|
+
if (t === "create")
|
|
17
|
+
l((r) => {
|
|
18
|
+
r[p] = {
|
|
19
|
+
count: {
|
|
20
|
+
total: 0,
|
|
21
|
+
succeed: 0,
|
|
22
|
+
errored: 0,
|
|
23
|
+
cancelled: 0
|
|
24
|
+
},
|
|
25
|
+
updatedAt: b(),
|
|
26
|
+
inactiveAt: 0,
|
|
27
|
+
simulate: null,
|
|
28
|
+
history: []
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
else if (t === "fetch") {
|
|
32
|
+
const [r] = o;
|
|
33
|
+
r[p].count.total++, r[p].updatedAt = b();
|
|
34
|
+
const u = b(), f = {
|
|
35
|
+
id: (((c = r[p].history.at(0)) == null ? void 0 : c.id) ?? -1) + 1,
|
|
36
|
+
key: r.key,
|
|
37
|
+
state: r.state.value,
|
|
38
|
+
updatedAt: u,
|
|
39
|
+
createdAt: u,
|
|
40
|
+
fetchTime: null
|
|
41
|
+
}, h = C((y = r.options) == null ? void 0 : y.enabled) ?? !0;
|
|
42
|
+
h && (f.fetchTime = {
|
|
43
|
+
start: u,
|
|
44
|
+
end: null
|
|
45
|
+
}), r[p].history.unshift(f), r[p].history = r[p].history.slice(0, 10), l(() => {
|
|
46
|
+
h && (f.fetchTime.end = b(), r[p].count.succeed++, f.state = r.state.value, f.updatedAt = b());
|
|
47
|
+
}), s(() => {
|
|
48
|
+
h && (f.fetchTime.end = b(), r[p].count.errored++, f.state = r.state.value, f.updatedAt = b());
|
|
49
|
+
});
|
|
50
|
+
} else if (t === "cancel") {
|
|
51
|
+
const [r] = o;
|
|
52
|
+
r.pending && r[p].count.cancelled++;
|
|
53
|
+
} else if (t === "setEntryState") {
|
|
54
|
+
const [r] = o;
|
|
55
|
+
let u = r[p].history[0];
|
|
56
|
+
l(() => {
|
|
57
|
+
r[p].updatedAt = b(), u ?? (u = r[p].history[0]), u && (u.state = r.state.value, u.updatedAt = b());
|
|
58
|
+
});
|
|
59
|
+
} else if (t === "untrack") {
|
|
60
|
+
const [r] = o;
|
|
61
|
+
l(() => {
|
|
62
|
+
r.active || (r[p].inactiveAt = b());
|
|
63
|
+
});
|
|
64
|
+
} else if (t === "setQueryData") {
|
|
65
|
+
const [r] = o;
|
|
66
|
+
l(() => {
|
|
67
|
+
const u = e.getEntries({ key: r, exact: !0 })[0];
|
|
68
|
+
u && !u.active && (u[p].inactiveAt = b());
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
function w(e) {
|
|
74
|
+
return {
|
|
75
|
+
id: e.key.join("\0"),
|
|
76
|
+
key: e.key,
|
|
77
|
+
state: e.state.value,
|
|
78
|
+
asyncStatus: e.asyncStatus.value,
|
|
79
|
+
active: e.active,
|
|
80
|
+
stale: e.stale,
|
|
81
|
+
when: e.when,
|
|
82
|
+
options: e.options && {
|
|
83
|
+
staleTime: e.options.staleTime,
|
|
84
|
+
gcTime: e.options.gcTime,
|
|
85
|
+
refetchOnMount: C(e.options.refetchOnMount),
|
|
86
|
+
refetchOnReconnect: C(e.options.refetchOnReconnect),
|
|
87
|
+
refetchOnWindowFocus: C(e.options.refetchOnWindowFocus),
|
|
88
|
+
enabled: C(e.options.enabled)
|
|
89
|
+
},
|
|
90
|
+
deps: Array.from(e.deps).map(
|
|
91
|
+
(t) => "uid" in t ? {
|
|
92
|
+
type: "component",
|
|
93
|
+
uid: t.uid,
|
|
94
|
+
name: t.type.displayName ?? t.type.name
|
|
95
|
+
} : {
|
|
96
|
+
type: "effect",
|
|
97
|
+
active: t.active,
|
|
98
|
+
detached: t.detached
|
|
99
|
+
}
|
|
100
|
+
),
|
|
101
|
+
gcTimeout: typeof e.gcTimeout == "number" ? e.gcTimeout : null,
|
|
102
|
+
devtools: e[p]
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
const I = /* @__PURE__ */ new WeakMap();
|
|
106
|
+
function ye(e, t, o, l) {
|
|
107
|
+
e.addEventListener(t, o, l), J() && Q(() => {
|
|
108
|
+
e.removeEventListener(t, o);
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
const he = [".isPip", ".port"], ge = /* @__PURE__ */ $({
|
|
13
112
|
__name: "PiniaColadaDevtools",
|
|
14
113
|
setup(e) {
|
|
15
|
-
const t =
|
|
16
|
-
|
|
114
|
+
const t = fe();
|
|
115
|
+
me(t), t.$onAction(({ name: n, after: i, onError: v, args: S }) => {
|
|
17
116
|
if (n === "remove") {
|
|
18
|
-
const [a] =
|
|
19
|
-
|
|
20
|
-
|
|
117
|
+
const [a] = S;
|
|
118
|
+
i(() => {
|
|
119
|
+
s.emit("queries:delete", w(a));
|
|
21
120
|
});
|
|
22
121
|
} else if (n === "track" || n === "untrack" || n === "cancel" || n === "invalidate" || n === "fetch" || n === "setEntryState") {
|
|
23
|
-
const [a] =
|
|
122
|
+
const [a] = S;
|
|
24
123
|
if (n === "fetch") {
|
|
25
|
-
const
|
|
26
|
-
|
|
124
|
+
const m = w(a);
|
|
125
|
+
m.asyncStatus = "loading", s.emit("queries:update", m);
|
|
27
126
|
}
|
|
28
|
-
|
|
29
|
-
var
|
|
30
|
-
a[
|
|
31
|
-
|
|
127
|
+
i(() => {
|
|
128
|
+
var m;
|
|
129
|
+
a[p].simulate = null, s.emit("queries:update", w(a)), n === "fetch" && ((m = a.options) == null ? void 0 : m.staleTime) != null && Number.isFinite(a.options.staleTime) && setTimeout(() => {
|
|
130
|
+
s.emit("queries:update", w(a));
|
|
32
131
|
}, a.options.staleTime);
|
|
33
|
-
}),
|
|
34
|
-
|
|
132
|
+
}), v(() => {
|
|
133
|
+
s.emit("queries:update", w(a));
|
|
35
134
|
});
|
|
36
135
|
} else if (n === "create")
|
|
37
|
-
|
|
38
|
-
|
|
136
|
+
i((a) => {
|
|
137
|
+
s.emit("queries:update", w(a));
|
|
39
138
|
});
|
|
40
139
|
else if (n === "setQueryData") {
|
|
41
|
-
const [a] =
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
|
|
140
|
+
const [a] = S;
|
|
141
|
+
i(() => {
|
|
142
|
+
const m = t.getEntries({ key: a, exact: !0 })[0];
|
|
143
|
+
m && s.emit("queries:update", w(m));
|
|
45
144
|
});
|
|
46
145
|
}
|
|
47
146
|
});
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
147
|
+
const o = oe("devtools"), l = N(new MessageChannel()), s = new pe(l.value.port1);
|
|
148
|
+
P(
|
|
149
|
+
l,
|
|
51
150
|
(n) => {
|
|
52
|
-
|
|
151
|
+
s.setPort(n.port1);
|
|
53
152
|
},
|
|
54
153
|
{ flush: "sync" }
|
|
55
|
-
),
|
|
56
|
-
console.log("[App] Received ping from devtools"),
|
|
57
|
-
}),
|
|
154
|
+
), s.on("ping", () => {
|
|
155
|
+
console.log("[App] Received ping from devtools"), s.emit("pong");
|
|
156
|
+
}), s.on("pong", () => {
|
|
58
157
|
console.log("[App] Received pong from devtools");
|
|
59
|
-
}),
|
|
158
|
+
}), s.on("queries:refetch", (n) => {
|
|
60
159
|
t.invalidateQueries({ key: n, exact: !0, active: null, stale: null });
|
|
61
|
-
}),
|
|
160
|
+
}), s.on("queries:invalidate", (n) => {
|
|
62
161
|
t.invalidateQueries({ key: n, exact: !0 });
|
|
63
|
-
}),
|
|
64
|
-
const
|
|
65
|
-
|
|
162
|
+
}), s.on("queries:reset", (n) => {
|
|
163
|
+
const i = t.getEntries({ key: n, exact: !0 })[0];
|
|
164
|
+
i && (t.cancel(i), t.setEntryState(i, {
|
|
66
165
|
status: "pending",
|
|
67
166
|
data: void 0,
|
|
68
167
|
error: null
|
|
69
168
|
}));
|
|
70
|
-
}),
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
}),
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
}),
|
|
77
|
-
const
|
|
78
|
-
|
|
79
|
-
}),
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
...
|
|
169
|
+
}), s.on("queries:set:state", (n, i) => {
|
|
170
|
+
const v = t.getEntries({ key: n, exact: !0 })[0];
|
|
171
|
+
v && (t.setEntryState(v, i), s.emit("queries:update", w(v)));
|
|
172
|
+
}), s.on("queries:simulate:loading", (n) => {
|
|
173
|
+
const i = t.getEntries({ key: n, exact: !0 })[0];
|
|
174
|
+
i && (i.asyncStatus.value = "loading", i[p].simulate = "loading", s.emit("queries:update", w(i)));
|
|
175
|
+
}), s.on("queries:simulate:loading:stop", (n) => {
|
|
176
|
+
const i = t.getEntries({ key: n, exact: !0 })[0];
|
|
177
|
+
i && i[p].simulate === "loading" && (i.asyncStatus.value = "idle", i[p].simulate = null, s.emit("queries:update", w(i)));
|
|
178
|
+
}), s.on("queries:simulate:error", (n) => {
|
|
179
|
+
const i = t.getEntries({ key: n, exact: !0 })[0];
|
|
180
|
+
i && (t.cancel(i), t.setEntryState(i, {
|
|
181
|
+
...i.state.value,
|
|
83
182
|
status: "error",
|
|
84
183
|
error: new Error("Simulated error")
|
|
85
|
-
}),
|
|
86
|
-
}),
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
...
|
|
90
|
-
status:
|
|
184
|
+
}), i[p].simulate = "error", s.emit("queries:update", w(i)));
|
|
185
|
+
}), s.on("queries:simulate:error:stop", (n) => {
|
|
186
|
+
const i = t.getEntries({ key: n, exact: !0 })[0];
|
|
187
|
+
i && i[p].simulate === "error" && (t.cancel(i), t.setEntryState(i, {
|
|
188
|
+
...i.state.value,
|
|
189
|
+
status: i.state.value.data !== void 0 ? "success" : "pending",
|
|
91
190
|
error: null
|
|
92
|
-
}),
|
|
191
|
+
}), i[p].simulate = null, s.emit("queries:update", w(i)));
|
|
93
192
|
});
|
|
94
|
-
const
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}),
|
|
193
|
+
const c = N(null);
|
|
194
|
+
P(c, () => {
|
|
195
|
+
l.value = new MessageChannel();
|
|
196
|
+
}), ye(
|
|
98
197
|
window,
|
|
99
198
|
"unload",
|
|
100
199
|
() => {
|
|
101
200
|
var n;
|
|
102
|
-
(n =
|
|
201
|
+
(n = c.value) == null || n.close();
|
|
103
202
|
},
|
|
104
203
|
{ passive: !0 }
|
|
105
|
-
),
|
|
204
|
+
), ie(() => {
|
|
106
205
|
var n;
|
|
107
|
-
(n =
|
|
206
|
+
(n = c.value) == null || n.close();
|
|
108
207
|
});
|
|
109
|
-
function
|
|
208
|
+
function y() {
|
|
110
209
|
var n;
|
|
111
|
-
(n =
|
|
210
|
+
(n = c.value) == null || n.close(), c.value = null;
|
|
112
211
|
}
|
|
113
|
-
function
|
|
114
|
-
const n =
|
|
212
|
+
function r() {
|
|
213
|
+
const n = o.value;
|
|
115
214
|
if (!n || !n.shadowRoot)
|
|
116
215
|
throw new Error("No devtools elemnt found for Pinia Colada devtools");
|
|
117
|
-
const
|
|
118
|
-
if (!
|
|
216
|
+
const i = n.shadowRoot.getElementById("root");
|
|
217
|
+
if (!i)
|
|
119
218
|
throw new Error("No devtools root element found for Pinia Colada devtools");
|
|
120
|
-
const
|
|
219
|
+
const v = Math.max(i.offsetWidth, 400), S = Math.max(i.offsetHeight, 400), a = window.open(
|
|
121
220
|
"",
|
|
122
221
|
"pinia-colada-devtools",
|
|
123
|
-
`popup,width=${
|
|
222
|
+
`popup,width=${v},height=${S}`
|
|
124
223
|
);
|
|
125
224
|
if (!a)
|
|
126
225
|
throw new Error("Failed to open PiP window for Pinia Colada devtools");
|
|
127
|
-
|
|
226
|
+
c.value = a, a.document.head.innerHTML = "", a.document.body.innerHTML = "", a.document.title = "🍹 Pinia Colada Devtools", a.document.body.style.margin = "0", u(n, a.document), a.addEventListener(
|
|
128
227
|
"unload",
|
|
129
228
|
() => {
|
|
130
|
-
|
|
229
|
+
c.value = null;
|
|
131
230
|
},
|
|
132
231
|
{ passive: !0 }
|
|
133
232
|
);
|
|
134
233
|
}
|
|
135
|
-
function
|
|
234
|
+
function u(n, i = document) {
|
|
136
235
|
if (!n || !n.shadowRoot)
|
|
137
236
|
throw new Error("No devtools element found for Pinia Colada devtools");
|
|
138
|
-
const
|
|
139
|
-
|
|
140
|
-
const
|
|
141
|
-
|
|
237
|
+
const v = i.getElementById("__pc-tw-properties") ?? i.createElement("style");
|
|
238
|
+
v.setAttribute("id", "__pc-tw-properties");
|
|
239
|
+
const S = [...n.shadowRoot.styleSheets].flatMap((a) => [...a.cssRules]).filter((a) => a instanceof CSSPropertyRule).map((a) => a.cssText).join("");
|
|
240
|
+
v.textContent = S, i.head.appendChild(v);
|
|
142
241
|
}
|
|
143
|
-
function
|
|
144
|
-
|
|
242
|
+
function f() {
|
|
243
|
+
c.value ? y() : r();
|
|
145
244
|
}
|
|
146
|
-
async function
|
|
147
|
-
|
|
245
|
+
async function h() {
|
|
246
|
+
u(o.value), s.emit("queries:all", t.getEntries({}).map(w)), s.emit(
|
|
148
247
|
"mutations:all",
|
|
149
248
|
// FIXME: mutations
|
|
150
|
-
t.getEntries({}).map(
|
|
249
|
+
t.getEntries({}).map(w)
|
|
151
250
|
);
|
|
152
251
|
}
|
|
153
|
-
return (n,
|
|
154
|
-
to:
|
|
252
|
+
return (n, i) => (x(), W(re, {
|
|
253
|
+
to: c.value ? c.value.document.body : "body"
|
|
155
254
|
}, [
|
|
156
|
-
|
|
255
|
+
se("pinia-colada-devtools-panel", {
|
|
157
256
|
ref: "devtools",
|
|
158
|
-
".isPip": !!
|
|
159
|
-
".port":
|
|
160
|
-
onTogglePip:
|
|
161
|
-
onReady:
|
|
162
|
-
}, null, 40,
|
|
257
|
+
".isPip": !!c.value,
|
|
258
|
+
".port": l.value.port2,
|
|
259
|
+
onTogglePip: i[0] || (i[0] = (v) => f()),
|
|
260
|
+
onReady: i[1] || (i[1] = (v) => h())
|
|
261
|
+
}, null, 40, he)
|
|
163
262
|
], 8, ["to"]));
|
|
164
263
|
}
|
|
165
264
|
});
|
|
166
|
-
function
|
|
167
|
-
return
|
|
265
|
+
function we(e) {
|
|
266
|
+
return J() ? (Q(e), !0) : !1;
|
|
168
267
|
}
|
|
169
|
-
const
|
|
268
|
+
const Se = typeof window < "u" && typeof document < "u";
|
|
170
269
|
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
171
|
-
const
|
|
270
|
+
const Ee = Object.prototype.toString, be = (e) => Ee.call(e) === "[object Object]", Ce = () => {
|
|
172
271
|
};
|
|
173
|
-
function
|
|
272
|
+
function Te(...e) {
|
|
174
273
|
if (e.length !== 1)
|
|
175
|
-
return
|
|
274
|
+
return le(...e);
|
|
176
275
|
const t = e[0];
|
|
177
|
-
return typeof t == "function" ?
|
|
276
|
+
return typeof t == "function" ? K(ue(() => ({ get: t, set: Ce }))) : R(t);
|
|
178
277
|
}
|
|
179
|
-
function
|
|
180
|
-
function
|
|
181
|
-
return new Promise((
|
|
182
|
-
Promise.resolve(e(() => t.apply(this,
|
|
278
|
+
function Ae(e, t) {
|
|
279
|
+
function o(...l) {
|
|
280
|
+
return new Promise((s, c) => {
|
|
281
|
+
Promise.resolve(e(() => t.apply(this, l), { fn: t, thisArg: this, args: l })).then(s).catch(c);
|
|
183
282
|
});
|
|
184
283
|
}
|
|
185
|
-
return
|
|
284
|
+
return o;
|
|
186
285
|
}
|
|
187
|
-
const
|
|
188
|
-
function _e(e =
|
|
286
|
+
const Y = (e) => e();
|
|
287
|
+
function _e(e = Y, t = {}) {
|
|
189
288
|
const {
|
|
190
|
-
initialState:
|
|
191
|
-
} = t,
|
|
192
|
-
function
|
|
193
|
-
|
|
289
|
+
initialState: o = "active"
|
|
290
|
+
} = t, l = Te(o === "active");
|
|
291
|
+
function s() {
|
|
292
|
+
l.value = !1;
|
|
194
293
|
}
|
|
195
|
-
function
|
|
196
|
-
|
|
294
|
+
function c() {
|
|
295
|
+
l.value = !0;
|
|
197
296
|
}
|
|
198
|
-
const
|
|
199
|
-
|
|
297
|
+
const y = (...r) => {
|
|
298
|
+
l.value && e(...r);
|
|
200
299
|
};
|
|
201
|
-
return { isActive:
|
|
300
|
+
return { isActive: K(l), pause: s, resume: c, eventFilter: y };
|
|
202
301
|
}
|
|
203
|
-
function
|
|
302
|
+
function q(e) {
|
|
204
303
|
return Array.isArray(e) ? e : [e];
|
|
205
304
|
}
|
|
206
305
|
function Pe(e) {
|
|
207
|
-
return
|
|
306
|
+
return ae();
|
|
208
307
|
}
|
|
209
|
-
function
|
|
308
|
+
function Oe(e, t, o = {}) {
|
|
210
309
|
const {
|
|
211
|
-
eventFilter:
|
|
212
|
-
...
|
|
213
|
-
} =
|
|
214
|
-
return
|
|
310
|
+
eventFilter: l = Y,
|
|
311
|
+
...s
|
|
312
|
+
} = o;
|
|
313
|
+
return P(
|
|
215
314
|
e,
|
|
216
|
-
|
|
217
|
-
|
|
315
|
+
Ae(
|
|
316
|
+
l,
|
|
218
317
|
t
|
|
219
318
|
),
|
|
220
|
-
|
|
319
|
+
s
|
|
221
320
|
);
|
|
222
321
|
}
|
|
223
|
-
function
|
|
322
|
+
function ke(e, t, o = {}) {
|
|
224
323
|
const {
|
|
225
|
-
eventFilter:
|
|
226
|
-
initialState:
|
|
227
|
-
...
|
|
228
|
-
} =
|
|
229
|
-
return { stop:
|
|
324
|
+
eventFilter: l,
|
|
325
|
+
initialState: s = "active",
|
|
326
|
+
...c
|
|
327
|
+
} = o, { eventFilter: y, pause: r, resume: u, isActive: f } = _e(l, { initialState: s });
|
|
328
|
+
return { stop: Oe(
|
|
230
329
|
e,
|
|
231
330
|
t,
|
|
232
331
|
{
|
|
233
|
-
...
|
|
234
|
-
eventFilter:
|
|
332
|
+
...c,
|
|
333
|
+
eventFilter: y
|
|
235
334
|
}
|
|
236
|
-
), pause:
|
|
335
|
+
), pause: r, resume: u, isActive: f };
|
|
237
336
|
}
|
|
238
|
-
function
|
|
239
|
-
Pe() ?
|
|
337
|
+
function xe(e, t = !0, o) {
|
|
338
|
+
Pe() ? L(e, o) : t ? e() : G(e);
|
|
240
339
|
}
|
|
241
|
-
function
|
|
242
|
-
return
|
|
340
|
+
function De(e, t, o) {
|
|
341
|
+
return P(
|
|
243
342
|
e,
|
|
244
343
|
t,
|
|
245
344
|
{
|
|
246
|
-
...
|
|
345
|
+
...o,
|
|
247
346
|
immediate: !0
|
|
248
347
|
}
|
|
249
348
|
);
|
|
250
349
|
}
|
|
251
|
-
const
|
|
350
|
+
const D = Se ? window : void 0;
|
|
252
351
|
function Re(e) {
|
|
253
352
|
var t;
|
|
254
|
-
const
|
|
255
|
-
return (t =
|
|
353
|
+
const o = C(e);
|
|
354
|
+
return (t = o == null ? void 0 : o.$el) != null ? t : o;
|
|
256
355
|
}
|
|
257
|
-
function
|
|
258
|
-
const t = [],
|
|
259
|
-
t.forEach((
|
|
260
|
-
},
|
|
261
|
-
const
|
|
262
|
-
return
|
|
263
|
-
}),
|
|
356
|
+
function z(...e) {
|
|
357
|
+
const t = [], o = () => {
|
|
358
|
+
t.forEach((r) => r()), t.length = 0;
|
|
359
|
+
}, l = (r, u, f, h) => (r.addEventListener(u, f, h), () => r.removeEventListener(u, f, h)), s = U(() => {
|
|
360
|
+
const r = q(C(e[0])).filter((u) => u != null);
|
|
361
|
+
return r.every((u) => typeof u != "string") ? r : void 0;
|
|
362
|
+
}), c = De(
|
|
264
363
|
() => {
|
|
265
|
-
var
|
|
364
|
+
var r, u;
|
|
266
365
|
return [
|
|
267
|
-
(
|
|
268
|
-
|
|
269
|
-
|
|
366
|
+
(u = (r = s.value) == null ? void 0 : r.map((f) => Re(f))) != null ? u : [D].filter((f) => f != null),
|
|
367
|
+
q(C(s.value ? e[1] : e[0])),
|
|
368
|
+
q(F(s.value ? e[2] : e[1])),
|
|
270
369
|
// @ts-expect-error - TypeScript gets the correct types, but somehow still complains
|
|
271
|
-
C(
|
|
370
|
+
C(s.value ? e[3] : e[2])
|
|
272
371
|
];
|
|
273
372
|
},
|
|
274
|
-
([
|
|
275
|
-
if (
|
|
373
|
+
([r, u, f, h]) => {
|
|
374
|
+
if (o(), !(r != null && r.length) || !(u != null && u.length) || !(f != null && f.length))
|
|
276
375
|
return;
|
|
277
|
-
const n =
|
|
376
|
+
const n = be(h) ? { ...h } : h;
|
|
278
377
|
t.push(
|
|
279
|
-
...
|
|
280
|
-
(
|
|
281
|
-
(
|
|
378
|
+
...r.flatMap(
|
|
379
|
+
(i) => u.flatMap(
|
|
380
|
+
(v) => f.map((S) => l(i, v, S, n))
|
|
282
381
|
)
|
|
283
382
|
)
|
|
284
383
|
);
|
|
285
384
|
},
|
|
286
385
|
{ flush: "post" }
|
|
287
|
-
),
|
|
288
|
-
|
|
386
|
+
), y = () => {
|
|
387
|
+
c(), o();
|
|
289
388
|
};
|
|
290
|
-
return
|
|
389
|
+
return we(o), y;
|
|
291
390
|
}
|
|
292
|
-
const
|
|
293
|
-
function
|
|
294
|
-
return
|
|
391
|
+
const O = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, k = "__vueuse_ssr_handlers__", qe = /* @__PURE__ */ Me();
|
|
392
|
+
function Me() {
|
|
393
|
+
return k in O || (O[k] = O[k] || {}), O[k];
|
|
295
394
|
}
|
|
296
395
|
function Ne(e, t) {
|
|
297
|
-
return
|
|
396
|
+
return qe[e] || t;
|
|
298
397
|
}
|
|
299
|
-
function
|
|
398
|
+
function We(e) {
|
|
300
399
|
return e == null ? "any" : e instanceof Set ? "set" : e instanceof Map ? "map" : e instanceof Date ? "date" : typeof e == "boolean" ? "boolean" : typeof e == "string" ? "string" : typeof e == "object" ? "object" : Number.isNaN(e) ? "any" : "number";
|
|
301
400
|
}
|
|
302
|
-
const
|
|
401
|
+
const Fe = {
|
|
303
402
|
boolean: {
|
|
304
403
|
read: (e) => e === "true",
|
|
305
404
|
write: (e) => String(e)
|
|
@@ -332,135 +431,135 @@ const We = {
|
|
|
332
431
|
read: (e) => new Date(e),
|
|
333
432
|
write: (e) => e.toISOString()
|
|
334
433
|
}
|
|
335
|
-
},
|
|
336
|
-
function
|
|
337
|
-
var
|
|
434
|
+
}, B = "vueuse-storage";
|
|
435
|
+
function $e(e, t, o, l = {}) {
|
|
436
|
+
var s;
|
|
338
437
|
const {
|
|
339
|
-
flush:
|
|
340
|
-
deep:
|
|
341
|
-
listenToStorageChanges:
|
|
342
|
-
writeDefaults:
|
|
343
|
-
mergeDefaults:
|
|
344
|
-
shallow:
|
|
345
|
-
window: n =
|
|
346
|
-
eventFilter:
|
|
347
|
-
onError:
|
|
348
|
-
console.error(
|
|
438
|
+
flush: c = "pre",
|
|
439
|
+
deep: y = !0,
|
|
440
|
+
listenToStorageChanges: r = !0,
|
|
441
|
+
writeDefaults: u = !0,
|
|
442
|
+
mergeDefaults: f = !1,
|
|
443
|
+
shallow: h,
|
|
444
|
+
window: n = D,
|
|
445
|
+
eventFilter: i,
|
|
446
|
+
onError: v = (d) => {
|
|
447
|
+
console.error(d);
|
|
349
448
|
},
|
|
350
|
-
initOnMounted:
|
|
351
|
-
} =
|
|
352
|
-
if (!
|
|
449
|
+
initOnMounted: S
|
|
450
|
+
} = l, a = (h ? N : R)(t), m = U(() => C(e));
|
|
451
|
+
if (!o)
|
|
353
452
|
try {
|
|
354
|
-
|
|
355
|
-
var
|
|
356
|
-
return (
|
|
453
|
+
o = Ne("getDefaultStorage", () => {
|
|
454
|
+
var d;
|
|
455
|
+
return (d = D) == null ? void 0 : d.localStorage;
|
|
357
456
|
})();
|
|
358
|
-
} catch (
|
|
359
|
-
|
|
457
|
+
} catch (d) {
|
|
458
|
+
v(d);
|
|
360
459
|
}
|
|
361
|
-
if (!
|
|
460
|
+
if (!o)
|
|
362
461
|
return a;
|
|
363
|
-
const
|
|
462
|
+
const T = C(t), j = We(T), A = (s = l.serializer) != null ? s : Fe[j], { pause: X, resume: V } = ke(
|
|
364
463
|
a,
|
|
365
|
-
() =>
|
|
366
|
-
{ flush:
|
|
464
|
+
() => Z(a.value),
|
|
465
|
+
{ flush: c, deep: y, eventFilter: i }
|
|
367
466
|
);
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
}),
|
|
371
|
-
function
|
|
467
|
+
P(m, () => _(), { flush: c }), n && r && xe(() => {
|
|
468
|
+
o instanceof Storage ? z(n, "storage", _, { passive: !0 }) : z(n, B, te), S && _();
|
|
469
|
+
}), S || _();
|
|
470
|
+
function H(d, g) {
|
|
372
471
|
if (n) {
|
|
373
|
-
const
|
|
374
|
-
key:
|
|
375
|
-
oldValue:
|
|
376
|
-
newValue:
|
|
377
|
-
storageArea:
|
|
472
|
+
const E = {
|
|
473
|
+
key: m.value,
|
|
474
|
+
oldValue: d,
|
|
475
|
+
newValue: g,
|
|
476
|
+
storageArea: o
|
|
378
477
|
};
|
|
379
|
-
n.dispatchEvent(
|
|
380
|
-
detail:
|
|
478
|
+
n.dispatchEvent(o instanceof Storage ? new StorageEvent("storage", E) : new CustomEvent(B, {
|
|
479
|
+
detail: E
|
|
381
480
|
}));
|
|
382
481
|
}
|
|
383
482
|
}
|
|
384
|
-
function
|
|
483
|
+
function Z(d) {
|
|
385
484
|
try {
|
|
386
|
-
const
|
|
387
|
-
if (
|
|
388
|
-
|
|
485
|
+
const g = o.getItem(m.value);
|
|
486
|
+
if (d == null)
|
|
487
|
+
H(g, null), o.removeItem(m.value);
|
|
389
488
|
else {
|
|
390
|
-
const
|
|
391
|
-
|
|
489
|
+
const E = A.write(d);
|
|
490
|
+
g !== E && (o.setItem(m.value, E), H(g, E));
|
|
392
491
|
}
|
|
393
|
-
} catch (
|
|
394
|
-
|
|
492
|
+
} catch (g) {
|
|
493
|
+
v(g);
|
|
395
494
|
}
|
|
396
495
|
}
|
|
397
|
-
function
|
|
398
|
-
const
|
|
399
|
-
if (
|
|
400
|
-
return
|
|
401
|
-
if (!
|
|
402
|
-
const
|
|
403
|
-
return typeof
|
|
404
|
-
} else return typeof
|
|
496
|
+
function ee(d) {
|
|
497
|
+
const g = d ? d.newValue : o.getItem(m.value);
|
|
498
|
+
if (g == null)
|
|
499
|
+
return u && T != null && o.setItem(m.value, A.write(T)), T;
|
|
500
|
+
if (!d && f) {
|
|
501
|
+
const E = A.read(g);
|
|
502
|
+
return typeof f == "function" ? f(E, T) : j === "object" && !Array.isArray(E) ? { ...T, ...E } : E;
|
|
503
|
+
} else return typeof g != "string" ? g : A.read(g);
|
|
405
504
|
}
|
|
406
|
-
function
|
|
407
|
-
if (!(
|
|
408
|
-
if (
|
|
409
|
-
a.value =
|
|
505
|
+
function _(d) {
|
|
506
|
+
if (!(d && d.storageArea !== o)) {
|
|
507
|
+
if (d && d.key == null) {
|
|
508
|
+
a.value = T;
|
|
410
509
|
return;
|
|
411
510
|
}
|
|
412
|
-
if (!(
|
|
413
|
-
|
|
511
|
+
if (!(d && d.key !== m.value)) {
|
|
512
|
+
X();
|
|
414
513
|
try {
|
|
415
|
-
(
|
|
416
|
-
} catch (
|
|
417
|
-
|
|
514
|
+
(d == null ? void 0 : d.newValue) !== A.write(a.value) && (a.value = ee(d));
|
|
515
|
+
} catch (g) {
|
|
516
|
+
v(g);
|
|
418
517
|
} finally {
|
|
419
|
-
|
|
518
|
+
d ? G(V) : V();
|
|
420
519
|
}
|
|
421
520
|
}
|
|
422
521
|
}
|
|
423
522
|
}
|
|
424
|
-
function
|
|
425
|
-
|
|
523
|
+
function te(d) {
|
|
524
|
+
_(d.detail);
|
|
426
525
|
}
|
|
427
526
|
return a;
|
|
428
527
|
}
|
|
429
|
-
function
|
|
430
|
-
const { window:
|
|
431
|
-
return
|
|
528
|
+
function Le(e, t, o = {}) {
|
|
529
|
+
const { window: l = D } = o;
|
|
530
|
+
return $e(e, t, l == null ? void 0 : l.localStorage, o);
|
|
432
531
|
}
|
|
433
|
-
const
|
|
532
|
+
const Ie = /* @__PURE__ */ $({
|
|
434
533
|
__name: "PCDevtoolsWrapper",
|
|
435
534
|
setup(e) {
|
|
436
|
-
const t =
|
|
437
|
-
async function
|
|
535
|
+
const t = R(!1), o = Le("pinia-colada-devtools-open", !1);
|
|
536
|
+
async function l() {
|
|
438
537
|
if (!t.value && (t.value = !0, !customElements.get("pinia-colada-devtools-panel"))) {
|
|
439
|
-
const { DevtoolsPanel:
|
|
440
|
-
customElements.define("pinia-colada-devtools-panel",
|
|
538
|
+
const { DevtoolsPanel: c } = await import("@pinia/colada-devtools/panel");
|
|
539
|
+
customElements.define("pinia-colada-devtools-panel", c);
|
|
441
540
|
}
|
|
442
541
|
}
|
|
443
|
-
async function
|
|
444
|
-
await
|
|
542
|
+
async function s() {
|
|
543
|
+
await l(), o.value = !0;
|
|
445
544
|
}
|
|
446
|
-
return
|
|
545
|
+
return L(() => {
|
|
447
546
|
requestIdleCallback(() => {
|
|
448
547
|
import("@pinia/colada-devtools/panel");
|
|
449
|
-
}),
|
|
450
|
-
}), (
|
|
451
|
-
default:
|
|
452
|
-
|
|
548
|
+
}), o.value && s();
|
|
549
|
+
}), (c, y) => (x(), W(ve, null, {
|
|
550
|
+
default: ce(() => [
|
|
551
|
+
F(o) ? M("", !0) : (x(), de("button", {
|
|
453
552
|
key: 0,
|
|
454
553
|
class: "fixed bottom-2 right-2 bg-primary-500 hover:cursor-pointer z-99999",
|
|
455
|
-
onClick:
|
|
554
|
+
onClick: y[0] || (y[0] = (r) => s())
|
|
456
555
|
}, " 🍹 Devtools ")),
|
|
457
|
-
t.value &&
|
|
556
|
+
t.value && F(o) ? (x(), W(ge, { key: 1 })) : M("", !0)
|
|
458
557
|
]),
|
|
459
558
|
_: 1
|
|
460
559
|
}));
|
|
461
560
|
}
|
|
462
561
|
});
|
|
463
562
|
export {
|
|
464
|
-
|
|
563
|
+
Ie as PiniaColadaDevtools
|
|
465
564
|
};
|
|
466
565
|
//# sourceMappingURL=index.js.map
|