@celestia-island/hikari 0.55.521 → 0.55.523

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/src/index.ts CHANGED
@@ -543,6 +543,14 @@ export {
543
543
  type HkRuntimeWriteOp,
544
544
  type HkRuntimeSnapshot,
545
545
  type HkRuntimeSnapshotEntry,
546
+ configureClipboardHub,
547
+ clipboardHubConfig,
548
+ getClipboardHub,
549
+ writeClipboardText,
550
+ type ClipboardCopyOptions,
551
+ type ClipboardEntry,
552
+ type ClipboardHub,
553
+ type ClipboardHubConfig,
546
554
  } from "./runtime";
547
555
 
548
556
  // i18n
@@ -0,0 +1,234 @@
1
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
2
+
3
+ import {
4
+ clipboardHubConfig,
5
+ configureClipboardHub,
6
+ getClipboardHub,
7
+ writeClipboardText,
8
+ } from "./clipboardHub";
9
+
10
+ // `navigator.clipboard` does not exist under happy-dom — install a
11
+ // controllable stub and restore whatever was there before.
12
+ // Mutation anchors for this file: MUT:clipboard-hub-honest-write (the
13
+ // never-fake-success MUTs) and MUT:clipboard-hub-history (the ring MUTs).
14
+ let writeText: ReturnType<typeof vi.fn>;
15
+ const originalClipboard = navigator.clipboard;
16
+ const originalExecCommand = document.execCommand;
17
+
18
+ beforeEach(() => {
19
+ writeText = vi.fn(async () => undefined);
20
+ Object.defineProperty(navigator, "clipboard", {
21
+ value: { writeText },
22
+ configurable: true,
23
+ });
24
+ configureClipboardHub({ historyLimit: 50, recordHistory: true });
25
+ getClipboardHub().clearHistory();
26
+ });
27
+
28
+ afterEach(() => {
29
+ Object.defineProperty(navigator, "clipboard", {
30
+ value: originalClipboard,
31
+ configurable: true,
32
+ });
33
+ document.execCommand = originalExecCommand;
34
+ });
35
+
36
+ describe("writeClipboardText", () => {
37
+ it("awaits the async API and reports true only when it fulfils", async () => {
38
+ await expect(writeClipboardText("hello")).resolves.toBe(true);
39
+ expect(writeText).toHaveBeenCalledWith("hello");
40
+ });
41
+
42
+ it("falls back to execCommand when the async API is missing entirely", async () => {
43
+ Object.defineProperty(navigator, "clipboard", {
44
+ value: undefined,
45
+ configurable: true,
46
+ });
47
+ // A missing async API hits `navigator.clipboard.writeText` on undefined —
48
+ // the access itself throws into the catch. Stub the legacy path.
49
+ // MUT:clipboard-hub-honest-write
50
+ const exec = vi.fn(() => true);
51
+ document.execCommand = exec as unknown as typeof document.execCommand;
52
+
53
+ await expect(writeClipboardText("legacy")).resolves.toBe(true);
54
+ expect(exec).toHaveBeenCalledWith("copy");
55
+ });
56
+
57
+ it("MUT: never reports success for an execCommand falsy return", async () => {
58
+ // The "Copied toast for a write that never landed" defect: the fallback
59
+ // must read execCommand's RETURN value, not just its absence of throw.
60
+ // MUT:clipboard-hub-honest-write
61
+ Object.defineProperty(navigator, "clipboard", {
62
+ value: undefined,
63
+ configurable: true,
64
+ });
65
+ document.execCommand = vi.fn(() => false) as unknown as typeof document.execCommand;
66
+
67
+ await expect(writeClipboardText("ghost")).resolves.toBe(false);
68
+ });
69
+
70
+ it("MUT: never reports success when the async write rejects", async () => {
71
+ writeText.mockRejectedValue(new DOMException("denied", "NotAllowedError"));
72
+ document.execCommand = vi.fn(() => false) as unknown as typeof document.execCommand;
73
+
74
+ await expect(writeClipboardText("denied")).resolves.toBe(false);
75
+ });
76
+ });
77
+
78
+ describe("getClipboardHub history", () => {
79
+ it("records confirmed writes newest-first with source labels", async () => {
80
+ const hub = getClipboardHub();
81
+ await hub.copy("first", { source: "code-block" });
82
+ await hub.copy("second");
83
+
84
+ const history = hub.history();
85
+ expect(history.map((entry) => entry.text)).toEqual(["second", "first"]);
86
+ expect(history[0].source).toBeUndefined();
87
+ expect(history[1].source).toBe("code-block");
88
+ // `at` is a real epoch timestamp, not a placeholder constant.
89
+ expect(history[0].at).toBeGreaterThan(0);
90
+ expect(history[0].at).toBeLessThanOrEqual(Date.now());
91
+ });
92
+
93
+ it("MUT: a zero history limit is the global off switch — per-call record cannot bypass it", async () => {
94
+ configureClipboardHub({ historyLimit: 0 });
95
+ const hub = getClipboardHub();
96
+ await hub.copy("asked to record", { record: true });
97
+
98
+ expect(hub.history()).toEqual([]);
99
+ expect(clipboardHubConfig().historyLimit).toBe(0);
100
+ });
101
+
102
+ it("MUT: never records a failed write", async () => {
103
+ writeText.mockRejectedValue(new Error("no"));
104
+ document.execCommand = vi.fn(() => false) as unknown as typeof document.execCommand;
105
+ const hub = getClipboardHub();
106
+
107
+ await expect(hub.copy("never landed")).resolves.toBe(false);
108
+
109
+ expect(hub.history()).toEqual([]);
110
+ });
111
+
112
+ it("collapses consecutive duplicate writes instead of growing the ring", async () => {
113
+ const hub = getClipboardHub();
114
+ await hub.copy("same", { source: "badge" });
115
+ await hub.copy("same", { source: "badge" });
116
+
117
+ // One entry, refreshed timestamp — collapse, not erasure.
118
+ const collapsed = hub.history();
119
+ expect(collapsed.map((entry) => entry.text)).toEqual(["same"]);
120
+
121
+ // A different write in between breaks the run: the later "same" is a new
122
+ // copy action and earns its own entry.
123
+ await hub.copy("other");
124
+ await hub.copy("same", { source: "badge" });
125
+
126
+ const history = hub.history();
127
+ expect(history.map((entry) => entry.text)).toEqual(["same", "other", "same"]);
128
+ expect(history.map((entry) => entry.source)).toEqual(["badge", undefined, "badge"]);
129
+ });
130
+
131
+ it("MUT: duplicate collapse keys on BOTH text and source", async () => {
132
+ const hub = getClipboardHub();
133
+ await hub.copy("same", { source: "badge" });
134
+ await hub.copy("same", { source: "code-block" });
135
+
136
+ // Same text from a different call site is a different entry — the two
137
+ // sources must stay distinguishable in any history surface.
138
+ expect(hub.history().map((entry) => entry.source)).toEqual(["code-block", "badge"]);
139
+ });
140
+
141
+ it("respects the ring limit, dropping the oldest entry", async () => {
142
+ configureClipboardHub({ historyLimit: 2 });
143
+ const hub = getClipboardHub();
144
+ await hub.copy("a");
145
+ await hub.copy("b");
146
+ await hub.copy("c");
147
+
148
+ expect(hub.history().map((entry) => entry.text)).toEqual(["c", "b"]);
149
+ });
150
+
151
+ it("skips history entirely when recording is off globally", async () => {
152
+ configureClipboardHub({ recordHistory: false });
153
+ const hub = getClipboardHub();
154
+ await hub.copy("quiet");
155
+
156
+ expect(hub.history()).toEqual([]);
157
+ expect(clipboardHubConfig().recordHistory).toBe(false);
158
+ });
159
+
160
+ it("skips history for a per-call record:false without flipping the switch", async () => {
161
+ const hub = getClipboardHub();
162
+ await hub.copy("quiet", { record: false });
163
+ await hub.copy("kept");
164
+
165
+ expect(hub.history().map((entry) => entry.text)).toEqual(["kept"]);
166
+ expect(clipboardHubConfig().recordHistory).toBe(true);
167
+ });
168
+
169
+ it("clearHistory empties the ring", async () => {
170
+ const hub = getClipboardHub();
171
+ await hub.copy("gone");
172
+ hub.clearHistory();
173
+
174
+ expect(hub.history()).toEqual([]);
175
+ });
176
+ });
177
+
178
+ describe("getClipboardHub subscriptions", () => {
179
+ it("notifies on confirmed writes and clears, not on failures", async () => {
180
+ const hub = getClipboardHub();
181
+ const listener = vi.fn();
182
+ hub.subscribe(listener);
183
+
184
+ await hub.copy("noted");
185
+ expect(listener).toHaveBeenCalledTimes(1);
186
+
187
+ writeText.mockRejectedValue(new Error("no"));
188
+ document.execCommand = vi.fn(() => false) as unknown as typeof document.execCommand;
189
+ await hub.copy("failed");
190
+ expect(listener).toHaveBeenCalledTimes(1);
191
+
192
+ hub.clearHistory();
193
+ expect(listener).toHaveBeenCalledTimes(2);
194
+ });
195
+
196
+ it("MUT: unsubscribe stops delivery for that listener only", async () => {
197
+ const hub = getClipboardHub();
198
+ const first = vi.fn();
199
+ const second = vi.fn();
200
+ const unsubscribeFirst = hub.subscribe(first);
201
+ hub.subscribe(second);
202
+
203
+ await hub.copy("before");
204
+ expect(first).toHaveBeenCalledTimes(1);
205
+ expect(second).toHaveBeenCalledTimes(1);
206
+
207
+ unsubscribeFirst();
208
+
209
+ await hub.copy("after");
210
+ // The unsubscribed listener went quiet; the other one still hears it.
211
+ expect(first).toHaveBeenCalledTimes(1);
212
+ expect(second).toHaveBeenCalledTimes(2);
213
+ });
214
+
215
+ it("hands every caller the same instance", () => {
216
+ expect(getClipboardHub()).toBe(getClipboardHub());
217
+ });
218
+ });
219
+
220
+ describe("configureClipboardHub", () => {
221
+ it("rejects a negative limit instead of silently clamping", () => {
222
+ expect(() => configureClipboardHub({ historyLimit: -1 })).toThrow(RangeError);
223
+ });
224
+
225
+ it("truncates the existing ring when the limit shrinks", async () => {
226
+ const hub = getClipboardHub();
227
+ await hub.copy("a");
228
+ await hub.copy("b");
229
+ await hub.copy("c");
230
+ configureClipboardHub({ historyLimit: 1 });
231
+
232
+ expect(hub.history().map((entry) => entry.text)).toEqual(["c"]);
233
+ });
234
+ });
@@ -0,0 +1,183 @@
1
+ /**
2
+ * The family's ONE clipboard context (user direction 2026-12-01: copy paths
3
+ * converge here — hosts stop owning private `navigator.clipboard` /
4
+ * `execCommand` sequences and consume this hub instead).
5
+ *
6
+ * Framework-free on purpose: the Vue hooks (`useClipboard`,
7
+ * `useClipboardWithToast`) wrap it, and non-Vue consumers (the lagrange docs
8
+ * shell's delegated DOM handlers today; any future host runtime) import the
9
+ * same module-scoped singleton, so every writer on a page shares one
10
+ * implementation, one history, one place to fix browser quirks in.
11
+ *
12
+ * The write core NEVER reports success it did not observe:
13
+ *
14
+ * - `navigator.clipboard.writeText` is awaited; only a fulfilled promise
15
+ * means "the clipboard now holds the text" (the browser contract).
16
+ * - Outside secure contexts (and wherever the async API refuses), the
17
+ * textarea + `execCommand("copy")` fallback runs, and `execCommand`
18
+ * reports failure by RETURNING false — treating that falsy return as
19
+ * success is exactly the defect that surfaced "Copied" toasts for writes
20
+ * that never landed (hikari #409, lagrange #211 follow-ups).
21
+ *
22
+ * History is the first of the hub's fine-grained management features: an
23
+ * in-memory ring of recent writes (newest first) with a subscribe hook, so
24
+ * hosts can surface "what did I copy" UI or audit writes without each
25
+ * consumer rolling its own log. Recording is on by default and can be turned
26
+ * off globally (`configureClipboardHub`) — e.g. on pages where clipboard
27
+ * content is sensitive enough that keeping it in memory is wrong.
28
+ */
29
+
30
+ export interface ClipboardEntry {
31
+ /** The text that was written. */
32
+ text: string;
33
+ /** Epoch milliseconds at the moment the write was confirmed. */
34
+ at: number;
35
+ /**
36
+ * Optional call-site label (`copy(text, { source: "code-block" })`) —
37
+ * lets a history surface distinguish code blocks, badges, modals…
38
+ */
39
+ source?: string;
40
+ }
41
+
42
+ export interface ClipboardCopyOptions {
43
+ /** Call-site label recorded into history alongside the text. */
44
+ source?: string;
45
+ /** Skip the history ring for this one write (defaults to recording). */
46
+ record?: boolean;
47
+ }
48
+
49
+ export interface ClipboardHubConfig {
50
+ /**
51
+ * Ring capacity; the oldest entry falls off. Default 50, 0 disables.
52
+ * **Zero is the global off switch**: with a zero limit nothing is recorded,
53
+ * and a per-call `record: true` cannot bypass it — a page that decided its
54
+ * clipboard contents must not sit in memory must not be undone by an
55
+ * individual writer.
56
+ */
57
+ historyLimit?: number;
58
+ /** Master switch for history recording. Default true. */
59
+ recordHistory?: boolean;
60
+ }
61
+
62
+ export interface ClipboardHub {
63
+ /**
64
+ * The single write path. Resolves to whether the clipboard verifiably
65
+ * received the text; a confirmed write is appended to history.
66
+ */
67
+ copy(text: string, options?: ClipboardCopyOptions): Promise<boolean>;
68
+ /** Recent confirmed writes, newest first (a readonly snapshot). */
69
+ history(): readonly ClipboardEntry[];
70
+ /** Drops every recorded entry. */
71
+ clearHistory(): void;
72
+ /**
73
+ * Notified after every confirmed write and every clear. Returns the
74
+ * unsubscribe function.
75
+ */
76
+ subscribe(listener: () => void): () => void;
77
+ }
78
+
79
+ /** Module-scope mutable config — `configureClipboardHub` writes it. */
80
+ const hubConfig: Required<ClipboardHubConfig> = {
81
+ historyLimit: 50,
82
+ recordHistory: true,
83
+ };
84
+
85
+ const historyRing: ClipboardEntry[] = [];
86
+ const listeners = new Set<() => void>();
87
+
88
+ function notify(): void {
89
+ for (const listener of listeners) listener();
90
+ }
91
+
92
+ /**
93
+ * The one write sequence every consumer shares. Never returns true unless a
94
+ * write verifiably landed. Exported for tests and for the rare caller that
95
+ * wants the raw write without touching the hub's history.
96
+ */
97
+ export async function writeClipboardText(text: string): Promise<boolean> {
98
+ try {
99
+ await navigator.clipboard.writeText(text);
100
+ return true;
101
+ } catch {
102
+ const textarea = document.createElement("textarea");
103
+ textarea.value = text;
104
+ textarea.style.position = "fixed";
105
+ textarea.style.opacity = "0";
106
+ document.body.appendChild(textarea);
107
+ textarea.select();
108
+ try {
109
+ // execCommand reports failure by RETURNING false (it only throws
110
+ // on unsupported commands) — treating that as success surfaced
111
+ // "Copied" toasts for writes that never landed.
112
+ if (!document.execCommand("copy")) return false;
113
+ return true;
114
+ } catch {
115
+ return false;
116
+ } finally {
117
+ document.body.removeChild(textarea);
118
+ }
119
+ }
120
+ }
121
+
122
+ export function configureClipboardHub(config: ClipboardHubConfig): void {
123
+ if (config.historyLimit !== undefined) {
124
+ if (config.historyLimit < 0) {
125
+ throw new RangeError("historyLimit must be >= 0");
126
+ }
127
+ hubConfig.historyLimit = config.historyLimit;
128
+ historyRing.splice(hubConfig.historyLimit);
129
+ }
130
+ if (config.recordHistory !== undefined) {
131
+ hubConfig.recordHistory = config.recordHistory;
132
+ }
133
+ }
134
+
135
+ /** Read-mostly view of the active config (tests assert against it). */
136
+ export function clipboardHubConfig(): Required<ClipboardHubConfig> {
137
+ return { ...hubConfig };
138
+ }
139
+
140
+ const hub: ClipboardHub = {
141
+ async copy(text, options) {
142
+ const ok = await writeClipboardText(text);
143
+ if (!ok) return false;
144
+ const record = options?.record ?? hubConfig.recordHistory;
145
+ if (record && hubConfig.historyLimit > 0) {
146
+ // Consecutive duplicates collapse: re-writing the same block twice
147
+ // should not grow the ring — the freshest timestamp wins.
148
+ const previous = historyRing[0];
149
+ if (previous && previous.text === text && previous.source === options?.source) {
150
+ previous.at = Date.now();
151
+ } else {
152
+ historyRing.unshift({ text, at: Date.now(), source: options?.source });
153
+ historyRing.splice(hubConfig.historyLimit);
154
+ }
155
+ }
156
+ notify();
157
+ return true;
158
+ },
159
+
160
+ history() {
161
+ return [...historyRing];
162
+ },
163
+
164
+ clearHistory() {
165
+ historyRing.length = 0;
166
+ notify();
167
+ },
168
+
169
+ subscribe(listener) {
170
+ listeners.add(listener);
171
+ return () => {
172
+ listeners.delete(listener);
173
+ };
174
+ },
175
+ };
176
+
177
+ /**
178
+ * The page-wide clipboard context. Every caller in the same bundle gets the
179
+ * same instance — that is the whole point of the convergence.
180
+ */
181
+ export function getClipboardHub(): ClipboardHub {
182
+ return hub;
183
+ }
@@ -127,6 +127,16 @@ export {
127
127
  } from "./useScreenIdentify";
