@lucaismyname/ginger 0.0.55 → 0.0.56

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +34 -1
  2. package/dist/client.cjs +1 -1
  3. package/dist/client.js +2 -2
  4. package/dist/context/GingerProvider.d.ts +1 -1
  5. package/dist/context/GingerProvider.d.ts.map +1 -1
  6. package/dist/devtools/GingerDevtools.d.ts +2 -0
  7. package/dist/devtools/GingerDevtools.d.ts.map +1 -0
  8. package/dist/devtools/index.cjs +2 -0
  9. package/dist/devtools/index.cjs.map +1 -0
  10. package/dist/devtools/index.d.ts +3 -0
  11. package/dist/devtools/index.d.ts.map +1 -0
  12. package/dist/devtools/index.js +465 -0
  13. package/dist/devtools/index.js.map +1 -0
  14. package/dist/devtools/registry.d.ts +49 -0
  15. package/dist/devtools/registry.d.ts.map +1 -0
  16. package/dist/formatTime-DUWvzW21.js +9 -0
  17. package/dist/formatTime-DUWvzW21.js.map +1 -0
  18. package/dist/formatTime-fm_QClmG.cjs +2 -0
  19. package/dist/formatTime-fm_QClmG.cjs.map +1 -0
  20. package/dist/ginger-B-W73LQC.cjs +2 -0
  21. package/dist/ginger-B-W73LQC.cjs.map +1 -0
  22. package/dist/ginger-BHu7Ofna.js +2177 -0
  23. package/dist/ginger-BHu7Ofna.js.map +1 -0
  24. package/dist/index.cjs +1 -1
  25. package/dist/index.js +2 -2
  26. package/dist/testing/index.cjs +1 -1
  27. package/dist/testing/index.js +1 -1
  28. package/dist/types.d.ts +2 -0
  29. package/dist/types.d.ts.map +1 -1
  30. package/dist/{useGingerChapterProgress-DIk27KzH.js → useGingerChapterProgress-DAIWjAtG.js} +2 -2
  31. package/dist/{useGingerChapterProgress-DIk27KzH.js.map → useGingerChapterProgress-DAIWjAtG.js.map} +1 -1
  32. package/dist/{useGingerChapterProgress-BgLkDm2S.cjs → useGingerChapterProgress-DLx-LayX.cjs} +2 -2
  33. package/dist/{useGingerChapterProgress-BgLkDm2S.cjs.map → useGingerChapterProgress-DLx-LayX.cjs.map} +1 -1
  34. package/package.json +6 -1
  35. package/dist/ginger-Bzjmat52.cjs +0 -2
  36. package/dist/ginger-Bzjmat52.cjs.map +0 -1
  37. package/dist/ginger-r_BCOWSm.js +0 -2121
  38. package/dist/ginger-r_BCOWSm.js.map +0 -1
