@joewinke/jatui 0.23.0 → 0.24.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/CLAUDE.md +32 -2
- package/dist/components/AudioRecorder.svelte +84 -304
- package/dist/components/AudioRecorder.svelte.d.ts +1 -7
- package/dist/components/BulkActionBar.svelte +40 -0
- package/dist/components/BulkActionBar.svelte.d.ts +9 -0
- package/dist/components/ConfirmDialog.svelte +39 -35
- package/dist/components/CopyButton.svelte +5 -2
- package/dist/components/FloatingActionBar.svelte +55 -1
- package/dist/components/FloatingActionBar.svelte.d.ts +8 -1
- package/dist/components/InputDialog.svelte +49 -38
- package/dist/components/KeyboardShortcutsOverlay.svelte +54 -0
- package/dist/components/KeyboardShortcutsOverlay.svelte.d.ts +30 -0
- package/dist/components/bulkActionBarKeys.d.ts +40 -0
- package/dist/components/bulkActionBarKeys.js +38 -0
- package/dist/components/linked-columns/LinkedColumns.svelte +10 -22
- package/dist/components/linked-columns/LinkedColumns.svelte.d.ts +1 -9
- package/dist/components/linked-columns/types.d.ts +9 -0
- package/dist/components/linked-columns/types.js +1 -0
- package/dist/components/replay/ChapterTimeline.svelte +43 -25
- package/dist/components/replay/ChapterTimeline.svelte.d.ts +26 -1
- package/dist/components/toast/ToastItem.svelte +47 -2
- package/dist/index.d.ts +7 -4
- package/dist/index.js +5 -1
- package/dist/stores/toast.d.ts +8 -0
- package/dist/stores/toast.js +2 -0
- package/dist/utils/audioRecorder.d.ts +28 -0
- package/dist/utils/audioRecorder.js +58 -0
- package/dist/utils/audioRecorderCore.d.ts +132 -0
- package/dist/utils/audioRecorderCore.js +447 -0
- package/dist/utils/clipboard.d.ts +25 -0
- package/dist/utils/clipboard.js +59 -0
- package/dist/utils/dateFormatters.d.ts +11 -2
- package/dist/utils/dateFormatters.js +22 -2
- package/package.json +1 -1
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clipboard write that works outside secure contexts.
|
|
3
|
+
*
|
|
4
|
+
* `navigator.clipboard` only exists on HTTPS or localhost origins. Apps using
|
|
5
|
+
* this library are routinely viewed over plain HTTP from another machine
|
|
6
|
+
* (Tailscale/LAN), where the API is undefined and a bare
|
|
7
|
+
* `navigator.clipboard.writeText()` throws synchronously — the classic
|
|
8
|
+
* "copy button silently does nothing" bug.
|
|
9
|
+
*
|
|
10
|
+
* Falls back to the legacy hidden-textarea + `document.execCommand('copy')`
|
|
11
|
+
* path, which still works in every browser the library targets.
|
|
12
|
+
*
|
|
13
|
+
* @returns true if the text was (as far as detectable) copied
|
|
14
|
+
*/
|
|
15
|
+
export async function copyText(text) {
|
|
16
|
+
if (typeof navigator !== 'undefined' && navigator.clipboard?.writeText) {
|
|
17
|
+
try {
|
|
18
|
+
await navigator.clipboard.writeText(text);
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
// Permission denied or transient failure — try the legacy path
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
const ta = document.createElement('textarea');
|
|
27
|
+
ta.value = text;
|
|
28
|
+
ta.setAttribute('readonly', '');
|
|
29
|
+
ta.style.position = 'fixed';
|
|
30
|
+
ta.style.left = '-9999px';
|
|
31
|
+
document.body.appendChild(ta);
|
|
32
|
+
ta.select();
|
|
33
|
+
const ok = document.execCommand('copy');
|
|
34
|
+
document.body.removeChild(ta);
|
|
35
|
+
return ok;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Clipboard read for menu-triggered paste actions (e.g. a context menu "Paste"
|
|
43
|
+
* item), where there's no native ClipboardEvent to pull text/plain from.
|
|
44
|
+
*
|
|
45
|
+
* Requires navigator.clipboard.readText, which needs a secure context and a
|
|
46
|
+
* user-gesture-driven call (satisfied by a click handler). Returns null on
|
|
47
|
+
* any failure — missing API, denied permission, non-secure origin — so
|
|
48
|
+
* callers can fall back to telling the user to press Ctrl+V instead.
|
|
49
|
+
*/
|
|
50
|
+
export async function readClipboardText() {
|
|
51
|
+
if (typeof navigator === 'undefined' || !navigator.clipboard?.readText)
|
|
52
|
+
return null;
|
|
53
|
+
try {
|
|
54
|
+
return await navigator.clipboard.readText();
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -68,6 +68,10 @@ export declare function taskAge(dateStr: string): {
|
|
|
68
68
|
color: string;
|
|
69
69
|
};
|
|
70
70
|
export type PacingLevel = 'fresh' | 'aging' | 'stale';
|
|
71
|
+
export interface PacingOptions {
|
|
72
|
+
/** Return DaisyUI CSS-var tokens (`var(--color-success|warning|error)`) instead of fixed oklch literals, so colors follow the active theme. */
|
|
73
|
+
themeVars?: boolean;
|
|
74
|
+
}
|
|
71
75
|
export interface PacingResult {
|
|
72
76
|
level: PacingLevel;
|
|
73
77
|
color: string;
|
|
@@ -84,6 +88,11 @@ export interface PacingResult {
|
|
|
84
88
|
*
|
|
85
89
|
* Usage:
|
|
86
90
|
* const pacing = pacingColor(elapsedSeconds, 30, 120)
|
|
87
|
-
* // <span style="color: {pacing.color}">{elapsedSeconds}
|
|
91
|
+
* // <span style="color: {pacing.color}">{formatPacingDuration(elapsedSeconds)}</span>
|
|
92
|
+
*
|
|
93
|
+
* Pass { themeVars: true } to get DaisyUI CSS-var tokens (var(--color-success|warning|error))
|
|
94
|
+
* instead of fixed oklch literals — colors then follow the active DaisyUI theme.
|
|
88
95
|
*/
|
|
89
|
-
export declare function pacingColor(elapsedSeconds: number, warnAtSeconds: number, alertAtSeconds: number): PacingResult;
|
|
96
|
+
export declare function pacingColor(elapsedSeconds: number, warnAtSeconds: number, alertAtSeconds: number, options?: PacingOptions): PacingResult;
|
|
97
|
+
/** Compact duration format for pacing readouts: "45s", "3m 12s", "1h 05m". */
|
|
98
|
+
export declare function formatPacingDuration(seconds: number): string;
|
|
@@ -209,12 +209,32 @@ export function taskAge(dateStr) {
|
|
|
209
209
|
*
|
|
210
210
|
* Usage:
|
|
211
211
|
* const pacing = pacingColor(elapsedSeconds, 30, 120)
|
|
212
|
-
* // <span style="color: {pacing.color}">{elapsedSeconds}
|
|
212
|
+
* // <span style="color: {pacing.color}">{formatPacingDuration(elapsedSeconds)}</span>
|
|
213
|
+
*
|
|
214
|
+
* Pass { themeVars: true } to get DaisyUI CSS-var tokens (var(--color-success|warning|error))
|
|
215
|
+
* instead of fixed oklch literals — colors then follow the active DaisyUI theme.
|
|
213
216
|
*/
|
|
214
|
-
export function pacingColor(elapsedSeconds, warnAtSeconds, alertAtSeconds) {
|
|
217
|
+
export function pacingColor(elapsedSeconds, warnAtSeconds, alertAtSeconds, options) {
|
|
218
|
+
if (options?.themeVars) {
|
|
219
|
+
if (elapsedSeconds >= alertAtSeconds)
|
|
220
|
+
return { level: 'stale', color: 'var(--color-error)' };
|
|
221
|
+
if (elapsedSeconds >= warnAtSeconds)
|
|
222
|
+
return { level: 'aging', color: 'var(--color-warning)' };
|
|
223
|
+
return { level: 'fresh', color: 'var(--color-success)' };
|
|
224
|
+
}
|
|
215
225
|
if (elapsedSeconds >= alertAtSeconds)
|
|
216
226
|
return { level: 'stale', color: 'oklch(0.65 0.20 25)' }; // red
|
|
217
227
|
if (elapsedSeconds >= warnAtSeconds)
|
|
218
228
|
return { level: 'aging', color: 'oklch(0.75 0.15 85)' }; // amber
|
|
219
229
|
return { level: 'fresh', color: 'oklch(0.75 0.18 145)' }; // green
|
|
220
230
|
}
|
|
231
|
+
/** Compact duration format for pacing readouts: "45s", "3m 12s", "1h 05m". */
|
|
232
|
+
export function formatPacingDuration(seconds) {
|
|
233
|
+
const s = Math.max(0, Math.floor(seconds));
|
|
234
|
+
if (s < 60)
|
|
235
|
+
return `${s}s`;
|
|
236
|
+
if (s < 3600)
|
|
237
|
+
return `${Math.floor(s / 60)}m ${s % 60}s`;
|
|
238
|
+
const mins = (s % 3600) / 60;
|
|
239
|
+
return `${Math.floor(s / 3600)}h ${mins < 10 ? '0' : ''}${Math.floor(mins)}m`;
|
|
240
|
+
}
|