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.
- package/dist/assets/wasm-spectrogram.worker-oU-CQV61.js.map +1 -1
- package/dist/birdnet-player.css +1 -1
- package/dist/birdnet-player.esm.js +1541 -1162
- package/dist/birdnet-player.esm.js.map +1 -1
- package/dist/birdnet-player.iife.js +63 -29
- package/dist/birdnet-player.iife.js.map +1 -1
- package/dist/tokens.css +3 -0
- package/package.json +6 -4
- package/types/generated/app/BirdNETPlayer.d.ts +36 -7
- package/types/generated/app/PlayerState.d.ts +8 -1
- package/types/generated/app/ViewportManager.d.ts +20 -3
- package/types/generated/app/adopt-detection.d.ts +34 -0
- package/types/generated/app/annotation-sets.d.ts +9 -1
- package/types/generated/app/annotator-profile.d.ts +2 -0
- package/types/generated/app/domRefs.d.ts +7 -0
- package/types/generated/app/interactionState.d.ts +2 -0
- package/types/generated/app/labeling/app-context.d.ts +44 -0
- package/types/generated/app/labeling/dedupe-labels.d.ts +13 -0
- package/types/generated/app/labeling/features/annota-import.d.ts +14 -0
- package/types/generated/app/labeling/features/file-drop.d.ts +12 -0
- package/types/generated/app/labeling/features/mic-recording.d.ts +9 -0
- package/types/generated/app/labeling/features/raven-export.d.ts +6 -0
- package/types/generated/app/labeling/features/theme.d.ts +1 -0
- package/types/generated/app/labeling/features/xc-upload.d.ts +48 -0
- package/types/generated/app/labeling/help-menu.d.ts +37 -0
- package/types/generated/app/labeling/label-store.d.ts +59 -0
- package/types/generated/app/labeling/main.d.ts +0 -0
- package/types/generated/app/labeling/render-scheduler.d.ts +16 -0
- package/types/generated/app/labeling/sponsor-card.d.ts +11 -0
- package/types/generated/app/player/WaveformRenderer.d.ts +10 -0
- package/types/generated/app/recording-manager.d.ts +2 -0
- package/types/generated/app/similarBand.d.ts +11 -0
- package/types/generated/app/similarSpectrogram.d.ts +34 -0
- package/types/generated/app/suggest-similar.d.ts +56 -0
- package/types/generated/domain/annotations.d.ts +103 -4
- package/types/generated/domain/detector/birdboxStream.d.ts +142 -0
- package/types/generated/domain/detector/boxUnder.d.ts +17 -0
- package/types/generated/domain/detector/fusion.d.ts +50 -0
- package/types/generated/domain/detector/nearby.d.ts +47 -0
- package/types/generated/domain/detector/pacer.d.ts +45 -0
- package/types/generated/domain/labelBand.d.ts +12 -0
- package/types/generated/domain/similar/cluster.d.ts +40 -0
- package/types/generated/domain/similar/ncc.d.ts +144 -0
- package/types/generated/domain/snapToCall.d.ts +10 -0
- package/types/generated/domain/species-lists.d.ts +53 -0
- package/types/generated/domain/speciesLinks.d.ts +17 -0
- package/types/generated/infrastructure/audio/LiveRecorder.d.ts +2 -0
- package/types/generated/infrastructure/birdnetInference.d.ts +3 -0
- package/types/generated/infrastructure/detector/birdbox.worker.d.ts +1 -0
- package/types/generated/infrastructure/detector/birdboxDetector.d.ts +69 -0
- package/types/generated/infrastructure/detector/birdboxGraph.d.ts +53 -0
- package/types/generated/infrastructure/similar.worker.d.ts +1 -0
- package/types/generated/infrastructure/tauri/runtime.d.ts +8 -2
- package/types/generated/infrastructure/xeno-canto/annotaPayload.d.ts +2 -0
- package/types/generated/shared/constants.d.ts +2 -1
- package/types/generated/shared/events.d.ts +2 -0
- package/types/generated/ui/components/label-editor/LabelEditorModal.d.ts +7 -1
- package/types/generated/ui/components/label-template/template-tags.d.ts +18 -0
- package/types/generated/ui/components/onboarding/onboarding-wizard.d.ts +22 -0
- package/types/generated/ui/components/overview/overview-controller.d.ts +6 -1
- package/types/generated/ui/components/similar-review/group-review.d.ts +40 -0
- package/types/generated/ui/components/similar-review/similar-review.d.ts +62 -0
- package/types/generated/ui/components/taxonomy-ui/species-geo-cache.d.ts +28 -0
- package/types/generated/ui/components/taxonomy-ui/species-ranking.d.ts +51 -0
- package/types/generated/ui/components/taxonomy-ui/taxonomy-ui.d.ts +43 -26
- package/types/generated/ui/components/toast/undo-toast.d.ts +6 -1
- package/types/generated/ui/components/waveform/waveform.d.ts +4 -1
- package/types/generated/ui/components/xc-export-modal/xc-export-modal.d.ts +5 -0
- package/types/generated/ui/mobile/i18n.d.ts +133 -0
- package/types/generated/ui/mobile/mobile-app.d.ts +272 -0
- package/types/generated/ui/mobile/thumb.d.ts +11 -0
- package/types/generated/ui/panels/birdbox-panel.d.ts +75 -0
- package/types/generated/ui/panels/birdnet-panel.d.ts +36 -4
- package/types/generated/ui/panels/label-list.d.ts +14 -0
- package/types/generated/ui/panels/mode-tiles.d.ts +7 -0
- package/types/generated/ui/panels/model-picker.d.ts +11 -0
- package/types/generated/ui/panels/recording-explorer.d.ts +2 -0
- package/types/generated/ui/panels/sidebar.d.ts +11 -1
- package/types/generated/ui/panels/similar-panel.d.ts +29 -0
- package/types/generated/ui/panels/species-lists-panel.d.ts +58 -0
- package/types/generated/ui/panels/xc-panel.d.ts +10 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
export interface ReviewItem {
|
|
2
|
+
id: string;
|
|
3
|
+
score: number;
|
|
4
|
+
}
|
|
5
|
+
export interface SimilarReviewHandlers {
|
|
6
|
+
onFocus: (id: string) => void;
|
|
7
|
+
onPlay: (id: string) => void;
|
|
8
|
+
onAccept: (ids: string[]) => void;
|
|
9
|
+
onReject: (ids: string[]) => void;
|
|
10
|
+
onClose?: () => void;
|
|
11
|
+
/** True while the host is in the middle of something that owns Escape (e.g. resizing a box). */
|
|
12
|
+
busy?: () => boolean;
|
|
13
|
+
/** Area to sit at the bottom of (e.g. the spectrogram); fixed near the window bottom without. */
|
|
14
|
+
anchor?: () => DOMRect | null;
|
|
15
|
+
}
|
|
16
|
+
export declare class SimilarReview {
|
|
17
|
+
private readonly h;
|
|
18
|
+
private el;
|
|
19
|
+
private items;
|
|
20
|
+
private pos;
|
|
21
|
+
/** No ↑/↓ since the last decision: a re-rank may move on to the new best. */
|
|
22
|
+
private fresh;
|
|
23
|
+
private threshold;
|
|
24
|
+
private title;
|
|
25
|
+
private readonly onKey;
|
|
26
|
+
private readonly onResize;
|
|
27
|
+
constructor(h: SimilarReviewHandlers);
|
|
28
|
+
get isOpen(): boolean;
|
|
29
|
+
/** Open (or refill) for suggestions of one exemplar; `items` best first. */
|
|
30
|
+
open(title: string, items: ReviewItem[]): void;
|
|
31
|
+
close(): void;
|
|
32
|
+
/** The item under review (null when closed or empty). */
|
|
33
|
+
get currentId(): string | null;
|
|
34
|
+
/** `id` is one of the suggestions of this review. */
|
|
35
|
+
has(id: string): boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Drop items that no longer exist (removed elsewhere), keeping the position.
|
|
38
|
+
* `decided`: they went by a decision on the box (✓ / ✗): a re-rank may move on to the new best.
|
|
39
|
+
*/
|
|
40
|
+
retain(ids: Set<string>, { decided }?: {
|
|
41
|
+
decided?: boolean;
|
|
42
|
+
}): void;
|
|
43
|
+
/**
|
|
44
|
+
* New scores (e.g. re-ranked after a decision): best first again. The item on screen stays
|
|
45
|
+
* unless the user has not moved since the last decision, then the new best is shown.
|
|
46
|
+
*/
|
|
47
|
+
rescore(scores: Map<string, number>): void;
|
|
48
|
+
/** The user picked a suggestion elsewhere (click on its box): review it now. */
|
|
49
|
+
focusId(id: string): boolean;
|
|
50
|
+
private get current();
|
|
51
|
+
private aboveThreshold;
|
|
52
|
+
private decide;
|
|
53
|
+
private acceptAbove;
|
|
54
|
+
private afterChange;
|
|
55
|
+
private move;
|
|
56
|
+
private focusCurrent;
|
|
57
|
+
private handleKey;
|
|
58
|
+
private build;
|
|
59
|
+
/** Bottom centre of the anchor, kept inside the window. */
|
|
60
|
+
private place;
|
|
61
|
+
private render;
|
|
62
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Geo occurrence scores for species search ranking.
|
|
3
|
+
*
|
|
4
|
+
* Holds the BirdNET area-model scores for one recording context (coordinates +
|
|
5
|
+
* date). Scores always belong to the current context: a context change clears
|
|
6
|
+
* them, results of an outdated request are discarded (and the current context is
|
|
7
|
+
* requested instead), and failed lookups are not cached, so the next refresh retries.
|
|
8
|
+
*/
|
|
9
|
+
export interface GeoContext {
|
|
10
|
+
lat: number;
|
|
11
|
+
lon: number;
|
|
12
|
+
date?: Date | string | null;
|
|
13
|
+
}
|
|
14
|
+
export interface SpeciesGeoCacheDeps {
|
|
15
|
+
/** Current recording context, or null when no location is known. */
|
|
16
|
+
getContext: () => GeoContext | null;
|
|
17
|
+
/** Scores for a context: scientific name → occurrence probability; null = no area model. */
|
|
18
|
+
fetchScores: (ctx: GeoContext) => Promise<Map<string, number> | null>;
|
|
19
|
+
/** Called after new scores were installed. */
|
|
20
|
+
onUpdate?: () => void;
|
|
21
|
+
onError?: (err: unknown) => void;
|
|
22
|
+
}
|
|
23
|
+
export declare function geoContextKey(ctx: GeoContext | null): string;
|
|
24
|
+
export declare function createSpeciesGeoCache({ getContext, fetchScores, onUpdate, onError }: SpeciesGeoCacheDeps): {
|
|
25
|
+
score: (sci: string) => number;
|
|
26
|
+
refresh: () => Promise<void>;
|
|
27
|
+
readonly key: string;
|
|
28
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Species search ranking — pure helpers shared by the suggestion provider
|
|
3
|
+
* and the search widget. No DOM, no taxonomy instance: easy to unit-test.
|
|
4
|
+
*
|
|
5
|
+
* Ranking (lower = better):
|
|
6
|
+
* 1. exact name / scientific name, or a 4/6-letter species code
|
|
7
|
+
* 2. direct match (display name or scientific name) — locally occurring species first
|
|
8
|
+
* 3. match only through another language's common name
|
|
9
|
+
* Within a bucket: match tier, then geo occurrence score, then name.
|
|
10
|
+
*/
|
|
11
|
+
/** Normalize text for search: lowercase + strip diacritics (ü→u, é→e, etc.) */
|
|
12
|
+
export declare function normalizeSearch(text: unknown): string;
|
|
13
|
+
export declare const MATCH: {
|
|
14
|
+
readonly NONE: -1;
|
|
15
|
+
readonly EXACT: 0;
|
|
16
|
+
readonly CODE: 1;
|
|
17
|
+
readonly PREFIX: 2;
|
|
18
|
+
readonly WORD: 3;
|
|
19
|
+
readonly SCI: 4;
|
|
20
|
+
readonly SUBSTRING: 5;
|
|
21
|
+
readonly ALT: 6;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Banding-style species codes from a binomial: first 2+2 and 3+3 letters
|
|
25
|
+
* ("Parus major" → ["pama", "parmaj"]). Empty for non-binomials.
|
|
26
|
+
*/
|
|
27
|
+
export declare function speciesCodes(scientificName: unknown): string[];
|
|
28
|
+
/**
|
|
29
|
+
* How well a normalized query matches a species.
|
|
30
|
+
* @param q normalized query (see normalizeSearch)
|
|
31
|
+
* @param name display name (any case)
|
|
32
|
+
* @param sci scientific name
|
|
33
|
+
* @param altNames common names in other languages
|
|
34
|
+
*/
|
|
35
|
+
export declare function matchTier(q: string, name: unknown, sci: unknown, altNames?: unknown[]): number;
|
|
36
|
+
/** Geo score at or above which a species counts as "occurs here". */
|
|
37
|
+
export declare const LOCAL_THRESHOLD = 0.03;
|
|
38
|
+
export interface RankInput {
|
|
39
|
+
name: string;
|
|
40
|
+
tier: number;
|
|
41
|
+
/** Geo occurrence probability, or null/undefined when unknown. */
|
|
42
|
+
geo?: number | null;
|
|
43
|
+
/** On the user's active species list. */
|
|
44
|
+
listed?: boolean;
|
|
45
|
+
}
|
|
46
|
+
/** Sort key bucket: 0 exact/code, 1 direct match, 2 other-language match. */
|
|
47
|
+
export declare function matchBucket(tier: number): 0 | 1 | 2;
|
|
48
|
+
/** Comparator for taxonomy results (see module doc for the order). */
|
|
49
|
+
export declare function compareRanked(a: RankInput, b: RankInput): number;
|
|
50
|
+
/** Split `text` around the first normalized occurrence of `q` (for <mark> highlighting). */
|
|
51
|
+
export declare function splitHighlight(text: string, q: string): [string, string, string];
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Reusable across any app that uses TaxonomyResolver + BirdNETPlayer.
|
|
6
6
|
*/
|
|
7
|
+
import { normalizeSearch } from './species-ranking.ts';
|
|
8
|
+
export { normalizeSearch };
|
|
7
9
|
/** Map BirdNET language codes to Unicode flag emoji. */
|
|
8
10
|
export declare const LANG_FLAGS: {
|
|
9
11
|
af: string;
|
|
@@ -44,8 +46,6 @@ export declare const LANG_FLAGS: {
|
|
|
44
46
|
uk: string;
|
|
45
47
|
zh: string;
|
|
46
48
|
};
|
|
47
|
-
/** Normalize text for search: lowercase + strip diacritics (ü→u, é→e, etc.) */
|
|
48
|
-
export declare function normalizeSearch(text: any): string;
|
|
49
49
|
/**
|
|
50
50
|
* Build a detail string with flags of languages that matched the query.
|
|
51
51
|
* Returns e.g. "🇩🇪 Kohlmeise · 🇫🇷 Mésange charbonnière".
|
|
@@ -60,39 +60,56 @@ export declare function buildMatchDetail(record: any, query: any, displayLang: a
|
|
|
60
60
|
* @returns {string} The resolved initial language value
|
|
61
61
|
*/
|
|
62
62
|
export declare function populateLanguageSelect(selectEl: any, taxonomy: any, defaultLang?: string): any;
|
|
63
|
+
/**
|
|
64
|
+
* One row of the species search dropdown. All fields beyond `name` are optional;
|
|
65
|
+
* `group` switches the widget to the grouped, two-line layout.
|
|
66
|
+
*/
|
|
67
|
+
export interface SpeciesSuggestion {
|
|
68
|
+
name: string;
|
|
69
|
+
scientificName?: string;
|
|
70
|
+
color?: string;
|
|
71
|
+
/** Short legacy badge text (origin / other-language match) for older renderers. */
|
|
72
|
+
detail?: string;
|
|
73
|
+
/** 'recent' | 'project' | 'taxonomy' | 'extra' (species outside the BirdNET model). */
|
|
74
|
+
group?: string;
|
|
75
|
+
/** Number of results in this group before truncation. */
|
|
76
|
+
groupTotal?: number;
|
|
77
|
+
/** Labels with this species in the project. */
|
|
78
|
+
count?: number;
|
|
79
|
+
/** "🇫🇷 Mésange charbonnière" when only another language's name matched. */
|
|
80
|
+
matchedAlt?: string;
|
|
81
|
+
/** Upper-case species code when the query matched one (e.g. "PAMA"). */
|
|
82
|
+
code?: string;
|
|
83
|
+
/** Species occurs at the recording location according to the geo model. */
|
|
84
|
+
local?: boolean;
|
|
85
|
+
/** On the user's active species list. */
|
|
86
|
+
listed?: boolean;
|
|
87
|
+
[k: string]: any;
|
|
88
|
+
}
|
|
89
|
+
/** First other-language name containing `q`, prefixed with its flag. */
|
|
90
|
+
export declare function altNameMatch(record: any, q: string, displayLang: string): string;
|
|
63
91
|
/**
|
|
64
92
|
* Create a label-suggestion provider function.
|
|
65
93
|
*
|
|
94
|
+
* Results come in groups: species already used in the project (labels, XC pool,
|
|
95
|
+
* background species), then taxonomy matches (ranked, see species-ranking.ts),
|
|
96
|
+
* then species outside the BirdNET model.
|
|
97
|
+
*
|
|
66
98
|
* @param {object} opts
|
|
67
99
|
* @param {import('../../src/infrastructure/taxonomyResolver.ts').TaxonomyResolver} opts.taxonomy
|
|
68
100
|
* @param {() => string} opts.getLang Returns current display language
|
|
69
101
|
* @param {() => Array} opts.getLabels Returns current label array
|
|
70
102
|
* @param {() => Array} opts.getPool Returns XC label pool array
|
|
71
|
-
* @
|
|
72
|
-
|
|
73
|
-
export declare function createSuggestionProvider({ taxonomy, getLang, getLabels, getPool }: any): (query: any, limit?: number) => any[];
|
|
74
|
-
/**
|
|
75
|
-
* Create a reusable species autocomplete widget (input + floating dropdown).
|
|
76
|
-
*
|
|
77
|
-
* The dropdown is appended to `document.body` and fixed-positioned under the
|
|
78
|
-
* anchor so it works correctly inside any scroll container.
|
|
79
|
-
*
|
|
80
|
-
* Suggestion objects may include optional fields that are rendered in the row:
|
|
81
|
-
* `color` — hex string, rendered as a coloured dot
|
|
82
|
-
* `scientificName` — italic secondary line
|
|
83
|
-
* `detail` — small badge (e.g. origin / language code)
|
|
84
|
-
*
|
|
85
|
-
* `onSelect` receives the full suggestion object (including `color` etc.) so
|
|
86
|
-
* callers do not need to look up the item again.
|
|
87
|
-
*
|
|
88
|
-
* @param {object} opts
|
|
89
|
-
* @param {(query: string, limit?: number) => Array<{name:string, scientificName?:string, color?:string, detail?:string}>} opts.getSuggestions
|
|
90
|
-
* @param {(item: {name:string, scientificName:string, color?:string, [k:string]:any}) => void} opts.onSelect
|
|
91
|
-
* @param {() => void} [opts.onClear] Called when the user explicitly clears the field via the × button.
|
|
92
|
-
* @param {string} [opts.placeholder]
|
|
93
|
-
* @param {string} [opts.initialValue]
|
|
94
|
-
* @returns {{ el: HTMLElement, input: HTMLInputElement, setValue: (v:string)=>void, destroy: () => void }}
|
|
103
|
+
* @param {(sci: string) => number|null} [opts.getGeoScore] Occurrence probability at the recording location
|
|
104
|
+
* @returns {(query: string, limit?: number) => SpeciesSuggestion[]}
|
|
95
105
|
*/
|
|
106
|
+
export declare function createSuggestionProvider({ taxonomy, getLang, getLabels, getPool, getGeoScore, isListed }: any): (query: any, limit?: number) => SpeciesSuggestion[];
|
|
107
|
+
export declare const EXTRA_TITLE = "Can be labelled, but BirdNET cannot detect this species";
|
|
108
|
+
/** Inner HTML of a group header; `n` shown, `total` before truncation. */
|
|
109
|
+
export declare function speciesGroupHeaderHtml(group: string, n: number, total?: number): string;
|
|
110
|
+
export declare function speciesRowClass(s: SpeciesSuggestion): string;
|
|
111
|
+
/** Inner HTML of a two-line species row; `q` is the normalized query to highlight. */
|
|
112
|
+
export declare function speciesRowHtml(s: SpeciesSuggestion, q: string): string;
|
|
96
113
|
export declare function createSpeciesSearchWidget({ getSuggestions, onSelect, onClear, placeholder, initialValue }: any): {
|
|
97
114
|
el: HTMLDivElement;
|
|
98
115
|
input: HTMLInputElement;
|
|
@@ -2,8 +2,13 @@ declare function dismiss(): void;
|
|
|
2
2
|
/**
|
|
3
3
|
* Show a toast with an Undo button. Only one toast at a time — a new one replaces
|
|
4
4
|
* (and thereby commits) the previous action.
|
|
5
|
+
* `action`: an optional second button before Undo (e.g. "All 4").
|
|
5
6
|
*/
|
|
6
|
-
export declare function showUndoToast(message: string, onUndo: () => void, { timeoutMs }?: {
|
|
7
|
+
export declare function showUndoToast(message: string, onUndo: () => void, { timeoutMs, action }?: {
|
|
7
8
|
timeoutMs?: number;
|
|
9
|
+
action?: {
|
|
10
|
+
label: string;
|
|
11
|
+
run: () => void;
|
|
12
|
+
} | null;
|
|
8
13
|
}): typeof dismiss;
|
|
9
14
|
export {};
|
|
@@ -10,11 +10,14 @@ export declare function renderMainWaveform({ audioBuffer, amplitudeCanvas, wavef
|
|
|
10
10
|
scrollLeft?: number;
|
|
11
11
|
viewportWidth?: number;
|
|
12
12
|
}): void;
|
|
13
|
-
export declare function renderOverviewWaveform({ audioBuffer, overviewCanvas, overviewContainer, amplitudePeakAbs, }: {
|
|
13
|
+
export declare function renderOverviewWaveform({ audioBuffer, overviewCanvas, overviewContainer, amplitudePeakAbs, startNorm, endNorm, }: {
|
|
14
14
|
audioBuffer: AudioBuffer;
|
|
15
15
|
overviewCanvas: HTMLCanvasElement;
|
|
16
16
|
overviewContainer: HTMLElement;
|
|
17
17
|
amplitudePeakAbs: number;
|
|
18
|
+
/** Part of the file to show (normalized); the detail strip shows a slice. */
|
|
19
|
+
startNorm?: number;
|
|
20
|
+
endNorm?: number;
|
|
18
21
|
}): void;
|
|
19
22
|
/**
|
|
20
23
|
* Draws a whole-file spectrogram image into the overview strip (overview
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strings of the phone UI (mobile-app.ts). English is the default and the fallback;
|
|
3
|
+
* another language is one more dictionary with the same keys (missing keys fall back to English).
|
|
4
|
+
*
|
|
5
|
+
* Language: `?lang=de` in the URL, else localStorage `signavis.lang`, else English
|
|
6
|
+
* (the desktop UI is English, so the phone follows it until there is a language setting).
|
|
7
|
+
*/
|
|
8
|
+
type Vars = Record<string, string | number>;
|
|
9
|
+
declare const en: {
|
|
10
|
+
'nav.recordings': string;
|
|
11
|
+
'nav.review': string;
|
|
12
|
+
'nav.live': string;
|
|
13
|
+
'nav.species': string;
|
|
14
|
+
'nav.label': string;
|
|
15
|
+
'common.back': string;
|
|
16
|
+
'common.all': string;
|
|
17
|
+
'common.undo': string;
|
|
18
|
+
'common.unknown': string;
|
|
19
|
+
'common.noRecording': string;
|
|
20
|
+
'common.labels': (v: Vars) => string;
|
|
21
|
+
'source.own': string;
|
|
22
|
+
'rec.new': string;
|
|
23
|
+
'rec.add': string;
|
|
24
|
+
'rec.empty': string;
|
|
25
|
+
'rec.species': (v: Vars) => string;
|
|
26
|
+
'rec.open': (v: Vars) => string;
|
|
27
|
+
'rec.reviewed': string;
|
|
28
|
+
'rec.notAnalysed': string;
|
|
29
|
+
'rec.audioFile': string;
|
|
30
|
+
'date.today': string;
|
|
31
|
+
'date.yesterday': string;
|
|
32
|
+
'new.file': string;
|
|
33
|
+
'new.fileHint': string;
|
|
34
|
+
'new.xc': string;
|
|
35
|
+
'new.xcHint': string;
|
|
36
|
+
'new.xcPlaceholder': string;
|
|
37
|
+
'new.load': string;
|
|
38
|
+
'new.xcLoading': string;
|
|
39
|
+
'new.mic': string;
|
|
40
|
+
'new.micHint': string;
|
|
41
|
+
'queue.title': string;
|
|
42
|
+
'queue.summary': (v: Vars) => string;
|
|
43
|
+
'queue.allDone': string;
|
|
44
|
+
'queue.nothing': string;
|
|
45
|
+
'queue.noRecs': string;
|
|
46
|
+
'rv.analyse': string;
|
|
47
|
+
'rv.rate': string;
|
|
48
|
+
'rv.play': string;
|
|
49
|
+
'rv.pause': string;
|
|
50
|
+
'rv.loop': string;
|
|
51
|
+
'rv.loopLabel': string;
|
|
52
|
+
'live.max': string;
|
|
53
|
+
'rv.skipBack': (v: Vars) => string;
|
|
54
|
+
'rv.skipFwd': (v: Vars) => string;
|
|
55
|
+
'rv.open': string;
|
|
56
|
+
'rv.detections': string;
|
|
57
|
+
'rv.sub': (v: Vars) => string;
|
|
58
|
+
'rv.pickRecording': string;
|
|
59
|
+
'rv.noDetections': string;
|
|
60
|
+
'rv.noDetectionsAnalyse': string;
|
|
61
|
+
'rv.allDone': string;
|
|
62
|
+
'rv.confirmed': string;
|
|
63
|
+
'rv.discard': string;
|
|
64
|
+
'rv.accept': string;
|
|
65
|
+
'rv.unaccept': string;
|
|
66
|
+
'rv.accepted': (v: Vars) => string;
|
|
67
|
+
'rv.unaccepted': string;
|
|
68
|
+
'rv.discarded': (v: Vars) => string;
|
|
69
|
+
'sp.title': string;
|
|
70
|
+
'sp.search': string;
|
|
71
|
+
'sp.confirmed': string;
|
|
72
|
+
'sp.detected': string;
|
|
73
|
+
'sp.sortBy': string;
|
|
74
|
+
'sp.sort.count': string;
|
|
75
|
+
'sp.sort.conf': string;
|
|
76
|
+
'sp.sort.name': string;
|
|
77
|
+
'sp.recs': (v: Vars) => string;
|
|
78
|
+
'sp.noMatch': string;
|
|
79
|
+
'sp.empty': string;
|
|
80
|
+
'sp.meta': (v: Vars) => string;
|
|
81
|
+
'sp.best': string;
|
|
82
|
+
'sp.more': (v: Vars) => string;
|
|
83
|
+
'sp.playBest': (v: Vars) => string;
|
|
84
|
+
'an.title': string;
|
|
85
|
+
'an.birdnet': string;
|
|
86
|
+
'an.birdnetHint': string;
|
|
87
|
+
'an.birdbox': string;
|
|
88
|
+
'an.birdboxHint': string;
|
|
89
|
+
'an.geo': string;
|
|
90
|
+
'an.geoNeedsModel': string;
|
|
91
|
+
'an.noLocation': string;
|
|
92
|
+
'an.minConf': string;
|
|
93
|
+
'an.minConfHint': string;
|
|
94
|
+
'an.expert': string;
|
|
95
|
+
'an.overlap': string;
|
|
96
|
+
'an.merge': string;
|
|
97
|
+
'an.desktopHint': string;
|
|
98
|
+
'an.run': string;
|
|
99
|
+
'an.running': (v: Vars) => string;
|
|
100
|
+
'an.failed': string;
|
|
101
|
+
'an.done': string;
|
|
102
|
+
'live.title': string;
|
|
103
|
+
'live.level': string;
|
|
104
|
+
'live.hint': string;
|
|
105
|
+
'live.discard': string;
|
|
106
|
+
'live.discardLabel': string;
|
|
107
|
+
'live.start': string;
|
|
108
|
+
'live.stop': string;
|
|
109
|
+
'live.every3s': string;
|
|
110
|
+
'live.noneYet': string;
|
|
111
|
+
'live.emptyHint': string;
|
|
112
|
+
'live.unavailable': string;
|
|
113
|
+
'live.justNow': string;
|
|
114
|
+
'live.agoS': (v: Vars) => string;
|
|
115
|
+
'live.agoMin': (v: Vars) => string;
|
|
116
|
+
'live.noMic': string;
|
|
117
|
+
'live.micDenied': string;
|
|
118
|
+
'live.mic': (v: Vars) => string;
|
|
119
|
+
'live.saved': string;
|
|
120
|
+
'live.discarded': string;
|
|
121
|
+
'live.saving': string;
|
|
122
|
+
'live.savedAs': (v: Vars) => string;
|
|
123
|
+
'live.saveFailed': (v: Vars) => string;
|
|
124
|
+
'live.geo': (v: Vars) => string;
|
|
125
|
+
'live.noGeo': string;
|
|
126
|
+
};
|
|
127
|
+
export type MKey = keyof typeof en;
|
|
128
|
+
export declare const LANGS: string[];
|
|
129
|
+
export declare function getLang(): string;
|
|
130
|
+
/** Change the language (stored); the caller re-renders. */
|
|
131
|
+
export declare function setLang(next: string): void;
|
|
132
|
+
export declare function t(key: MKey, vars?: Vars): string;
|
|
133
|
+
export {};
|
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
export declare const PHONE_QUERY = "(max-width: 600px), (pointer: coarse) and (max-height: 500px)";
|
|
2
|
+
export interface MobileRecording {
|
|
3
|
+
id: string;
|
|
4
|
+
title: string;
|
|
5
|
+
/** Short line under the title, e.g. "Xeno-canto" or "48 kHz". */
|
|
6
|
+
meta: string;
|
|
7
|
+
labels: any[];
|
|
8
|
+
active: boolean;
|
|
9
|
+
/** Length in seconds, once known. */
|
|
10
|
+
duration?: number | null;
|
|
11
|
+
/** Mini spectrogram (data URL), once rendered. */
|
|
12
|
+
thumb?: string | null;
|
|
13
|
+
/** Audio source, used to render the thumbnail of a recording that is not open. */
|
|
14
|
+
audioUrl?: string | null;
|
|
15
|
+
/** Recording date (YYYY-MM-DD) and time (HH:MM), if known. */
|
|
16
|
+
date?: string | null;
|
|
17
|
+
time?: string | null;
|
|
18
|
+
/** When it was added to the project (ISO); shown when the recording date is unknown. */
|
|
19
|
+
addedAt?: string | null;
|
|
20
|
+
/** Place name or coordinates. */
|
|
21
|
+
place?: string | null;
|
|
22
|
+
}
|
|
23
|
+
export interface MobileAppHost {
|
|
24
|
+
/** The player instance (BirdNETPlayer). */
|
|
25
|
+
player: any;
|
|
26
|
+
/** Element the player renders into (moved between desktop and phone layout). */
|
|
27
|
+
playerRoot: HTMLElement;
|
|
28
|
+
getRecordings(): MobileRecording[];
|
|
29
|
+
openRecording(id: string): Promise<void> | void;
|
|
30
|
+
/** Labels of the active recording. */
|
|
31
|
+
getLabels(): any[];
|
|
32
|
+
resolveName(lbl: any): {
|
|
33
|
+
display: string;
|
|
34
|
+
scientific?: string;
|
|
35
|
+
};
|
|
36
|
+
/** Common names in all languages, so the species filter also finds other-language names. */
|
|
37
|
+
altNames?(scientificName: string): string[];
|
|
38
|
+
/** True for labels in "My labels" (confirmed by the user). */
|
|
39
|
+
isOwn?(lbl: any): boolean;
|
|
40
|
+
/** Open the file picker to add audio. */
|
|
41
|
+
addFile(): void;
|
|
42
|
+
/** Load a Xeno-canto recording (number or URL) into the project and open it. */
|
|
43
|
+
addXenoCanto?(raw: string): Promise<void> | void;
|
|
44
|
+
/** Remember thumbnail / duration on the recording (so they survive a reload). */
|
|
45
|
+
setRecordingInfo?(id: string, info: {
|
|
46
|
+
thumb?: string | null;
|
|
47
|
+
duration?: number;
|
|
48
|
+
}): void;
|
|
49
|
+
/** ✓: copy a detection of the active recording into "My labels" (desktop: spectrogramlabeladopt). */
|
|
50
|
+
acceptLabel?(id: string): void;
|
|
51
|
+
/** ✕: remove a label of the active recording; returns the removed label (for undo). */
|
|
52
|
+
discardLabel?(id: string): any;
|
|
53
|
+
/** Undo for ✕: put a removed label back into the active recording. */
|
|
54
|
+
restoreLabel?(lbl: any): void;
|
|
55
|
+
/** Called when phone mode is entered (true) or left (false). */
|
|
56
|
+
onModeChange?(phone: boolean): void;
|
|
57
|
+
/**
|
|
58
|
+
* The app's analysis controls (desktop Analyse panel). The phone screen drives these
|
|
59
|
+
* elements, so BirdNET / BirdBox keep one implementation.
|
|
60
|
+
*/
|
|
61
|
+
analysis?: AnalysisControls;
|
|
62
|
+
/** Live screen: microphone + BirdNET every 3 s; the recording is added to the project. */
|
|
63
|
+
live?: LiveHost;
|
|
64
|
+
}
|
|
65
|
+
export interface LivePrediction {
|
|
66
|
+
scientific: string;
|
|
67
|
+
common: string;
|
|
68
|
+
confidence: number;
|
|
69
|
+
}
|
|
70
|
+
export interface LiveHost {
|
|
71
|
+
/** Load BirdNET (and the location filter); returns a classifier for one chunk of audio. */
|
|
72
|
+
prepare(onStatus: (msg: string) => void): Promise<{
|
|
73
|
+
analyze(pcm: Float32Array, sampleRate: number): Promise<LivePrediction[]>;
|
|
74
|
+
}>;
|
|
75
|
+
/** Add the finished recording to the project and open it. */
|
|
76
|
+
save(file: File): Promise<void>;
|
|
77
|
+
/** Short line about the filter, e.g. "Geofilter: Leipzig" (optional). */
|
|
78
|
+
describe?(): string;
|
|
79
|
+
}
|
|
80
|
+
export interface AnalysisControls {
|
|
81
|
+
confInput: HTMLInputElement;
|
|
82
|
+
overlapSelect?: HTMLSelectElement | null;
|
|
83
|
+
mergeCheckbox?: HTMLInputElement | null;
|
|
84
|
+
geoCheckbox?: HTMLInputElement | null;
|
|
85
|
+
locationLine?: HTMLElement | null;
|
|
86
|
+
analyzeBtn: HTMLButtonElement;
|
|
87
|
+
status?: HTMLElement | null;
|
|
88
|
+
progressBar?: HTMLElement | null;
|
|
89
|
+
birdboxBtn?: HTMLButtonElement | null;
|
|
90
|
+
birdboxStatus?: HTMLElement | null;
|
|
91
|
+
birdboxProgressWrap?: HTMLElement | null;
|
|
92
|
+
birdboxProgressBar?: HTMLElement | null;
|
|
93
|
+
/** Start an analysis (same as the desktop buttons). */
|
|
94
|
+
run(job: 'birdnet' | 'birdbox'): void;
|
|
95
|
+
}
|
|
96
|
+
type Screen = 'recordings' | 'queue' | 'review' | 'analyse' | 'live' | 'species';
|
|
97
|
+
export declare function fmtClock(sec: number, tenths?: boolean): string;
|
|
98
|
+
/** „today 05:42“, „yesterday 20:15“, „14 Nov 06:10“ (older years with the year). */
|
|
99
|
+
export declare function fmtWhen(r: {
|
|
100
|
+
date?: string | null;
|
|
101
|
+
time?: string | null;
|
|
102
|
+
addedAt?: string | null;
|
|
103
|
+
}, now?: Date): string;
|
|
104
|
+
/** Review state of one recording's labels: detections, which are confirmed (copied into own labels), which are open. */
|
|
105
|
+
export declare function reviewState(labels: any[], isOwn: (l: any) => boolean): {
|
|
106
|
+
adopted: Set<string>;
|
|
107
|
+
detections: any[];
|
|
108
|
+
open: any[];
|
|
109
|
+
};
|
|
110
|
+
export declare class MobileApp {
|
|
111
|
+
private h;
|
|
112
|
+
private mql;
|
|
113
|
+
private active;
|
|
114
|
+
private screen;
|
|
115
|
+
private root;
|
|
116
|
+
private screens;
|
|
117
|
+
private navBtns;
|
|
118
|
+
private navBadge;
|
|
119
|
+
private recList;
|
|
120
|
+
private rvTitle;
|
|
121
|
+
private rvSub;
|
|
122
|
+
private playerSlot;
|
|
123
|
+
private timeCur;
|
|
124
|
+
private timeDur;
|
|
125
|
+
private playBtn;
|
|
126
|
+
private rateBtn;
|
|
127
|
+
private loopBtn;
|
|
128
|
+
private detHead;
|
|
129
|
+
private detList;
|
|
130
|
+
private currentDetId;
|
|
131
|
+
private rvFilter;
|
|
132
|
+
private rvChips;
|
|
133
|
+
/** Where the review screen was opened from (back button + highlighted nav tab). */
|
|
134
|
+
private rvFrom;
|
|
135
|
+
private qList;
|
|
136
|
+
private qHead;
|
|
137
|
+
private snack;
|
|
138
|
+
private newMenu;
|
|
139
|
+
private xcInput;
|
|
140
|
+
/** Thumbnails being rendered in the background (ids), and ones that failed. */
|
|
141
|
+
private thumbBusy;
|
|
142
|
+
private swipedAt;
|
|
143
|
+
private thumbFailed;
|
|
144
|
+
private snackTimer;
|
|
145
|
+
private rvProgress;
|
|
146
|
+
/** Analyse the next recording that gets loaded (after „Neu“ or Live). */
|
|
147
|
+
private autoAnalyse;
|
|
148
|
+
private loopSeg;
|
|
149
|
+
private spList;
|
|
150
|
+
private spSearch;
|
|
151
|
+
private spChips;
|
|
152
|
+
private spSortBtn;
|
|
153
|
+
private spMeta;
|
|
154
|
+
private spFilter;
|
|
155
|
+
private spSort;
|
|
156
|
+
private spOpen;
|
|
157
|
+
private anSub;
|
|
158
|
+
private anProgress;
|
|
159
|
+
private anProgressText;
|
|
160
|
+
private anProgressBar;
|
|
161
|
+
private anBirdnet;
|
|
162
|
+
private anBirdbox;
|
|
163
|
+
private anGeo;
|
|
164
|
+
private anGeoRow;
|
|
165
|
+
private anLocation;
|
|
166
|
+
private anConf;
|
|
167
|
+
private anConfVal;
|
|
168
|
+
private anRun;
|
|
169
|
+
private anExpert;
|
|
170
|
+
private anBackTo;
|
|
171
|
+
private anJob;
|
|
172
|
+
private anJobStarted;
|
|
173
|
+
private anJobAt;
|
|
174
|
+
private lvSpec;
|
|
175
|
+
private lvMeter;
|
|
176
|
+
private lvInfo;
|
|
177
|
+
private lvList;
|
|
178
|
+
private lvTime;
|
|
179
|
+
private lvBtn;
|
|
180
|
+
private lvDiscard;
|
|
181
|
+
private lvRec;
|
|
182
|
+
private lvView;
|
|
183
|
+
private lvSpecies;
|
|
184
|
+
private lvBusy;
|
|
185
|
+
private lvRaf;
|
|
186
|
+
private lvTick;
|
|
187
|
+
private playerHome;
|
|
188
|
+
private raf;
|
|
189
|
+
/** A recording was loaded while the player was hidden: fit the time span once it shows. */
|
|
190
|
+
private needsFit;
|
|
191
|
+
constructor(host: MobileAppHost);
|
|
192
|
+
get isActive(): boolean;
|
|
193
|
+
/** Re-render lists after labels or recordings changed. */
|
|
194
|
+
refresh(): void;
|
|
195
|
+
private applyMode;
|
|
196
|
+
/** Show VIEW_SEC seconds around the playhead (or all of a shorter recording). */
|
|
197
|
+
private fitTime;
|
|
198
|
+
private mountPlayer;
|
|
199
|
+
private unmountPlayer;
|
|
200
|
+
private resizePlayer;
|
|
201
|
+
show(screen: Screen): void;
|
|
202
|
+
private buildRecordings;
|
|
203
|
+
/** „New“: audio file, Xeno-canto or microphone (Live). */
|
|
204
|
+
private buildNewMenu;
|
|
205
|
+
private toggleNewMenu;
|
|
206
|
+
private renderRecordings;
|
|
207
|
+
/** Render the thumbnail of the open recording from the player's decoded audio. */
|
|
208
|
+
private thumbActive;
|
|
209
|
+
/** Background: render one missing thumbnail at a time (recordings that were never opened here). */
|
|
210
|
+
private thumbNext;
|
|
211
|
+
private get isOwn();
|
|
212
|
+
/** Open detections over all recordings (nav badge). */
|
|
213
|
+
private openTotal;
|
|
214
|
+
private buildQueue;
|
|
215
|
+
/** Open detections grouped by recording, then species (most open first). */
|
|
216
|
+
private renderQueue;
|
|
217
|
+
/** Open a recording in the review screen, optionally at one detection. */
|
|
218
|
+
private openReview;
|
|
219
|
+
private speciesImg;
|
|
220
|
+
private buildReview;
|
|
221
|
+
private renderReview;
|
|
222
|
+
private detCard;
|
|
223
|
+
/** Swipe right = accept, left = discard (horizontal drags only; vertical scrolling stays). */
|
|
224
|
+
private swipeable;
|
|
225
|
+
/** The open detection after `lbl` (by time), for „weiter zum nächsten“. */
|
|
226
|
+
private nextOpen;
|
|
227
|
+
/** Re-render and go on with the next open detection (or stop when none is left). */
|
|
228
|
+
private afterDecision;
|
|
229
|
+
private accept;
|
|
230
|
+
private unaccept;
|
|
231
|
+
private discard;
|
|
232
|
+
private activeRecId;
|
|
233
|
+
/** Short message above the nav, with an optional undo; the undo only applies to the recording it was made in. */
|
|
234
|
+
private toast;
|
|
235
|
+
private playLabel;
|
|
236
|
+
/** Highlight the card under the playhead (or the last tapped one). */
|
|
237
|
+
private markCurrent;
|
|
238
|
+
private togglePlay;
|
|
239
|
+
private skip;
|
|
240
|
+
private cycleRate;
|
|
241
|
+
private toggleLoop;
|
|
242
|
+
private startTicker;
|
|
243
|
+
private stopTicker;
|
|
244
|
+
private buildSpecies;
|
|
245
|
+
/** Species across all recordings: confirmed (own labels) and detected (everything else). */
|
|
246
|
+
private collectSpecies;
|
|
247
|
+
private renderSpecies;
|
|
248
|
+
/** Play one example; opens its recording first if needed (stays on the species screen). */
|
|
249
|
+
private playExample;
|
|
250
|
+
openAnalyse(from: Screen): void;
|
|
251
|
+
private buildAnalyse;
|
|
252
|
+
private buildExpert;
|
|
253
|
+
private toggleRow;
|
|
254
|
+
private switchInput;
|
|
255
|
+
private mirrorCheckbox;
|
|
256
|
+
/** Pull the current values from the desktop controls into the phone screen. */
|
|
257
|
+
private renderAnalyse;
|
|
258
|
+
/** Analyse the active recording with the current settings and show it in the review screen. */
|
|
259
|
+
private analyseNow;
|
|
260
|
+
private runAnalysis;
|
|
261
|
+
private startJob;
|
|
262
|
+
private jobRunning;
|
|
263
|
+
/** Follow the running job (called from the ticker). */
|
|
264
|
+
private tickAnalyse;
|
|
265
|
+
private buildLive;
|
|
266
|
+
private renderLive;
|
|
267
|
+
private ago;
|
|
268
|
+
private startLive;
|
|
269
|
+
/** Ends the live recording; `keep` adds it to the project and opens it. */
|
|
270
|
+
private stopLive;
|
|
271
|
+
}
|
|
272
|
+
export {};
|