@mintplayer/web-components 2.11.0 → 2.13.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.
@@ -1,19 +1,23 @@
1
- import { a as e, b as r, c as o, d as i, e as l, l as c, p as t, f as n, r as b, s as f, g as p } from "../../chunks/color-5yPBn70k.mjs";
2
- import { l as m, n as L, a as T, t as d } from "../../chunks/scale-B0bRUdc7.mjs";
1
+ import { a as e, b as t, c as r, d as i, e as o, f as l, g as c, h as n, l as f, p as m, i as p, r as u, j as b, s as L, k as T } from "../../chunks/color-DIeST-IS.mjs";
2
+ import { l as x, n as d, a as k, t as v } from "../../chunks/scale-B0bRUdc7.mjs";
3
3
  export {
4
4
  e as arcLabelTransform,
5
- r as arcLabelVisible,
6
- o as arcPath,
7
- i as buildIndex,
8
- l as colorScale,
9
- c as levelOf,
10
- m as linearScale,
11
- L as niceDomain,
12
- T as niceTicks,
13
- t as partitionLayout,
14
- n as pathTo,
5
+ t as arcPath,
6
+ r as buildIndex,
7
+ i as colorScale,
8
+ o as composite,
9
+ l as contrastText,
10
+ c as fitArcLabel,
11
+ n as fitCellLabel,
12
+ f as levelOf,
13
+ x as linearScale,
14
+ d as niceDomain,
15
+ k as niceTicks,
16
+ m as partitionLayout,
17
+ p as pathTo,
18
+ u as relativeLuminance,
15
19
  b as resolveFocus,
16
- f as squarifyLayout,
17
- p as subtreeDepth,
18
- d as timeTicks
20
+ L as squarifyLayout,
21
+ T as subtreeDepth,
22
+ v as timeTicks
19
23
  };
@@ -19,10 +19,9 @@ export interface ArcOptions {
19
19
  }
20
20
  export declare function arcPath(cx: number, cy: number, r0: number, r1: number, a0: number, a1: number, options?: ArcOptions): string;
21
21
  /**
22
- * Sunburst label placement: translate to the arc's radial midpoint and rotate
23
- * to read along the radius, flipping on the lower half so text is never
24
- * upside-down (Observable's transform).
22
+ * Sunburst label placement: translate to the arc's radial midpoint, then
23
+ * rotate to read along the radius (radial, Observable's transform) or along
24
+ * the chord (tangential), flipping on the half where the text would otherwise
25
+ * be upside-down. Orientation is chosen by fitArcLabel (label-fit.ts).
25
26
  */
26
- export declare function arcLabelTransform(x0: number, x1: number, rMid: number): string;
27
- /** Observable's area threshold: label only arcs whose (rings × sweep-fraction) area clears it. */
28
- export declare function arcLabelVisible(x0: number, x1: number, rings: number, minArea?: number): boolean;
27
+ export declare function arcLabelTransform(x0: number, x1: number, rMid: number, orientation?: 'radial' | 'tangential'): string;
@@ -1,7 +1,9 @@
1
1
  /**
2
2
  * Two-stop clamped HSL color scale (codecov's coverage ramp: a long-way hue
3
- * sweep red -> green with yellow in the middle, clamped outside the domain).
4
- * Accepts #rgb/#rrggbb and rgb(r, g, b) stops.
3
+ * sweep red -> green with yellow in the middle, clamped outside the domain),
4
+ * plus the WCAG contrast math the hierarchy chart's label coloring rides on.
5
+ * Accepts #rgb/#rrggbb, rgb(r, g, b) and hsl(h, s%, l%) colors — the forms
6
+ * this module itself emits, plus what browsers report as computed values.
5
7
  */
6
8
  /**
7
9
  * Returns v -> "hsl(...)" mapping [min, max] onto [from, to], clamped outside.
@@ -9,3 +11,20 @@
9
11
  * interpolateHslLong behaviour, which is what produces red->yellow->green).
10
12
  */
11
13
  export declare function colorScale(min: number, max: number, from: string, to: string): (value: number) => string;
14
+ /**
15
+ * WCAG 2.x relative luminance (0 = black, 1 = white).
16
+ * Returns undefined for colors the parser does not understand (named colors,
17
+ * var() references, gradients) — callers fall back to a backdrop-based pick.
18
+ */
19
+ export declare function relativeLuminance(color: string): number | undefined;
20
+ /**
21
+ * Source-over compositing of a translucent fill onto an opaque backdrop —
22
+ * the effective surface a .6-opacity leaf arc actually presents under a label.
23
+ */
24
+ export declare function composite(fg: string, bg: string, alpha: number): string | undefined;
25
+ /**
26
+ * Which text tone contrasts better with the given surface: 'dark' text (for
27
+ * light surfaces) or 'light' text (for dark surfaces), by comparing WCAG
28
+ * contrast ratios against black and white. undefined when unparseable.
29
+ */
30
+ export declare function contrastText(surface: string): 'dark' | 'light' | undefined;
@@ -1,5 +1,6 @@
1
1
  export * from './types';
2
2
  export * from './hierarchy-layout';
3
3
  export * from './arc';
4
+ export * from './label-fit';
4
5
  export * from './scale';
5
6
  export * from './color';
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Label fitting for chart nodes — pure arithmetic, no text measurement (jsdom
3
+ * has neither SVG geometry APIs nor a 2D canvas context). Char advance is
4
+ * estimated at 0.6 x font-size; extreme strings ("iiii" vs "WWWW") misjudge by
5
+ * a few characters at worst, and the failure mode is a slightly early
6
+ * truncation or suppression — never overflow into a neighbouring node.
7
+ *
8
+ * All geometry is in device px: the caller converts from layout units using
9
+ * its rendered size, so the same font-size threshold holds at every host size.
10
+ */
11
+ export type ArcLabelOrientation = 'radial' | 'tangential';
12
+ export interface ArcLabelFit {
13
+ visible: boolean;
14
+ /** The (possibly ellipsis-truncated) text to render; '' when not visible. */
15
+ text: string;
16
+ /** The orientation that fits more characters (tangential wins ties). */
17
+ orientation: ArcLabelOrientation;
18
+ }
19
+ /**
20
+ * Fit a label into an annular sector. Radial text runs along the radius
21
+ * (advance limited by ring thickness, line height by the arc length at the
22
+ * label radius); tangential text runs along the chord (advance limited by
23
+ * chord and arc length, line height by ring thickness). Returns whichever
24
+ * orientation places more characters.
25
+ */
26
+ export declare function fitArcLabel(name: string, sweepRad: number, r0Px: number, r1Px: number, fontPx: number): ArcLabelFit;
27
+ /**
28
+ * Fit gate for a cartesian cell (icicle/treemap). Truncation is left to the
29
+ * cell's CSS ellipsis; this only decides whether a label is worth rendering.
30
+ */
31
+ export declare function fitCellLabel(widthPx: number, heightPx: number, fontPx: number): boolean;