@shane_il/pulse 0.1.2 → 0.3.0
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/README.md +20 -167
- package/dist/connect.d.ts +1 -0
- package/dist/devtools/core.d.ts +47 -0
- package/dist/devtools/index.d.ts +9 -0
- package/dist/devtools/panel/actions-tab.d.ts +10 -0
- package/dist/devtools/panel/components-tab.d.ts +5 -0
- package/dist/devtools/panel/panel.d.ts +24 -0
- package/dist/devtools/panel/stores-tab.d.ts +7 -0
- package/dist/devtools/panel/styles.d.ts +41 -0
- package/dist/devtools/time-travel.d.ts +11 -0
- package/dist/devtools.cjs +2 -0
- package/dist/devtools.cjs.map +1 -0
- package/dist/devtools.js +1218 -0
- package/dist/devtools.js.map +1 -0
- package/dist/diff.d.ts +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/middleware.d.ts +36 -0
- package/dist/patch.d.ts +2 -2
- package/dist/pulse.cjs +1 -1
- package/dist/pulse.cjs.map +1 -1
- package/dist/pulse.js +472 -366
- package/dist/pulse.js.map +1 -1
- package/dist/store.d.ts +4 -0
- package/package.json +14 -2
package/dist/devtools.js
ADDED
|
@@ -0,0 +1,1218 @@
|
|
|
1
|
+
var rt = Object.defineProperty;
|
|
2
|
+
var it = (t, e, n) => e in t ? rt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var S = (t, e, n) => it(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
let A = !1;
|
|
5
|
+
const R = /* @__PURE__ */ new Set();
|
|
6
|
+
function ct(t) {
|
|
7
|
+
R.add(t), A || (A = !0, queueMicrotask(lt));
|
|
8
|
+
}
|
|
9
|
+
function lt() {
|
|
10
|
+
const t = [...R];
|
|
11
|
+
R.clear(), A = !1;
|
|
12
|
+
for (const e of t)
|
|
13
|
+
e();
|
|
14
|
+
}
|
|
15
|
+
const q = Symbol("PULSE_CONNECTED"), F = globalThis;
|
|
16
|
+
F.__PULSE_HOOKS__ || (F.__PULSE_HOOKS__ = { onMount: null, onUnmount: null });
|
|
17
|
+
const T = F.__PULSE_HOOKS__;
|
|
18
|
+
function at(t, e) {
|
|
19
|
+
T.onMount = t, T.onUnmount = e;
|
|
20
|
+
}
|
|
21
|
+
function pt(t, e) {
|
|
22
|
+
return function(o) {
|
|
23
|
+
const s = t || {};
|
|
24
|
+
function r(i) {
|
|
25
|
+
const a = {};
|
|
26
|
+
for (const p in s) {
|
|
27
|
+
const { store: l, selector: h } = s[p];
|
|
28
|
+
a[p] = h(l.getState());
|
|
29
|
+
}
|
|
30
|
+
return o({ ...a, ...i });
|
|
31
|
+
}
|
|
32
|
+
return r[q] = !0, r._bindings = s, r._innerComponent = o, r.displayName = `Connected(${o.displayName || o.name || "Anonymous"})`, r;
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
class ut {
|
|
36
|
+
constructor(e, n) {
|
|
37
|
+
S(this, "connectedFn");
|
|
38
|
+
S(this, "props");
|
|
39
|
+
S(this, "prevSelected");
|
|
40
|
+
S(this, "unsubscribers");
|
|
41
|
+
S(this, "lastVTree");
|
|
42
|
+
S(this, "parentDom");
|
|
43
|
+
S(this, "_renderCallback");
|
|
44
|
+
S(this, "_mountCleanup");
|
|
45
|
+
this.connectedFn = e, this.props = n, this.prevSelected = {}, this.unsubscribers = [], this.lastVTree = null, this.parentDom = null, this._renderCallback = null, this._mountCleanup = null;
|
|
46
|
+
}
|
|
47
|
+
mount(e, n) {
|
|
48
|
+
var r;
|
|
49
|
+
this.parentDom = e, this._renderCallback = n;
|
|
50
|
+
const o = this.connectedFn._bindings;
|
|
51
|
+
for (const i in o) {
|
|
52
|
+
const { store: a, selector: p } = o[i];
|
|
53
|
+
this.prevSelected[i] = p(a.getState());
|
|
54
|
+
}
|
|
55
|
+
for (const i in o) {
|
|
56
|
+
const { store: a } = o[i], p = a.subscribe(() => {
|
|
57
|
+
this._onStoreChange();
|
|
58
|
+
});
|
|
59
|
+
this.unsubscribers.push(p);
|
|
60
|
+
}
|
|
61
|
+
const s = this.connectedFn._lifecycle;
|
|
62
|
+
if (s != null && s.onMount) {
|
|
63
|
+
const i = s.onMount({
|
|
64
|
+
dom: (r = this.lastVTree) == null ? void 0 : r._dom,
|
|
65
|
+
props: this.props
|
|
66
|
+
});
|
|
67
|
+
typeof i == "function" && (this._mountCleanup = i);
|
|
68
|
+
}
|
|
69
|
+
T.onMount && T.onMount(this);
|
|
70
|
+
}
|
|
71
|
+
_onStoreChange() {
|
|
72
|
+
const e = this.connectedFn._bindings;
|
|
73
|
+
let n = !1;
|
|
74
|
+
for (const o in e) {
|
|
75
|
+
const { store: s, selector: r } = e[o], i = r(s.getState());
|
|
76
|
+
if (!ft(i, this.prevSelected[o])) {
|
|
77
|
+
n = !0;
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
n && ct(this._renderCallback);
|
|
82
|
+
}
|
|
83
|
+
updateSelected() {
|
|
84
|
+
const e = this.connectedFn._bindings;
|
|
85
|
+
for (const n in e) {
|
|
86
|
+
const { store: o, selector: s } = e[n];
|
|
87
|
+
this.prevSelected[n] = s(o.getState());
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
unmount() {
|
|
91
|
+
T.onUnmount && T.onUnmount(this), this._mountCleanup && (this._mountCleanup(), this._mountCleanup = null);
|
|
92
|
+
const e = this.connectedFn._lifecycle;
|
|
93
|
+
e != null && e.onDestroy && e.onDestroy({ props: this.props });
|
|
94
|
+
for (const n of this.unsubscribers)
|
|
95
|
+
n();
|
|
96
|
+
this.unsubscribers = [], this._renderCallback = null;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
function ft(t, e) {
|
|
100
|
+
if (Object.is(t, e)) return !0;
|
|
101
|
+
if (typeof t != "object" || typeof e != "object" || t === null || e === null) return !1;
|
|
102
|
+
const n = Object.keys(t), o = Object.keys(e);
|
|
103
|
+
if (n.length !== o.length) return !1;
|
|
104
|
+
for (const s of n)
|
|
105
|
+
if (!Object.prototype.hasOwnProperty.call(e, s) || !Object.is(t[s], e[s]))
|
|
106
|
+
return !1;
|
|
107
|
+
return !0;
|
|
108
|
+
}
|
|
109
|
+
function J(t) {
|
|
110
|
+
let e = t.state;
|
|
111
|
+
const n = t.actions, o = /* @__PURE__ */ new Set(), s = t.middleware;
|
|
112
|
+
function r() {
|
|
113
|
+
return e;
|
|
114
|
+
}
|
|
115
|
+
function i() {
|
|
116
|
+
for (const f of o)
|
|
117
|
+
f(e);
|
|
118
|
+
}
|
|
119
|
+
function a(f, m) {
|
|
120
|
+
const b = n[f];
|
|
121
|
+
if (!b)
|
|
122
|
+
throw new Error(`[pulse] Unknown action: "${f}"`);
|
|
123
|
+
const _ = b(e, m);
|
|
124
|
+
_ !== e && (e = _, i());
|
|
125
|
+
}
|
|
126
|
+
function p(f, m) {
|
|
127
|
+
if (f === "__devtools_replace__") {
|
|
128
|
+
e = m, i();
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
const b = n[f];
|
|
132
|
+
if (!b)
|
|
133
|
+
throw new Error(`[pulse] Unknown action: "${f}"`);
|
|
134
|
+
const _ = {
|
|
135
|
+
store: c,
|
|
136
|
+
actionName: f,
|
|
137
|
+
payload: m,
|
|
138
|
+
prevState: e,
|
|
139
|
+
nextState: void 0
|
|
140
|
+
};
|
|
141
|
+
let w = 0;
|
|
142
|
+
function z() {
|
|
143
|
+
if (w < s.length) {
|
|
144
|
+
const C = s[w++];
|
|
145
|
+
C(_, z);
|
|
146
|
+
} else {
|
|
147
|
+
const C = b(_.prevState, _.payload);
|
|
148
|
+
_.nextState = C, C !== e && (e = C, i());
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
z();
|
|
152
|
+
}
|
|
153
|
+
const l = s && s.length > 0 ? p : a;
|
|
154
|
+
function h(f) {
|
|
155
|
+
return o.add(f), () => {
|
|
156
|
+
o.delete(f);
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
function g(f) {
|
|
160
|
+
return { store: c, selector: f };
|
|
161
|
+
}
|
|
162
|
+
const c = {
|
|
163
|
+
getState: r,
|
|
164
|
+
dispatch: l,
|
|
165
|
+
subscribe: h,
|
|
166
|
+
select: g
|
|
167
|
+
};
|
|
168
|
+
return t.name && (c.name = t.name), c;
|
|
169
|
+
}
|
|
170
|
+
function dt(t, e) {
|
|
171
|
+
return (o, s) => {
|
|
172
|
+
s(), t.push({
|
|
173
|
+
actionName: o.actionName,
|
|
174
|
+
payload: o.payload,
|
|
175
|
+
prevState: o.prevState,
|
|
176
|
+
nextState: o.nextState ?? o.prevState,
|
|
177
|
+
timestamp: Date.now()
|
|
178
|
+
}), t.length > 1 / 0 && t.splice(0, t.length - 1 / 0);
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
let ht = 1;
|
|
182
|
+
class mt {
|
|
183
|
+
constructor() {
|
|
184
|
+
S(this, "stores", /* @__PURE__ */ new Map());
|
|
185
|
+
S(this, "components", /* @__PURE__ */ new Map());
|
|
186
|
+
S(this, "listeners", /* @__PURE__ */ new Set());
|
|
187
|
+
}
|
|
188
|
+
registerStore(e, n, o) {
|
|
189
|
+
const s = o || e.name || `store_${this.stores.size}`;
|
|
190
|
+
this.stores.set(s, { store: e, history: n, name: s }), e.subscribe(() => {
|
|
191
|
+
this.emit({ type: "action-dispatched", storeName: s });
|
|
192
|
+
}), this.emit({ type: "store-registered", storeName: s });
|
|
193
|
+
}
|
|
194
|
+
getStoreNames() {
|
|
195
|
+
return Array.from(this.stores.keys());
|
|
196
|
+
}
|
|
197
|
+
getStoreState(e) {
|
|
198
|
+
var n;
|
|
199
|
+
return (n = this.stores.get(e)) == null ? void 0 : n.store.getState();
|
|
200
|
+
}
|
|
201
|
+
getTrackedStore(e) {
|
|
202
|
+
return this.stores.get(e);
|
|
203
|
+
}
|
|
204
|
+
getHistory(e) {
|
|
205
|
+
var o;
|
|
206
|
+
if (e)
|
|
207
|
+
return ((o = this.stores.get(e)) == null ? void 0 : o.history) ?? [];
|
|
208
|
+
const n = [];
|
|
209
|
+
for (const s of this.stores.values())
|
|
210
|
+
n.push(...s.history);
|
|
211
|
+
return n.sort((s, r) => s.timestamp - r.timestamp);
|
|
212
|
+
}
|
|
213
|
+
trackComponent(e, n) {
|
|
214
|
+
const o = ht++;
|
|
215
|
+
return this.components.set(o, { id: o, displayName: e, storeNames: n }), this.emit({
|
|
216
|
+
type: "component-mounted",
|
|
217
|
+
data: { id: o, displayName: e, storeNames: n }
|
|
218
|
+
}), o;
|
|
219
|
+
}
|
|
220
|
+
untrackComponent(e) {
|
|
221
|
+
const n = this.components.get(e);
|
|
222
|
+
n && (this.components.delete(e), this.emit({
|
|
223
|
+
type: "component-unmounted",
|
|
224
|
+
data: { id: e, displayName: n.displayName }
|
|
225
|
+
}));
|
|
226
|
+
}
|
|
227
|
+
getComponents() {
|
|
228
|
+
return Array.from(this.components.values());
|
|
229
|
+
}
|
|
230
|
+
on(e) {
|
|
231
|
+
return this.listeners.add(e), () => {
|
|
232
|
+
this.listeners.delete(e);
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
emit(e) {
|
|
236
|
+
for (const n of this.listeners)
|
|
237
|
+
n(e);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
function Qt(t, e) {
|
|
241
|
+
const n = [], o = dt(n), s = J({
|
|
242
|
+
...e,
|
|
243
|
+
middleware: [o, ...e.middleware || []]
|
|
244
|
+
});
|
|
245
|
+
return t.registerStore(s, n, e.name), { store: s, history: n };
|
|
246
|
+
}
|
|
247
|
+
const D = Symbol("TEXT_NODE"), yt = Symbol("FRAGMENT");
|
|
248
|
+
function B(t) {
|
|
249
|
+
return {
|
|
250
|
+
type: D,
|
|
251
|
+
props: { nodeValue: String(t) },
|
|
252
|
+
children: [],
|
|
253
|
+
key: null
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function gt(t) {
|
|
257
|
+
return t == null || typeof t == "boolean" ? null : typeof t == "string" || typeof t == "number" ? B(t) : t;
|
|
258
|
+
}
|
|
259
|
+
function Q(t) {
|
|
260
|
+
const e = [];
|
|
261
|
+
for (const n of t)
|
|
262
|
+
if (Array.isArray(n))
|
|
263
|
+
e.push(...Q(n));
|
|
264
|
+
else {
|
|
265
|
+
const o = gt(n);
|
|
266
|
+
o !== null && e.push(o);
|
|
267
|
+
}
|
|
268
|
+
return e;
|
|
269
|
+
}
|
|
270
|
+
function u(t, e, ...n) {
|
|
271
|
+
e = e || {};
|
|
272
|
+
const o = e.key ?? null;
|
|
273
|
+
e.key !== void 0 && (e = { ...e }, delete e.key);
|
|
274
|
+
const s = Q(n);
|
|
275
|
+
return { type: t, props: e, children: s, key: o };
|
|
276
|
+
}
|
|
277
|
+
const y = {
|
|
278
|
+
CREATE: "CREATE",
|
|
279
|
+
REMOVE: "REMOVE",
|
|
280
|
+
REPLACE: "REPLACE",
|
|
281
|
+
UPDATE: "UPDATE",
|
|
282
|
+
TEXT: "TEXT",
|
|
283
|
+
MOVE: "MOVE",
|
|
284
|
+
CHILDREN: "CHILDREN"
|
|
285
|
+
};
|
|
286
|
+
function x(t, e) {
|
|
287
|
+
if (e == null && t == null) return [];
|
|
288
|
+
if (e == null) return [{ type: y.REMOVE, target: t }];
|
|
289
|
+
if (t == null) return [{ type: y.CREATE, newVNode: e }];
|
|
290
|
+
if (t.type !== e.type)
|
|
291
|
+
return [{ type: y.REPLACE, oldVNode: t, newVNode: e }];
|
|
292
|
+
if (e._dom = t._dom, t.type === D)
|
|
293
|
+
return t.props.nodeValue !== e.props.nodeValue ? [{ type: y.TEXT, oldVNode: t, newVNode: e }] : [];
|
|
294
|
+
const n = [], o = St(t.props, e.props);
|
|
295
|
+
o && n.push({ type: y.UPDATE, target: t, propPatches: o });
|
|
296
|
+
const s = bt(t.children, e.children);
|
|
297
|
+
return s.length && n.push({ type: y.CHILDREN, parent: t, childPatches: s }), n;
|
|
298
|
+
}
|
|
299
|
+
function St(t, e) {
|
|
300
|
+
const n = {}, o = [];
|
|
301
|
+
let s = !1;
|
|
302
|
+
for (const r in e)
|
|
303
|
+
r !== "children" && t[r] !== e[r] && (n[r] = e[r], s = !0);
|
|
304
|
+
for (const r in t)
|
|
305
|
+
r !== "children" && (r in e || (o.push(r), s = !0));
|
|
306
|
+
return s ? { set: n, remove: o } : null;
|
|
307
|
+
}
|
|
308
|
+
function P(t, e) {
|
|
309
|
+
return t == null || e == null ? !1 : t.type === e.type && t.key === e.key;
|
|
310
|
+
}
|
|
311
|
+
function G(t, e) {
|
|
312
|
+
const n = /* @__PURE__ */ new Set();
|
|
313
|
+
let o = 0, s = 0;
|
|
314
|
+
for (const r of t)
|
|
315
|
+
r != null && (r.key != null ? (o++, n.has(r.key) && console.warn(
|
|
316
|
+
`[pulse] Duplicate key "${String(r.key)}" in ${e} children. Keys must be unique among siblings.`
|
|
317
|
+
), n.add(r.key)) : s++);
|
|
318
|
+
o > 0 && s > 0 && console.warn(
|
|
319
|
+
`[pulse] Mixed keyed and unkeyed children in ${e} list (${o} keyed, ${s} unkeyed). Either all children should have keys or none should.`
|
|
320
|
+
);
|
|
321
|
+
}
|
|
322
|
+
function bt(t, e) {
|
|
323
|
+
var g;
|
|
324
|
+
process.env.NODE_ENV !== "production" && (G(t, "old"), G(e, "new"));
|
|
325
|
+
const n = [];
|
|
326
|
+
let o = 0, s = t.length - 1, r = 0, i = e.length - 1, a = t[o], p = t[s], l = e[r], h = e[i];
|
|
327
|
+
for (; o <= s && r <= i; ) {
|
|
328
|
+
if (a == null) {
|
|
329
|
+
a = t[++o];
|
|
330
|
+
continue;
|
|
331
|
+
}
|
|
332
|
+
if (p == null) {
|
|
333
|
+
p = t[--s];
|
|
334
|
+
continue;
|
|
335
|
+
}
|
|
336
|
+
if (P(a, l))
|
|
337
|
+
n.push(...x(a, l)), a = t[++o], l = e[++r];
|
|
338
|
+
else if (P(p, h))
|
|
339
|
+
n.push(...x(p, h)), p = t[--s], h = e[--i];
|
|
340
|
+
else if (P(a, h))
|
|
341
|
+
n.push({
|
|
342
|
+
type: y.MOVE,
|
|
343
|
+
vnode: a,
|
|
344
|
+
anchor: t[s + 1] || null,
|
|
345
|
+
childPatches: x(a, h)
|
|
346
|
+
}), a = t[++o], h = e[--i];
|
|
347
|
+
else if (P(p, l))
|
|
348
|
+
n.push({
|
|
349
|
+
type: y.MOVE,
|
|
350
|
+
vnode: p,
|
|
351
|
+
anchor: a,
|
|
352
|
+
childPatches: x(p, l)
|
|
353
|
+
}), p = t[--s], l = e[++r];
|
|
354
|
+
else
|
|
355
|
+
break;
|
|
356
|
+
}
|
|
357
|
+
if (o <= s && r <= i) {
|
|
358
|
+
const c = /* @__PURE__ */ new Map();
|
|
359
|
+
for (let f = o; f <= s; f++) {
|
|
360
|
+
const m = (g = t[f]) == null ? void 0 : g.key;
|
|
361
|
+
m != null && c.set(m, f);
|
|
362
|
+
}
|
|
363
|
+
for (; r <= i; ) {
|
|
364
|
+
l = e[r];
|
|
365
|
+
const f = l.key != null ? c.get(l.key) : void 0;
|
|
366
|
+
if (f !== void 0) {
|
|
367
|
+
const m = t[f];
|
|
368
|
+
n.push({
|
|
369
|
+
type: y.MOVE,
|
|
370
|
+
vnode: m,
|
|
371
|
+
anchor: t[o] || null,
|
|
372
|
+
childPatches: x(m, l)
|
|
373
|
+
}), t[f] = null, c.delete(l.key);
|
|
374
|
+
} else
|
|
375
|
+
n.push({
|
|
376
|
+
type: y.CREATE,
|
|
377
|
+
newVNode: l,
|
|
378
|
+
anchor: t[o] || null
|
|
379
|
+
});
|
|
380
|
+
r++;
|
|
381
|
+
}
|
|
382
|
+
for (let f = o; f <= s; f++)
|
|
383
|
+
t[f] != null && n.push({ type: y.REMOVE, target: t[f] });
|
|
384
|
+
}
|
|
385
|
+
if (o > s) {
|
|
386
|
+
const c = e[i + 1] || null;
|
|
387
|
+
for (let f = r; f <= i; f++)
|
|
388
|
+
n.push({ type: y.CREATE, newVNode: e[f], anchor: c });
|
|
389
|
+
} else if (r > i)
|
|
390
|
+
for (let c = o; c <= s; c++)
|
|
391
|
+
t[c] != null && n.push({ type: y.REMOVE, target: t[c] });
|
|
392
|
+
return n;
|
|
393
|
+
}
|
|
394
|
+
const Y = "http://www.w3.org/2000/svg";
|
|
395
|
+
function V(t, e) {
|
|
396
|
+
if (t.type === D) {
|
|
397
|
+
const o = document.createTextNode(t.props.nodeValue);
|
|
398
|
+
return t._dom = o, o;
|
|
399
|
+
}
|
|
400
|
+
if (t.type === yt) {
|
|
401
|
+
const o = document.createDocumentFragment();
|
|
402
|
+
for (const s of t.children)
|
|
403
|
+
o.appendChild(V(s, e));
|
|
404
|
+
return t._dom = o, o;
|
|
405
|
+
}
|
|
406
|
+
t.type === "svg" ? e = Y : t.type === "foreignObject" && (e = void 0);
|
|
407
|
+
const n = e ? document.createElementNS(e, t.type) : document.createElement(t.type);
|
|
408
|
+
_t(n, {}, t.props);
|
|
409
|
+
for (const o of t.children)
|
|
410
|
+
n.appendChild(V(o, e));
|
|
411
|
+
return t._dom = n, n;
|
|
412
|
+
}
|
|
413
|
+
function _t(t, e, n) {
|
|
414
|
+
for (const o in e)
|
|
415
|
+
o === "children" || o === "key" || o in n || tt(t, o, e[o]);
|
|
416
|
+
for (const o in n)
|
|
417
|
+
o === "children" || o === "key" || e[o] !== n[o] && Z(t, o, n[o], e[o]);
|
|
418
|
+
}
|
|
419
|
+
function Z(t, e, n, o) {
|
|
420
|
+
if (e.startsWith("on")) {
|
|
421
|
+
const s = e.slice(2).toLowerCase();
|
|
422
|
+
o && t.removeEventListener(s, o), n && t.addEventListener(s, n);
|
|
423
|
+
} else if (e === "className" || e === "class")
|
|
424
|
+
t instanceof SVGElement ? t.setAttribute("class", n || "") : t.className = n || "";
|
|
425
|
+
else if (e === "style" && typeof n == "object") {
|
|
426
|
+
if (typeof o == "object" && o)
|
|
427
|
+
for (const s in o)
|
|
428
|
+
s in n || (t.style[s] = "");
|
|
429
|
+
Object.assign(t.style, n);
|
|
430
|
+
} else if (e === "dangerouslySetInnerHTML")
|
|
431
|
+
n && typeof n.__html == "string" && (t.innerHTML = n.__html);
|
|
432
|
+
else if (e === "ref")
|
|
433
|
+
typeof n == "function" && n(t);
|
|
434
|
+
else if (e in t && !(t instanceof SVGElement))
|
|
435
|
+
try {
|
|
436
|
+
t[e] = n ?? "";
|
|
437
|
+
} catch {
|
|
438
|
+
t.setAttribute(e, n);
|
|
439
|
+
}
|
|
440
|
+
else n === !0 ? t.setAttribute(e, "") : n === !1 || n == null ? t.removeAttribute(e) : t.setAttribute(e, n);
|
|
441
|
+
}
|
|
442
|
+
function tt(t, e, n) {
|
|
443
|
+
if (e.startsWith("on"))
|
|
444
|
+
t.removeEventListener(e.slice(2).toLowerCase(), n);
|
|
445
|
+
else if (e === "dangerouslySetInnerHTML")
|
|
446
|
+
t.innerHTML = "";
|
|
447
|
+
else if (e === "className" || e === "class")
|
|
448
|
+
t instanceof SVGElement ? t.removeAttribute("class") : t.className = "";
|
|
449
|
+
else if (e in t && !(t instanceof SVGElement))
|
|
450
|
+
try {
|
|
451
|
+
t[e] = "";
|
|
452
|
+
} catch {
|
|
453
|
+
t.removeAttribute(e);
|
|
454
|
+
}
|
|
455
|
+
else
|
|
456
|
+
t.removeAttribute(e);
|
|
457
|
+
}
|
|
458
|
+
function K(t) {
|
|
459
|
+
return t instanceof SVGElement ? Y : void 0;
|
|
460
|
+
}
|
|
461
|
+
function v(t, e) {
|
|
462
|
+
var n, o, s;
|
|
463
|
+
for (const r of e)
|
|
464
|
+
switch (r.type) {
|
|
465
|
+
case y.CREATE: {
|
|
466
|
+
const i = V(r.newVNode, K(t));
|
|
467
|
+
(n = r.anchor) != null && n._dom ? t.insertBefore(i, r.anchor._dom) : t.appendChild(i);
|
|
468
|
+
break;
|
|
469
|
+
}
|
|
470
|
+
case y.REMOVE: {
|
|
471
|
+
const i = r.target._dom;
|
|
472
|
+
i != null && i.parentNode && i.parentNode.removeChild(i);
|
|
473
|
+
break;
|
|
474
|
+
}
|
|
475
|
+
case y.REPLACE: {
|
|
476
|
+
const i = r.oldVNode._dom, a = i == null ? void 0 : i.parentNode, p = V(
|
|
477
|
+
r.newVNode,
|
|
478
|
+
a ? K(a) : void 0
|
|
479
|
+
);
|
|
480
|
+
a && a.replaceChild(p, i);
|
|
481
|
+
break;
|
|
482
|
+
}
|
|
483
|
+
case y.UPDATE: {
|
|
484
|
+
const i = r.target._dom, { set: a, remove: p } = r.propPatches;
|
|
485
|
+
for (const l of p)
|
|
486
|
+
tt(i, l, r.target.props[l]);
|
|
487
|
+
for (const l in a)
|
|
488
|
+
Z(i, l, a[l], r.target.props[l]);
|
|
489
|
+
break;
|
|
490
|
+
}
|
|
491
|
+
case y.TEXT: {
|
|
492
|
+
const i = r.oldVNode._dom;
|
|
493
|
+
i && (i.nodeValue = r.newVNode.props.nodeValue);
|
|
494
|
+
break;
|
|
495
|
+
}
|
|
496
|
+
case y.MOVE: {
|
|
497
|
+
const i = r.vnode._dom;
|
|
498
|
+
i && ((o = r.anchor) != null && o._dom ? t.insertBefore(i, r.anchor._dom) : t.appendChild(i)), (s = r.childPatches) != null && s.length && i && v(i, r.childPatches);
|
|
499
|
+
break;
|
|
500
|
+
}
|
|
501
|
+
case y.CHILDREN: {
|
|
502
|
+
const i = r.parent._dom;
|
|
503
|
+
i && r.childPatches.length && v(i, r.childPatches);
|
|
504
|
+
break;
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
const $ = /* @__PURE__ */ new WeakMap();
|
|
509
|
+
function xt(t, e) {
|
|
510
|
+
const n = $.get(e);
|
|
511
|
+
if (n) {
|
|
512
|
+
const o = E(t, e), s = [];
|
|
513
|
+
I(n.vTree, s);
|
|
514
|
+
const r = x(n.vTree, o);
|
|
515
|
+
v(e, r);
|
|
516
|
+
const i = [];
|
|
517
|
+
o && I(o, i);
|
|
518
|
+
const a = new Set(i);
|
|
519
|
+
for (const l of s)
|
|
520
|
+
a.has(l) || l.unmount();
|
|
521
|
+
const p = new Set(s);
|
|
522
|
+
for (const l of i)
|
|
523
|
+
p.has(l) || l.mount(e, () => U(l, e));
|
|
524
|
+
$.set(e, { vTree: o });
|
|
525
|
+
} else {
|
|
526
|
+
const o = E(t, e);
|
|
527
|
+
if (!o) return;
|
|
528
|
+
const s = V(o);
|
|
529
|
+
e.appendChild(s);
|
|
530
|
+
const r = [];
|
|
531
|
+
I(o, r);
|
|
532
|
+
for (const i of r)
|
|
533
|
+
i.mount(e, () => U(i, e));
|
|
534
|
+
$.set(e, { vTree: o });
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
function E(t, e) {
|
|
538
|
+
var n;
|
|
539
|
+
if (t == null) return null;
|
|
540
|
+
if (typeof t.type == "function") {
|
|
541
|
+
if (t.type[q]) {
|
|
542
|
+
const s = t.type._lifecycle;
|
|
543
|
+
try {
|
|
544
|
+
const r = new ut(t.type, t.props), i = t.type(t.props), p = E(i, e) ?? B("");
|
|
545
|
+
if (p._instance) {
|
|
546
|
+
const l = {
|
|
547
|
+
type: "div",
|
|
548
|
+
props: { style: { display: "contents" } },
|
|
549
|
+
children: [p],
|
|
550
|
+
key: t.key
|
|
551
|
+
};
|
|
552
|
+
return l._instance = r, r.lastVTree = l, l;
|
|
553
|
+
}
|
|
554
|
+
return p._instance = r, r.lastVTree = p, p;
|
|
555
|
+
} catch (r) {
|
|
556
|
+
if (s != null && s.onError) {
|
|
557
|
+
const i = s.onError({
|
|
558
|
+
error: r,
|
|
559
|
+
props: t.props
|
|
560
|
+
});
|
|
561
|
+
return E(i, e);
|
|
562
|
+
}
|
|
563
|
+
throw r;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
const o = t.type({ ...t.props, children: t.children });
|
|
567
|
+
return E(o, e);
|
|
568
|
+
}
|
|
569
|
+
return (n = t.children) != null && n.length && (t.children = t.children.map((o) => E(o, e)).filter((o) => o != null)), t;
|
|
570
|
+
}
|
|
571
|
+
function U(t, e) {
|
|
572
|
+
var s, r;
|
|
573
|
+
if (!t._renderCallback) return;
|
|
574
|
+
const n = t.connectedFn, o = n._lifecycle;
|
|
575
|
+
try {
|
|
576
|
+
const i = n(t.props), p = E(i, e) ?? B("");
|
|
577
|
+
let l;
|
|
578
|
+
if (p._instance && p._instance !== t ? (l = {
|
|
579
|
+
type: "div",
|
|
580
|
+
props: { style: { display: "contents" } },
|
|
581
|
+
children: [p],
|
|
582
|
+
key: null
|
|
583
|
+
}, l._instance = t) : (p._instance = t, l = p), t.lastVTree) {
|
|
584
|
+
H(t.lastVTree, t);
|
|
585
|
+
const m = x(t.lastVTree, l), b = ((s = t.lastVTree._dom) == null ? void 0 : s.parentNode) || e;
|
|
586
|
+
v(b, m), l._dom || (l._dom = t.lastVTree._dom);
|
|
587
|
+
}
|
|
588
|
+
const h = [];
|
|
589
|
+
M(t.lastVTree, h, t);
|
|
590
|
+
const g = [];
|
|
591
|
+
M(l, g, t);
|
|
592
|
+
const c = new Set(g);
|
|
593
|
+
for (const m of h)
|
|
594
|
+
c.has(m) || m.unmount();
|
|
595
|
+
t.lastVTree = l;
|
|
596
|
+
const f = new Set(h);
|
|
597
|
+
for (const m of g)
|
|
598
|
+
f.has(m) || m.mount(e, () => U(m, e));
|
|
599
|
+
o != null && o.onUpdate && o.onUpdate({
|
|
600
|
+
dom: l == null ? void 0 : l._dom,
|
|
601
|
+
props: t.props
|
|
602
|
+
}), t.updateSelected();
|
|
603
|
+
} catch (i) {
|
|
604
|
+
if (o != null && o.onError) {
|
|
605
|
+
const a = o.onError({ error: i, props: t.props }), p = E(a, e);
|
|
606
|
+
if (t.lastVTree && p) {
|
|
607
|
+
H(t.lastVTree, t);
|
|
608
|
+
const h = x(t.lastVTree, p), g = ((r = t.lastVTree._dom) == null ? void 0 : r.parentNode) || e;
|
|
609
|
+
v(g, h), p._dom || (p._dom = t.lastVTree._dom);
|
|
610
|
+
}
|
|
611
|
+
const l = [];
|
|
612
|
+
M(t.lastVTree, l, t);
|
|
613
|
+
for (const h of l) h.unmount();
|
|
614
|
+
t.lastVTree = p, t.updateSelected();
|
|
615
|
+
} else
|
|
616
|
+
throw i;
|
|
617
|
+
}
|
|
618
|
+
}
|
|
619
|
+
function H(t, e) {
|
|
620
|
+
if (!(!t || !t.children))
|
|
621
|
+
for (let n = 0; n < t.children.length; n++) {
|
|
622
|
+
const o = t.children[n];
|
|
623
|
+
o._instance && o._instance !== e && o._instance.lastVTree && o._instance.lastVTree !== o && (t.children[n] = o._instance.lastVTree), H(t.children[n], e);
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
function I(t, e) {
|
|
627
|
+
if (t && (t._instance && e.push(t._instance), t.children))
|
|
628
|
+
for (const n of t.children)
|
|
629
|
+
I(n, e);
|
|
630
|
+
}
|
|
631
|
+
function M(t, e, n) {
|
|
632
|
+
if (t && (t._instance && t._instance !== n && e.push(t._instance), t.children))
|
|
633
|
+
for (const o of t.children)
|
|
634
|
+
M(o, e, n);
|
|
635
|
+
}
|
|
636
|
+
function W(t, e, n) {
|
|
637
|
+
const o = t.getTrackedStore(e);
|
|
638
|
+
if (!o)
|
|
639
|
+
throw new Error(`[pulse-devtools] Unknown store: "${e}"`);
|
|
640
|
+
const { store: s, history: r } = o;
|
|
641
|
+
if (n < 0 || n >= r.length)
|
|
642
|
+
throw new Error(
|
|
643
|
+
`[pulse-devtools] Index ${n} out of range (0..${r.length - 1})`
|
|
644
|
+
);
|
|
645
|
+
const i = r[n].nextState;
|
|
646
|
+
s.dispatch("__devtools_replace__", i), t.emit({ type: "time-travel", storeName: e, data: { entryIndex: n } });
|
|
647
|
+
}
|
|
648
|
+
function Yt(t, e, n) {
|
|
649
|
+
const o = t.getTrackedStore(e);
|
|
650
|
+
if (!o)
|
|
651
|
+
throw new Error(`[pulse-devtools] Unknown store: "${e}"`);
|
|
652
|
+
const { store: s, history: r } = o;
|
|
653
|
+
if (n < 0 || n >= r.length)
|
|
654
|
+
throw new Error(
|
|
655
|
+
`[pulse-devtools] Index ${n} out of range (0..${r.length - 1})`
|
|
656
|
+
);
|
|
657
|
+
const i = r.slice(n), a = r[n].prevState;
|
|
658
|
+
s.dispatch("__devtools_replace__", a);
|
|
659
|
+
for (const p of i)
|
|
660
|
+
s.dispatch(p.actionName, p.payload);
|
|
661
|
+
t.emit({
|
|
662
|
+
type: "time-travel",
|
|
663
|
+
storeName: e,
|
|
664
|
+
data: { replayFrom: n }
|
|
665
|
+
});
|
|
666
|
+
}
|
|
667
|
+
const d = {
|
|
668
|
+
base: "#1e1e2e",
|
|
669
|
+
surface0: "#313244",
|
|
670
|
+
surface1: "#45475a",
|
|
671
|
+
overlay0: "#6c7086",
|
|
672
|
+
text: "#cdd6f4",
|
|
673
|
+
subtext0: "#a6adc8",
|
|
674
|
+
blue: "#89b4fa",
|
|
675
|
+
green: "#a6e3a1",
|
|
676
|
+
yellow: "#f9e2af",
|
|
677
|
+
mauve: "#cba6f7",
|
|
678
|
+
teal: "#94e2d5",
|
|
679
|
+
peach: "#fab387"
|
|
680
|
+
}, Et = {
|
|
681
|
+
position: "fixed",
|
|
682
|
+
bottom: "0",
|
|
683
|
+
left: "0",
|
|
684
|
+
right: "0",
|
|
685
|
+
height: "320px",
|
|
686
|
+
backgroundColor: d.base,
|
|
687
|
+
color: d.text,
|
|
688
|
+
fontFamily: "'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace",
|
|
689
|
+
fontSize: "12px",
|
|
690
|
+
lineHeight: "1.5",
|
|
691
|
+
zIndex: "2147483647",
|
|
692
|
+
display: "flex",
|
|
693
|
+
flexDirection: "column",
|
|
694
|
+
borderTop: `2px solid ${d.mauve}`,
|
|
695
|
+
overflow: "hidden"
|
|
696
|
+
}, Tt = {
|
|
697
|
+
display: "flex",
|
|
698
|
+
alignItems: "center",
|
|
699
|
+
backgroundColor: d.surface0,
|
|
700
|
+
borderBottom: `1px solid ${d.surface1}`,
|
|
701
|
+
padding: "0 8px",
|
|
702
|
+
height: "32px",
|
|
703
|
+
flexShrink: "0"
|
|
704
|
+
}, kt = (t) => ({
|
|
705
|
+
background: "none",
|
|
706
|
+
border: "none",
|
|
707
|
+
color: t ? d.mauve : d.subtext0,
|
|
708
|
+
fontFamily: "inherit",
|
|
709
|
+
fontSize: "12px",
|
|
710
|
+
padding: "6px 12px",
|
|
711
|
+
cursor: "pointer",
|
|
712
|
+
borderBottom: t ? `2px solid ${d.mauve}` : "2px solid transparent",
|
|
713
|
+
marginBottom: "-1px"
|
|
714
|
+
}), wt = {
|
|
715
|
+
background: "none",
|
|
716
|
+
border: "none",
|
|
717
|
+
color: d.overlay0,
|
|
718
|
+
fontSize: "16px",
|
|
719
|
+
cursor: "pointer",
|
|
720
|
+
marginLeft: "auto",
|
|
721
|
+
padding: "4px 8px",
|
|
722
|
+
fontFamily: "inherit"
|
|
723
|
+
}, Ct = {
|
|
724
|
+
flex: "1",
|
|
725
|
+
overflow: "auto",
|
|
726
|
+
padding: "8px 12px"
|
|
727
|
+
}, Nt = {
|
|
728
|
+
display: "flex",
|
|
729
|
+
height: "100%",
|
|
730
|
+
gap: "1px"
|
|
731
|
+
}, Vt = {
|
|
732
|
+
width: "200px",
|
|
733
|
+
flexShrink: "0",
|
|
734
|
+
borderRight: `1px solid ${d.surface1}`,
|
|
735
|
+
overflow: "auto",
|
|
736
|
+
padding: "4px 0"
|
|
737
|
+
}, vt = {
|
|
738
|
+
flex: "1",
|
|
739
|
+
overflow: "auto",
|
|
740
|
+
padding: "8px"
|
|
741
|
+
}, Pt = (t) => ({
|
|
742
|
+
padding: "4px 12px",
|
|
743
|
+
cursor: "pointer",
|
|
744
|
+
backgroundColor: t ? d.surface1 : "transparent",
|
|
745
|
+
color: t ? d.blue : d.text
|
|
746
|
+
}), X = {
|
|
747
|
+
color: d.mauve
|
|
748
|
+
}, O = {
|
|
749
|
+
color: d.green
|
|
750
|
+
}, Ot = {
|
|
751
|
+
color: d.yellow
|
|
752
|
+
}, It = {
|
|
753
|
+
color: d.peach
|
|
754
|
+
}, k = {
|
|
755
|
+
color: d.overlay0,
|
|
756
|
+
fontStyle: "italic"
|
|
757
|
+
}, Mt = (t) => ({
|
|
758
|
+
padding: "4px 8px",
|
|
759
|
+
cursor: "pointer",
|
|
760
|
+
backgroundColor: t ? d.surface1 : "transparent",
|
|
761
|
+
borderLeft: t ? `3px solid ${d.blue}` : "3px solid transparent",
|
|
762
|
+
display: "flex",
|
|
763
|
+
justifyContent: "space-between",
|
|
764
|
+
alignItems: "center"
|
|
765
|
+
}), et = {
|
|
766
|
+
color: d.blue,
|
|
767
|
+
fontWeight: "bold"
|
|
768
|
+
}, Lt = {
|
|
769
|
+
color: d.overlay0,
|
|
770
|
+
fontSize: "10px"
|
|
771
|
+
}, $t = {
|
|
772
|
+
width: "100%",
|
|
773
|
+
accentColor: d.mauve,
|
|
774
|
+
margin: "4px 0 8px"
|
|
775
|
+
}, At = {
|
|
776
|
+
width: "100%",
|
|
777
|
+
backgroundColor: d.surface0,
|
|
778
|
+
border: `1px solid ${d.surface1}`,
|
|
779
|
+
color: d.text,
|
|
780
|
+
padding: "4px 8px",
|
|
781
|
+
fontFamily: "inherit",
|
|
782
|
+
fontSize: "12px",
|
|
783
|
+
borderRadius: "4px",
|
|
784
|
+
outline: "none",
|
|
785
|
+
marginBottom: "8px",
|
|
786
|
+
boxSizing: "border-box"
|
|
787
|
+
}, Rt = {
|
|
788
|
+
padding: "4px 8px",
|
|
789
|
+
borderBottom: `1px solid ${d.surface0}`
|
|
790
|
+
}, Ft = {
|
|
791
|
+
color: d.teal,
|
|
792
|
+
fontWeight: "bold"
|
|
793
|
+
}, Ut = {
|
|
794
|
+
color: d.overlay0,
|
|
795
|
+
fontSize: "10px",
|
|
796
|
+
marginLeft: "8px"
|
|
797
|
+
}, nt = {
|
|
798
|
+
display: "inline-block",
|
|
799
|
+
backgroundColor: d.surface1,
|
|
800
|
+
color: d.subtext0,
|
|
801
|
+
padding: "1px 6px",
|
|
802
|
+
borderRadius: "8px",
|
|
803
|
+
fontSize: "10px",
|
|
804
|
+
marginLeft: "4px"
|
|
805
|
+
}, Ht = {
|
|
806
|
+
color: d.mauve,
|
|
807
|
+
fontWeight: "bold",
|
|
808
|
+
fontSize: "12px",
|
|
809
|
+
marginRight: "8px"
|
|
810
|
+
};
|
|
811
|
+
function j(t, e) {
|
|
812
|
+
if (t === null)
|
|
813
|
+
return u("span", { style: k }, "null");
|
|
814
|
+
if (t === void 0)
|
|
815
|
+
return u("span", { style: k }, "undefined");
|
|
816
|
+
if (typeof t == "string")
|
|
817
|
+
return u("span", { style: Ot }, `"${t}"`);
|
|
818
|
+
if (typeof t == "boolean")
|
|
819
|
+
return u("span", { style: It }, String(t));
|
|
820
|
+
if (typeof t == "number")
|
|
821
|
+
return u("span", { style: O }, String(t));
|
|
822
|
+
if (Array.isArray(t))
|
|
823
|
+
return t.length === 0 ? u("span", { style: O }, "[]") : e > 4 ? u("span", { style: k }, "[…]") : u(
|
|
824
|
+
"div",
|
|
825
|
+
{ style: { paddingLeft: "12px" } },
|
|
826
|
+
...t.map(
|
|
827
|
+
(n, o) => u(
|
|
828
|
+
"div",
|
|
829
|
+
{ key: o },
|
|
830
|
+
u("span", { style: X }, `${o}: `),
|
|
831
|
+
j(n, e + 1)
|
|
832
|
+
)
|
|
833
|
+
)
|
|
834
|
+
);
|
|
835
|
+
if (typeof t == "object") {
|
|
836
|
+
const n = Object.keys(t);
|
|
837
|
+
return n.length === 0 ? u("span", { style: O }, "{}") : e > 4 ? u("span", { style: k }, "{…}") : u(
|
|
838
|
+
"div",
|
|
839
|
+
{ style: { paddingLeft: "12px" } },
|
|
840
|
+
...n.map(
|
|
841
|
+
(o) => u(
|
|
842
|
+
"div",
|
|
843
|
+
{ key: o },
|
|
844
|
+
u("span", { style: X }, `${o}: `),
|
|
845
|
+
j(t[o], e + 1)
|
|
846
|
+
)
|
|
847
|
+
)
|
|
848
|
+
);
|
|
849
|
+
}
|
|
850
|
+
return u("span", { style: O }, String(t));
|
|
851
|
+
}
|
|
852
|
+
function jt({
|
|
853
|
+
storeNames: t,
|
|
854
|
+
selectedStore: e,
|
|
855
|
+
storeStates: n,
|
|
856
|
+
onSelectStore: o
|
|
857
|
+
}) {
|
|
858
|
+
const s = e ? n[e] : null;
|
|
859
|
+
return u(
|
|
860
|
+
"div",
|
|
861
|
+
{ style: Nt },
|
|
862
|
+
u(
|
|
863
|
+
"div",
|
|
864
|
+
{ style: Vt },
|
|
865
|
+
...t.map(
|
|
866
|
+
(r) => u(
|
|
867
|
+
"div",
|
|
868
|
+
{
|
|
869
|
+
key: r,
|
|
870
|
+
style: Pt(r === e),
|
|
871
|
+
onClick: () => o(r)
|
|
872
|
+
},
|
|
873
|
+
r
|
|
874
|
+
)
|
|
875
|
+
)
|
|
876
|
+
),
|
|
877
|
+
u(
|
|
878
|
+
"div",
|
|
879
|
+
{ style: vt },
|
|
880
|
+
e ? u(
|
|
881
|
+
"div",
|
|
882
|
+
null,
|
|
883
|
+
u(
|
|
884
|
+
"div",
|
|
885
|
+
{ style: { marginBottom: "8px", color: d.subtext0 } },
|
|
886
|
+
"State of ",
|
|
887
|
+
u("span", { style: et }, e)
|
|
888
|
+
),
|
|
889
|
+
s != null ? j(s, 0) : u("span", { style: k }, "No state")
|
|
890
|
+
) : u("span", { style: k }, "Select a store")
|
|
891
|
+
)
|
|
892
|
+
);
|
|
893
|
+
}
|
|
894
|
+
function Dt(t) {
|
|
895
|
+
const e = new Date(t), n = (o) => String(o).padStart(2, "0");
|
|
896
|
+
return `${n(e.getHours())}:${n(e.getMinutes())}:${n(e.getSeconds())}`;
|
|
897
|
+
}
|
|
898
|
+
function Bt({
|
|
899
|
+
actionLog: t,
|
|
900
|
+
timeTravelIndex: e,
|
|
901
|
+
filter: n,
|
|
902
|
+
onFilterChange: o,
|
|
903
|
+
onTravelTo: s,
|
|
904
|
+
onSliderChange: r
|
|
905
|
+
}) {
|
|
906
|
+
const i = n ? t.filter(
|
|
907
|
+
(a) => a.actionName.toLowerCase().includes(n.toLowerCase())
|
|
908
|
+
) : t;
|
|
909
|
+
return u(
|
|
910
|
+
"div",
|
|
911
|
+
{ style: { height: "100%", display: "flex", flexDirection: "column" } },
|
|
912
|
+
// Filter
|
|
913
|
+
u("input", {
|
|
914
|
+
style: At,
|
|
915
|
+
placeholder: "Filter actions…",
|
|
916
|
+
value: n,
|
|
917
|
+
onInput: (a) => o(a.target.value)
|
|
918
|
+
}),
|
|
919
|
+
// Slider
|
|
920
|
+
t.length > 0 ? u(
|
|
921
|
+
"div",
|
|
922
|
+
{ style: { flexShrink: "0" } },
|
|
923
|
+
u("input", {
|
|
924
|
+
type: "range",
|
|
925
|
+
style: $t,
|
|
926
|
+
min: "0",
|
|
927
|
+
max: String(t.length - 1),
|
|
928
|
+
value: String(e),
|
|
929
|
+
onInput: (a) => r(Number(a.target.value))
|
|
930
|
+
}),
|
|
931
|
+
u(
|
|
932
|
+
"div",
|
|
933
|
+
{
|
|
934
|
+
style: {
|
|
935
|
+
color: d.overlay0,
|
|
936
|
+
fontSize: "10px",
|
|
937
|
+
marginBottom: "4px"
|
|
938
|
+
}
|
|
939
|
+
},
|
|
940
|
+
`${e + 1} / ${t.length}`
|
|
941
|
+
)
|
|
942
|
+
) : null,
|
|
943
|
+
// Action list
|
|
944
|
+
u(
|
|
945
|
+
"div",
|
|
946
|
+
{ style: { flex: "1", overflow: "auto" } },
|
|
947
|
+
...i.map((a) => {
|
|
948
|
+
const p = t.indexOf(a);
|
|
949
|
+
return u(
|
|
950
|
+
"div",
|
|
951
|
+
{
|
|
952
|
+
key: p,
|
|
953
|
+
style: Mt(p === e),
|
|
954
|
+
onClick: () => s(p)
|
|
955
|
+
},
|
|
956
|
+
u(
|
|
957
|
+
"span",
|
|
958
|
+
null,
|
|
959
|
+
u("span", { style: et }, a.actionName),
|
|
960
|
+
a.payload !== void 0 ? u(
|
|
961
|
+
"span",
|
|
962
|
+
{ style: { color: d.subtext0, marginLeft: "8px" } },
|
|
963
|
+
typeof a.payload == "object" ? JSON.stringify(a.payload) : String(a.payload)
|
|
964
|
+
) : null
|
|
965
|
+
),
|
|
966
|
+
u("span", { style: Lt }, Dt(a.timestamp))
|
|
967
|
+
);
|
|
968
|
+
}),
|
|
969
|
+
i.length === 0 ? u(
|
|
970
|
+
"div",
|
|
971
|
+
{ style: { color: d.overlay0, padding: "8px" } },
|
|
972
|
+
t.length === 0 ? "No actions yet" : "No matching actions"
|
|
973
|
+
) : null
|
|
974
|
+
)
|
|
975
|
+
);
|
|
976
|
+
}
|
|
977
|
+
function zt({
|
|
978
|
+
components: t
|
|
979
|
+
}) {
|
|
980
|
+
return t.length === 0 ? u(
|
|
981
|
+
"div",
|
|
982
|
+
{ style: { color: d.overlay0, padding: "8px" } },
|
|
983
|
+
"No connected components mounted"
|
|
984
|
+
) : u(
|
|
985
|
+
"div",
|
|
986
|
+
null,
|
|
987
|
+
...t.map(
|
|
988
|
+
(e) => u(
|
|
989
|
+
"div",
|
|
990
|
+
{ key: e.id, style: Rt },
|
|
991
|
+
u("span", { style: Ft }, e.displayName),
|
|
992
|
+
e.storeNames.length > 0 ? u(
|
|
993
|
+
"span",
|
|
994
|
+
{ style: Ut },
|
|
995
|
+
e.storeNames.map(
|
|
996
|
+
(n) => u("span", { key: n, style: nt }, n)
|
|
997
|
+
)
|
|
998
|
+
) : null
|
|
999
|
+
)
|
|
1000
|
+
)
|
|
1001
|
+
);
|
|
1002
|
+
}
|
|
1003
|
+
function Gt() {
|
|
1004
|
+
return J({
|
|
1005
|
+
state: {
|
|
1006
|
+
open: !1,
|
|
1007
|
+
activeTab: "stores",
|
|
1008
|
+
selectedStore: null,
|
|
1009
|
+
timeTravelIndex: -1,
|
|
1010
|
+
storeNames: [],
|
|
1011
|
+
storeStates: {},
|
|
1012
|
+
actionLog: [],
|
|
1013
|
+
filter: "",
|
|
1014
|
+
components: []
|
|
1015
|
+
},
|
|
1016
|
+
actions: {
|
|
1017
|
+
toggle: (t) => ({ ...t, open: !t.open }),
|
|
1018
|
+
open: (t) => ({ ...t, open: !0 }),
|
|
1019
|
+
close: (t) => ({ ...t, open: !1 }),
|
|
1020
|
+
setTab: (t, e) => ({ ...t, activeTab: e }),
|
|
1021
|
+
selectStore: (t, e) => ({ ...t, selectedStore: e }),
|
|
1022
|
+
setFilter: (t, e) => ({ ...t, filter: e }),
|
|
1023
|
+
setTimeTravelIndex: (t, e) => ({
|
|
1024
|
+
...t,
|
|
1025
|
+
timeTravelIndex: e
|
|
1026
|
+
}),
|
|
1027
|
+
sync: (t, e) => ({ ...t, ...e })
|
|
1028
|
+
}
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
function Kt({
|
|
1032
|
+
open: t,
|
|
1033
|
+
activeTab: e,
|
|
1034
|
+
selectedStore: n,
|
|
1035
|
+
timeTravelIndex: o,
|
|
1036
|
+
storeNames: s,
|
|
1037
|
+
storeStates: r,
|
|
1038
|
+
actionLog: i,
|
|
1039
|
+
filter: a,
|
|
1040
|
+
components: p,
|
|
1041
|
+
panelActions: l
|
|
1042
|
+
}) {
|
|
1043
|
+
if (!t) return null;
|
|
1044
|
+
const h = [
|
|
1045
|
+
{ id: "stores", label: "Stores" },
|
|
1046
|
+
{ id: "actions", label: "Actions" },
|
|
1047
|
+
{ id: "components", label: "Components" }
|
|
1048
|
+
];
|
|
1049
|
+
let g;
|
|
1050
|
+
return e === "stores" ? g = jt({
|
|
1051
|
+
storeNames: s,
|
|
1052
|
+
selectedStore: n,
|
|
1053
|
+
storeStates: r,
|
|
1054
|
+
onSelectStore: l.selectStore
|
|
1055
|
+
}) : e === "actions" ? g = Bt({
|
|
1056
|
+
actionLog: i,
|
|
1057
|
+
timeTravelIndex: o,
|
|
1058
|
+
filter: a,
|
|
1059
|
+
onFilterChange: l.setFilter,
|
|
1060
|
+
onTravelTo: l.travelTo,
|
|
1061
|
+
onSliderChange: l.sliderChange
|
|
1062
|
+
}) : g = zt({ components: p }), u(
|
|
1063
|
+
"div",
|
|
1064
|
+
{ style: Et },
|
|
1065
|
+
// Tab bar (all children keyed to avoid mixed key warnings)
|
|
1066
|
+
u(
|
|
1067
|
+
"div",
|
|
1068
|
+
{ style: Tt },
|
|
1069
|
+
u("span", { key: "title", style: Ht }, "Pulse"),
|
|
1070
|
+
...h.map(
|
|
1071
|
+
(c) => u(
|
|
1072
|
+
"button",
|
|
1073
|
+
{
|
|
1074
|
+
key: c.id,
|
|
1075
|
+
style: kt(c.id === e),
|
|
1076
|
+
onClick: () => l.setTab(c.id)
|
|
1077
|
+
},
|
|
1078
|
+
c.label
|
|
1079
|
+
)
|
|
1080
|
+
),
|
|
1081
|
+
u(
|
|
1082
|
+
"span",
|
|
1083
|
+
{ key: "badge", style: nt },
|
|
1084
|
+
`${s.length} stores`
|
|
1085
|
+
),
|
|
1086
|
+
u(
|
|
1087
|
+
"button",
|
|
1088
|
+
{
|
|
1089
|
+
key: "close",
|
|
1090
|
+
style: wt,
|
|
1091
|
+
onClick: l.close
|
|
1092
|
+
},
|
|
1093
|
+
"×"
|
|
1094
|
+
)
|
|
1095
|
+
),
|
|
1096
|
+
// Content
|
|
1097
|
+
u("div", { style: Ct }, g)
|
|
1098
|
+
);
|
|
1099
|
+
}
|
|
1100
|
+
function Wt(t, e) {
|
|
1101
|
+
const n = Gt();
|
|
1102
|
+
e && e(n);
|
|
1103
|
+
let o = !1;
|
|
1104
|
+
function s() {
|
|
1105
|
+
if (!o) {
|
|
1106
|
+
o = !0;
|
|
1107
|
+
try {
|
|
1108
|
+
const c = t.getStoreNames(), f = {};
|
|
1109
|
+
for (const w of c)
|
|
1110
|
+
f[w] = t.getStoreState(w);
|
|
1111
|
+
const b = n.getState().selectedStore || c[0] || null, _ = b ? t.getHistory(b) : [];
|
|
1112
|
+
n.dispatch("sync", {
|
|
1113
|
+
storeNames: c,
|
|
1114
|
+
storeStates: f,
|
|
1115
|
+
actionLog: _,
|
|
1116
|
+
timeTravelIndex: _.length > 0 ? _.length - 1 : -1,
|
|
1117
|
+
selectedStore: b,
|
|
1118
|
+
components: t.getComponents()
|
|
1119
|
+
});
|
|
1120
|
+
} finally {
|
|
1121
|
+
o = !1;
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
}
|
|
1125
|
+
t.on((c) => {
|
|
1126
|
+
c.type === "component-mounted" || c.type === "component-unmounted" || s();
|
|
1127
|
+
});
|
|
1128
|
+
const r = {
|
|
1129
|
+
selectStore: (c) => {
|
|
1130
|
+
n.dispatch("selectStore", c);
|
|
1131
|
+
const f = t.getHistory(c);
|
|
1132
|
+
n.dispatch("sync", {
|
|
1133
|
+
actionLog: f,
|
|
1134
|
+
timeTravelIndex: f.length > 0 ? f.length - 1 : -1
|
|
1135
|
+
});
|
|
1136
|
+
},
|
|
1137
|
+
setTab: (c) => n.dispatch("setTab", c),
|
|
1138
|
+
setFilter: (c) => n.dispatch("setFilter", c),
|
|
1139
|
+
close: () => n.dispatch("close"),
|
|
1140
|
+
travelTo: (c) => {
|
|
1141
|
+
const f = n.getState().selectedStore;
|
|
1142
|
+
f && (W(t, f, c), n.dispatch("setTimeTravelIndex", c));
|
|
1143
|
+
},
|
|
1144
|
+
sliderChange: (c) => {
|
|
1145
|
+
const f = n.getState().selectedStore;
|
|
1146
|
+
f && (W(t, f, c), n.dispatch("setTimeTravelIndex", c));
|
|
1147
|
+
}
|
|
1148
|
+
}, i = pt({
|
|
1149
|
+
open: n.select((c) => c.open),
|
|
1150
|
+
activeTab: n.select((c) => c.activeTab),
|
|
1151
|
+
selectedStore: n.select((c) => c.selectedStore),
|
|
1152
|
+
timeTravelIndex: n.select((c) => c.timeTravelIndex),
|
|
1153
|
+
storeNames: n.select((c) => c.storeNames),
|
|
1154
|
+
storeStates: n.select((c) => c.storeStates),
|
|
1155
|
+
actionLog: n.select((c) => c.actionLog),
|
|
1156
|
+
filter: n.select((c) => c.filter),
|
|
1157
|
+
components: n.select((c) => c.components)
|
|
1158
|
+
})((c) => Kt({ ...c, panelActions: r }));
|
|
1159
|
+
let a = null;
|
|
1160
|
+
function p() {
|
|
1161
|
+
a || (a = document.createElement("div"), a.id = "pulse-devtools-root", document.body.appendChild(a), xt(u(i, null), a), s());
|
|
1162
|
+
}
|
|
1163
|
+
function l() {
|
|
1164
|
+
p(), n.dispatch("open");
|
|
1165
|
+
}
|
|
1166
|
+
function h() {
|
|
1167
|
+
n.dispatch("close");
|
|
1168
|
+
}
|
|
1169
|
+
function g() {
|
|
1170
|
+
p(), n.dispatch("toggle");
|
|
1171
|
+
}
|
|
1172
|
+
return { openPanel: l, closePanel: h, togglePanel: g, panelStore: n };
|
|
1173
|
+
}
|
|
1174
|
+
const L = new mt(), ot = /* @__PURE__ */ new WeakSet();
|
|
1175
|
+
function Xt(t) {
|
|
1176
|
+
ot.add(t);
|
|
1177
|
+
}
|
|
1178
|
+
at(
|
|
1179
|
+
(t) => {
|
|
1180
|
+
const e = t.connectedFn._bindings || {}, n = Object.values(e).map((i) => i.store);
|
|
1181
|
+
if (n.length > 0 && n.every((i) => ot.has(i)))
|
|
1182
|
+
return;
|
|
1183
|
+
const o = n.map((i) => i.name || "unnamed"), s = t.connectedFn.displayName || "Unknown", r = L.trackComponent(s, o);
|
|
1184
|
+
t._devtoolsId = r;
|
|
1185
|
+
},
|
|
1186
|
+
(t) => {
|
|
1187
|
+
const e = t._devtoolsId;
|
|
1188
|
+
e != null && L.untrackComponent(e);
|
|
1189
|
+
}
|
|
1190
|
+
);
|
|
1191
|
+
let N = null;
|
|
1192
|
+
function st() {
|
|
1193
|
+
return N || (N = Wt(L, Xt)), N;
|
|
1194
|
+
}
|
|
1195
|
+
function Zt() {
|
|
1196
|
+
st().openPanel();
|
|
1197
|
+
}
|
|
1198
|
+
function te() {
|
|
1199
|
+
N && N.closePanel();
|
|
1200
|
+
}
|
|
1201
|
+
function qt() {
|
|
1202
|
+
st().togglePanel();
|
|
1203
|
+
}
|
|
1204
|
+
typeof window < "u" && (window.addEventListener("keydown", (t) => {
|
|
1205
|
+
t.ctrlKey && t.shiftKey && t.key === "P" && (t.preventDefault(), qt());
|
|
1206
|
+
}), window.__PULSE_DEVTOOLS__ = L);
|
|
1207
|
+
export {
|
|
1208
|
+
mt as PulseDevtools,
|
|
1209
|
+
Xt as _markInternalStore,
|
|
1210
|
+
te as closePanel,
|
|
1211
|
+
L as devtools,
|
|
1212
|
+
Qt as instrumentStore,
|
|
1213
|
+
Zt as openPanel,
|
|
1214
|
+
Yt as replayFrom,
|
|
1215
|
+
qt as togglePanel,
|
|
1216
|
+
W as travelTo
|
|
1217
|
+
};
|
|
1218
|
+
//# sourceMappingURL=devtools.js.map
|