128
128
  export { useBreakpoint } from "./useBreakpoint";
129
129
  export { useClipboard, useClipboardWithToast } from "./useClipboard";
130
+ export {
131
+ configureClipboardHub,
132
+ clipboardHubConfig,
133
+ getClipboardHub,
134
+ writeClipboardText,
135
+ type ClipboardCopyOptions,
136
+ type ClipboardEntry,
137
+ type ClipboardHub,
138
+ type ClipboardHubConfig,
139
+ } from "./clipboardHub";
130
140
  export { provideScrollWindow, useScrollWindow, type ScrollWindowContext } from "../composables/useScrollWindow";
131
141
  export { useReportedTransition, type ReportedTransition, type ReportedTransitionTrack } from "../composables/useReportedTransition";
132
142
  export { showProgressDialog, useProgressDialog, type ProgressDialogHandle, type ProgressDialogState } from "../composables/useProgressDialog";
@@ -1,6 +1,7 @@
1
1
  import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
2
2
 
3
- import { useClipboardWithToast } from "./useClipboard";
3
+ import { configureClipboardHub, getClipboardHub } from "./clipboardHub";
4
+ import { useClipboard, useClipboardWithToast } from "./useClipboard";
4
5
 
5
6
  // `navigator.clipboard` does not exist under happy-dom — install a
