@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.
Files changed (27) hide show
  1. package/dist/index.js +353 -254
  2. package/dist/index.js.map +1 -1
  3. package/dist-panel/{_queryId_-hQFnZzX2.js → _queryId_-dahx0N-a.js} +16 -16
  4. package/dist-panel/{_queryId_-hQFnZzX2.js.map → _queryId_-dahx0N-a.js.map} +1 -1
  5. package/dist-panel/{index-BVvWMadg.js → index-BkrEntNA.js} +3 -3
  6. package/dist-panel/{index-BVvWMadg.js.map → index-BkrEntNA.js.map} +1 -1
  7. package/dist-panel/{index-B2dJ1q6y.js → index-BoUh47CR.js} +2 -2
  8. package/dist-panel/{index-B2dJ1q6y.js.map → index-BoUh47CR.js.map} +1 -1
  9. package/dist-panel/{index-DfIXa7Jb.js → index-Covr4drg.js} +693 -713
  10. package/dist-panel/{index-DfIXa7Jb.js.map → index-Covr4drg.js.map} +1 -1
  11. package/dist-panel/index.js +1 -1
  12. package/dist-panel/{loader-B7hpsxwv.js → loader-CuAz6irK.js} +2 -2
  13. package/dist-panel/loader-CuAz6irK.js.map +1 -0
  14. package/dist-panel/{mouse-pointer-click-C8Q9Aulw.js → mouse-pointer-click-BRg0nGpd.js} +2 -2
  15. package/dist-panel/mouse-pointer-click-BRg0nGpd.js.map +1 -0
  16. package/dist-panel/{mutations-DqlFNONQ.js → mutations-ComK9mEg.js} +2 -2
  17. package/dist-panel/{mutations-DqlFNONQ.js.map → mutations-ComK9mEg.js.map} +1 -1
  18. package/dist-panel/{queries-DPJvb6qB.js → queries-C8H8bbDX.js} +85 -88
  19. package/dist-panel/{queries-DPJvb6qB.js.map → queries-C8H8bbDX.js.map} +1 -1
  20. package/dist-panel/{settings-DiWRvbPR.js → settings-DoijmHf7.js} +2 -2
  21. package/dist-panel/{settings-DiWRvbPR.js.map → settings-DoijmHf7.js.map} +1 -1
  22. package/dist-shared/index.d.ts +0 -15
  23. package/dist-shared/index.js +51 -152
  24. package/dist-shared/index.js.map +1 -1
  25. package/package.json +2 -2
  26. package/dist-panel/loader-B7hpsxwv.js.map +0 -1
  27. package/dist-panel/mouse-pointer-click-C8Q9Aulw.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,305 +1,404 @@
