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