6
7
  // controllable stub and restore whatever was there before.
@@ -14,6 +15,10 @@ beforeEach(() => {
14
15
  value: { writeText },
15
16
  configurable: true,
16
17
  });
18
+ // The hub is a module-scoped singleton shared with clipboardHub.test.ts;
19
+ // each test starts from the default config and an empty ring.
20
+ configureClipboardHub({ historyLimit: 50, recordHistory: true });
21
+ getClipboardHub().clearHistory();
17
22
  });
18
23
 
19
24
  afterEach(() => {
@@ -64,3 +69,54 @@ describe("useClipboardWithToast", () => {
64
69
  expect(toast.success).not.toHaveBeenCalled();
65
70
  });
66
71
  });
72
+
73
+ describe("useClipboard", () => {
74
+ it("flips copied on success and lands the write in the shared hub history", async () => {
75
+ vi.useFakeTimers();
76
+ try {
77
+ const { copied, copy } = useClipboard();
78
+ expect(copied.value).toBe(false);
79
+
80
+ const ok = await copy("visible");
81
+ expect(ok).toBe(true);
82
+ expect(copied.value).toBe(true);
83
+ expect(getClipboardHub().history().map((entry) => entry.text)).toEqual(["visible"]);
84
+
85
+ // The 2s reset flips it back — one copy, one window.
86
+ vi.advanceTimersByTime(2000);
87
+ expect(copied.value).toBe(false);
88
+ } finally {
89
+ vi.useRealTimers();
90
+ }
91
+ });
92
+
93
+ it("MUT: a second success reschedules the reset — copied stays true until the LAST copy's 2s", async () => {
94
+ vi.useFakeTimers();
95
+ try {
96
+ const { copied, copy } = useClipboard();
97
+
98
+ await copy("first");
99
+ // Halfway through the first reset window, write again.
100
+ vi.advanceTimersByTime(1000);
101
+ await copy("second");
102
+ // The first timer (1000ms from now) must NOT flip copied off.
103
+ vi.advanceTimersByTime(1000);
104
+ expect(copied.value).toBe(true);
105
+ // Only the second copy's full window ends the state.
106
+ vi.advanceTimersByTime(1000);
107
+ expect(copied.value).toBe(false);
108
+ } finally {
109
+ vi.useRealTimers();
110
+ }
111
+ });
112
+
113
+ it("leaves copied false when the write fails", async () => {
114
+ writeText.mockRejectedValue(new Error("no"));
115
+ document.execCommand = vi.fn(() => false) as unknown as typeof document.execCommand;
116
+ const { copied, copy } = useClipboard();
117
+
118
+ const ok = await copy("ghost");
119
+ expect(ok).toBe(false);
120
+ expect(copied.value).toBe(false);
121
+ });
122
+ });
@@ -1,41 +1,28 @@
1
1
  import { ref } from "vue";
