@refraction-ui/react 0.12.3 → 0.14.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 (75) hide show
  1. package/dist/index.cjs +4285 -10
  2. package/dist/index.cjs.map +1 -1
  3. package/dist/index.d.cts +28 -0
  4. package/dist/index.d.ts +28 -0
  5. package/dist/index.js +4238 -11
  6. package/dist/index.js.map +1 -1
  7. package/dist/internal/audio-room/index.d.ts +91 -0
  8. package/dist/internal/call-controls/index.d.ts +83 -0
  9. package/dist/internal/checklist/index.d.ts +84 -0
  10. package/dist/internal/editor-status-bar/index.d.ts +70 -0
  11. package/dist/internal/editor-tabs/index.d.ts +68 -0
  12. package/dist/internal/empty-state/index.d.cts +39 -0
  13. package/dist/internal/empty-state/index.d.ts +39 -0
  14. package/dist/internal/floating-reactions/index.d.ts +98 -0
  15. package/dist/internal/flow-editor/index.d.ts +91 -0
  16. package/dist/internal/graph-view/index.d.ts +107 -0
  17. package/dist/internal/infinite-canvas/index.d.ts +74 -0
  18. package/dist/internal/input/index.d.cts +19 -1
  19. package/dist/internal/input/index.d.ts +19 -1
  20. package/dist/internal/live-captions/index.d.ts +59 -0
  21. package/dist/internal/live-cursors/index.d.ts +65 -0
  22. package/dist/internal/live-transcript/index.d.ts +73 -0
  23. package/dist/internal/mini-map/index.d.ts +81 -0
  24. package/dist/internal/pre-call-lobby/index.d.ts +97 -0
  25. package/dist/internal/radial-gauge/index.d.ts +120 -0
  26. package/dist/internal/rating-scale/index.d.ts +76 -0
  27. package/dist/internal/react-audio-room/index.d.ts +39 -0
  28. package/dist/internal/react-call-controls/index.d.ts +44 -0
  29. package/dist/internal/react-checklist/index.d.ts +27 -0
  30. package/dist/internal/react-editor-status-bar/index.d.ts +43 -0
  31. package/dist/internal/react-editor-tabs/index.d.ts +25 -0
  32. package/dist/internal/react-empty-state/index.d.cts +36 -0
  33. package/dist/internal/react-empty-state/index.d.ts +36 -0
  34. package/dist/internal/react-floating-reactions/index.d.ts +65 -0
  35. package/dist/internal/react-flow-editor/index.d.ts +35 -0
  36. package/dist/internal/react-graph-view/index.d.ts +25 -0
  37. package/dist/internal/react-infinite-canvas/index.d.ts +40 -0
  38. package/dist/internal/react-input/index.d.cts +16 -0
  39. package/dist/internal/react-input/index.d.ts +16 -0
  40. package/dist/internal/react-live-captions/index.d.ts +29 -0
  41. package/dist/internal/react-live-cursors/index.d.ts +42 -0
  42. package/dist/internal/react-live-transcript/index.d.ts +22 -0
  43. package/dist/internal/react-mini-map/index.d.ts +35 -0
  44. package/dist/internal/react-password-input/index.d.cts +26 -0
  45. package/dist/internal/react-password-input/index.d.ts +26 -0
  46. package/dist/internal/react-pre-call-lobby/index.d.ts +47 -0
  47. package/dist/internal/react-radial-gauge/index.d.ts +43 -0
  48. package/dist/internal/react-rating-scale/index.d.ts +38 -0
  49. package/dist/internal/react-segmented-control/index.d.cts +38 -0
  50. package/dist/internal/react-segmented-control/index.d.ts +38 -0
  51. package/dist/internal/react-separator/index.d.cts +29 -0
  52. package/dist/internal/react-separator/index.d.ts +29 -0
  53. package/dist/internal/react-social-auth-button/index.d.cts +31 -0
  54. package/dist/internal/react-social-auth-button/index.d.ts +31 -0
  55. package/dist/internal/react-sticky-note/index.d.ts +39 -0
  56. package/dist/internal/react-terminal/index.d.ts +39 -0
  57. package/dist/internal/react-test-results/index.d.ts +21 -0
  58. package/dist/internal/react-timeline/index.d.ts +35 -0
  59. package/dist/internal/react-video-grid/index.d.ts +33 -0
  60. package/dist/internal/react-video-tile/index.d.ts +41 -0
  61. package/dist/internal/react-wizard/index.d.ts +59 -0
  62. package/dist/internal/segmented-control/index.d.cts +56 -0
  63. package/dist/internal/segmented-control/index.d.ts +56 -0
  64. package/dist/internal/separator/index.d.cts +55 -0
  65. package/dist/internal/separator/index.d.ts +55 -0
  66. package/dist/internal/social-auth-button/index.d.cts +47 -0
  67. package/dist/internal/social-auth-button/index.d.ts +47 -0
  68. package/dist/internal/sticky-note/index.d.ts +49 -0
  69. package/dist/internal/terminal/index.d.ts +65 -0
  70. package/dist/internal/test-results/index.d.ts +97 -0
  71. package/dist/internal/timeline/index.d.ts +111 -0
  72. package/dist/internal/video-grid/index.d.ts +83 -0
  73. package/dist/internal/video-tile/index.d.ts +88 -0
  74. package/dist/internal/wizard/index.d.ts +148 -0
  75. package/package.json +48 -20
