@pinia/colada-devtools 0.0.1 → 0.0.3

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