2
2
 
3
+ import { getClipboardHub } from "./clipboardHub";
3
4
  import { useI18n } from "../i18n/context";
4
5
 
5
6
  export function useClipboard() {
6
7
  const copied = ref(false);
8
+ // Each success reschedules the reset; the previous timer is cancelled so
9
+ // `copied` flips false 2s after the LAST copy, not the first one that
10
+ // happened to still be ticking.
11
+ let resetTimer: ReturnType<typeof setTimeout> | undefined;
7
12
 
8
13
  async function copy(text: string): Promise<boolean> {
9
- try {
10
- await navigator.clipboard.writeText(text);
14
+ // The ONE write path (user direction 2026-12-01): every hook instance
15
+ // delegates to the page-wide hub, so the write sequence, its fallback
16
+ // quirks and the history ring live in exactly one place.
17
+ const ok = await getClipboardHub().copy(text);
18
+ if (ok) {
11
19
  copied.value = true;
12
- setTimeout(() => {
20
+ clearTimeout(resetTimer);
21
+ resetTimer = setTimeout(() => {
13
22
  copied.value = false;
14
23
  }, 2000);
15
- return true;
16
- } catch {
17
- const textarea = document.createElement("textarea");
18
- textarea.value = text;
19
- textarea.style.position = "fixed";
20
- textarea.style.opacity = "0";
21
- document.body.appendChild(textarea);
22
- textarea.select();
23
- try {
24
- // execCommand reports failure by RETURNING false (it only throws
25
- // on unsupported commands) — treating that as success surfaced
26
- // "Copied" toasts for writes that never landed.
27
- if (!document.execCommand("copy")) return false;
28
- copied.value = true;
29
- setTimeout(() => {
30
- copied.value = false;
31
- }, 2000);
32
- return true;
33
- } catch {
34
- return false;
35
- } finally {
36
- document.body.removeChild(textarea);
37
- }
38
24
  }
25
+ return ok;
39
26
  }
40
27
 
41
28
  return { copied, copy };
@@ -45,10 +32,11 @@ export function useClipboard() {
45
32
  * Clipboard copy with a toast on success/failure.
46
33
  * (Upstreamed from shittim-chest's plana-legacy layer.)
47
34
  *
48
- * Wraps the base `useClipboard` above (which already falls back to
49
- * `execCommand` outside secure contexts) and adds toast feedback;
50
- * `copied` reflects the 2s copied state. The `toast` argument matches
51
- * hikari's `useToast()` surface (`success` / `error` message pushers).
35
+ * Wraps the base `useClipboard` above (which now delegates to the shared
36
+ * clipboard hub — the write sequence and the history ring are family-wide,
37
+ * not per-hook) and adds toast feedback; `copied` reflects the 2s copied
38
+ * state. The `toast` argument matches hikari's `useToast()` surface
39
+ * (`success` / `error` message pushers).
52
40
  *
53
41
  * Default toast messages come from hikari's own i18n
54
42
  * (`hikari::clipboard.copied` / `hikari::clipboard.copyFailed`) so a