@@ -0,0 +1,107 @@
1
+ /** Visual mastery state of a node in the knowledge graph. */
2
+ type GraphNodeState = 'mastered' | 'in-progress' | 'not-started' | 'highlight';
3
+ /** A concept node in the knowledge / dependency graph. */
4
+ interface GraphNode {
5
+ /** Unique identifier. */
6
+ id: string;
7
+ /** X position in the graph canvas (pixels). */
8
+ x: number;
9
+ /** Y position in the graph canvas (pixels). */
10
+ y: number;
11
+ /** Human-readable label shown in the node chip. */
12
+ label: string;
13
+ /** Visual mastery state. Defaults to `'not-started'`. */
14
+ state?: GraphNodeState;
15
+ }
16
+ /** A directed edge connecting two nodes. */
17
+ interface GraphEdge {
18
+ /** Unique identifier. */
19
+ id: string;
20
+ /** ID of the source node. */
21
+ source: string;
22
+ /** ID of the target node. */
23
+ target: string;
24
+ }
25
+ /** Axis-aligned bounding box of a set of nodes. */
26
+ interface GraphBounds {
27
+ minX: number;
28
+ minY: number;
29
+ maxX: number;
30
+ maxY: number;
31
+ width: number;
32
+ height: number;
33
+ }
34
+ /** Per-state counts returned by {@link summarizeStates}. */
35
+ type GraphStateSummary = Record<GraphNodeState, number>;
36
+ interface GraphViewAPI {
37
+ /** ARIA/role attributes to spread on the graph container. */
38
+ ariaProps: {
39
+ role: string;
40
+ 'aria-label': string;
41
+ };
42
+ /** Data attributes for styling hooks. */
43
+ dataAttributes: Record<string, string>;
44
+ }
45
+ /**
46
+ * Build framework-agnostic container props for a GraphView.
47
+ *
48
+ * The graph is a read-only knowledge / dependency visualisation. It uses
49
+ * `role="group"` (not `role="img"`) so that interactive node chips inside it
50
+ * remain in the accessibility tree and keyboard reachable.
51
+ */
52
+ declare function createGraphView(): GraphViewAPI;
53
+ /**
54
+ * Look up a node by id. Returns `undefined` when not found.
55
+ */
56
+ declare function nodeById(nodes: GraphNode[], id: string): GraphNode | undefined;
57
+ /**
58
+ * Build an SVG cubic-bezier path `d` string between two node positions.
59
+ *
60
+ * The control points bend the curve vertically so edges arc gracefully between
61
+ * horizontally or vertically offset nodes. Works for any pair of positions.
62
+ */
63
+ declare function graphEdgePath(source: GraphNode, target: GraphNode): string;
64
+ /**
65
+ * Compute the axis-aligned bounding box of a set of nodes.
66
+ *
67
+ * Returns zero-area bounds centred at the origin when the array is empty.
68
+ */
69
+ declare function graphBounds(nodes: GraphNode[]): GraphBounds;
70
+ /**
71
+ * Count nodes per mastery state.
72
+ *
73
+ * Nodes without an explicit `state` are counted as `'not-started'`.
74
+ */
75
+ declare function summarizeStates(nodes: GraphNode[]): GraphStateSummary;
76
+
77
+ /** Outer wrapper for the graph canvas area. */
78
+ declare const graphViewVariants: (props?: ({} & {
79
+ className?: string;
80
+ }) | undefined) => string;
81
+ /**
82
+ * Node chip: a positioned, clickable concept node colored by mastery state.
83
+ *
84
+ * `state` variant drives the visual treatment:
85
+ * - mastered → filled primary (bg-primary / text-primary-foreground)
86
+ * - in-progress → accent ring (ring-2 ring-ring bg-accent text-accent-foreground)
87
+ * - not-started → muted (bg-muted text-muted-foreground)
88
+ * - highlight → border-primary accent outline (border-primary bg-background text-foreground)
89
+ */
90
+ declare const graphNodeVariants: (props?: ({
91
+ state?: "mastered" | "in-progress" | "not-started" | "highlight" | undefined;
92
+ interactive?: "true" | "false" | undefined;
93
+ } & {
94
+ className?: string;
95
+ }) | undefined) => string;
96
+ /** Label text rendered inside each node chip (already embedded in the chip). */
97
+ declare const graphNodeLabelClass = "pointer-events-none whitespace-nowrap";
98
+ /** SVG edge line/path classes. */
99
+ declare const graphEdgeClass = "fill-none stroke-border stroke-[1.5] opacity-60";
100
+ /** Legend chip: a small colored indicator + label for a single mastery state. */
101
+ declare const graphLegendChipVariants: (props?: ({
102
+ state?: "mastered" | "in-progress" | "not-started" | "highlight" | undefined;
103
+ } & {
104
+ className?: string;
105
+ }) | undefined) => string;
106
+
107
+ export { type GraphBounds, type GraphEdge, type GraphNode, type GraphNodeState, type GraphStateSummary, type GraphViewAPI, createGraphView, graphBounds, graphEdgeClass, graphEdgePath, graphLegendChipVariants, graphNodeLabelClass, graphNodeVariants, graphViewVariants, nodeById, summarizeStates };
@@ -0,0 +1,74 @@
1
+ /** Transform state for an infinite canvas viewport. */
2
+ type CanvasTransform = {
3
+ zoom: number;
4
+ x: number;
5
+ y: number;
6
+ };
7
+ /** Axis-aligned bounding box of canvas content. */
8
+ interface Bounds {
9
+ minX: number;
10
+ minY: number;
11
+ maxX: number;
12
+ maxY: number;
13
+ }
14
+ /**
15
+ * Clamp a zoom level to [min, max].
16
+ *
17
+ * Defaults match common design-tool conventions: 25 % (0.25) to 400 % (4).
18
+ */
19
+ declare function clampZoom(zoom: number, min?: number, max?: number): number;
20
+ /**
21
+ * Compute the transform that centers `bounds` inside a viewport of size
22
+ * `viewportW × viewportH` with optional uniform `padding` (default 32 px).
23
+ *
24
+ * Returns a `CanvasTransform` clamped to [0.25, 4].
25
+ */
26
+ declare function fitTransform(bounds: Bounds, viewportW: number, viewportH: number, padding?: number): CanvasTransform;
27
+ /**
28
+ * Convert a `CanvasTransform` to a CSS `transform` string suitable for the
29
+ * content layer (`transformOrigin: '0 0'`).
30
+ */
31
+ declare function transformToCss(t: CanvasTransform): string;
32
+ interface CreateInfiniteCanvasOptions {
33
+ zoom?: number;
34
+ }
35
+ interface InfiniteCanvasAPI {
36
+ /** ARIA attributes to spread on the viewport element. */
37
+ ariaProps: Record<string, string | number | boolean>;
38
+ /** Data attributes for styling hooks. */
39
+ dataAttributes: Record<string, string | number | boolean>;
40
+ }
41
+ /**
42
+ * Build the framework-agnostic props for an infinite canvas viewport.
43
+ *
44
+ * Returns `role="group"` plus data attributes; adapters spread these onto
45
+ * their container element.
46
+ */
47
+ declare function createInfiniteCanvas(options?: CreateInfiniteCanvasOptions): InfiniteCanvasAPI;
48
+
49
+ /**
50
+ * The outer viewport container. `overflow-hidden` clips panned content;
51
+ * `relative` anchors the absolute controls overlay.
52
+ *
53
+ * The `grid` variant adds a subtle dot-grid background rendered with a radial
54
+ * gradient using the `--border` semantic token so it respects the active theme.
55
+ */
56
+ declare const infiniteCanvasVariants: (props?: ({
57
+ grid?: "true" | "false" | undefined;
58
+ } & {
59
+ className?: string;
60
+ }) | undefined) => string;
61
+ /**
62
+ * The transformed content layer that wraps children.
63
+ * `transform-gpu` promotes the layer for smooth panning/zooming.
64
+ * `origin-top-left` matches `transformOrigin: '0 0'` in the React adapter.
65
+ */
66
+ declare const canvasContentClass = "absolute inset-0 origin-top-left will-change-transform";
67
+ /** Zoom-controls cluster — pinned to the bottom-right of the viewport. */
68
+ declare const canvasControlsClass = "absolute bottom-4 right-4 z-10 flex items-center gap-1";
69
+ /** Individual zoom button (+ / − / fit). */
70
+ declare const canvasZoomButtonVariants: (props?: ({} & {
71
+ className?: string;
72
+ }) | undefined) => string;
73
+
74
+ export { type Bounds, type CanvasTransform, type CreateInfiniteCanvasOptions, type InfiniteCanvasAPI, canvasContentClass, canvasControlsClass, canvasZoomButtonVariants, clampZoom, createInfiniteCanvas, fitTransform, infiniteCanvasVariants, transformToCss };
@@ -1,6 +1,8 @@
1
1
  import { AccessibilityProps } from '../shared/index.cjs';