@@ -0,0 +1,465 @@
1
+ import { jsxs as r, jsx as t, Fragment as y } from "react/jsx-runtime";
2
+ import { useState as c, useEffect as u, useRef as v, useCallback as x } from "react";
3
+ import { createPortal as N } from "react-dom";
4
+ import { f as m } from "../formatTime-DUWvzW21.js";
5
+ const h = "__GINGER_DEVTOOLS__";
6
+ let f = 0;
7
+ function w() {
8
+ const n = /* @__PURE__ */ new Map(), e = /* @__PURE__ */ new Set(), g = () => {
9
+ for (const i of e)
10
+ i(n);
11
+ };
12
+ return {
13
+ register(i, a) {
14
+ f += 1;
15
+ const d = {
16
+ id: i,
17
+ label: a.label || `Player ${f}`,
18
+ state: a.state,
19
+ actions: a.actions,
20
+ audioSrc: a.audioSrc,
21
+ registeredAt: Date.now(),
22
+ updatedAt: Date.now()
23
+ };
24
+ n.set(i, d), g();
25
+ },
26
+ unregister(i) {
27
+ n.delete(i) && g();
28
+ },
29
+ update(i, a) {
30
+ const d = n.get(i);
31
+ d && (d.state = a.state, d.audioSrc = a.audioSrc, d.updatedAt = Date.now(), g());
32
+ },
33
+ subscribe(i) {
34
+ return e.add(i), () => {
35
+ e.delete(i);
36
+ };
37
+ },
38
+ getAll() {
39
+ return n;
40
+ }
41
+ };
42
+ }
43
+ function k() {
44
+ if (typeof window > "u")
45
+ throw new Error("GingerDevtools requires a browser environment.");
46
+ const n = window;
47
+ let e = n[h];
48
+ return e || (e = w(), n[h] = e), e;
49
+ }
50
+ const b = "https://cdn.tailwindcss.com";
51
+ function S() {
52
+ const n = v(null);
53
+ u(() => {
54
+ if (document.querySelector(`script[src="${b}"]`)) return;
55
+ const e = document.createElement("script");
56
+ return e.src = b, e.async = !0, document.head.appendChild(e), n.current = e, () => {
57
+ var g;
58
+ (g = n.current) != null && g.parentNode && n.current.parentNode.removeChild(n.current);
59
+ };
60
+ }, []);
61
+ }
62
+ function C() {
63
+ const [n, e] = c([]);
64
+ return u(() => {
65
+ const g = k(), i = (a) => {
66
+ e(Array.from(a.values()));
67
+ };
68
+ return i(g.getAll()), g.subscribe(i);
69
+ }, []), n;
70
+ }
71
+ function M({ snap: n }) {
72
+ const { state: e, actions: g } = n, i = e.tracks[e.currentIndex];
73
+ return /* @__PURE__ */ r("div", { className: "ginger-dt-space-y-2", children: [
74
+ /* @__PURE__ */ t("h4", { className: "ginger-dt-text-[10px] ginger-dt-font-semibold ginger-dt-uppercase ginger-dt-tracking-wider ginger-dt-text-orange-400", children: "Playback" }),
75
+ /* @__PURE__ */ r("div", { className: "ginger-dt-flex ginger-dt-items-center ginger-dt-gap-1.5", children: [
76
+ /* @__PURE__ */ t(
77
+ "button",
78
+ {
79
+ type: "button",
80
+ onClick: g.prev,
81
+ className: "ginger-dt-rounded ginger-dt-bg-neutral-700 ginger-dt-px-2 ginger-dt-py-0.5 ginger-dt-text-[11px] hover:ginger-dt-bg-neutral-600 ginger-dt-transition-colors",
82
+ title: "Previous",
83
+ children: "⏮"
84
+ }
85
+ ),
86
+ /* @__PURE__ */ t(
87
+ "button",
88
+ {
89
+ type: "button",
90
+ onClick: g.togglePlayPause,
91
+ className: "ginger-dt-rounded ginger-dt-bg-orange-600 ginger-dt-px-3 ginger-dt-py-0.5 ginger-dt-text-[11px] ginger-dt-font-medium hover:ginger-dt-bg-orange-500 ginger-dt-transition-colors",
92
+ children: e.isPaused ? "▶ Play" : "⏸ Pause"
93
+ }
94
+ ),
95
+ /* @__PURE__ */ t(
96
+ "button",
97
+ {
98
+ type: "button",
99
+ onClick: g.next,
100
+ className: "ginger-dt-rounded ginger-dt-bg-neutral-700 ginger-dt-px-2 ginger-dt-py-0.5 ginger-dt-text-[11px] hover:ginger-dt-bg-neutral-600 ginger-dt-transition-colors",
101
+ title: "Next",
102
+ children: "⏭"
103
+ }
104
+ )
105
+ ] }),
106
+ /* @__PURE__ */ r("div", { className: "ginger-dt-grid ginger-dt-grid-cols-2 ginger-dt-gap-x-3 ginger-dt-gap-y-1 ginger-dt-text-[11px]", children: [
107
+ /* @__PURE__ */ t(
108
+ s,
109
+ {
110
+ label: "Track",
111
+ value: i ? `${e.currentIndex + 1}/${e.tracks.length}` : "—"
112
+ }
113
+ ),
114
+ /* @__PURE__ */ t(s, { label: "Mode", value: e.playbackMode, children: /* @__PURE__ */ t(
115
+ "button",
116
+ {
117
+ type: "button",
118
+ onClick: () => g.setPlaybackMode(e.playbackMode === "playlist" ? "single" : "playlist"),
119
+ className: "ginger-dt-ml-1 ginger-dt-text-orange-400 hover:ginger-dt-text-orange-300 ginger-dt-text-[10px]",
120
+ children: "↻"
121
+ }
122
+ ) }),
123
+ /* @__PURE__ */ t(s, { label: "Repeat", value: e.repeatMode, children: /* @__PURE__ */ t(
124
+ "button",
125
+ {
126
+ type: "button",
127
+ onClick: g.cycleRepeat,
128
+ className: "ginger-dt-ml-1 ginger-dt-text-orange-400 hover:ginger-dt-text-orange-300 ginger-dt-text-[10px]",
129
+ children: "↻"
130
+ }
131
+ ) }),
132
+ /* @__PURE__ */ t(s, { label: "Shuffle", value: e.isShuffled ? "on" : "off", children: /* @__PURE__ */ t(
133
+ "button",
134
+ {
135
+ type: "button",
136
+ onClick: g.toggleShuffle,
137
+ className: "ginger-dt-ml-1 ginger-dt-text-orange-400 hover:ginger-dt-text-orange-300 ginger-dt-text-[10px]",
138
+ children: "↻"
139
+ }
140
+ ) })
141
+ ] })
142
+ ] });
143
+ }
144
+ function R({ snap: n }) {
145
+ const { state: e, actions: g } = n, i = x(
146
+ (d) => {
147
+ g.seek(Number(d.target.value));
148
+ },
149
+ [g]
150
+ ), a = x(
151
+ (d) => {
152
+ g.setVolume(Number(d.target.value));
153
+ },
154
+ [g]
155
+ );
156
+ return /* @__PURE__ */ r("div", { className: "ginger-dt-space-y-2", children: [
157
+ /* @__PURE__ */ t("h4", { className: "ginger-dt-text-[10px] ginger-dt-font-semibold ginger-dt-uppercase ginger-dt-tracking-wider ginger-dt-text-orange-400", children: "Media" }),
158
+ /* @__PURE__ */ r("div", { children: [
159
+ /* @__PURE__ */ r("div", { className: "ginger-dt-flex ginger-dt-items-center ginger-dt-justify-between ginger-dt-text-[11px] ginger-dt-mb-0.5", children: [
160
+ /* @__PURE__ */ t("span", { className: "ginger-dt-text-neutral-400", children: "Time" }),
161
+ /* @__PURE__ */ r("span", { children: [
162
+ m(e.currentTime),
163
+ " / ",
164
+ m(e.duration)
165
+ ] })
166
+ ] }),
167
+ /* @__PURE__ */ t(
168
+ "input",
169
+ {
170
+ type: "range",
171
+ min: 0,
172
+ max: e.duration || 0,
173
+ step: 0.1,
174
+ value: e.currentTime,
175
+ onChange: i,
176
+ className: "ginger-dt-w-full ginger-dt-h-1.5 ginger-dt-accent-orange-500 ginger-dt-cursor-pointer"
177
+ }
178
+ ),
179
+ /* @__PURE__ */ t("div", { className: "ginger-dt-w-full ginger-dt-h-1 ginger-dt-bg-neutral-700 ginger-dt-rounded-full ginger-dt-mt-1 ginger-dt-overflow-hidden", children: /* @__PURE__ */ t(
180
+ "div",
181
+ {
182
+ className: "ginger-dt-h-full ginger-dt-bg-orange-800 ginger-dt-rounded-full ginger-dt-transition-all",
183
+ style: { width: `${(e.bufferedFraction * 100).toFixed(1)}%` }
184
+ }
185
+ ) }),
186
+ /* @__PURE__ */ r("div", { className: "ginger-dt-text-[10px] ginger-dt-text-neutral-500 ginger-dt-mt-0.5", children: [
187
+ "Buffered: ",
188
+ (e.bufferedFraction * 100).toFixed(1),
189
+ "%",
190
+ e.isBuffering && /* @__PURE__ */ t("span", { className: "ginger-dt-ml-2 ginger-dt-text-yellow-400", children: "● buffering" })
191
+ ] })
192
+ ] }),
193
+ /* @__PURE__ */ r("div", { children: [
194
+ /* @__PURE__ */ r("div", { className: "ginger-dt-flex ginger-dt-items-center ginger-dt-justify-between ginger-dt-text-[11px] ginger-dt-mb-0.5", children: [
195
+ /* @__PURE__ */ t("span", { className: "ginger-dt-text-neutral-400", children: "Volume" }),
196
+ /* @__PURE__ */ r("span", { className: "ginger-dt-flex ginger-dt-items-center ginger-dt-gap-1", children: [
197
+ Math.round(e.volume * 100),
198
+ "%",
199
+ /* @__PURE__ */ t(
200
+ "button",
201
+ {
202
+ type: "button",
203
+ onClick: g.toggleMute,
204
+ className: `ginger-dt-text-[10px] ginger-dt-px-1 ginger-dt-rounded ${e.muted ? "ginger-dt-bg-red-900 ginger-dt-text-red-300" : "ginger-dt-bg-neutral-700 ginger-dt-text-neutral-300"}`,
205
+ children: e.muted ? "unmute" : "mute"
206
+ }
207
+ )
208
+ ] })
209
+ ] }),
210
+ /* @__PURE__ */ t(
211
+ "input",
212
+ {
213
+ type: "range",
214
+ min: 0,
215
+ max: 1,
216
+ step: 0.01,
217
+ value: e.volume,
218
+ onChange: a,
219
+ className: "ginger-dt-w-full ginger-dt-h-1.5 ginger-dt-accent-orange-500 ginger-dt-cursor-pointer"
220
+ }
221
+ )
222
+ ] }),
223
+ /* @__PURE__ */ r("div", { className: "ginger-dt-flex ginger-dt-items-center ginger-dt-gap-2 ginger-dt-text-[11px]", children: [
224
+ /* @__PURE__ */ t("span", { className: "ginger-dt-text-neutral-400", children: "Rate" }),
225
+ /* @__PURE__ */ t("div", { className: "ginger-dt-flex ginger-dt-gap-0.5", children: [0.5, 0.75, 1, 1.25, 1.5, 2].map((d) => /* @__PURE__ */ r(
226
+ "button",
227
+ {
228
+ type: "button",
229
+ onClick: () => g.setPlaybackRate(d),
230
+ className: `ginger-dt-px-1.5 ginger-dt-py-0.5 ginger-dt-rounded ginger-dt-text-[10px] ginger-dt-transition-colors ${e.playbackRate === d ? "ginger-dt-bg-orange-600 ginger-dt-text-white" : "ginger-dt-bg-neutral-700 hover:ginger-dt-bg-neutral-600 ginger-dt-text-neutral-300"}`,
231
+ children: [
232
+ d,
233
+ "x"
234
+ ]
235
+ },
236
+ d
237
+ )) })
238
+ ] }),
239
+ e.errorMessage && /* @__PURE__ */ t("div", { className: "ginger-dt-text-[11px] ginger-dt-text-red-400 ginger-dt-bg-red-950 ginger-dt-rounded ginger-dt-px-2 ginger-dt-py-1", children: e.errorMessage })
240
+ ] });
241
+ }
242
+ function T({ snap: n }) {
243
+ const e = n.state.tracks[n.state.currentIndex];
244
+ return e ? /* @__PURE__ */ r("div", { className: "ginger-dt-space-y-2", children: [
245
+ /* @__PURE__ */ t("h4", { className: "ginger-dt-text-[10px] ginger-dt-font-semibold ginger-dt-uppercase ginger-dt-tracking-wider ginger-dt-text-orange-400", children: "Current Track" }),
246
+ /* @__PURE__ */ r("div", { className: "ginger-dt-flex ginger-dt-gap-2", children: [
247
+ e.artworkUrl && /* @__PURE__ */ t(
248
+ "img",
249
+ {
250
+ src: e.artworkUrl,
251
+ alt: "",
252
+ className: "ginger-dt-w-10 ginger-dt-h-10 ginger-dt-rounded ginger-dt-object-cover ginger-dt-flex-shrink-0"
253
+ }
254
+ ),
255
+ /* @__PURE__ */ r("div", { className: "ginger-dt-min-w-0 ginger-dt-text-[11px]", children: [
256
+ /* @__PURE__ */ t("div", { className: "ginger-dt-font-medium ginger-dt-truncate", children: e.title }),
257
+ e.artist && /* @__PURE__ */ t("div", { className: "ginger-dt-text-neutral-400 ginger-dt-truncate", children: e.artist }),
258
+ e.album && /* @__PURE__ */ t("div", { className: "ginger-dt-text-neutral-500 ginger-dt-truncate ginger-dt-text-[10px]", children: e.album })
259
+ ] })
260
+ ] }),
261
+ /* @__PURE__ */ r("div", { className: "ginger-dt-grid ginger-dt-grid-cols-2 ginger-dt-gap-x-3 ginger-dt-gap-y-0.5 ginger-dt-text-[10px] ginger-dt-text-neutral-400", children: [
262
+ /* @__PURE__ */ r("span", { children: [
263
+ "src: ",
264
+ $(e.fileUrl)
265
+ ] }),
266
+ e.chapters && /* @__PURE__ */ r("span", { children: [
267
+ "chapters: ",
268
+ e.chapters.length
269
+ ] }),
270
+ e.lyricsTimed && /* @__PURE__ */ r("span", { children: [
271
+ "lyrics: timed (",
272
+ e.lyricsTimed.length,
273
+ ")"
274
+ ] }),
275
+ e.lyrics && !e.lyricsTimed && /* @__PURE__ */ t("span", { children: "lyrics: plain" })
276
+ ] })
277
+ ] }) : /* @__PURE__ */ r("div", { className: "ginger-dt-space-y-2", children: [
278
+ /* @__PURE__ */ t("h4", { className: "ginger-dt-text-[10px] ginger-dt-font-semibold ginger-dt-uppercase ginger-dt-tracking-wider ginger-dt-text-orange-400", children: "Current Track" }),
279
+ /* @__PURE__ */ t("div", { className: "ginger-dt-text-[11px] ginger-dt-text-neutral-500 ginger-dt-italic", children: "No track loaded" })
280
+ ] });
281
+ }
282
+ function I({ snap: n }) {
283
+ const { state: e, actions: g } = n;
284
+ return /* @__PURE__ */ r("div", { className: "ginger-dt-space-y-2", children: [
285
+ /* @__PURE__ */ r("h4", { className: "ginger-dt-text-[10px] ginger-dt-font-semibold ginger-dt-uppercase ginger-dt-tracking-wider ginger-dt-text-orange-400", children: [
286
+ "Queue (",
287
+ e.tracks.length,
288
+ ")"
289
+ ] }),
290
+ /* @__PURE__ */ r("div", { className: "ginger-dt-max-h-32 ginger-dt-overflow-y-auto ginger-dt-space-y-px ginger-dt-scrollbar-thin", children: [
291
+ e.tracks.length === 0 && /* @__PURE__ */ t("div", { className: "ginger-dt-text-[11px] ginger-dt-text-neutral-500 ginger-dt-italic", children: "Empty queue" }),
292
+ e.tracks.map((i, a) => /* @__PURE__ */ r(
293
+ "button",
294
+ {
295
+ type: "button",
296
+ onClick: () => g.playTrackAt(a),
297
+ className: `ginger-dt-w-full ginger-dt-text-left ginger-dt-px-2 ginger-dt-py-1 ginger-dt-rounded ginger-dt-text-[11px] ginger-dt-flex ginger-dt-items-center ginger-dt-gap-2 ginger-dt-transition-colors ${a === e.currentIndex ? "ginger-dt-bg-orange-900/50 ginger-dt-text-orange-200" : "hover:ginger-dt-bg-neutral-700/50 ginger-dt-text-neutral-300"}`,
298
+ children: [
299
+ /* @__PURE__ */ t("span", { className: "ginger-dt-w-5 ginger-dt-text-right ginger-dt-text-[10px] ginger-dt-text-neutral-500 ginger-dt-flex-shrink-0", children: a === e.currentIndex ? "▸" : a + 1 }),
300
+ /* @__PURE__ */ t("span", { className: "ginger-dt-truncate", children: i.title }),
301
+ i.artist && /* @__PURE__ */ t("span", { className: "ginger-dt-text-neutral-500 ginger-dt-truncate ginger-dt-text-[10px] ginger-dt-ml-auto ginger-dt-flex-shrink-0", children: i.artist })
302
+ ]
303
+ },
304
+ i.id ?? `${i.fileUrl}-${a}`
305
+ ))
306
+ ] })
307
+ ] });
308
+ }
309
+ function s({
310
+ label: n,
311
+ value: e,
312
+ children: g
313
+ }) {
314
+ return /* @__PURE__ */ r("div", { className: "ginger-dt-flex ginger-dt-items-center", children: [
315
+ /* @__PURE__ */ r("span", { className: "ginger-dt-text-neutral-400", children: [
316
+ n,
317
+ ":"
318
+ ] }),
319
+ /* @__PURE__ */ t("span", { className: "ginger-dt-ml-1 ginger-dt-font-mono", children: e }),
320
+ g
321
+ ] });
322
+ }
323
+ function $(n, e = 40) {
324
+ return n.length <= e ? n : `…${n.slice(-e)}`;
325
+ }
326
+ function G() {
327
+ S();
328
+ const n = C(), [e, g] = c(!1), [i, a] = c(null), d = n.find((l) => l.id === i) ?? n[0] ?? null;
329
+ u(() => {
330
+ !i && n.length > 0 && a(n[0].id), i && !n.find((l) => l.id === i) && n.length > 0 && a(n[0].id);
331
+ }, [n, i]);
332
+ const p = typeof document < "u" ? document.body : null;
333
+ return p ? N(
334
+ /* @__PURE__ */ r(
335
+ "div",
336
+ {
337
+ style: {
338
+ fontFamily: 'ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace',
339
+ zIndex: 2147483647,
340
+ position: "fixed",
341
+ bottom: 0,
342
+ right: 0
343
+ },
344
+ children: [
345
+ !e && /* @__PURE__ */ r(
346
+ "button",
347
+ {
348
+ type: "button",
349
+ onClick: () => g(!0),
350
+ style: {
351
+ position: "fixed",
352
+ bottom: "12px",
353
+ right: "12px",
354
+ zIndex: 2147483647,
355
+ background: "#ea580c",
356
+ color: "#fff",
357
+ border: "none",
358
+ borderRadius: "8px",
359
+ padding: "6px 12px",
360
+ fontSize: "12px",
361
+ fontWeight: 600,
362
+ fontFamily: "inherit",
363
+ cursor: "pointer",
364
+ boxShadow: "0 4px 12px rgba(0,0,0,0.4)",
365
+ display: "flex",
366
+ alignItems: "center",
367
+ gap: "6px"
368
+ },
369
+ children: [
370
+ /* @__PURE__ */ t("span", { style: { fontSize: "14px" }, children: "🍊" }),
371
+ "Ginger",
372
+ n.length > 0 && /* @__PURE__ */ t(
373
+ "span",
374
+ {
375
+ style: {
376
+ background: "rgba(255,255,255,0.2)",
377
+ borderRadius: "4px",
378
+ padding: "1px 5px",
379
+ fontSize: "10px"
380
+ },
381
+ children: n.length
382
+ }
383
+ )
384
+ ]
385
+ }
386
+ ),
387
+ e && /* @__PURE__ */ r(
388
+ "div",
389
+ {
390
+ className: "ginger-dt-fixed ginger-dt-bottom-3 ginger-dt-right-3 ginger-dt-w-[380px] ginger-dt-max-h-[80vh] ginger-dt-bg-neutral-900 ginger-dt-text-neutral-100 ginger-dt-rounded-xl ginger-dt-shadow-2xl ginger-dt-border ginger-dt-border-neutral-700/50 ginger-dt-flex ginger-dt-flex-col ginger-dt-overflow-hidden",
391
+ style: { zIndex: 2147483647 },
392
+ children: [
393
+ /* @__PURE__ */ r("div", { className: "ginger-dt-flex ginger-dt-items-center ginger-dt-justify-between ginger-dt-px-3 ginger-dt-py-2 ginger-dt-bg-neutral-800 ginger-dt-border-b ginger-dt-border-neutral-700/50", children: [
394
+ /* @__PURE__ */ r("div", { className: "ginger-dt-flex ginger-dt-items-center ginger-dt-gap-2", children: [
395
+ /* @__PURE__ */ t("span", { className: "ginger-dt-text-sm", children: "🍊" }),
396
+ /* @__PURE__ */ t("span", { className: "ginger-dt-text-xs ginger-dt-font-semibold ginger-dt-tracking-wide", children: "Ginger Devtools" })
397
+ ] }),
398
+ /* @__PURE__ */ t(
399
+ "button",
400
+ {
401
+ type: "button",
402
+ onClick: () => g(!1),
403
+ className: "ginger-dt-text-neutral-400 hover:ginger-dt-text-white ginger-dt-text-lg ginger-dt-leading-none ginger-dt-transition-colors",
404
+ children: "×"
405
+ }
406
+ )
407
+ ] }),
408
+ n.length > 1 && /* @__PURE__ */ t("div", { className: "ginger-dt-flex ginger-dt-gap-0 ginger-dt-bg-neutral-800 ginger-dt-px-1 ginger-dt-border-b ginger-dt-border-neutral-700/50 ginger-dt-overflow-x-auto", children: n.map((l) => /* @__PURE__ */ t(
409
+ "button",
410
+ {
411
+ type: "button",
412
+ onClick: () => a(l.id),
413
+ className: `ginger-dt-px-3 ginger-dt-py-1.5 ginger-dt-text-[11px] ginger-dt-whitespace-nowrap ginger-dt-border-b-2 ginger-dt-transition-colors ${(d == null ? void 0 : d.id) === l.id ? "ginger-dt-border-orange-500 ginger-dt-text-orange-300" : "ginger-dt-border-transparent ginger-dt-text-neutral-400 hover:ginger-dt-text-neutral-200"}`,
414
+ children: l.label
415
+ },
416
+ l.id
417
+ )) }),
418
+ /* @__PURE__ */ t("div", { className: "ginger-dt-flex-1 ginger-dt-overflow-y-auto ginger-dt-px-3 ginger-dt-py-3 ginger-dt-space-y-4", children: d ? /* @__PURE__ */ r(y, { children: [
419
+ /* @__PURE__ */ t(M, { snap: d }),
420
+ /* @__PURE__ */ t(o, {}),
421
+ /* @__PURE__ */ t(R, { snap: d }),
422
+ /* @__PURE__ */ t(o, {}),
423
+ /* @__PURE__ */ t(T, { snap: d }),
424
+ /* @__PURE__ */ t(o, {}),
425
+ /* @__PURE__ */ t(I, { snap: d })
426
+ ] }) : /* @__PURE__ */ r("div", { className: "ginger-dt-text-[11px] ginger-dt-text-neutral-500 ginger-dt-text-center ginger-dt-py-8", children: [
427
+ "No Ginger providers detected.",
428
+ /* @__PURE__ */ t("br", {}),
429
+ /* @__PURE__ */ r("span", { className: "ginger-dt-text-[10px]", children: [
430
+ "Add ",
431
+ "<Ginger.Provider>",
432
+ " to your app."
433
+ ] })
434
+ ] }) }),
435
+ d && /* @__PURE__ */ r("div", { className: "ginger-dt-px-3 ginger-dt-py-1.5 ginger-dt-bg-neutral-800 ginger-dt-border-t ginger-dt-border-neutral-700/50 ginger-dt-text-[10px] ginger-dt-text-neutral-500 ginger-dt-flex ginger-dt-justify-between", children: [
436
+ /* @__PURE__ */ r("span", { children: [
437
+ "ID: ",
438
+ d.id.slice(0, 8),
439
+ "…"
440
+ ] }),
441
+ /* @__PURE__ */ r("span", { children: [
442
+ "Updated ",
443
+ D(d.updatedAt)
444
+ ] })
445
+ ] })
446
+ ]
447
+ }
448
+ )
449
+ ]
450
+ }
451
+ ),
452
+ p
453
+ ) : null;
454
+ }
455
+ function o() {
456
+ return /* @__PURE__ */ t("div", { className: "ginger-dt-border-t ginger-dt-border-neutral-700/30" });
457
+ }
458
+ function D(n) {
459
+ const e = Date.now() - n;
460
+ return e < 1e3 ? "just now" : e < 6e4 ? `${Math.floor(e / 1e3)}s ago` : `${Math.floor(e / 6e4)}m ago`;
461
+ }
462
+ export {
463
+ G as GingerDevtools
464
+ };
465
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../src/devtools/registry.ts","../../src/devtools/GingerDevtools.tsx"],"sourcesContent":["import type { GingerState, PlaybackMode, RepeatMode } from \"../types\";\n\nexport type ProviderActions = {\n play: () => void;\n pause: () => void;\n togglePlayPause: () => void;\n next: () => void;\n prev: () => void;\n seek: (time: number) => void;\n setVolume: (v: number) => void;\n setMuted: (m: boolean) => void;\n toggleMute: () => void;\n setPlaybackRate: (rate: number) => void;\n setRepeatMode: (mode: RepeatMode) => void;\n cycleRepeat: () => void;\n toggleShuffle: () => void;\n playTrackAt: (index: number) => void;\n setPlaybackMode: (mode: PlaybackMode) => void;\n};\n\nexport type ProviderSnapshot = {\n id: string;\n label: string;\n state: GingerState;\n actions: ProviderActions;\n audioSrc: string | null;\n registeredAt: number;\n updatedAt: number;\n};\n\ntype RegistrationPayload = {\n label?: string;\n state: GingerState;\n actions: ProviderActions;\n audioSrc: string | null;\n};\n\ntype UpdatePayload = {\n state: GingerState;\n audioSrc: string | null;\n};\n\ntype Listener = (snapshots: Map<string, ProviderSnapshot>) => void;\n\nexport type DevtoolsRegistry = {\n register: (id: string, payload: RegistrationPayload) => void;\n unregister: (id: string) => void;\n update: (id: string, payload: UpdatePayload) => void;\n subscribe: (listener: Listener) => () => void;\n getAll: () => Map<string, ProviderSnapshot>;\n};\n\nconst WINDOW_KEY = \"__GINGER_DEVTOOLS__\";\n\nlet counter = 0;\n\nfunction buildRegistry(): DevtoolsRegistry {\n const providers = new Map<string, ProviderSnapshot>();\n const listeners = new Set<Listener>();\n\n const notify = () => {\n for (const fn of listeners) {\n fn(providers);\n }\n };\n\n return {\n register(id, payload) {\n counter += 1;\n const snapshot: ProviderSnapshot = {\n id,\n label: payload.label || `Player ${counter}`,\n state: payload.state,\n actions: payload.actions,\n audioSrc: payload.audioSrc,\n registeredAt: Date.now(),\n updatedAt: Date.now(),\n };\n providers.set(id, snapshot);\n notify();\n },\n\n unregister(id) {\n if (providers.delete(id)) {\n notify();\n }\n },\n\n update(id, payload) {\n const existing = providers.get(id);\n if (!existing) return;\n existing.state = payload.state;\n existing.audioSrc = payload.audioSrc;\n existing.updatedAt = Date.now();\n notify();\n },\n\n subscribe(listener) {\n listeners.add(listener);\n return () => {\n listeners.delete(listener);\n };\n },\n\n getAll() {\n return providers;\n },\n };\n}\n\nexport function getRegistry(): DevtoolsRegistry | null {\n if (typeof window === \"undefined\") return null;\n return (\n ((window as unknown as Record<string, unknown>)[WINDOW_KEY] as DevtoolsRegistry | null) ?? null\n );\n}\n\nexport function ensureRegistry(): DevtoolsRegistry {\n if (typeof window === \"undefined\") {\n throw new Error(\"GingerDevtools requires a browser environment.\");\n }\n const win = window as unknown as Record<string, unknown>;\n let reg = win[WINDOW_KEY] as DevtoolsRegistry | undefined;\n if (!reg) {\n reg = buildRegistry();\n win[WINDOW_KEY] = reg;\n }\n return reg;\n}\n","import { useCallback, useEffect, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { formatMmSs } from \"../internal/formatTime\";\nimport type { ProviderSnapshot } from \"./registry\";\nimport { ensureRegistry } from \"./registry\";\n\nconst TAILWIND_CDN = \"https://cdn.tailwindcss.com\";\n\nfunction useTailwindCdn() {\n const scriptRef = useRef<HTMLScriptElement | null>(null);\n\n useEffect(() => {\n if (document.querySelector(`script[src=\"${TAILWIND_CDN}\"]`)) return;\n const script = document.createElement(\"script\");\n script.src = TAILWIND_CDN;\n script.async = true;\n document.head.appendChild(script);\n scriptRef.current = script;\n return () => {\n if (scriptRef.current?.parentNode) {\n scriptRef.current.parentNode.removeChild(scriptRef.current);\n }\n };\n }, []);\n}\n\nfunction useRegistrySnapshots() {\n const [snapshots, setSnapshots] = useState<ProviderSnapshot[]>([]);\n\n useEffect(() => {\n const registry = ensureRegistry();\n const sync = (map: Map<string, ProviderSnapshot>) => {\n setSnapshots(Array.from(map.values()));\n };\n sync(registry.getAll());\n return registry.subscribe(sync);\n }, []);\n\n return snapshots;\n}\n\n// ─── Sub-components for each section ─────────────────────────────────────────\n\nfunction PlaybackSection({ snap }: { snap: ProviderSnapshot }) {\n const { state, actions } = snap;\n const track = state.tracks[state.currentIndex];\n\n return (\n <div className=\"ginger-dt-space-y-2\">\n <h4 className=\"ginger-dt-text-[10px] ginger-dt-font-semibold ginger-dt-uppercase ginger-dt-tracking-wider ginger-dt-text-orange-400\">\n Playback\n </h4>\n <div className=\"ginger-dt-flex ginger-dt-items-center ginger-dt-gap-1.5\">\n <button\n type=\"button\"\n onClick={actions.prev}\n className=\"ginger-dt-rounded ginger-dt-bg-neutral-700 ginger-dt-px-2 ginger-dt-py-0.5 ginger-dt-text-[11px] hover:ginger-dt-bg-neutral-600 ginger-dt-transition-colors\"\n title=\"Previous\"\n >\n ⏮\n </button>\n <button\n type=\"button\"\n onClick={actions.togglePlayPause}\n className=\"ginger-dt-rounded ginger-dt-bg-orange-600 ginger-dt-px-3 ginger-dt-py-0.5 ginger-dt-text-[11px] ginger-dt-font-medium hover:ginger-dt-bg-orange-500 ginger-dt-transition-colors\"\n >\n {state.isPaused ? \"▶ Play\" : \"⏸ Pause\"}\n </button>\n <button\n type=\"button\"\n onClick={actions.next}\n className=\"ginger-dt-rounded ginger-dt-bg-neutral-700 ginger-dt-px-2 ginger-dt-py-0.5 ginger-dt-text-[11px] hover:ginger-dt-bg-neutral-600 ginger-dt-transition-colors\"\n title=\"Next\"\n >\n ⏭\n </button>\n </div>\n <div className=\"ginger-dt-grid ginger-dt-grid-cols-2 ginger-dt-gap-x-3 ginger-dt-gap-y-1 ginger-dt-text-[11px]\">\n <Row\n label=\"Track\"\n value={track ? `${state.currentIndex + 1}/${state.tracks.length}` : \"—\"}\n />\n <Row label=\"Mode\" value={state.playbackMode}>\n <button\n type=\"button\"\n onClick={() =>\n actions.setPlaybackMode(state.playbackMode === \"playlist\" ? \"single\" : \"playlist\")\n }\n className=\"ginger-dt-ml-1 ginger-dt-text-orange-400 hover:ginger-dt-text-orange-300 ginger-dt-text-[10px]\"\n >\n ↻\n </button>\n </Row>\n <Row label=\"Repeat\" value={state.repeatMode}>\n <button\n type=\"button\"\n onClick={actions.cycleRepeat}\n className=\"ginger-dt-ml-1 ginger-dt-text-orange-400 hover:ginger-dt-text-orange-300 ginger-dt-text-[10px]\"\n >\n ↻\n </button>\n </Row>\n <Row label=\"Shuffle\" value={state.isShuffled ? \"on\" : \"off\"}>\n <button\n type=\"button\"\n onClick={actions.toggleShuffle}\n className=\"ginger-dt-ml-1 ginger-dt-text-orange-400 hover:ginger-dt-text-orange-300 ginger-dt-text-[10px]\"\n >\n ↻\n </button>\n </Row>\n </div>\n </div>\n );\n}\n\nfunction MediaSection({ snap }: { snap: ProviderSnapshot }) {\n const { state, actions } = snap;\n\n const handleSeek = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n actions.seek(Number(e.target.value));\n },\n [actions],\n );\n\n const handleVolume = useCallback(\n (e: React.ChangeEvent<HTMLInputElement>) => {\n actions.setVolume(Number(e.target.value));\n },\n [actions],\n );\n\n return (\n <div className=\"ginger-dt-space-y-2\">\n <h4 className=\"ginger-dt-text-[10px] ginger-dt-font-semibold ginger-dt-uppercase ginger-dt-tracking-wider ginger-dt-text-orange-400\">\n Media\n </h4>\n {/* Seek */}\n <div>\n <div className=\"ginger-dt-flex ginger-dt-items-center ginger-dt-justify-between ginger-dt-text-[11px] ginger-dt-mb-0.5\">\n <span className=\"ginger-dt-text-neutral-400\">Time</span>\n <span>\n {formatMmSs(state.currentTime)} / {formatMmSs(state.duration)}\n </span>\n </div>\n <input\n type=\"range\"\n min={0}\n max={state.duration || 0}\n step={0.1}\n value={state.currentTime}\n onChange={handleSeek}\n className=\"ginger-dt-w-full ginger-dt-h-1.5 ginger-dt-accent-orange-500 ginger-dt-cursor-pointer\"\n />\n {/* Buffer bar */}\n <div className=\"ginger-dt-w-full ginger-dt-h-1 ginger-dt-bg-neutral-700 ginger-dt-rounded-full ginger-dt-mt-1 ginger-dt-overflow-hidden\">\n <div\n className=\"ginger-dt-h-full ginger-dt-bg-orange-800 ginger-dt-rounded-full ginger-dt-transition-all\"\n style={{ width: `${(state.bufferedFraction * 100).toFixed(1)}%` }}\n />\n </div>\n <div className=\"ginger-dt-text-[10px] ginger-dt-text-neutral-500 ginger-dt-mt-0.5\">\n Buffered: {(state.bufferedFraction * 100).toFixed(1)}%\n {state.isBuffering && (\n <span className=\"ginger-dt-ml-2 ginger-dt-text-yellow-400\">● buffering</span>\n )}\n </div>\n </div>\n\n {/* Volume */}\n <div>\n <div className=\"ginger-dt-flex ginger-dt-items-center ginger-dt-justify-between ginger-dt-text-[11px] ginger-dt-mb-0.5\">\n <span className=\"ginger-dt-text-neutral-400\">Volume</span>\n <span className=\"ginger-dt-flex ginger-dt-items-center ginger-dt-gap-1\">\n {Math.round(state.volume * 100)}%\n <button\n type=\"button\"\n onClick={actions.toggleMute}\n className={`ginger-dt-text-[10px] ginger-dt-px-1 ginger-dt-rounded ${state.muted ? \"ginger-dt-bg-red-900 ginger-dt-text-red-300\" : \"ginger-dt-bg-neutral-700 ginger-dt-text-neutral-300\"}`}\n >\n {state.muted ? \"unmute\" : \"mute\"}\n </button>\n </span>\n </div>\n <input\n type=\"range\"\n min={0}\n max={1}\n step={0.01}\n value={state.volume}\n onChange={handleVolume}\n className=\"ginger-dt-w-full ginger-dt-h-1.5 ginger-dt-accent-orange-500 ginger-dt-cursor-pointer\"\n />\n </div>\n\n {/* Playback rate */}\n <div className=\"ginger-dt-flex ginger-dt-items-center ginger-dt-gap-2 ginger-dt-text-[11px]\">\n <span className=\"ginger-dt-text-neutral-400\">Rate</span>\n <div className=\"ginger-dt-flex ginger-dt-gap-0.5\">\n {[0.5, 0.75, 1, 1.25, 1.5, 2].map((r) => (\n <button\n key={r}\n type=\"button\"\n onClick={() => actions.setPlaybackRate(r)}\n className={`ginger-dt-px-1.5 ginger-dt-py-0.5 ginger-dt-rounded ginger-dt-text-[10px] ginger-dt-transition-colors ${\n state.playbackRate === r\n ? \"ginger-dt-bg-orange-600 ginger-dt-text-white\"\n : \"ginger-dt-bg-neutral-700 hover:ginger-dt-bg-neutral-600 ginger-dt-text-neutral-300\"\n }`}\n >\n {r}x\n </button>\n ))}\n </div>\n </div>\n\n {/* Error */}\n {state.errorMessage && (\n <div className=\"ginger-dt-text-[11px] ginger-dt-text-red-400 ginger-dt-bg-red-950 ginger-dt-rounded ginger-dt-px-2 ginger-dt-py-1\">\n {state.errorMessage}\n </div>\n )}\n </div>\n );\n}\n\nfunction TrackSection({ snap }: { snap: ProviderSnapshot }) {\n const track = snap.state.tracks[snap.state.currentIndex];\n if (!track) {\n return (\n <div className=\"ginger-dt-space-y-2\">\n <h4 className=\"ginger-dt-text-[10px] ginger-dt-font-semibold ginger-dt-uppercase ginger-dt-tracking-wider ginger-dt-text-orange-400\">\n Current Track\n </h4>\n <div className=\"ginger-dt-text-[11px] ginger-dt-text-neutral-500 ginger-dt-italic\">\n No track loaded\n </div>\n </div>\n );\n }\n return (\n <div className=\"ginger-dt-space-y-2\">\n <h4 className=\"ginger-dt-text-[10px] ginger-dt-font-semibold ginger-dt-uppercase ginger-dt-tracking-wider ginger-dt-text-orange-400\">\n Current Track\n </h4>\n <div className=\"ginger-dt-flex ginger-dt-gap-2\">\n {track.artworkUrl && (\n <img\n src={track.artworkUrl}\n alt=\"\"\n className=\"ginger-dt-w-10 ginger-dt-h-10 ginger-dt-rounded ginger-dt-object-cover ginger-dt-flex-shrink-0\"\n />\n )}\n <div className=\"ginger-dt-min-w-0 ginger-dt-text-[11px]\">\n <div className=\"ginger-dt-font-medium ginger-dt-truncate\">{track.title}</div>\n {track.artist && (\n <div className=\"ginger-dt-text-neutral-400 ginger-dt-truncate\">{track.artist}</div>\n )}\n {track.album && (\n <div className=\"ginger-dt-text-neutral-500 ginger-dt-truncate ginger-dt-text-[10px]\">\n {track.album}\n </div>\n )}\n </div>\n </div>\n <div className=\"ginger-dt-grid ginger-dt-grid-cols-2 ginger-dt-gap-x-3 ginger-dt-gap-y-0.5 ginger-dt-text-[10px] ginger-dt-text-neutral-400\">\n <span>src: {truncateUrl(track.fileUrl)}</span>\n {track.chapters && <span>chapters: {track.chapters.length}</span>}\n {track.lyricsTimed && <span>lyrics: timed ({track.lyricsTimed.length})</span>}\n {track.lyrics && !track.lyricsTimed && <span>lyrics: plain</span>}\n </div>\n </div>\n );\n}\n\nfunction QueueSection({ snap }: { snap: ProviderSnapshot }) {\n const { state, actions } = snap;\n\n return (\n <div className=\"ginger-dt-space-y-2\">\n <h4 className=\"ginger-dt-text-[10px] ginger-dt-font-semibold ginger-dt-uppercase ginger-dt-tracking-wider ginger-dt-text-orange-400\">\n Queue ({state.tracks.length})\n </h4>\n <div className=\"ginger-dt-max-h-32 ginger-dt-overflow-y-auto ginger-dt-space-y-px ginger-dt-scrollbar-thin\">\n {state.tracks.length === 0 && (\n <div className=\"ginger-dt-text-[11px] ginger-dt-text-neutral-500 ginger-dt-italic\">\n Empty queue\n </div>\n )}\n {state.tracks.map((track, i) => (\n <button\n key={track.id ?? `${track.fileUrl}-${i}`}\n type=\"button\"\n onClick={() => actions.playTrackAt(i)}\n className={`ginger-dt-w-full ginger-dt-text-left ginger-dt-px-2 ginger-dt-py-1 ginger-dt-rounded ginger-dt-text-[11px] ginger-dt-flex ginger-dt-items-center ginger-dt-gap-2 ginger-dt-transition-colors ${\n i === state.currentIndex\n ? \"ginger-dt-bg-orange-900/50 ginger-dt-text-orange-200\"\n : \"hover:ginger-dt-bg-neutral-700/50 ginger-dt-text-neutral-300\"\n }`}\n >\n <span className=\"ginger-dt-w-5 ginger-dt-text-right ginger-dt-text-[10px] ginger-dt-text-neutral-500 ginger-dt-flex-shrink-0\">\n {i === state.currentIndex ? \"▸\" : i + 1}\n </span>\n <span className=\"ginger-dt-truncate\">{track.title}</span>\n {track.artist && (\n <span className=\"ginger-dt-text-neutral-500 ginger-dt-truncate ginger-dt-text-[10px] ginger-dt-ml-auto ginger-dt-flex-shrink-0\">\n {track.artist}\n </span>\n )}\n </button>\n ))}\n </div>\n </div>\n );\n}\n\n// ─── Helpers ──────────────────────────────────────────────────────────────────\n\nfunction Row({\n label,\n value,\n children,\n}: { label: string; value: string; children?: React.ReactNode }) {\n return (\n <div className=\"ginger-dt-flex ginger-dt-items-center\">\n <span className=\"ginger-dt-text-neutral-400\">{label}:</span>\n <span className=\"ginger-dt-ml-1 ginger-dt-font-mono\">{value}</span>\n {children}\n </div>\n );\n}\n\nfunction truncateUrl(url: string, max = 40): string {\n if (url.length <= max) return url;\n return `…${url.slice(-max)}`;\n}\n\n// ─── Main Overlay ─────────────────────────────────────────────────────────────\n\nexport function GingerDevtools() {\n useTailwindCdn();\n const snapshots = useRegistrySnapshots();\n\n const [open, setOpen] = useState(false);\n const [activeTab, setActiveTab] = useState<string | null>(null);\n\n const activeSnap = snapshots.find((s) => s.id === activeTab) ?? snapshots[0] ?? null;\n\n useEffect(() => {\n if (!activeTab && snapshots.length > 0) {\n setActiveTab(snapshots[0].id);\n }\n if (activeTab && !snapshots.find((s) => s.id === activeTab) && snapshots.length > 0) {\n setActiveTab(snapshots[0].id);\n }\n }, [snapshots, activeTab]);\n\n const portalRoot = typeof document !== \"undefined\" ? document.body : null;\n if (!portalRoot) return null;\n\n return createPortal(\n <div\n style={{\n fontFamily: 'ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, monospace',\n zIndex: 2147483647,\n position: \"fixed\",\n bottom: 0,\n right: 0,\n }}\n >\n {/* Toggle button */}\n {!open && (\n <button\n type=\"button\"\n onClick={() => setOpen(true)}\n style={{\n position: \"fixed\",\n bottom: \"12px\",\n right: \"12px\",\n zIndex: 2147483647,\n background: \"#ea580c\",\n color: \"#fff\",\n border: \"none\",\n borderRadius: \"8px\",\n padding: \"6px 12px\",\n fontSize: \"12px\",\n fontWeight: 600,\n fontFamily: \"inherit\",\n cursor: \"pointer\",\n boxShadow: \"0 4px 12px rgba(0,0,0,0.4)\",\n display: \"flex\",\n alignItems: \"center\",\n gap: \"6px\",\n }}\n >\n <span style={{ fontSize: \"14px\" }}>🍊</span>\n Ginger\n {snapshots.length > 0 && (\n <span\n style={{\n background: \"rgba(255,255,255,0.2)\",\n borderRadius: \"4px\",\n padding: \"1px 5px\",\n fontSize: \"10px\",\n }}\n >\n {snapshots.length}\n </span>\n )}\n </button>\n )}\n\n {/* Panel */}\n {open && (\n <div\n className=\"ginger-dt-fixed ginger-dt-bottom-3 ginger-dt-right-3 ginger-dt-w-[380px] ginger-dt-max-h-[80vh] ginger-dt-bg-neutral-900 ginger-dt-text-neutral-100 ginger-dt-rounded-xl ginger-dt-shadow-2xl ginger-dt-border ginger-dt-border-neutral-700/50 ginger-dt-flex ginger-dt-flex-col ginger-dt-overflow-hidden\"\n style={{ zIndex: 2147483647 }}\n >\n {/* Header */}\n <div className=\"ginger-dt-flex ginger-dt-items-center ginger-dt-justify-between ginger-dt-px-3 ginger-dt-py-2 ginger-dt-bg-neutral-800 ginger-dt-border-b ginger-dt-border-neutral-700/50\">\n <div className=\"ginger-dt-flex ginger-dt-items-center ginger-dt-gap-2\">\n <span className=\"ginger-dt-text-sm\">🍊</span>\n <span className=\"ginger-dt-text-xs ginger-dt-font-semibold ginger-dt-tracking-wide\">\n Ginger Devtools\n </span>\n </div>\n <button\n type=\"button\"\n onClick={() => setOpen(false)}\n className=\"ginger-dt-text-neutral-400 hover:ginger-dt-text-white ginger-dt-text-lg ginger-dt-leading-none ginger-dt-transition-colors\"\n >\n ×\n </button>\n </div>\n\n {/* Tabs (when multiple providers) */}\n {snapshots.length > 1 && (\n <div className=\"ginger-dt-flex ginger-dt-gap-0 ginger-dt-bg-neutral-800 ginger-dt-px-1 ginger-dt-border-b ginger-dt-border-neutral-700/50 ginger-dt-overflow-x-auto\">\n {snapshots.map((s) => (\n <button\n key={s.id}\n type=\"button\"\n onClick={() => setActiveTab(s.id)}\n className={`ginger-dt-px-3 ginger-dt-py-1.5 ginger-dt-text-[11px] ginger-dt-whitespace-nowrap ginger-dt-border-b-2 ginger-dt-transition-colors ${\n activeSnap?.id === s.id\n ? \"ginger-dt-border-orange-500 ginger-dt-text-orange-300\"\n : \"ginger-dt-border-transparent ginger-dt-text-neutral-400 hover:ginger-dt-text-neutral-200\"\n }`}\n >\n {s.label}\n </button>\n ))}\n </div>\n )}\n\n {/* Content */}\n <div className=\"ginger-dt-flex-1 ginger-dt-overflow-y-auto ginger-dt-px-3 ginger-dt-py-3 ginger-dt-space-y-4\">\n {!activeSnap ? (\n <div className=\"ginger-dt-text-[11px] ginger-dt-text-neutral-500 ginger-dt-text-center ginger-dt-py-8\">\n No Ginger providers detected.\n <br />\n <span className=\"ginger-dt-text-[10px]\">\n Add {\"<Ginger.Provider>\"} to your app.\n </span>\n </div>\n ) : (\n <>\n <PlaybackSection snap={activeSnap} />\n <Divider />\n <MediaSection snap={activeSnap} />\n <Divider />\n <TrackSection snap={activeSnap} />\n <Divider />\n <QueueSection snap={activeSnap} />\n </>\n )}\n </div>\n\n {/* Footer */}\n {activeSnap && (\n <div className=\"ginger-dt-px-3 ginger-dt-py-1.5 ginger-dt-bg-neutral-800 ginger-dt-border-t ginger-dt-border-neutral-700/50 ginger-dt-text-[10px] ginger-dt-text-neutral-500 ginger-dt-flex ginger-dt-justify-between\">\n <span>ID: {activeSnap.id.slice(0, 8)}…</span>\n <span>Updated {msAgo(activeSnap.updatedAt)}</span>\n </div>\n )}\n </div>\n )}\n </div>,\n portalRoot,\n );\n}\n\nfunction Divider() {\n return <div className=\"ginger-dt-border-t ginger-dt-border-neutral-700/30\" />;\n}\n\nfunction msAgo(ts: number): string {\n const diff = Date.now() - ts;\n if (diff < 1000) return \"just now\";\n if (diff < 60_000) return `${Math.floor(diff / 1000)}s ago`;\n return `${Math.floor(diff / 60_000)}m ago`;\n}\n"],"names":["WINDOW_KEY","counter","buildRegistry","providers","listeners","notify","fn","id","payload","snapshot","existing","listener","ensureRegistry","win","reg","TAILWIND_CDN","useTailwindCdn","scriptRef","useRef","useEffect","script","_a","useRegistrySnapshots","snapshots","setSnapshots","useState","registry","sync","map","PlaybackSection","snap","state","actions","track","jsxs","jsx","Row","MediaSection","handleSeek","useCallback","e","handleVolume","formatMmSs","r","TrackSection","truncateUrl","QueueSection","i","label","value","children","url","max","GingerDevtools","open","setOpen","activeTab","setActiveTab","activeSnap","s","portalRoot","createPortal","Fragment","Divider","msAgo","ts","diff"],"mappings":";;;;AAoDA,MAAMA,IAAa;AAEnB,IAAIC,IAAU;AAEd,SAASC,IAAkC;AACzC,QAAMC,wBAAgB,IAAA,GAChBC,wBAAgB,IAAA,GAEhBC,IAAS,MAAM;AACnB,eAAWC,KAAMF;AACf,MAAAE,EAAGH,CAAS;AAAA,EAEhB;AAEA,SAAO;AAAA,IACL,SAASI,GAAIC,GAAS;AACpB,MAAAP,KAAW;AAC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AClC,IAhBA,gBAAAxB,EAAC,OAAA,EAAI,WAAU,yFAAwF,UAAA;AAAA,kBAAA;AAAA,oCAEpG,MAAA,EAAG;AAAA,kBACJ,gBAAAA,EAAC,QAAA,EAAK,WAAU,yBAAwB,UAAA;AAAA,oBAAA;AAAA,oBACjC;AAAA,oBAAoB;AAAA,kBAAA,EAAA,CAC3B;AAAA,gBAAA,EAAA,CACF,EAUA,CAEJ;AAAA,gBAGCwB,KACC,gBAAAxB,EAAC,OAAA,EAAI,WAAU,yMACb,UAAA;AAAA,kBAAA,gBAAAA,EAAC,QAAA,EAAK,UAAA;AAAA,oBAAA;AAAA,oBAAKwB,EAAW,GAAG,MAAM,GAAG,CAAC;AAAA,oBAAE;AAAA,kBAAA,GAAC;AAAA,oCACrC,QAAA,EAAK,UAAA;AAAA,oBAAA;AAAA,oBAASM,EAAMN,EAAW,SAAS;AAAA,kBAAA,EAAA,CAAE;AAAA,gBAAA,EAAA,CAC7C;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QAEJ;AAAA,MAAA;AAAA,IAAA;AAAA,IAGJE;AAAA,EAAA,IAlIsB;AAoI1B;AAEA,SAASG,IAAU;AACjB,SAAO,gBAAA5B,EAAC,OAAA,EAAI,WAAU,qDAAA,CAAqD;AAC7E;AAEA,SAAS6B,EAAMC,GAAoB;AACjC,QAAMC,IAAO,KAAK,IAAA,IAAQD;AAC1B,SAAIC,IAAO,MAAa,aACpBA,IAAO,MAAe,GAAG,KAAK,MAAMA,IAAO,GAAI,CAAC,UAC7C,GAAG,KAAK,MAAMA,IAAO,GAAM,CAAC;AACrC;"}
@@ -0,0 +1,49 @@
1
+ import { GingerState, PlaybackMode, RepeatMode } from '../types';
2
+ export type ProviderActions = {
3
+ play: () => void;
4
+ pause: () => void;
5
+ togglePlayPause: () => void;
6
+ next: () => void;
7
+ prev: () => void;
8
+ seek: (time: number) => void;
9
+ setVolume: (v: number) => void;
10
+ setMuted: (m: boolean) => void;
11
+ toggleMute: () => void;
12
+ setPlaybackRate: (rate: number) => void;
13
+ setRepeatMode: (mode: RepeatMode) => void;
14
+ cycleRepeat: () => void;
15
+ toggleShuffle: () => void;
16
+ playTrackAt: (index: number) => void;
17
+ setPlaybackMode: (mode: PlaybackMode) => void;
18
+ };
19
+ export type ProviderSnapshot = {
20
+ id: string;
21
+ label: string;
22
+ state: GingerState;
23
+ actions: ProviderActions;
24
+ audioSrc: string | null;
25
+ registeredAt: number;
26
+ updatedAt: number;
27
+ };
28
+ type RegistrationPayload = {
29
+ label?: string;
30
+ state: GingerState;
31
+ actions: ProviderActions;
32
+ audioSrc: string | null;
33
+ };
34
+ type UpdatePayload = {
35
+ state: GingerState;
36
+ audioSrc: string | null;
37
+ };
38
+ type Listener = (snapshots: Map<string, ProviderSnapshot>) => void;
39
+ export type DevtoolsRegistry = {
40
+ register: (id: string, payload: RegistrationPayload) => void;
41
+ unregister: (id: string) => void;
42
+ update: (id: string, payload: UpdatePayload) => void;
43
+ subscribe: (listener: Listener) => () => void;
44
+ getAll: () => Map<string, ProviderSnapshot>;
45
+ };
46
+ export declare function getRegistry(): DevtoolsRegistry | null;
47
+ export declare function ensureRegistry(): DevtoolsRegistry;
48
+ export {};
49
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/devtools/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtE,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,eAAe,EAAE,MAAM,IAAI,CAAC;IAC5B,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,SAAS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mB,KAAK,IAAI,CAAC;IAC7D,UAAU,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,KAAK,IAAI,CAAC;IACrD,SAAS,EAAE,CAAC,QAAQ,EAAE,QAAQ,KAAK,MAAM,IAAI,CAAC;IAC9C,MAAM,EAAE,MAAM,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;CAC7C,CAAC;AA4DF,wBAAgB,WAAW,IAAI,gBAAgB,GAAG,IAAI,CAKrD;AAED,wBAAgB,cAAc,IAAI,gBAAgB,CAWjD"}
@@ -0,0 +1,9 @@
1
+ function f(t) {
2
+ if (!Number.isFinite(t) || t < 0) return "0:00";
3
+ const r = Math.floor(t), o = r % 60, a = Math.floor(r / 60), i = a % 60, n = Math.floor(r / 3600);
4
+ return n > 0 ? `${n}:${i.toString().padStart(2, "0")}:${o.toString().padStart(2, "0")}` : `${a}:${o.toString().padStart(2, "0")}`;
5
+ }
6
+ export {
7
+ f
8
+ };
9
+ //# sourceMappingURL=formatTime-DUWvzW21.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatTime-DUWvzW21.js","sources":["../src/internal/formatTime.ts"],"sourcesContent":["export function formatMmSs(seconds: number): string {\n if (!Number.isFinite(seconds) || seconds < 0) return \"0:00\";\n const totalSec = Math.floor(seconds);\n const s = totalSec % 60;\n const totalMin = Math.floor(totalSec / 60);\n const m = totalMin % 60;\n const h = Math.floor(totalSec / 3600);\n if (h > 0) return `${h}:${m.toString().padStart(2, \"0\")}:${s.toString().padStart(2, \"0\")}`;\n return `${totalMin}:${s.toString().padStart(2, \"0\")}`;\n}\n"],"names":["formatMmSs","seconds","totalSec","s","totalMin","m","h"],"mappings":"AAAO,SAASA,EAAWC,GAAyB;AAClD,MAAI,CAAC,OAAO,SAASA,CAAO,KAAKA,IAAU,EAAG,QAAO;AACrD,QAAMC,IAAW,KAAK,MAAMD,CAAO,GAC7BE,IAAID,IAAW,IACfE,IAAW,KAAK,MAAMF,IAAW,EAAE,GACnCG,IAAID,IAAW,IACfE,IAAI,KAAK,MAAMJ,IAAW,IAAI;AACpC,SAAII,IAAI,IAAU,GAAGA,CAAC,IAAID,EAAE,WAAW,SAAS,GAAG,GAAG,CAAC,IAAIF,EAAE,SAAA,EAAW,SAAS,GAAG,GAAG,CAAC,KACjF,GAAGC,CAAQ,IAAID,EAAE,WAAW,SAAS,GAAG,GAAG,CAAC;AACrD;"}
@@ -0,0 +1,2 @@
1
+ "use strict";function S(t){if(!Number.isFinite(t)||t<0)return"0:00";const r=Math.floor(t),o=r%60,a=Math.floor(r/60),i=a%60,n=Math.floor(r/3600);return n>0?`${n}:${i.toString().padStart(2,"0")}:${o.toString().padStart(2,"0")}`:`${a}:${o.toString().padStart(2,"0")}`}exports.formatMmSs=S;
2
+ //# sourceMappingURL=formatTime-fm_QClmG.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatTime-fm_QClmG.cjs","sources":["../src/internal/formatTime.ts"],"sourcesContent":["export function formatMmSs(seconds: number): string {\n if (!Number.isFinite(seconds) || seconds < 0) return \"0:00\";\n const totalSec = Math.floor(seconds);\n const s = totalSec % 60;\n const totalMin = Math.floor(totalSec / 60);\n const m = totalMin % 60;\n const h = Math.floor(totalSec / 3600);\n if (h > 0) return `${h}:${m.toString().padStart(2, \"0\")}:${s.toString().padStart(2, \"0\")}`;\n return `${totalMin}:${s.toString().padStart(2, \"0\")}`;\n}\n"],"names":["formatMmSs","seconds","totalSec","s","totalMin","m","h"],"mappings":"aAAO,SAASA,EAAWC,EAAyB,CAClD,GAAI,CAAC,OAAO,SAASA,CAAO,GAAKA,EAAU,EAAG,MAAO,OACrD,MAAMC,EAAW,KAAK,MAAMD,CAAO,EAC7BE,EAAID,EAAW,GACfE,EAAW,KAAK,MAAMF,EAAW,EAAE,EACnCG,EAAID,EAAW,GACfE,EAAI,KAAK,MAAMJ,EAAW,IAAI,EACpC,OAAII,EAAI,EAAU,GAAGA,CAAC,IAAID,EAAE,WAAW,SAAS,EAAG,GAAG,CAAC,IAAIF,EAAE,SAAA,EAAW,SAAS,EAAG,GAAG,CAAC,GACjF,GAAGC,CAAQ,IAAID,EAAE,WAAW,SAAS,EAAG,GAAG,CAAC,EACrD"}