signavis 1.2.0 → 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/assets/wasm-spectrogram.worker-oU-CQV61.js.map +1 -1
  2. package/dist/birdnet-player.css +1 -1
  3. package/dist/birdnet-player.esm.js +1541 -1162
  4. package/dist/birdnet-player.esm.js.map +1 -1
  5. package/dist/birdnet-player.iife.js +63 -29
  6. package/dist/birdnet-player.iife.js.map +1 -1
  7. package/dist/tokens.css +3 -0
  8. package/package.json +6 -4
  9. package/types/generated/app/BirdNETPlayer.d.ts +36 -7
  10. package/types/generated/app/PlayerState.d.ts +8 -1
  11. package/types/generated/app/ViewportManager.d.ts +20 -3
  12. package/types/generated/app/adopt-detection.d.ts +34 -0
  13. package/types/generated/app/annotation-sets.d.ts +9 -1
  14. package/types/generated/app/annotator-profile.d.ts +2 -0
  15. package/types/generated/app/domRefs.d.ts +7 -0
  16. package/types/generated/app/interactionState.d.ts +2 -0
  17. package/types/generated/app/labeling/app-context.d.ts +44 -0
  18. package/types/generated/app/labeling/dedupe-labels.d.ts +13 -0
  19. package/types/generated/app/labeling/features/annota-import.d.ts +14 -0
  20. package/types/generated/app/labeling/features/file-drop.d.ts +12 -0
  21. package/types/generated/app/labeling/features/mic-recording.d.ts +9 -0
  22. package/types/generated/app/labeling/features/raven-export.d.ts +6 -0
  23. package/types/generated/app/labeling/features/theme.d.ts +1 -0
  24. package/types/generated/app/labeling/features/xc-upload.d.ts +48 -0
  25. package/types/generated/app/labeling/help-menu.d.ts +37 -0
  26. package/types/generated/app/labeling/label-store.d.ts +59 -0
  27. package/types/generated/app/labeling/main.d.ts +0 -0
  28. package/types/generated/app/labeling/render-scheduler.d.ts +16 -0
  29. package/types/generated/app/labeling/sponsor-card.d.ts +11 -0
  30. package/types/generated/app/player/WaveformRenderer.d.ts +10 -0
  31. package/types/generated/app/recording-manager.d.ts +2 -0
  32. package/types/generated/app/similarBand.d.ts +11 -0
  33. package/types/generated/app/similarSpectrogram.d.ts +34 -0
  34. package/types/generated/app/suggest-similar.d.ts +56 -0
  35. package/types/generated/domain/annotations.d.ts +103 -4
  36. package/types/generated/domain/detector/birdboxStream.d.ts +142 -0
  37. package/types/generated/domain/detector/boxUnder.d.ts +17 -0
  38. package/types/generated/domain/detector/fusion.d.ts +50 -0
  39. package/types/generated/domain/detector/nearby.d.ts +47 -0
  40. package/types/generated/domain/detector/pacer.d.ts +45 -0
  41. package/types/generated/domain/labelBand.d.ts +12 -0
  42. package/types/generated/domain/similar/cluster.d.ts +40 -0
  43. package/types/generated/domain/similar/ncc.d.ts +144 -0
  44. package/types/generated/domain/snapToCall.d.ts +10 -0
  45. package/types/generated/domain/species-lists.d.ts +53 -0
  46. package/types/generated/domain/speciesLinks.d.ts +17 -0
  47. package/types/generated/infrastructure/audio/LiveRecorder.d.ts +2 -0
  48. package/types/generated/infrastructure/birdnetInference.d.ts +3 -0
  49. package/types/generated/infrastructure/detector/birdbox.worker.d.ts +1 -0
  50. package/types/generated/infrastructure/detector/birdboxDetector.d.ts +69 -0
  51. package/types/generated/infrastructure/detector/birdboxGraph.d.ts +53 -0
  52. package/types/generated/infrastructure/similar.worker.d.ts +1 -0
  53. package/types/generated/infrastructure/tauri/runtime.d.ts +8 -2
  54. package/types/generated/infrastructure/xeno-canto/annotaPayload.d.ts +2 -0
  55. package/types/generated/shared/constants.d.ts +2 -1
  56. package/types/generated/shared/events.d.ts +2 -0
  57. package/types/generated/ui/components/label-editor/LabelEditorModal.d.ts +7 -1
  58. package/types/generated/ui/components/label-template/template-tags.d.ts +18 -0
  59. package/types/generated/ui/components/onboarding/onboarding-wizard.d.ts +22 -0
  60. package/types/generated/ui/components/overview/overview-controller.d.ts +6 -1
  61. package/types/generated/ui/components/similar-review/group-review.d.ts +40 -0
  62. package/types/generated/ui/components/similar-review/similar-review.d.ts +62 -0
  63. package/types/generated/ui/components/taxonomy-ui/species-geo-cache.d.ts +28 -0
  64. package/types/generated/ui/components/taxonomy-ui/species-ranking.d.ts +51 -0
  65. package/types/generated/ui/components/taxonomy-ui/taxonomy-ui.d.ts +43 -26
  66. package/types/generated/ui/components/toast/undo-toast.d.ts +6 -1
  67. package/types/generated/ui/components/waveform/waveform.d.ts +4 -1
  68. package/types/generated/ui/components/xc-export-modal/xc-export-modal.d.ts +5 -0
  69. package/types/generated/ui/mobile/i18n.d.ts +133 -0
  70. package/types/generated/ui/mobile/mobile-app.d.ts +272 -0
  71. package/types/generated/ui/mobile/thumb.d.ts +11 -0
  72. package/types/generated/ui/panels/birdbox-panel.d.ts +75 -0
  73. package/types/generated/ui/panels/birdnet-panel.d.ts +36 -4
  74. package/types/generated/ui/panels/label-list.d.ts +14 -0
  75. package/types/generated/ui/panels/mode-tiles.d.ts +7 -0
  76. package/types/generated/ui/panels/model-picker.d.ts +11 -0
  77. package/types/generated/ui/panels/recording-explorer.d.ts +2 -0
  78. package/types/generated/ui/panels/sidebar.d.ts +11 -1
  79. package/types/generated/ui/panels/similar-panel.d.ts +29 -0
  80. package/types/generated/ui/panels/species-lists-panel.d.ts +58 -0
  81. package/types/generated/ui/panels/xc-panel.d.ts +10 -0