2
2
 
3
3
  type InputType = 'text' | 'password' | 'email' | 'number' | 'tel' | 'url' | 'search';
4
+ /** High-level validation affordance for an input. */
5
+ type InputValidationState = 'valid' | 'invalid';
4
6
  interface InputProps {
5
7
  type?: InputType;
6
8
  disabled?: boolean;
@@ -8,6 +10,14 @@ interface InputProps {
8
10
  required?: boolean;
9
11
  placeholder?: string;
10
12
  'aria-invalid'?: boolean;
13
+ /**
14
+ * Validation affordance. The core derives `aria-invalid` from this:
15
+ * - `'valid'` → `aria-invalid={false}`
16
+ * - `'invalid'` → `aria-invalid={true}`
17
+ *
18
+ * An explicit `aria-invalid` prop always takes precedence.
19
+ */
20
+ validationState?: InputValidationState;
11
21
  }
12
22
  interface InputAPI {
13
23
  /** ARIA attributes to spread on the element */
@@ -18,6 +28,13 @@ interface InputAPI {
18
28
  /** Data attributes for CSS styling hooks */
19
29
  dataAttributes: Record<string, string>;
20
30
  }
31
+ /**
32
+ * Resolve the effective `aria-invalid` value from an explicit `aria-invalid`
33
+ * prop and a high-level `validationState`. The explicit prop always wins;
34
+ * otherwise `validationState` maps `'invalid' → true`, `'valid' → false`, and
35
+ * an absent state leaves `aria-invalid` undefined (legacy behavior).
36
+ */
37
+ declare function resolveAriaInvalid(ariaInvalid: boolean | undefined, validationState: InputValidationState | undefined): boolean | undefined;
21
38
  declare function createInput(props?: InputProps): InputAPI;
22
39
  declare function getInputAriaProps(state: {
23
40
  disabled?: boolean;
@@ -31,8 +48,9 @@ declare function getInputAriaProps(state: {
31
48
 
32
49
  declare const inputVariants: (props?: ({
33
50
  size?: "sm" | "default" | "lg" | undefined;
51
+ validationState?: "valid" | "invalid" | undefined;
34
52
  } & {
35
53
  className?: string;
36
54
  }) | undefined) => string;
37
55
 
38
- export { type InputAPI, type InputProps, type InputType, createInput, getInputAriaProps, inputVariants };
56
+ export { type InputAPI, type InputProps, type InputType, type InputValidationState, createInput, getInputAriaProps, inputVariants, resolveAriaInvalid };
@@ -1,6 +1,8 @@
1
1
  import { AccessibilityProps } from '../shared/index.js';
2
2
 
3
3
  type InputType = 'text' | 'password' | 'email' | 'number' | 'tel' | 'url' | 'search';
4
+ /** High-level validation affordance for an input. */
5
+ type InputValidationState = 'valid' | 'invalid';
4
6
  interface InputProps {
5
7
  type?: InputType;
6
8
  disabled?: boolean;
@@ -8,6 +10,14 @@ interface InputProps {
8
10
  required?: boolean;
9
11
  placeholder?: string;
10
12
  'aria-invalid'?: boolean;
13
+ /**
14
+ * Validation affordance. The core derives `aria-invalid` from this:
15
+ * - `'valid'` → `aria-invalid={false}`
16
+ * - `'invalid'` → `aria-invalid={true}`
17
+ *
18
+ * An explicit `aria-invalid` prop always takes precedence.
19
+ */
20
+ validationState?: InputValidationState;
11
21
  }
12
22
  interface InputAPI {
13
23
  /** ARIA attributes to spread on the element */
@@ -18,6 +28,13 @@ interface InputAPI {
18
28
  /** Data attributes for CSS styling hooks */
19
29
  dataAttributes: Record<string, string>;
20
30
  }
31
+ /**
32
+ * Resolve the effective `aria-invalid` value from an explicit `aria-invalid`
33
+ * prop and a high-level `validationState`. The explicit prop always wins;
34
+ * otherwise `validationState` maps `'invalid' → true`, `'valid' → false`, and
35
+ * an absent state leaves `aria-invalid` undefined (legacy behavior).
36
+ */
37
+ declare function resolveAriaInvalid(ariaInvalid: boolean | undefined, validationState: InputValidationState | undefined): boolean | undefined;
21
38
  declare function createInput(props?: InputProps): InputAPI;
22
39
  declare function getInputAriaProps(state: {
23
40
  disabled?: boolean;
@@ -31,8 +48,9 @@ declare function getInputAriaProps(state: {
31
48
 
32
49
  declare const inputVariants: (props?: ({
33
50
  size?: "sm" | "default" | "lg" | undefined;
51
+ validationState?: "valid" | "invalid" | undefined;
34
52
  } & {
35
53
  className?: string;
36
54
  }) | undefined) => string;
37
55
 
38
- export { type InputAPI, type InputProps, type InputType, createInput, getInputAriaProps, inputVariants };
56
+ export { type InputAPI, type InputProps, type InputType, type InputValidationState, createInput, getInputAriaProps, inputVariants, resolveAriaInvalid };
@@ -0,0 +1,59 @@
1
+ /** A single caption cue — may be interim (non-final) while speech is in flight. */
2
+ interface CaptionCue {
3
+ /** Unique identifier for this cue. */
4
+ id: string;
5
+ /** Speaker name, shown as a prefix when present. */
6
+ speaker?: string;
7
+ /** The caption text. */
8
+ text: string;
9
+ /** Whether this cue is finalised (true) or still being transcribed (false/absent). */
10
+ final?: boolean;
11
+ }
12
+ /**
13
+ * Return the last `maxLines` cues to display in the caption overlay.
14
+ * Preserves ordering (oldest first within the slice) so the overlay reads top-to-bottom.
15
+ */
16
+ declare function visibleCues(cues: CaptionCue[], maxLines?: number): CaptionCue[];
17
+ /**
18
+ * Format a single cue for display.
19
+ * When `speaker` is present the result is `'Maya: the bottleneck is review capacity'`.
20
+ * Without a speaker it is just the text.
21
+ */
22
+ declare function formatCue(cue: CaptionCue): string;
23
+ interface LiveCaptionsAPI {
24
+ /** ARIA attributes to spread on the caption container element. */
25
+ ariaProps: Record<string, string | number | boolean>;
26
+ /** Data attributes for styling hooks. */
27
+ dataAttributes: Record<string, string>;
28
+ }
29
+ /**
30
+ * Build the framework-agnostic accessibility props for a live-caption overlay.
31
+ *
32
+ * Returns `role="log"` with `aria-live="polite"` and `aria-atomic=false` so
33
+ * screen readers announce individual cues as they arrive without re-reading the
34
+ * whole log. Adapters spread these onto the container element.
35
+ */
36
+ declare function createLiveCaptions(): LiveCaptionsAPI;
37
+
38
+ /**
39
+ * Caption overlay container — an absolute-friendly, translucent dark surface
40
+ * centred over its positioned ancestor (e.g. a video element).
41
+ */
42
+ declare const liveCaptionsVariants: (props?: ({
43
+ position?: "static" | "absolute" | undefined;
44
+ } & {
45
+ className?: string;
46
+ }) | undefined) => string;
47
+ /**
48
+ * A single cue line inside the overlay.
49
+ * Non-final (interim) cues get a dimmed italic treatment to signal they may change.
50
+ */
51
+ declare const liveCaptionsCueVariants: (props?: ({
52
+ interim?: "true" | "false" | undefined;
53
+ } & {
54
+ className?: string;
55
+ }) | undefined) => string;
56
+ /** Speaker-name prefix — rendered slightly muted to distinguish it from the speech text. */
57
+ declare const liveCaptionsSpeakerClass = "font-medium text-muted-foreground";
58
+
59
+ export { type CaptionCue, type LiveCaptionsAPI, createLiveCaptions, formatCue, liveCaptionsCueVariants, liveCaptionsSpeakerClass, liveCaptionsVariants, visibleCues };
@@ -0,0 +1,65 @@
1
+ /** Data for a single collaborator cursor. */
2
+ type CursorData = {
3
+ id: string;
4
+ name: string;
5
+ x: number;
6
+ y: number;
7
+ color?: string;
8
+ };
9
+ /**
10
+ * A fixed palette of 8 hex colors for distinguishing collaborator cursors.
11
+ * Each color is vivid enough to be visible against both light and dark surfaces.
12
+ */
13
+ declare const CURSOR_COLORS: string[];
14
+ /**
15
+ * Assign a stable color to a cursor.
16
+ *
17
+ * When `index` is supplied the color is simply `CURSOR_COLORS[index % length]`
18
+ * (deterministic for ordered participant lists). Otherwise a lightweight
19
+ * djb2-style hash of the `id` string is used so the same id always maps to the
20
+ * same color across renders without using Math.random or Date.now.
21
+ */
22
+ declare function assignCursorColor(id: string, index?: number): string;
23
+ interface LiveCursorsAPI {
24
+ /** ARIA attributes to spread on the overlay container. */
25
+ ariaProps: Record<string, string | number | boolean>;
26
+ /** Data attributes for styling hooks. */
27
+ dataAttributes: Record<string, string>;
28
+ }
29
+ /**
30
+ * Build the framework-agnostic props for the live-cursors overlay.
31
+ *
32
+ * Cursors are purely decorative real-time presence indicators — aria-hidden
33
+ * true keeps them out of the accessibility tree. The group role is present for
34
+ * semantic correctness should a developer choose to un-hide it.
35
+ */
36
+ declare function createLiveCursors(): LiveCursorsAPI;
37
+
38
+ /**
39
+ * Full-bleed overlay that contains all cursor elements.
40
+ * `pointer-events-none` and `overflow-hidden` ensure cursors are decorative
41
+ * and don't interfere with the underlying canvas interactions.
42
+ */
43
+ declare const liveCursorsVariants: (props?: ({
44
+ hidden?: "true" | "false" | undefined;
45
+ } & {
46
+ className?: string;
47
+ }) | undefined) => string;
48
+ /**
49
+ * Wrapper for a single cursor (SVG + label). Absolutely positioned via inline
50
+ * `left`/`top` style; the transition provides smooth movement when coordinates
51
+ * update.
52
+ */
53
+ declare const cursorWrapperClass = "absolute flex flex-col items-start transition-[left,top] duration-100 ease-linear";
54
+ /**
55
+ * The SVG cursor arrow container. Fill is applied via inline style (per
56
+ * collaborator color) so no utility class is needed here.
57
+ */
58
+ declare const cursorArrowClass = "h-5 w-5 drop-shadow-sm";
59
+ /**
60
+ * Name-label chip that appears below the cursor arrow. Background is applied
61
+ * via inline style (per collaborator color); text is always white for contrast.
62
+ */
63
+ declare const cursorLabelClass = "mt-0.5 ml-2 rounded px-1.5 py-0.5 text-xs font-medium text-white shadow-sm whitespace-nowrap";
64
+
65
+ export { CURSOR_COLORS, type CursorData, type LiveCursorsAPI, assignCursorColor, createLiveCursors, cursorArrowClass, cursorLabelClass, cursorWrapperClass, liveCursorsVariants };
@@ -0,0 +1,73 @@
1
+ /** A single transcript entry from one speaker at a point in time. */
2
+ interface TranscriptEntry {
3
+ /** Unique identifier for this entry. */
4
+ id: string;
5
+ /** Display name of the speaker. */
6
+ speaker: string;
7
+ /** The spoken text. */
8
+ text: string;
9
+ /** Optional formatted timestamp string (e.g. "0:42"). */
10
+ timestamp?: string;
11
+ /** Optional CSS color for the speaker's name (e.g. "#3b82f6"). */
12
+ speakerColor?: string;
13
+ }
14
+ /** A merged block of consecutive entries from the same speaker. */
15
+ interface TranscriptBlock {
16
+ /** Speaker display name. */
17
+ speaker: string;
18
+ /** Timestamp of the first entry in the run (if present). */
19
+ timestamp?: string;
20
+ /** Optional CSS color for the speaker name. */
21
+ speakerColor?: string;
22
+ /** All text segments from the consecutive run, in order. */
23
+ texts: string[];
24
+ }
25
+ /**
26
+ * Merge consecutive `TranscriptEntry` items from the same speaker into
27
+ * `TranscriptBlock` objects. A new block is started whenever the speaker
28
+ * changes; the block uses the timestamp of the *first* entry in that run.
29
+ */
30
+ declare function groupConsecutiveBySpeaker(entries: TranscriptEntry[]): TranscriptBlock[];
31
+ interface LiveTranscriptAPI {
32
+ /**
33
+ * ARIA attributes to spread on the scroll container.
34
+ * Typed as a plain record so frameworks can spread without fighting their
35
+ * aria-* type narrowing.
36
+ */
37
+ ariaProps: Record<string, string | number | boolean>;
38
+ /** Data attributes for styling hooks. */
39
+ dataAttributes: Record<string, string>;
40
+ }
41
+ /**
42
+ * Build the framework-agnostic container props for a live transcript panel.
43
+ *
44
+ * Returns `role="log"` and `aria-live="polite"` so screen readers announce
45
+ * new transcript entries without interrupting the user.
46
+ */
47
+ declare function createLiveTranscript(): LiveTranscriptAPI;
48
+
49
+ /**
50
+ * Scroll container that wraps all speaker blocks.
51
+ * The `compact` variant tightens the gap between blocks.
52
+ */
53
+ declare const liveTranscriptVariants: (props?: ({
54
+ compact?: "true" | "false" | undefined;
55
+ } & {
56
+ className?: string;
57
+ }) | undefined) => string;
58
+ /** A single grouped speaker block (header + text lines). */
59
+ declare const transcriptBlockVariants: (props?: ({
60
+ compact?: "true" | "false" | undefined;
61
+ } & {
62
+ className?: string;
63
+ }) | undefined) => string;
64
+ /** The row containing the speaker name and optional timestamp. */
65
+ declare const transcriptSpeakerRowClass = "flex items-baseline gap-2";
66
+ /** Speaker name badge / label. */
67
+ declare const transcriptSpeakerNameClass = "text-sm font-semibold text-foreground leading-snug";
68
+ /** Timestamp displayed beside the speaker name. */
69
+ declare const transcriptTimestampClass = "text-xs text-muted-foreground tabular-nums";
70
+ /** A single line of transcript text. */
71
+ declare const transcriptTextLineClass = "text-sm text-foreground/80 leading-relaxed";
72
+
73
+ export { type LiveTranscriptAPI, type TranscriptBlock, type TranscriptEntry, createLiveTranscript, groupConsecutiveBySpeaker, liveTranscriptVariants, transcriptBlockVariants, transcriptSpeakerNameClass, transcriptSpeakerRowClass, transcriptTextLineClass, transcriptTimestampClass };
@@ -0,0 +1,81 @@
1
+ /** A rectangle in 2-D space. */
2
+ interface Rect {
3
+ x: number;
4
+ y: number;
5
+ width: number;
6
+ height: number;
7
+ }
8
+ /** A single item to be represented as a dot on the minimap. */
9
+ interface MiniMapItem {
10
+ id: string;
11
+ x: number;
12
+ y: number;
13
+ width?: number;
14
+ height?: number;
15
+ }
16
+ interface MiniMapAPI {
17
+ /** ARIA attributes to spread on the minimap container element. */
18
+ ariaProps: {
19
+ role: 'img';
20
+ 'aria-label': string;
21
+ };
22
+ /** Data attributes for styling hooks. */
23
+ dataAttributes: Record<string, string>;
24
+ }
25
+ /**
26
+ * Compute the bounding box that encloses all items (using their x/y + optional
27
+ * width/height). Returns a zero-size rect at the origin when `items` is empty.
28
+ */
29
+ declare function contentBounds(items: MiniMapItem[]): Rect;
30
+ /**
31
+ * Compute the uniform scale factor that fits `contentRect` into the minimap
32
+ * box (after subtracting `padding` on each side). Returns 1 when the content
33
+ * has zero area (nothing to scale).
34
+ */
35
+ declare function miniScale(contentRect: Rect, miniW: number, miniH: number, padding?: number): number;
36
+ /**
37
+ * Map a world-space point `{ x, y }` to minimap pixel coordinates.
38
+ *
39
+ * @param point World coordinate
40
+ * @param contentRect Bounding box of all content (from `contentBounds`)
41
+ * @param scale Scale factor (from `miniScale`)
42
+ * @param padding Padding inset in px (must match the value passed to `miniScale`)
43
+ */
44
+ declare function worldToMini(point: {
45
+ x: number;
46
+ y: number;
47
+ }, contentRect: Rect, scale: number, padding?: number): {
48
+ x: number;
49
+ y: number;
50
+ };
51
+ /**
52
+ * Compute the position and size of the viewport indicator rectangle in
53
+ * minimap coordinates, ready to be applied as CSS `left/top/width/height`.
54
+ */
55
+ declare function viewportRectInMini(viewport: Rect, contentRect: Rect, scale: number, padding?: number): Rect;
56
+ /**
57
+ * Build the framework-agnostic ARIA props for the minimap container.
58
+ *
59
+ * Every adapter spreads `ariaProps` onto its outermost element; `dataAttributes`
60
+ * are available for CSS hooks.
61
+ */
62
+ declare function createMiniMap(): MiniMapAPI;
63
+
64
+ /**
65
+ * The outer minimap box: small, rounded, bordered, card background.
66
+ * The `interactive` variant switches to grab cursor for clickable minimaps.
67
+ */
68
+ declare const miniMapVariants: (props?: ({
69
+ interactive?: "true" | "false" | undefined;
70
+ } & {
71
+ className?: string;
72
+ }) | undefined) => string;
73
+ /** A single node dot in the minimap (represents one `MiniMapItem`). */
74
+ declare const miniMapDotClass = "absolute rounded-sm bg-muted";
75
+ /**
76
+ * The draggable viewport indicator rectangle.
77
+ * Uses a semi-transparent primary fill with a primary ring/border.
78
+ */
79
+ declare const miniMapViewportClass = "absolute rounded-sm border border-primary ring-1 ring-primary bg-primary/10";
80
+
81
+ export { type MiniMapAPI, type MiniMapItem, type Rect, contentBounds, createMiniMap, miniMapDotClass, miniMapVariants, miniMapViewportClass, miniScale, viewportRectInMini, worldToMini };
@@ -0,0 +1,97 @@
1
+ /** A single selectable media device (camera, microphone, or speaker). */
2
+ interface MediaDeviceOption {
3
+ id: string;
4
+ label: string;
5
+ }
6
+ /** The kind of media device. */
7
+ type DeviceKind = 'camera' | 'microphone' | 'speaker';
8
+ interface PreCallLobbyProps {
9
+ /** Whether the camera is currently enabled. */
10
+ cameraOn: boolean;
11
+ /** Whether the microphone is currently enabled. */
12
+ micOn: boolean;
13
+ }
14
+ interface PreCallLobbyAPI {
15
+ /** ARIA attributes to spread on the group element. */
16
+ ariaProps: {
17
+ role: 'group';
18
+ 'aria-label': string;
19
+ };
20
+ /** Data attributes for styling hooks. */
21
+ dataAttributes: {
22
+ 'data-camera': string;
23
+ 'data-mic': string;
24
+ };
25
+ }
26
+ /**
27
+ * Build the framework-agnostic group props for a pre-call lobby / device-check panel.
28
+ *
29
+ * Returns `role="group"` plus data attributes reflecting camera and mic state.
30
+ * Adapters spread these onto their container and render the device pickers,
31
+ * preview, and join button themselves.
32
+ */
33
+ declare function createPreCallLobby(props: PreCallLobbyProps): PreCallLobbyAPI;
34
+ /**
35
+ * Convert a microphone level (0..1) to a count of lit bars.
36
+ *
37
+ * Pure function — no side effects, no JSX. Adapters use this to render
38
+ * the mic level meter by iterating `0..barCount` and lighting bars up to
39
+ * the returned value.
40
+ *
41
+ * @param level Current mic level in the range [0, 1].
42
+ * @param barCount Total number of bars in the meter.
43
+ * @returns Number of bars that should appear "lit" (0..barCount).
44
+ */
45
+ declare function micLevelToBars(level: number, barCount: number): number;
46
+
47
+ /**
48
+ * Outer lobby card — a centered panel that holds all preflight controls.
49
+ */
50
+ declare const preCallLobbyVariants: (props?: ({} & {
51
+ className?: string;
52
+ }) | undefined) => string;
53
+ /**
54
+ * Camera preview area. The `camera` variant switches between the live preview
55
+ * slot and an avatar / placeholder shown when the camera is off.
56
+ */
57
+ declare const preCallCameraVariants: (props?: ({
58
+ camera?: "on" | "off" | undefined;
59
+ } & {
60
+ className?: string;
61
+ }) | undefined) => string;
62
+ /** Placeholder shown inside the camera area when the camera is off. */
63
+ declare const preCallCameraPlaceholderClass: string;
64
+ /** Row that holds the label and the <select> for a device picker. */
65
+ declare const preCallDeviceRowClass = "flex flex-col gap-1";
66
+ /** Label text above a device picker. */
67
+ declare const preCallDeviceLabelClass = "text-xs font-medium text-muted-foreground";
68
+ /** The <select> element used for device selection. */
69
+ declare const preCallDeviceSelectClass: string;
70
+ /**
71
+ * Mic level meter container. Renders a row of bars.
72
+ */
73
+ declare const preCallMicMeterClass = "flex items-end gap-0.5 h-5";
74
+ /**
75
+ * An individual bar in the mic level meter.
76
+ * The `lit` variant distinguishes active (lit) from inactive bars.
77
+ */
78
+ declare const preCallMicBarVariants: (props?: ({
79
+ lit?: "true" | "false" | undefined;
80
+ } & {
81
+ className?: string;
82
+ }) | undefined) => string;
83
+ /** Row holding the camera-toggle and mic-toggle buttons. */
84
+ declare const preCallControlsRowClass = "flex items-center gap-3";
85
+ /**
86
+ * Toggle button for camera or microphone.
87
+ * The `active` variant styles the enabled vs disabled states.
88
+ */
89
+ declare const preCallToggleVariants: (props?: ({
90
+ active?: "true" | "false" | undefined;
91
+ } & {
92
+ className?: string;
93
+ }) | undefined) => string;
94
+ /** Primary "Join" button. */
95
+ declare const preCallJoinButtonClass: string;
96
+
97
+ export { type DeviceKind, type MediaDeviceOption, type PreCallLobbyAPI, type PreCallLobbyProps, createPreCallLobby, micLevelToBars, preCallCameraPlaceholderClass, preCallCameraVariants, preCallControlsRowClass, preCallDeviceLabelClass, preCallDeviceRowClass, preCallDeviceSelectClass, preCallJoinButtonClass, preCallLobbyVariants, preCallMicBarVariants, preCallMicMeterClass, preCallToggleVariants };