@touchcastllc/napster-companion-api-dev 2.1.0-alpha.7 → 2.1.0-alpha.9

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.
@@ -201,7 +201,6 @@ export interface FeatureConfig {
201
201
  enabled: boolean;
202
202
  /** Optional text shown when the disclaimer is enabled. */
203
203
  text?: string;
204
- color?: string;
205
204
  };
206
205
  /** Document Picture-in-Picture. When enabled, the avatar automatically
207
206
  * opens in a PiP window when the user switches browser tabs (Chrome/Edge 116+). */
@@ -257,6 +256,10 @@ export interface StyleConfig {
257
256
  * photo bubble's own ring. Does NOT affect the muted-mic button (a fixed
258
257
  * warning color, not brand-tied) or `persistence.navigationProgress`'s
259
258
  * own color (set separately — see {@link NavigationProgressOptions}).
259
+ *
260
+ * Text and icons on the accent are white or black, whichever contrasts
261
+ * more with it, so any accent stays readable (WCAG 1.4.3). The SDK picks
262
+ * them; they can't be set.
260
263
  */
261
264
  accentColor?: string;
262
265
  /** CSS class name(s) added to the SDK root container. Useful for theming. */
@@ -0,0 +1,43 @@
1
+ /**
2
+ * `style.accentColor` is the background of text and icons: the mic button,
3
+ * the "I'm here" and microphone-card buttons, the no-photo bubble. The SDK,
4
+ * not the integrator, picks white or black for them, whichever contrasts
5
+ * more with the accent — at least 4.58:1 for any colour (CA-1278).
6
+ *
7
+ * Everything reaches CSS as custom properties on the root, each with a
8
+ * fallback in the stylesheets that reproduces the default accent:
9
+ * --np-accent-color the accent itself
10
+ * --np-accent-text #ffffff or #000000
11
+ * --np-accent-hover the hover background
12
+ * --np-accent-glyph-filter turns the white no-photo glyph black
13
+ * --np-accent-shade end of the mic button's darkening gradient;
14
+ * transparent under a black icon, where
15
+ * darkening would take it below 4.5:1
16
+ */
17
+ export type Rgb = [number, number, number];
18
+ declare const WHITE = "#ffffff";
19
+ declare const BLACK = "#000000";
20
+ /** White or black, whichever has the higher WCAG contrast; white on a tie. */
21
+ export declare function accentTextColor(rgb: Rgb): typeof WHITE | typeof BLACK;
22
+ /**
23
+ * The hover background: 15% away from the text colour — darker under white
24
+ * text, lighter under black — so hovering only ever raises the contrast.
25
+ * For the default accent this is the old `color-mix(… 85%, black)`.
26
+ */
27
+ export declare function accentHoverColor(rgb: Rgb): string;
28
+ /**
29
+ * Any CSS colour string as sRGB, the way the browser draws it (hex, rgb(),
30
+ * hsl(), oklch(), names…), or null if it isn't a colour. A canvas, not
31
+ * getComputedStyle, because computed colours keep their own space
32
+ * (`oklch(…)` stays `oklch(…)`).
33
+ */
34
+ export declare function parseCssColor(css: string): Rgb | null;
35
+ /**
36
+ * Sets the accent and the colours derived from it on `el`. When the accent
37
+ * can't be read, the derived ones are removed and the stylesheets'
38
+ * defaults (white text, darker hover) apply.
39
+ */
40
+ export declare function applyAccentColor(el: HTMLElement, accent: string, parse?: (css: string) => Rgb | null): void;
41
+ /** Copies the accent and its derived colours from one element to another. */
42
+ export declare function copyAccentColor(from: HTMLElement, to: HTMLElement): void;
43
+ export {};
@@ -0,0 +1,24 @@
1
+ /**
2
+ * CA-1240 — a fixed widget is sized in CSS pixels, so zooming the page grows
3
+ * it with everything else: at 400% it covered most of a 320px-wide window
4
+ * and the page controls under it (WCAG 2.4.11, 1.4.10). Past 40% of the
5
+ * window's width the widget stops growing: it is scaled down as a whole —
6
+ * buttons, text and cards alike — so its layout never changes, only its
7
+ * drawn size.
8
+ *
9
+ * The factor goes on the root as `--np-fit-scale`; App.css applies it with
10
+ * `scale`, anchored on the corner the widget is docked to. Nothing is set
11
+ * while the widget fits, in inline layout (the host sizes the container),
12
+ * or on touch devices: a phone is narrow at 100% zoom, and shrinking the
13
+ * buttons there would only make them harder to tap.
14
+ */
15
+ /** The widest a fixed widget may be, as a share of the window's width. */
16
+ export declare const MAX_WINDOW_SHARE = 0.4;
17
+ export interface FixedFitScale {
18
+ /** Measure again now. */
19
+ check(): void;
20
+ destroy(): void;
21
+ }
22
+ /** The scale that keeps a `widgetWidth` widget within its share of the window. */
23
+ export declare function fitScale(widgetWidth: number, windowWidth: number): number;
24
+ export declare function createFixedFitScale(root: HTMLElement): FixedFitScale;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * How much smaller (or larger) `el` is drawn than it is laid out: the fixed
3
+ * widget is scaled down in a narrow window (fixedFitScale.ts, CA-1240).
4
+ * getBoundingClientRect() reports drawn sizes, CSS lengths are layout sizes —
5
+ * divide a rect-derived number by this before writing it into a style.
6
+ * 1 while nothing is laid out.
7
+ */
8
+ export declare function layoutScale(el: HTMLElement): number;
@@ -12,5 +12,10 @@
12
12
  *
13
13
  * The selection is moved to the start of the button's control group, or just
14
14
  * before a button that has none, so Tab reaches the first control.
15
+ *
16
+ * The listener is on the document, not on the root: a click listener on an
17
+ * element makes VoiceOver announce everything inside it as "clickable" —
18
+ * the video and the "Avatar is ready" text included (found live, Safari and
19
+ * Firefox). Returns the function that removes it.
15
20
  */
16
- export declare function guardTabStart(root: HTMLElement): void;
21
+ export declare function guardTabStart(root: HTMLElement): () => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@touchcastllc/napster-companion-api-dev",
3
- "version": "2.1.0-alpha.7",
3
+ "version": "2.1.0-alpha.9",
4
4
  "keywords": [
5
5
  "napster",
6
6
  "companion-api",