package/dist/tokens.css CHANGED
@@ -88,6 +88,7 @@
88
88
  Overrides prefers-color-scheme: light when user toggles.
89
89
  ═══════════════════════════════════════════════════════ */
90
90
  html[data-theme="dark"] {
91
+ --overview-dim: rgba(5, 10, 25, 0.55);
91
92
  --color-bg-primary: #1a1a2e;
92
93
  --color-bg-secondary: #16213e;
93
94
  --color-bg-tertiary: #0f3460;
@@ -141,6 +142,7 @@ html[data-theme="dark"] {
141
142
  --color-accent: #0284c7;
142
143
  --color-accent-hover: #0369a1;
143
144
  --color-accent-faint: rgba(2, 132, 199, 0.08);
145
+ --overview-dim: rgba(240, 242, 248, 0.62);
144
146
 
145
147
  --color-border: rgba(0, 0, 0, 0.10);
146
148
 
@@ -180,6 +182,7 @@ html[data-theme="light"] {
180
182
  --color-accent: #0284c7;
181
183
  --color-accent-hover: #0369a1;
182
184
  --color-accent-faint: rgba(2, 132, 199, 0.08);
185
+ --overview-dim: rgba(240, 242, 248, 0.62);
183
186
 
184
187
  --color-border: rgba(0, 0, 0, 0.10);
185
188
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "signavis",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "DAW-like audio player with waveform + spectrogram for analysis",
5
5
  "readme": "README.md",
6
6
  "type": "module",
@@ -43,7 +43,7 @@
43
43
  },
44
44
  "dependencies": {
45
45
  "jsoneditor": "^10.4.3",
46
- "onnxruntime-web": "1.30.0"
46
+ "onnxruntime-web": "1.31.1"
47
47
  },
48
48
  "keywords": [
49
49
  "audio",
@@ -76,9 +76,12 @@
76
76
  "typecheck": "tsc --noEmit --checkers 4",
77
77
  "postinstall": "node ./scripts/postinstall.js",
78
78
  "types:generate": "node ./scripts/generate-types.js",
79
- "taxonomy:build": "node ./scripts/build-birdnet-taxonomy.js --source ./_birdnet_upstream/birdnet_analyzer/labels/V2.4 --output ./demo/data/birdnet-taxonomy.v2.4.json --model V2.4 --source-url https://github.com/birdnet-team/BirdNET-Analyzer/tree/main/birdnet_analyzer/labels/V2.4",
79
+ "taxonomy:build": "node ./scripts/build-birdnet-taxonomy.js --output ./demo/data/birdnet-taxonomy.json --v24-labels ./_birdnet_upstream/birdnet_analyzer/labels/V2.4",
80
80
  "pack:check": "npm pack",
81
81
  "test": "node ./scripts/run-tests.mjs",
82
+ "models:birdbox": "node scripts/birdbox/fetch-model.mjs",
83
+ "models:anurapam": "bash scripts/fetch-anurapam.sh",
84
+ "test:birdbox-stream": "node --import tsx scripts/birdbox/stream-parity.mjs",
82
85
  "test:analysis-smoke": "node --experimental-loader ./scripts/ignore-styles-loader.mjs --experimental-strip-types --test tests/analysis-backend-e2e-smoke.test.ts",
83
86
  "prepare": "npm run build:css && node ./scripts/install-githooks.js",
84
87
  "prepack": "npm run build:css",
@@ -117,7 +120,6 @@
117
120
  "lucide-static": "^1.8.0",
118
121
  "postcss": "^8.5.32",
119
122
  "sass": "^1.70.0",
120
- "sharp": "^0.35.5",
121
123
  "tsx": "^4.23.1",
122
124
  "typescript": "^7.0.2",
123
125
  "vite": "^8.0.8",
@@ -16,8 +16,10 @@ export interface LabelSuggestionItem {
16
16
  color?: string;
17
17
  scientificName?: string;
18
18
  detail?: string;
19
+ /** Structured fields from the species search provider (group, count, matchedAlt, code, local, …). */
20
+ [k: string]: unknown;
19
21
  }
20
- export type PlayerEventName = 'ready' | 'transportstatechange' | 'play' | 'pause' | 'finish' | 'seek' | 'labelfocus' | 'labelsync' | 'labelrestore' | 'undochange' | 'labeltaxonomyapply' | 'annotationcreate' | 'annotationupdate' | 'annotationremove' | 'annotationpreview' | 'spectrogramlabelcreate' | 'spectrogramlabelupdate' | 'spectrogramlabelremove' | 'spectrogramlabelpreview' | 'stampmodechange' | 'snapmodechange' | 'speciesbarchange' | 'viewresize' | 'viewportchange' | string;
22
+ export type PlayerEventName = 'ready' | 'transportstatechange' | 'play' | 'pause' | 'finish' | 'seek' | 'labelfocus' | 'labelsync' | 'labelrestore' | 'undochange' | 'labeltaxonomyapply' | 'annotationcreate' | 'annotationupdate' | 'annotationremove' | 'annotationpreview' | 'spectrogramlabelcreate' | 'spectrogramlabelupdate' | 'spectrogramlabelremove' | 'spectrogramlabelpreview' | 'spectrogramlabeladopt' | 'stampmodechange' | 'snapmodechange' | 'speciesbarchange' | 'viewresize' | 'viewportchange' | string;
21
23
  export type AnnotationInput = Partial<AnnotationEntry> & {
22
24
  start: number;
23
25
  end: number;
@@ -67,6 +69,7 @@ export declare class BirdNETPlayer {
67
69
  _onLabelFocus: ((e: Event) => void) | null;
68
70
  _backgroundSpecies: any;
69
71
  _speciesBarSelection: any;
72
+ _templateTags: Record<string, string>;
70
73
  on: any;
71
74
  off: any;
72
75
  ready: any;
@@ -222,6 +225,22 @@ export declare class BirdNETPlayer {
222
225
  * @param {PlaySegmentOptions} [options]
223
226
  */
224
227
  playSegment(startSec: number, endSec: number, options?: PlaySegmentOptions): void;
228
+ /**
229
+ * Whether playing a label filters the sound to the label's frequency band (default on).
230
+ * Off plays the plain segment.
231
+ */
232
+ labelBandpass: boolean;
233
+ /**
234
+ * Play a label's time range — bandpassed to its frequency range when `labelBandpass` is on
235
+ * and the label has one.
236
+ */
237
+ playLabelSegment(label: {
238
+ start: number;
239
+ end: number;
240
+ freqMin?: number | null;
241
+ freqMax?: number | null;
242
+ fullBand?: boolean;
243
+ }, options?: PlaySegmentOptions): void;
225
244
  /**
226
245
  * Play a segment through a bandpass filter centered on the given frequency range.
227
246
  * @param {number} startSec
@@ -291,9 +310,6 @@ export declare class BirdNETPlayer {
291
310
  */
292
311
  getLabelEditorSuggestions(query?: string, limit?: number): ({
293
312
  name: string;
294
- color?: undefined;
295
- scientificName?: undefined;
296
- detail?: undefined;
297
313
  } | {
298
314
  name: string;
299
315
  color: string;
@@ -433,17 +449,25 @@ export declare class BirdNETPlayer {
433
449
  }): void;
434
450
  /** Restore the view from before the last zoom-box step. */
435
451
  _zoomBoxBack(): void;
436
- /** Public getter for current species bar selection. */
452
+ /**
453
+ * Label template: species (name, colour, scientific name) and tags that every new
454
+ * label gets without the dialog. Null when neither a species nor a tag is set;
455
+ * `name` is empty for a tags-only template (the dialog then opens with these tags).
456
+ */
437
457
  getSpeciesBarSelection(): any;
438
458
  /**
439
- * Programmatically set the species search bar (e.g. after loading XC recording).
459
+ * Set the template's species (e.g. after loading an XC recording); '' clears it.
460
+ * The template's tags stay unless `opts.tags` is given.
440
461
  * @param {string} name
441
- * @param {{ color?: string, scientificName?: string }} [opts]
462
+ * @param {{ color?: string, scientificName?: string, tags?: Record<string, string> }} [opts]
442
463
  */
443
464
  setSpeciesBar(name: string, opts?: {
444
465
  color?: string;
445
466
  scientificName?: string;
467
+ tags?: Record<string, string> | null;
446
468
  }): void;
469
+ /** Set the template's tags (sex, life stage, sound type, custom); the species stays. */
470
+ setTemplateTags(tags: Record<string, string> | null): void;
447
471
  /**
448
472
  * Set background species (XC "also" field) to appear in search suggestions.
449
473
  * @param {Array<string | { name: string, scientificName?: string }>} species
@@ -493,6 +517,7 @@ export declare class BirdNETPlayer {
493
517
  origin: string;
494
518
  author: string;
495
519
  tags: Record<string, string>;
520
+ reviewing?: boolean;
496
521
  createdAt: any;
497
522
  updatedAt?: any;
498
523
  };
@@ -500,6 +525,8 @@ export declare class BirdNETPlayer {
500
525
  _syncLinkedLabelsToLayers(): void;
501
526
  /** Content key of a snapshot: what the user can change, ignoring bookkeeping fields. */
502
527
  _undoKey(snap: LinkedLabel[]): string;
528
+ /** Draw mode on the spectrogram (drag draws a label); turning it on ends stamp / snap / zoom-box mode. */
529
+ setDrawMode(on: boolean): void;
503
530
  /** Create a deep snapshot of the current _linkedLabels for undo. */
504
531
  _snapshotLabels(): LinkedLabel[];
505
532
  /** Restore a snapshot from the undo stack. */
@@ -567,6 +594,7 @@ export declare class BirdNETPlayer {
567
594
  origin: string;
568
595
  author: string;
569
596
  tags: Record<string, unknown>;
597
+ reviewing?: boolean;
570
598
  }[];
571
599
  _normalizeLinkedLabel(label: Partial<LinkedLabel>): {
572
600
  id: string;
@@ -584,6 +612,7 @@ export declare class BirdNETPlayer {
584
612
  origin: string;
585
613
  author: string;
586
614
  tags: Record<string, string>;
615
+ reviewing?: boolean;
587
616
  createdAt: any;
588
617
  updatedAt?: any;
589
618
  };
@@ -221,6 +221,13 @@ export declare class PlayerState {
221
221
  overviewWindow: any;
222
222
  overviewHandleLeft: any;
223
223
  overviewHandleRight: any;
224
+ overviewLens: any;
225
+ overviewDetail: any;
226
+ overviewDetailCanvas: any;
227
+ overviewDetailWindow: any;
228
+ overviewDetailHandleLeft: any;
229
+ overviewDetailHandleRight: any;
230
+ overviewDetailRange: any;
224
231
  overviewLabelTracks: any;
225
232
  overviewLabelSection: any;
226
233
  overviewLabelToggle: any;
@@ -408,7 +415,7 @@ export declare class PlayerState {
408
415
  _syncOverviewWindowToViewport(): void;
409
416
  _updateOverviewWindowElement(): void;
410
417
  _getOverviewSpanConstraints(): any;
411
- _startOverviewDrag(mode: unknown, clientX: unknown): void;
418
+ _startOverviewDrag(mode: unknown, clientX: unknown, scale?: number): void;
412
419
  _updateOverviewDrag(clientX: unknown): void;
413
420
  _queueOverviewViewportApply(redrawFinal?: boolean): void;
414
421
  _toggleOverviewLabelSection(force?: boolean): void;
@@ -23,6 +23,11 @@ export interface ViewportManagerOptions {
23
23
  /** Cheap, synchronous: refresh coords and the scroll extent after a pps change. */
24
24
  onZoomApplied?: () => void;
25
25
  getSpectroHasData: () => boolean;
26
+ /** The detail (lens) strip shows a new range, or was switched off (null). */
27
+ onLensChange?: (range: {
28
+ startNorm: number;
29
+ endNorm: number;
30
+ } | null) => void;
26
31
  emit: (name: string, detail?: unknown) => void;
27
32
  }
28
33
  export declare class ViewportManager extends EventTarget {
@@ -75,6 +80,16 @@ export declare class ViewportManager extends EventTarget {
75
80
  _lastViewRangeTextStart: any;
76
81
  /** Overview container width the window element was last laid out for. */
77
82
  _overviewLayoutWidth: number;
83
+ /** Detail strip range (normalized). Active when the main window is too narrow to use. */
84
+ lensActive: boolean;
85
+ lensStartNorm: number;
86
+ lensEndNorm: number;
87
+ /** Duration the range badge was last written for (a new file keeps the normalized range). */
88
+ _lensRangeDuration: number;
89
+ _onLensChange: (range: {
90
+ startNorm: number;
91
+ endNorm: number;
92
+ } | null) => void;
78
93
  _lastViewRangeTextEnd: any;
79
94
  /**
80
95
  * @param {object} opts
@@ -92,7 +107,7 @@ export declare class ViewportManager extends EventTarget {
92
107
  * @param {() => boolean} opts.getSpectroHasData
93
108
  * @param {(event: string, detail: object) => void} opts.emit
94
109
  */
95
- constructor({ d, coords, interaction, layout, playbackViewportConfig, getAudioBuffer, getWavesurfer, scheduleUiUpdate, onRedrawNeeded, onZoomApplied, getSpectroHasData, emit }: ViewportManagerOptions);
110
+ constructor({ d, coords, interaction, layout, playbackViewportConfig, getAudioBuffer, getWavesurfer, scheduleUiUpdate, onRedrawNeeded, onZoomApplied, getSpectroHasData, onLensChange, emit }: ViewportManagerOptions);
96
111
  /**
97
112
  * Called by PlayerState whenever the playback viewport config is updated.
98
113
  * @param {import('./PlayerState.ts').PlaybackViewportConfig} cfg
@@ -198,7 +213,7 @@ export declare class ViewportManager extends EventTarget {
198
213
  * @param {'move'|'left'|'right'} mode
199
214
  * @param {number} clientX
200
215
  */
201
- startOverviewDrag(mode: 'move' | 'left' | 'right', clientX: number): void;
216
+ startOverviewDrag(mode: 'move' | 'left' | 'right', clientX: number, scale?: number): void;
202
217
  /**
203
218
  * Update overview drag in progress.
204
219
  * @param {number} clientX
@@ -232,11 +247,13 @@ export declare class ViewportManager extends EventTarget {
232
247
  _redrawNow(forceEmit?: boolean): void;
233
248
  _syncOverviewWindowToViewport(): void;
234
249
  _updateOverviewWindowElement(): void;
250
+ /** Pick, keep or drop the detail strip range for the current window. */
251
+ _updateLens(compact: boolean, cw: number): void;
235
252
  _getOverviewSpanConstraints(): {
236
253
  minSpanNorm: number;
237
254
  maxSpanNorm: number;
238
255
  };
239
- _startOverviewDrag(mode: 'move' | 'left' | 'right', clientX: number): void;
256
+ _startOverviewDrag(mode: 'move' | 'left' | 'right', clientX: number, scale?: number): void;
240
257
  _updateOverviewDrag(clientX: number): void;
241
258
  _queueOverviewViewportApply(redrawFinal?: boolean): void;
242
259
  _applyOverviewWindowToViewport(redraw?: boolean): void;
@@ -0,0 +1,34 @@
1
+ export declare const SPECIES_ORIGIN = "BirdNET";
2
+ export declare const BOX_ORIGIN = "BirdBox";
3
+ export interface AdoptTemplate {
4
+ name?: string;
5
+ color?: string;
6
+ scientificName?: string;
7
+ tags?: Record<string, string>;
8
+ }
9
+ export interface AdoptionPlan {
10
+ /** Labels to hand to adoptLabels(). */
11
+ sources: any[];
12
+ /** Call boxes found for a species detection (0: copied as it is). */
13
+ candidates: number;
14
+ /** A call box without a species: ask for a name after copying. */
15
+ needsName: boolean;
16
+ }
17
+ /** Call boxes inside a species detection's window, most confident first. */
18
+ export declare function boxesIn(det: any, labels: any[]): any[];
19
+ /** The most confident species detection whose window holds the box. */
20
+ export declare function speciesFor(box: any, labels: any[]): any | null;
21
+ /**
22
+ * What adopting `lbl` copies. `all`: the labels of the same recording.
23
+ * `mode`: 'best' takes the most confident call box of a species detection, 'all' every one.
24
+ */
25
+ export declare function adoptionPlan(lbl: any, all: any[], { mode, template }?: {
26
+ mode?: 'best' | 'all';
27
+ template?: AdoptTemplate | null;
28
+ }): AdoptionPlan;
29
+ /**
30
+ * Drop sources whose call box (time, frequency) is already in `targetSetId` under the same name, or
31
+ * twice in `sources`: overlapping detections of one species share their boxes, and
32
+ * a box's id changes when the detector's sliders move.
33
+ */
34
+ export declare function withoutKnownBoxes(sources: any[], existing: any[], targetSetId: string): any[];
@@ -10,10 +10,18 @@ export declare function setStatusFromValidation(set: any, validation: {
10
10
  * Copy labels (e.g. from an imported XC/BirdNET set) into the own source.
11
11
  * Copies get new IDs and become editable manual labels; the source is kept in `adoptedFrom`.
12
12
  * `layer`: own layer for the copies (see label-sources.ts).
13
+ * A source's `adoptBox` (adopt-detection.ts: the call box as detected) is kept as `adoptedFrom.box`.
13
14
  */
14
15
  export declare function adoptLabels(labels: any[], targetSetId: string, now?: Date, layer?: string): any[];
15
16
  /**
16
- * Labels of `src` that have no copy in `targetSetId` yet (a copy carries adoptedFrom.id).
17
+ * Identity of a call box copied under a name: time and frequency bounds as detected plus
18
+ * the name it was copied as (`adoptBox` of a source, `adoptedFrom.box` of a copy).
19
+ * The same box may be copied once per species.
20
+ */
21
+ export declare function adoptBoxKey(box: any): string;
22
+ /**
23
+ * Labels of `src` that have no copy in `targetSetId` yet (a copy carries adoptedFrom.id,
24
+ * and adoptedFrom.box when it took a call box).
17
25
  * Makes "copy into my labels" idempotent: pressing it twice adds nothing.
18
26
  * A copy the user deleted again counts as not adopted, so it can be copied once more.
19
27
  */
@@ -44,3 +44,5 @@ export declare class AnnotatorProfile extends EventTarget {
44
44
  _load(): void;
45
45
  _fire(): void;
46
46
  }
47
+ /** True while the first-run onboarding has neither been finished/skipped nor made moot by a filled-in name. */
48
+ export declare function onboardingPending(): boolean;
@@ -38,6 +38,13 @@ export interface DomRefs {
38
38
  overviewWindow: HTMLElement | null;
39
39
  overviewHandleLeft: HTMLElement | null;
40
40
  overviewHandleRight: HTMLElement | null;
41
+ overviewLens: HTMLElement | null;
42
+ overviewDetail: HTMLElement | null;
43
+ overviewDetailCanvas: HTMLCanvasElement | null;
44
+ overviewDetailWindow: HTMLElement | null;
45
+ overviewDetailHandleLeft: HTMLElement | null;
46
+ overviewDetailHandleRight: HTMLElement | null;
47
+ overviewDetailRange: HTMLElement | null;
41
48
  overviewLabelTracks: HTMLElement | null;
42
49
  overviewLabelSection: HTMLElement | null;
43
50
  overviewLabelToggle: HTMLButtonElement | null;
@@ -41,6 +41,8 @@ export interface InteractionContext {
41
41
  overviewStartNorm?: number;
42
42
  overviewEndNorm?: number;
43
43
  overviewMoved?: boolean;
44
+ /** Normalized file span per container width (1 = main strip, <1 = detail strip). */
45
+ overviewScale?: number;
44
46
  resizeStartY?: number;
45
47
  resizeStartWaveformH?: number;
46
48
  resizeStartSpectrogramH?: number;
@@ -0,0 +1,44 @@
1
+ import type { LabelStore, StoredLabel } from './label-store.ts';
2
+ import type { RecordingManager } from '../recording-manager.ts';
3
+ /** A label as the app stores it (more fields are passed through untouched). */
4
+ export interface AppLabel extends StoredLabel {
5
+ setId?: string | null;
6
+ label?: string;
7
+ start?: number;
8
+ end?: number;
9
+ }
10
+ export interface LabelSetInfo {
11
+ name?: string;
12
+ [key: string]: unknown;
13
+ }
14
+ export interface AppState {
15
+ readonly labels: readonly AppLabel[];
16
+ labelSets: Map<string, LabelSetInfo>;
17
+ sampleRate: number;
18
+ }
19
+ /** Project storage (browser or folder), as far as feature modules write to it. */
20
+ export interface ProjectStoreLike {
21
+ readonly label: string;
22
+ writeText(path: string, text: string): Promise<unknown>;
23
+ }
24
+ export interface AppContext {
25
+ readonly state: AppState;
26
+ readonly labelStore: LabelStore<AppLabel>;
27
+ readonly recordingManager: RecordingManager;
28
+ /** The player; typed loosely until BirdNETPlayer's public API is described. */
29
+ readonly player: {
30
+ recordingStart?: Date | string | null;
31
+ [key: string]: any;
32
+ };
33
+ /** Status line under the player. */
34
+ readonly selectionMeta: HTMLElement;
35
+ /** File name shown in the status bar. */
36
+ readonly fileLabel: HTMLElement;
37
+ readonly projectStore: ProjectStoreLike | null;
38
+ /** Save the open recording's labels into its entry now (see labelStore). */
39
+ saveCurrentAnnotations(): void;
40
+ /** Redraw every label view and save (changes besides the labels: sets, visibility). */
41
+ syncToPlayer(): void;
42
+ /** Switch the left sidebar to a tab. */
43
+ showSidebarTab(id: string): void;
44
+ }
@@ -0,0 +1,13 @@
1
+ interface LabelKeyFields {
2
+ id?: string | number | null;
3
+ setId?: string | null;
4
+ start?: number;
5
+ end?: number;
6
+ scientificName?: string;
7
+ }
8
+ /** Identity of a label for de-duplication. Id keys and composite keys can never collide. */
9
+ export declare function labelKey(l: LabelKeyFields): string;
10
+ /** Items whose label (via `labelOf`) was not seen before, in order. */
11
+ export declare function dedupeBy<T>(items: readonly T[] | null | undefined, labelOf: (item: T) => LabelKeyFields | null | undefined): T[];
12
+ export declare function dedupeLabels<T extends LabelKeyFields>(labels: readonly T[] | null | undefined): T[];
13
+ export {};
@@ -0,0 +1,14 @@
1
+ import type { AppContext, AppLabel } from '../app-context.ts';
2
+ export interface AnnotaImportDeps {
3
+ button: HTMLElement;
4
+ input: HTMLInputElement;
5
+ /** Register the XC annotation sets of the imported labels (locked sets). */
6
+ promoteXcSets(labels: AppLabel[], xcNr: string): void;
7
+ /** Re-apply species names in the current taxonomy language. */
8
+ relocalizeLabels(): void;
9
+ /** Redraw the recording list (label counts). */
10
+ refreshRecordings(): void;
11
+ }
12
+ export declare function installAnnotaImport(ctx: AppContext, deps: AnnotaImportDeps): {
13
+ importFile: (file: File) => Promise<void>;
14
+ };
@@ -0,0 +1,12 @@
1
+ export interface FileDropDeps {
2
+ /** Open a local audio file (same path as the file picker). */
3
+ openFile(file: File): Promise<unknown>;
4
+ /** Show an error dialog. */
5
+ showError(message: string, title: string): void;
6
+ }
7
+ /** True for an audio file by MIME type or file name. */
8
+ export declare function isAudioFile(file: {
9
+ type: string;
10
+ name: string;
11
+ }): boolean;
12
+ export declare function installFileDrop(deps: FileDropDeps): void;
@@ -0,0 +1,9 @@
1
+ import type { AppContext } from '../app-context.ts';
2
+ export interface MicRecordingDeps {
3
+ button: HTMLElement | null;
4
+ /** Whether the browser can record (BirdNETPlayer.recordingSupported). */
5
+ supported: boolean;
6
+ openFile(file: File): Promise<unknown>;
7
+ showError(message: string, title: string): void;
8
+ }
9
+ export declare function installMicRecording(ctx: AppContext, deps: MicRecordingDeps): void;
@@ -0,0 +1,6 @@
1
+ import type { AppContext } from '../app-context.ts';
2
+ export declare function createRavenExport(ctx: AppContext): {
3
+ download: () => void;
4
+ writeToFolder: () => Promise<void>;
5
+ setName: (id: string) => string;
6
+ };
@@ -0,0 +1 @@
1
+ export declare function installThemeToggle(button: HTMLElement | null): void;
@@ -0,0 +1,48 @@
1
+ import type { AppContext, AppLabel } from '../app-context.ts';
2
+ interface UploadResult {
3
+ ok: boolean;
4
+ message?: string;
5
+ errors?: string[]; /** set_name as sent */
6
+ setName?: string;
7
+ }
8
+ /** The parts of XenoCantoPanel this module uses. */
9
+ export interface XcPanelLike {
10
+ readonly apiKey: string;
11
+ readonly xcId: string | null;
12
+ buildAnnotationSetPayload(labels: AppLabel[], sets: Map<string, unknown>): unknown;
13
+ uploadToXenoCanto(labels: AppLabel[], sets: Map<string, unknown>): Promise<UploadResult>;
14
+ exportAnnotationSetJSON(labels: AppLabel[], sets: Map<string, unknown>): unknown;
15
+ _setStatus(message: string, kind: 'info' | 'success' | 'error'): void;
16
+ _updateUploadState(): void;
17
+ }
18
+ export interface XcUploadDeps {
19
+ xcPanel: XcPanelLike;
20
+ annotatorProfile: {
21
+ readonly name?: string;
22
+ readonly xcUsername?: string;
23
+ };
24
+ /** Save the label sets (project autosave or localStorage). */
25
+ saveSets(): void;
26
+ /** Redraw the recording list. */
27
+ refreshRecordings(): void;
28
+ /** Redraw the label list (upload markers). */
29
+ refreshLabelList(): void;
30
+ activateRecording(entry: unknown): Promise<unknown>;
31
+ selectLabel(id: string, opts: {
32
+ seekMode: 'start';
33
+ }): void;
34
+ /** Display name of the project folder root. */
35
+ projectName(): string;
36
+ }
37
+ export interface XcUpload {
38
+ /** Labels of the next XC set over all recordings, tagged with xc_nr / sound_file. */
39
+ collectSetLabels(): AppLabel[];
40
+ /** Re-run the local check and redraw checklist, selection, summary and buttons. */
41
+ refresh(): void;
42
+ /** First error of the last check ('' when the set can be uploaded). */
43
+ blockReason(): string;
44
+ /** Turn the modal's upload button on or off (API key present). */
45
+ setUploadEnabled(on: boolean): void;
46
+ }
47
+ export declare function createXcUpload(ctx: AppContext, deps: XcUploadDeps): XcUpload;
48
+ export {};
@@ -0,0 +1,37 @@
1
+ export interface HelpItem {
2
+ group: string;
3
+ icon: string;
4
+ label: string;
5
+ hint?: string;
6
+ kbd?: string;
7
+ keywords?: string;
8
+ action: () => void;
9
+ }
10
+ export interface Shortcut {
11
+ keys: string;
12
+ desc: string;
13
+ }
14
+ /** Items and shortcuts matching every word of the query (empty query → all items, no shortcuts). */
15
+ export declare function filterHelp(items: HelpItem[], shortcuts: Shortcut[], query: string): {
16
+ items: HelpItem[];
17
+ shortcuts: Shortcut[];
18
+ };
19
+ /** Reads the `<kbd>` / `.sc-desc` pairs of the help panel's shortcut grids. */
20
+ export declare function readShortcuts(root: ParentNode | null): Shortcut[];
21
+ export declare const HELP_ICONS: {
22
+ CircleHelp: string;
23
+ Keyboard: string;
24
+ Lightbulb: string;
25
+ PlayCircle: string;
26
+ RotateCcw: string;
27
+ Info: string;
28
+ Shield: string;
29
+ Heart: string;
30
+ Bug: string;
31
+ };
32
+ export declare function initHelpMenu(opts: {
33
+ button: HTMLElement | null;
34
+ items: HelpItem[];
35
+ shortcutsRoot: ParentNode | null;
36
+ onShowShortcuts: () => void;
37
+ }): void;
@@ -0,0 +1,59 @@
1
+ export interface StoredLabel {
2
+ id: string;
3
+ [key: string]: unknown;
4
+ }
5
+ /** Passed along with a change to the subscribers, e.g. which views need a redraw. */
6
+ export interface ChangeMeta {
7
+ /** Views to redraw (default: all). Leave out the ones that already show the change. */
8
+ views?: readonly string[];
9
+ }
10
+ export type LabelChange = ChangeMeta & ({
11
+ kind: 'load' | 'clear' | 'replace' | 'touch';
12
+ } | {
13
+ kind: 'add' | 'update' | 'remove';
14
+ ids: string[];
15
+ });
16
+ export type LabelListener<L extends StoredLabel> = (change: LabelChange, store: LabelStore<L>) => void;
17
+ export interface LabelStoreOptions {
18
+ /** Freeze each new array, so in-place changes throw (development only). */
19
+ freeze?: boolean;
20
+ }
21
+ export declare class LabelStore<L extends StoredLabel = StoredLabel> {
22
+ private _labels;
23
+ private _entryId;
24
+ private readonly _listeners;
25
+ private readonly _freeze;
26
+ constructor(opts?: LabelStoreOptions);
27
+ /** Current labels. Do not change this array — use the methods. */
28
+ get labels(): readonly L[];
29
+ /** Recording the labels belong to (null: none yet, e.g. while a recording loads). */
30
+ get entryId(): string | null;
31
+ get size(): number;
32
+ get(id: string): L | undefined;
33
+ has(id: string): boolean;
34
+ /** Labels of a recording, from now on owned by it. */
35
+ load(labels: readonly L[], entryId: string | null, meta?: ChangeMeta): void;
36
+ /** No labels; owned by `entryId` (default: by no recording). */
37
+ clear(entryId?: string | null, meta?: ChangeMeta): void;
38
+ /** The labels now belong to this recording (labels unchanged, nobody notified). */
39
+ claim(entryId: string | null): void;
40
+ /** New list for the same recording. */
41
+ replaceAll(labels: readonly L[], meta?: ChangeMeta): void;
42
+ add(labels: L | readonly L[], meta?: ChangeMeta): void;
43
+ /**
44
+ * Replace labels by id with `fn(old)`; ids that are not there are skipped.
45
+ * Returns the new labels in the order of `ids`.
46
+ */
47
+ update(ids: string | Iterable<string>, fn: (old: L) => L, meta?: ChangeMeta): L[];
48
+ /** Shallow-merge `patch` into one label. */
49
+ patch(id: string, patch: Partial<L>, meta?: ChangeMeta): L | undefined;
50
+ /** Remove labels by id, or every label `pred` accepts. Returns the removed ones. */
51
+ remove(which: string | Iterable<string> | ((l: L) => boolean), meta?: ChangeMeta): L[];
52
+ /** Label objects were edited in place: tell the subscribers. */
53
+ changed(meta?: ChangeMeta): void;
54
+ /** Call `fn` after every change; returns the unsubscribe function. */
55
+ subscribe(fn: LabelListener<L>): () => void;
56
+ private _wrap;
57
+ private _set;
58
+ private _emit;
59
+ }
File without changes
@@ -0,0 +1,16 @@
1
+ export type RenderStep<K extends string> = readonly [key: K, run: (pending: ReadonlySet<K>) => void];
2
+ export declare class RenderScheduler<K extends string> {
3
+ private readonly _steps;
4
+ private readonly _schedule;
5
+ private _pending;
6
+ private _queued;
7
+ constructor(steps: ReadonlyArray<RenderStep<K>>, schedule?: (cb: () => void) => void);
8
+ /** Mark views as stale; they are redrawn in the next flush. */
9
+ invalidate(...keys: K[]): void;
10
+ get pending(): ReadonlySet<K>;
11
+ /**
12
+ * Run the stale steps now. Steps that invalidate again are picked up by the next flush.
13
+ * A failing step is logged and does not stop the others.
14
+ */
15
+ flush(): void;
16
+ }
@@ -0,0 +1,11 @@
1
+ export declare const SPONSOR_STORAGE_KEY = "signavis.sponsor";
2
+ export type SponsorState = 'none' | 'pending' | 'sponsor';
3
+ export declare function readSponsorState(storage: Pick<Storage, 'getItem'> | null): SponsorState;
4
+ export declare function writeSponsorState(storage: Pick<Storage, 'setItem' | 'removeItem'> | null, state: SponsorState): void;
5
+ /** Which view the card shows for a given state. */
6
+ export declare function viewForState(state: SponsorState): 'ask' | 'confirm' | 'thanks';
7
+ export interface SponsorCardHandle {
8
+ /** Call when the user heads to the sponsor page from elsewhere (e.g. the help menu). */
9
+ startSponsor(): void;
10
+ }
11
+ export declare function initSponsorCard(doc?: Document): SponsorCardHandle | null;