Methods
(static) colorToHSV(color) → {Object}
Converts a CSS color string (hex or rgb()) to HSV components.
Parameters:
| Name | Type | Description |
|---|---|---|
color | string | A hex color ('#rgb', '#rrggbb') or 'rgb(r, g, b)' string |
- Source
Returns:
Hue 0–360, saturation 0–1, value 0–1
- Type:
- Object
(static) farthestAngle(angles) → {number}
Finds the angle (in degrees) that is farthest from all given angles on a circular 0–360 scale. Works by locating the largest arc gap between the sorted input angles and returning its midpoint. - Zero angles: returns a random angle. - One angle: returns the opposite (180° away). - Multiple angles: returns the midpoint of the largest gap.
Parameters:
| Name | Type | Description |
|---|---|---|
angles | Array.<number> | Array of angles in degrees (0–360) |
- Source
Returns:
The angle farthest from all inputs, in degrees (0–360)
- Type:
- number
(static) farthestColor(colors) → {string}
Finds the color farthest from all others, considering only hue.
Parameters:
| Name | Type | Description |
|---|---|---|
colors | Array.<string> | Array of CSS color strings (hex, rgb, hsl, named) |
- Source
Returns:
- The color that is farthest from all others
- Type:
- string
(static) formatTime(s) → {string}
Formats a time in seconds as "H:MM:SS" (always includes hours).
Parameters:
| Name | Type | Description |
|---|---|---|
s | number | seconds |
- Source
Returns:
e.g. "0:01:05"
- Type:
- string
(static) formatTimeMs(s) → {string}
Formats a time in seconds as "H:MM:SS.S" (always includes hours, one decimal second). Used for timecode display and split popup labels.
Parameters:
| Name | Type | Description |
|---|---|---|
s | number | seconds |
- Source
Returns:
e.g. "0:01:05.3"
- Type:
- string
(static) generateId() → {string}
Generates a locally-unique project id. Format: "local_" + base-36 timestamp + 4 random base-36 chars. Collision probability is negligible for typical usage.
- Source
Returns:
- Type:
- string
(static) hexToHue(hex) → {number}
Extracts the hue angle (0–360) from a hex color string. Used to position the cursor in the hue picker at the color's current hue.
Parameters:
| Name | Type | Description |
|---|---|---|
hex | string | e.g. '#47c8ff' or '47c8ff' |
- Source
Returns:
hue in degrees
- Type:
- number
(static) hexToRgb(hex) → {Object}
Parses a 6-digit hex color string into separate R, G, B integer components.
Parameters:
| Name | Type | Description |
|---|---|---|
hex | string | e.g. '#47c8ff' or '47c8ff' |
- Source
Returns:
- Type:
- Object
(static) hslToHex(h, s, l) → {string}
Converts HSL color values to a 6-digit hex string. Uses the standard HSL → RGB algorithm.
Parameters:
| Name | Type | Description |
|---|---|---|
h | number | hue in degrees 0–360 |
s | number | saturation 0–100 |
l | number | lightness 0–100 |
- Source
Returns:
e.g. '#47c8ff'
- Type:
- string
(static) mergeSegmentsToSentences(segments) → {Array.<object>}
Merges a flat array of Whisper segments (arbitrary audio chunks) into sentence-like units. Flushes the accumulator on: - speaker change - gap ≥ GAP_THRESHOLD between segments - accumulated text ending with sentence-final punctuation (.?!) Used as a transitional shim when loading legacy CSV transcripts.
Parameters:
| Name | Type | Description |
|---|---|---|
segments | Array.<object> | flat segments from parseCSV |
- Source
Returns:
merged sentence-like segments
- Type:
- Array.<object>
(static) parseCSV(text) → {Array.<{start: number, end: number, speaker: string, text: string}>}
Parses a CSV string in the format: start,end,speaker,text Implements RFC 4180 field quoting: quoted fields may contain commas, newlines, and escaped double quotes ("" → "). The header row is skipped; rows with fewer than 4 columns are ignored.
Parameters:
| Name | Type | Description |
|---|---|---|
text | string | raw CSV string |
- Source
Returns:
- Type:
- Array.<{start: number, end: number, speaker: string, text: string}>
(static) parseTranscriptJSON(json) → {Array.<{start: number, end: number, speaker: string, text: string, words: Array.<object>}>}
Flattens a transcript JSON object (paragraphs > sentences > words) into a flat segments array compatible with the Transcript class. Each segment gains a `words` array for word-level playback highlighting.
Parameters:
| Name | Type | Description |
|---|---|---|
json | object | transcript JSON with a `paragraphs` array |
- Source
Returns:
- Type:
- Array.<{start: number, end: number, speaker: string, text: string, words: Array.<object>}>
(static) roundRectCorners(ctx, x, y, w, h, radii)
Draws a rounded rectangle path on a 2D canvas context with independent corner radii. Each radius is clamped to half the shorter dimension to prevent over-rounding artefacts.
Parameters:
| Name | Type | Description |
|---|---|---|
ctx | CanvasRenderingContext2D | canvas rendering context to draw on |
x | number | x coordinate of the rectangle's top-left corner |
y | number | y coordinate of the rectangle's top-left corner |
w | number | width |
h | number | height |
radii | Array.<number> | Corner radii [top-left, top-right, bottom-right, bottom-left] |
- Source