1
- import { defineComponent as F, ref as T, onMounted as $, renderSlot as X, createCommentVNode as N, useTemplateRef as Z, shallowRef as A, watch as q, onBeforeUnmount as ee, createBlock as W, openBlock as O, Teleport as te, createElementVNode as ne, nextTick as B, readonly as H, getCurrentInstance as oe, toRef as re, customRef as ie, getCurrentScope as ae, onScopeDispose as se, computed as J, toValue as C, unref as M, withCtx as le, createElementBlock as ue } from "vue";
2
- import { useQueryCache as ce } from "@pinia/colada";
3
- import { addDevtoolsInfo as de, DuplexChannel as fe, createQueryEntryPayload as y, DEVTOOLS_INFO_KEY as b, useEventListener as pe } from "@pinia/colada-devtools/shared";
4
- const ve = /* @__PURE__ */ F({
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 = T(!1);
8
- return $(() => {
7
+ const t = R(!1);
8
+ return L(() => {
9
9
  t.value = !0;
10
- }), (r, s) => t.value ? X(r.$slots, "default", { key: 0 }) : N("", !0);
10
+ }), (o, l) => t.value ? ne(o.$slots, "default", { key: 0 }) : M("", !0);
11
11
  }
12
- }), me = [".isPip", ".port"], ye = /* @__PURE__ */ F({
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 = ce();
16
- de(t), t.$onAction(({ name: n, after: o, onError: f, args: h }) => {
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] = h;
19
- o(() => {
20
- i.emit("queries:delete", y(a));
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] = h;
122
+ const [a] = S;
24
123
  if (n === "fetch") {
25
- const v = y(a);
26
- v.asyncStatus = "loading", i.emit("queries:update", v);
124
+ const m = w(a);
125
+ m.asyncStatus = "loading", s.emit("queries:update", m);
27
126
  }
28
- o(() => {
29
- var v;
30
- a[b].simulate = null, i.emit("queries:update", y(a)), n === "fetch" && ((v = a.options) == null ? void 0 : v.staleTime) != null && Number.isFinite(a.options.staleTime) && setTimeout(() => {
31
- i.emit("queries:update", y(a));
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
- }), f(() => {
34
- i.emit("queries:update", y(a));
132
+ }), v(() => {
133
+ s.emit("queries:update", w(a));
35
134
  });
36
135
  } else if (n === "create")
37
- o((a) => {
38
- i.emit("queries:update", y(a));
136
+ i((a) => {
137
+ s.emit("queries:update", w(a));
39
138
  });
40
139
  else if (n === "setQueryData") {
41
- const [a] = h;
42
- o(() => {
43
- const v = t.getEntries({ key: a, exact: !0 })[0];
44
- v && i.emit("queries:update", y(v));
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 r = Z("devtools"), s = A(new MessageChannel()), i = new fe(s.value.port1);
49
- q(
50
- s,
147
+ const o = oe("devtools"), l = N(new MessageChannel()), s = new pe(l.value.port1);
148
+ P(
149
+ l,
51
150
  (n) => {
52
- i.setPort(n.port1);
151
+ s.setPort(n.port1);
53
152
  },
54
153
  { flush: "sync" }
55
- ), i.on("ping", () => {
56
- console.log("[App] Received ping from devtools"), i.emit("pong");
57
- }), i.on("pong", () => {
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
- }), i.on("queries:refetch", (n) => {
158
+ }), s.on("queries:refetch", (n) => {
60
159
  t.invalidateQueries({ key: n, exact: !0, active: null, stale: null });
61
- }), i.on("queries:invalidate", (n) => {
160
+ }), s.on("queries:invalidate", (n) => {
62
161
  t.invalidateQueries({ key: n, exact: !0 });
63
- }), i.on("queries:reset", (n) => {
64
- const o = t.getEntries({ key: n, exact: !0 })[0];
65
- o && (t.cancel(o), t.setEntryState(o, {
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
- }), i.on("queries:set:state", (n, o) => {
71
- const f = t.getEntries({ key: n, exact: !0 })[0];
72
- f && (t.setEntryState(f, o), i.emit("queries:update", y(f)));
73
- }), i.on("queries:simulate:loading", (n) => {
74
- const o = t.getEntries({ key: n, exact: !0 })[0];
75
- o && (o.asyncStatus.value = "loading", o[b].simulate = "loading", i.emit("queries:update", y(o)));
76
- }), i.on("queries:simulate:loading:stop", (n) => {
77
- const o = t.getEntries({ key: n, exact: !0 })[0];
78
- o && o[b].simulate === "loading" && (o.asyncStatus.value = "idle", o[b].simulate = null, i.emit("queries:update", y(o)));
79
- }), i.on("queries:simulate:error", (n) => {
80
- const o = t.getEntries({ key: n, exact: !0 })[0];
81
- o && (t.cancel(o), t.setEntryState(o, {
82
- ...o.state.value,
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
- }), o[b].simulate = "error", i.emit("queries:update", y(o)));
86
- }), i.on("queries:simulate:error:stop", (n) => {
87
- const o = t.getEntries({ key: n, exact: !0 })[0];
88
- o && o[b].simulate === "error" && (t.cancel(o), t.setEntryState(o, {
89
- ...o.state.value,
90
- status: o.state.value.data !== void 0 ? "success" : "pending",
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
- }), o[b].simulate = null, i.emit("queries:update", y(o)));
191
+ }), i[p].simulate = null, s.emit("queries:update", w(i)));
93
192
  });
94
- const u = A(null);
95
- q(u, () => {
96
- s.value = new MessageChannel();
97
- }), pe(
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 = u.value) == null || n.close();
201
+ (n = c.value) == null || n.close();
103
202
  },
104
203
  { passive: !0 }
105
- ), ee(() => {
204
+ ), ie(() => {
106
205
  var n;
107
- (n = u.value) == null || n.close();
206
+ (n = c.value) == null || n.close();
108
207
  });
109
- function g() {
208
+ function y() {
110
209
  var n;
111
- (n = u.value) == null || n.close(), u.value = null;
210
+ (n = c.value) == null || n.close(), c.value = null;
112
211
  }
113
- function c() {
114
- const n = r.value;
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 o = n.shadowRoot.getElementById("root");
118
- if (!o)
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 f = Math.max(o.offsetWidth, 400), h = Math.max(o.offsetHeight, 400), a = window.open(
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=${f},height=${h}`
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
- u.value = a, a.document.head.innerHTML = "", a.document.body.innerHTML = "", a.document.title = "🍹 Pinia Colada Devtools", a.document.body.style.margin = "0", d(n, a.document), a.addEventListener(
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
- u.value = null;
229
+ c.value = null;
131
230
  },
132
231
  { passive: !0 }
133
232
  );
134
233
  }
135
- function d(n, o = document) {
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 f = o.getElementById("__pc-tw-properties") ?? o.createElement("style");
139
- f.setAttribute("id", "__pc-tw-properties");
140
- const h = [...n.shadowRoot.styleSheets].flatMap((a) => [...a.cssRules]).filter((a) => a instanceof CSSPropertyRule).map((a) => a.cssText).join("");
141
- f.textContent = h, o.head.appendChild(f);
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 p() {
144
- u.value ? g() : c();
242
+ function f() {
243
+ c.value ? y() : r();
145
244
  }
146
- async function w() {
147
- d(r.value), i.emit("queries:all", t.getEntries({}).map(y)), i.emit(
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(y)
249
+ t.getEntries({}).map(w)
151
250
  );
152
251
  }
153
- return (n, o) => (O(), W(te, {
154
- to: u.value ? u.value.document.body : "body"
252
+ return (n, i) => (x(), W(re, {
253
+ to: c.value ? c.value.document.body : "body"
155
254
  }, [
156
- ne("pinia-colada-devtools-panel", {
255
+ se("pinia-colada-devtools-panel", {
157
256
  ref: "devtools",
158
- ".isPip": !!u.value,
159
- ".port": s.value.port2,
160
- onTogglePip: o[0] || (o[0] = (f) => p()),
161
- onReady: o[1] || (o[1] = (f) => w())
162
- }, null, 40, me)
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 ge(e) {
167
- return ae() ? (se(e), !0) : !1;
265
+ function we(e) {
266
+ return J() ? (Q(e), !0) : !1;
168
267
  }
169
- const he = typeof window < "u" && typeof document < "u";
268
+ const Se = typeof window < "u" && typeof document < "u";
170
269
  typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
171
- const we = Object.prototype.toString, Se = (e) => we.call(e) === "[object Object]", Ee = () => {
270
+ const Ee = Object.prototype.toString, be = (e) => Ee.call(e) === "[object Object]", Ce = () => {
172
271
  };
173
- function be(...e) {
272
+ function Te(...e) {
174
273
  if (e.length !== 1)
175
- return re(...e);
274
+ return le(...e);
176
275
  const t = e[0];
177
- return typeof t == "function" ? H(ie(() => ({ get: t, set: Ee }))) : T(t);
276
+ return typeof t == "function" ? K(ue(() => ({ get: t, set: Ce }))) : R(t);
178
277
  }
179
- function Ce(e, t) {
180
- function r(...s) {
181
- return new Promise((i, u) => {
182
- Promise.resolve(e(() => t.apply(this, s), { fn: t, thisArg: this, args: s })).then(i).catch(u);
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 r;
284
+ return o;
186
285
  }
187
- const Q = (e) => e();
188
- function _e(e = Q, t = {}) {
286
+ const Y = (e) => e();
287
+ function _e(e = Y, t = {}) {
189
288
  const {
190
- initialState: r = "active"
191
- } = t, s = be(r === "active");
192
- function i() {
193
- s.value = !1;
289
+ initialState: o = "active"
290
+ } = t, l = Te(o === "active");
291
+ function s() {
292
+ l.value = !1;
194
293
  }
195
- function u() {
196
- s.value = !0;
294
+ function c() {
295
+ l.value = !0;
197
296
  }
198
- const g = (...c) => {
199
- s.value && e(...c);
297
+ const y = (...r) => {
298
+ l.value && e(...r);
200
299
  };
201
- return { isActive: H(s), pause: i, resume: u, eventFilter: g };
300
+ return { isActive: K(l), pause: s, resume: c, eventFilter: y };
202
301
  }
203
- function k(e) {
302
+ function q(e) {
204
303
  return Array.isArray(e) ? e : [e];
205
304
  }
206
305
  function Pe(e) {
207
- return oe();
306
+ return ae();
208
307
  }
209
- function qe(e, t, r = {}) {
308
+ function Oe(e, t, o = {}) {
210
309
  const {
211
- eventFilter: s = Q,
212
- ...i
213
- } = r;
214
- return q(
310
+ eventFilter: l = Y,
311
+ ...s
312
+ } = o;
313
+ return P(
215
314
  e,
216
- Ce(
217
- s,
315
+ Ae(
316
+ l,
218
317
  t
219
318
  ),
220
- i
319
+ s
221
320
  );
222
321
  }
223
- function xe(e, t, r = {}) {
322
+ function ke(e, t, o = {}) {
224
323
  const {
225
- eventFilter: s,
226
- initialState: i = "active",
227
- ...u
228
- } = r, { eventFilter: g, pause: c, resume: d, isActive: p } = _e(s, { initialState: i });
229
- return { stop: qe(
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
- ...u,
234
- eventFilter: g
332
+ ...c,
333
+ eventFilter: y
235
334
  }
236
- ), pause: c, resume: d, isActive: p };
335
+ ), pause: r, resume: u, isActive: f };
237
336
  }
238
- function De(e, t = !0, r) {
239
- Pe() ? $(e, r) : t ? e() : B(e);
337
+ function xe(e, t = !0, o) {
338
+ Pe() ? L(e, o) : t ? e() : G(e);
240
339
  }
241
- function Oe(e, t, r) {
242
- return q(
340
+ function De(e, t, o) {
341
+ return P(
243
342
  e,
244
343
  t,
245
344
  {
246
- ...r,
345
+ ...o,
247
346
  immediate: !0
248
347
  }
249
348
  );
250
349
  }
251
- const R = he ? window : void 0;
350
+ const D = Se ? window : void 0;
252
351
  function Re(e) {
253
352
  var t;
254
- const r = C(e);
255
- return (t = r == null ? void 0 : r.$el) != null ? t : r;
353
+ const o = C(e);
354
+ return (t = o == null ? void 0 : o.$el) != null ? t : o;
256
355
  }
257
- function I(...e) {
258
- const t = [], r = () => {
259
- t.forEach((c) => c()), t.length = 0;
260
- }, s = (c, d, p, w) => (c.addEventListener(d, p, w), () => c.removeEventListener(d, p, w)), i = J(() => {
261
- const c = k(C(e[0])).filter((d) => d != null);
262
- return c.every((d) => typeof d != "string") ? c : void 0;
263
- }), u = Oe(
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 c, d;
364
+ var r, u;
266
365
  return [
267
- (d = (c = i.value) == null ? void 0 : c.map((p) => Re(p))) != null ? d : [R].filter((p) => p != null),
268
- k(C(i.value ? e[1] : e[0])),
269
- k(M(i.value ? e[2] : e[1])),
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(i.value ? e[3] : e[2])
370
+ C(s.value ? e[3] : e[2])
272
371
  ];
273
372
  },
274
- ([c, d, p, w]) => {
275
- if (r(), !(c != null && c.length) || !(d != null && d.length) || !(p != null && p.length))
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 = Se(w) ? { ...w } : w;
376
+ const n = be(h) ? { ...h } : h;
278
377
  t.push(
279
- ...c.flatMap(
280
- (o) => d.flatMap(
281
- (f) => p.map((h) => s(o, f, h, n))
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
- ), g = () => {
288
- u(), r();
386
+ ), y = () => {
387
+ c(), o();
289
388
  };
290
- return ge(r), g;
389
+ return we(o), y;
291
390
  }
292
- const x = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, D = "__vueuse_ssr_handlers__", Te = /* @__PURE__ */ ke();
293
- function ke() {
294
- return D in x || (x[D] = x[D] || {}), x[D];
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 Te[e] || t;
396
+ return qe[e] || t;
298
397
  }
299
- function Ae(e) {
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 We = {
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
- }, z = "vueuse-storage";
336
- function Me(e, t, r, s = {}) {
337
- var i;
434
+ }, B = "vueuse-storage";
435
+ function $e(e, t, o, l = {}) {
436
+ var s;
338
437
  const {
339
- flush: u = "pre",
340
- deep: g = !0,
341
- listenToStorageChanges: c = !0,
342
- writeDefaults: d = !0,
343
- mergeDefaults: p = !1,
344
- shallow: w,
345
- window: n = R,
346
- eventFilter: o,
347
- onError: f = (l) => {
348
- console.error(l);
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: h
351
- } = s, a = (w ? A : T)(t), v = J(() => C(e));
352
- if (!r)
449
+ initOnMounted: S
450
+ } = l, a = (h ? N : R)(t), m = U(() => C(e));
451
+ if (!o)
353
452
  try {
354
- r = Ne("getDefaultStorage", () => {
355
- var l;
356
- return (l = R) == null ? void 0 : l.localStorage;
453
+ o = Ne("getDefaultStorage", () => {
454
+ var d;
455
+ return (d = D) == null ? void 0 : d.localStorage;
357
456
  })();
358
- } catch (l) {
359
- f(l);
457
+ } catch (d) {
458
+ v(d);
360
459
  }
361
- if (!r)
460
+ if (!o)
362
461
  return a;
363
- const E = C(t), L = Ae(E), _ = (i = s.serializer) != null ? i : We[L], { pause: G, resume: j } = xe(
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
- () => K(a.value),
366
- { flush: u, deep: g, eventFilter: o }
464
+ () => Z(a.value),
465
+ { flush: c, deep: y, eventFilter: i }
367
466
  );
368
- q(v, () => P(), { flush: u }), n && c && De(() => {
369
- r instanceof Storage ? I(n, "storage", P, { passive: !0 }) : I(n, z, Y), h && P();
370
- }), h || P();
371
- function V(l, m) {
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 S = {
374
- key: v.value,
375
- oldValue: l,
376
- newValue: m,
377
- storageArea: r
472
+ const E = {
473
+ key: m.value,
474
+ oldValue: d,
475
+ newValue: g,
476
+ storageArea: o
378
477
  };
379
- n.dispatchEvent(r instanceof Storage ? new StorageEvent("storage", S) : new CustomEvent(z, {
380
- detail: S
478
+ n.dispatchEvent(o instanceof Storage ? new StorageEvent("storage", E) : new CustomEvent(B, {
479
+ detail: E
381
480
  }));
382
481
  }
383
482
  }
384
- function K(l) {
483
+ function Z(d) {
385
484
  try {
386
- const m = r.getItem(v.value);
387
- if (l == null)
388
- V(m, null), r.removeItem(v.value);
485
+ const g = o.getItem(m.value);
486
+ if (d == null)
487
+ H(g, null), o.removeItem(m.value);
389
488
  else {
390
- const S = _.write(l);
391
- m !== S && (r.setItem(v.value, S), V(m, S));
489
+ const E = A.write(d);
490
+ g !== E && (o.setItem(m.value, E), H(g, E));
392
491
  }
393
- } catch (m) {
394
- f(m);
492
+ } catch (g) {
493
+ v(g);
395
494
  }
396
495
  }
397
- function U(l) {
398
- const m = l ? l.newValue : r.getItem(v.value);
399
- if (m == null)
400
- return d && E != null && r.setItem(v.value, _.write(E)), E;
401
- if (!l && p) {
402
- const S = _.read(m);
403
- return typeof p == "function" ? p(S, E) : L === "object" && !Array.isArray(S) ? { ...E, ...S } : S;
404
- } else return typeof m != "string" ? m : _.read(m);
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 P(l) {
407
- if (!(l && l.storageArea !== r)) {
408
- if (l && l.key == null) {
409
- a.value = E;
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 (!(l && l.key !== v.value)) {
413
- G();
511
+ if (!(d && d.key !== m.value)) {
512
+ X();
414
513
  try {
415
- (l == null ? void 0 : l.newValue) !== _.write(a.value) && (a.value = U(l));
416
- } catch (m) {
417
- f(m);
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
- l ? B(j) : j();
518
+ d ? G(V) : V();
420
519
  }
421
520
  }
422
521
  }
423
522
  }
424
- function Y(l) {
425
- P(l.detail);
523
+ function te(d) {
524
+ _(d.detail);
426
525
  }
427
526
  return a;
428
527
  }
429
- function Fe(e, t, r = {}) {
430
- const { window: s = R } = r;
431
- return Me(e, t, s == null ? void 0 : s.localStorage, r);
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 Ve = /* @__PURE__ */ F({
532
+ const Ie = /* @__PURE__ */ $({
434
533
  __name: "PCDevtoolsWrapper",
435
534
  setup(e) {
436
- const t = T(!1), r = Fe("pinia-colada-devtools-open", !1);
437
- async function s() {
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: u } = await import("@pinia/colada-devtools/panel");
440
- customElements.define("pinia-colada-devtools-panel", u);
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 i() {
444
- await s(), r.value = !0;
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
- }), r.value && i();
450
- }), (u, g) => (O(), W(ve, null, {
451
- default: le(() => [
452
- M(r) ? N("", !0) : (O(), ue("button", {
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: g[0] || (g[0] = (c) => i())
554
+ onClick: y[0] || (y[0] = (r) => s())
456
555
  }, " 🍹 Devtools ")),
457
- t.value && M(r) ? (O(), W(ye, { key: 1 })) : N("", !0)
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
- Ve as PiniaColadaDevtools
563
+ Ie as PiniaColadaDevtools
465
564
  };
466
565
  //# sourceMappingURL=index.js.map