@refraction-ui/react 0.13.0 → 0.15.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/index.cjs +4244 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +4199 -3
- package/dist/index.js.map +1 -1
- package/dist/internal/audio-room/index.d.ts +91 -0
- package/dist/internal/browser-chrome-mock/index.d.ts +57 -0
- package/dist/internal/call-controls/index.d.ts +83 -0
- package/dist/internal/checklist/index.d.ts +84 -0
- package/dist/internal/editor-status-bar/index.d.ts +70 -0
- package/dist/internal/editor-tabs/index.d.ts +68 -0
- package/dist/internal/floating-reactions/index.d.ts +98 -0
- package/dist/internal/flow-editor/index.d.ts +91 -0
- package/dist/internal/graph-view/index.d.ts +107 -0
- package/dist/internal/infinite-canvas/index.d.ts +74 -0
- package/dist/internal/live-captions/index.d.ts +59 -0
- package/dist/internal/live-cursors/index.d.ts +65 -0
- package/dist/internal/live-transcript/index.d.ts +73 -0
- package/dist/internal/mastery-bar/index.d.ts +60 -0
- package/dist/internal/mini-map/index.d.ts +81 -0
- package/dist/internal/numbered-steps/index.d.ts +71 -0
- package/dist/internal/pre-call-lobby/index.d.ts +97 -0
- package/dist/internal/pricing-card/index.d.ts +61 -0
- package/dist/internal/radial-gauge/index.d.ts +120 -0
- package/dist/internal/rating-scale/index.d.ts +76 -0
- package/dist/internal/react-audience-feature-card/index.d.ts +22 -0
- package/dist/internal/react-audio-room/index.d.ts +39 -0
- package/dist/internal/react-brand-network-cell/index.d.ts +30 -0
- package/dist/internal/react-browser-chrome-mock/index.d.ts +21 -0
- package/dist/internal/react-call-controls/index.d.ts +44 -0
- package/dist/internal/react-checklist/index.d.ts +27 -0
- package/dist/internal/react-editor-status-bar/index.d.ts +43 -0
- package/dist/internal/react-editor-tabs/index.d.ts +25 -0
- package/dist/internal/react-floating-reactions/index.d.ts +65 -0
- package/dist/internal/react-flow-editor/index.d.ts +35 -0
- package/dist/internal/react-graph-view/index.d.ts +25 -0
- package/dist/internal/react-infinite-canvas/index.d.ts +40 -0
- package/dist/internal/react-live-captions/index.d.ts +29 -0
- package/dist/internal/react-live-cursors/index.d.ts +42 -0
- package/dist/internal/react-live-transcript/index.d.ts +22 -0
- package/dist/internal/react-marquee-strip/index.d.ts +33 -0
- package/dist/internal/react-mastery-bar/index.d.ts +26 -0
- package/dist/internal/react-mini-map/index.d.ts +35 -0
- package/dist/internal/react-numbered-steps/index.d.ts +24 -0
- package/dist/internal/react-pre-call-lobby/index.d.ts +47 -0
- package/dist/internal/react-pricing-card/index.d.ts +40 -0
- package/dist/internal/react-radial-gauge/index.d.ts +43 -0
- package/dist/internal/react-rating-scale/index.d.ts +38 -0
- package/dist/internal/react-section-head/index.d.ts +27 -0
- package/dist/internal/react-stat-grid/index.d.ts +29 -0
- package/dist/internal/react-sticky-note/index.d.ts +39 -0
- package/dist/internal/react-terminal/index.d.ts +39 -0
- package/dist/internal/react-test-results/index.d.ts +21 -0
- package/dist/internal/react-timeline/index.d.ts +35 -0
- package/dist/internal/react-video-grid/index.d.ts +33 -0
- package/dist/internal/react-video-tile/index.d.ts +41 -0
- package/dist/internal/react-wizard/index.d.ts +59 -0
- package/dist/internal/section-head/index.d.ts +36 -0
- package/dist/internal/stat-grid/index.d.ts +45 -0
- package/dist/internal/sticky-note/index.d.ts +49 -0
- package/dist/internal/terminal/index.d.ts +65 -0
- package/dist/internal/test-results/index.d.ts +97 -0
- package/dist/internal/timeline/index.d.ts +111 -0
- package/dist/internal/video-grid/index.d.ts +83 -0
- package/dist/internal/video-tile/index.d.ts +88 -0
- package/dist/internal/wizard/index.d.ts +148 -0
- package/package.json +33 -1
|
@@ -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 };
|
|
@@ -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,60 @@
|
|
|
1
|
+
/** Visual size of a mastery bar. */
|
|
2
|
+
type MasteryBarSize = 'sm' | 'md' | 'lg';
|
|
3
|
+
interface MasteryBarProps {
|
|
4
|
+
/** Progress value (0–100). Values outside this range are clamped. */
|
|
5
|
+
value: number;
|
|
6
|
+
/** Label shown on the right side of the header row. */
|
|
7
|
+
label?: string;
|
|
8
|
+
/** Label shown on the left side of the header row. */
|
|
9
|
+
leadingLabel?: string;
|
|
10
|
+
/** Visual size of the track. */
|
|
11
|
+
size?: MasteryBarSize;
|
|
12
|
+
/** Renders the fill at reduced opacity to indicate a muted/secondary state. */
|
|
13
|
+
muted?: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface MasteryBarAPI {
|
|
16
|
+
/** ARIA attributes to spread on the progressbar element. */
|
|
17
|
+
ariaProps: Record<string, string | number | boolean>;
|
|
18
|
+
/** Data attributes for styling hooks. */
|
|
19
|
+
dataAttributes: Record<string, string>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Clamp a raw numeric value to the [0, 100] range.
|
|
23
|
+
*
|
|
24
|
+
* Values below 0 become 0; values above 100 become 100; NaN is treated as 0.
|
|
25
|
+
*/
|
|
26
|
+
declare function clampPercent(value: number): number;
|
|
27
|
+
/**
|
|
28
|
+
* Build the framework-agnostic progressbar props for a mastery bar.
|
|
29
|
+
*
|
|
30
|
+
* Returns `role="progressbar"` ARIA attributes plus data attributes; adapters
|
|
31
|
+
* spread these onto their track element.
|
|
32
|
+
*/
|
|
33
|
+
declare function createMasteryBar({ value }: Pick<MasteryBarProps, 'value'>): MasteryBarAPI;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Track (outer container): rounded, muted background.
|
|
37
|
+
* `size` variant controls the track height.
|
|
38
|
+
*/
|
|
39
|
+
declare const masteryBarVariants: (props?: ({
|
|
40
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
41
|
+
} & {
|
|
42
|
+
className?: string;
|
|
43
|
+
}) | undefined) => string;
|
|
44
|
+
/**
|
|
45
|
+
* Fill (inner bar): rounded, primary background.
|
|
46
|
+
* `muted` variant renders at reduced opacity for secondary/inactive states.
|
|
47
|
+
*/
|
|
48
|
+
declare const masteryBarFillVariants: (props?: ({
|
|
49
|
+
muted?: "true" | "false" | undefined;
|
|
50
|
+
} & {
|
|
51
|
+
className?: string;
|
|
52
|
+
}) | undefined) => string;
|
|
53
|
+
/** Class applied to each text label (leading or trailing). */
|
|
54
|
+
declare const masteryBarLabelClass = "text-xs text-muted-foreground";
|
|
55
|
+
/** Class for the leading (left-side) label. */
|
|
56
|
+
declare const masteryBarLeadingLabelClass = "text-xs text-muted-foreground";
|
|
57
|
+
/** Header row above the track: leading label on the left, label on the right. */
|
|
58
|
+
declare const masteryBarHeaderClass = "flex justify-between items-baseline mb-1";
|
|
59
|
+
|
|
60
|
+
export { type MasteryBarAPI, type MasteryBarProps, type MasteryBarSize, clampPercent, createMasteryBar, masteryBarFillVariants, masteryBarHeaderClass, masteryBarLabelClass, masteryBarLeadingLabelClass, masteryBarVariants };
|
|
@@ -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,71 @@
|
|
|
1
|
+
/** A single step item in the numbered steps grid. */
|
|
2
|
+
type NumberedStepItem = {
|
|
3
|
+
/** Step title displayed prominently below the ordinal badge. */
|
|
4
|
+
title: string;
|
|
5
|
+
/** Step body copy displayed below the title. */
|
|
6
|
+
body: string;
|
|
7
|
+
};
|
|
8
|
+
interface NumberedStepsProps {
|
|
9
|
+
/** The step items to display. */
|
|
10
|
+
items: NumberedStepItem[];
|
|
11
|
+
/**
|
|
12
|
+
* Number of grid columns. When omitted, defaults to clamping the item count
|
|
13
|
+
* to the 2–5 range via {@link stepColumns}.
|
|
14
|
+
*/
|
|
15
|
+
columns?: number;
|
|
16
|
+
}
|
|
17
|
+
interface NumberedStepsAPI {
|
|
18
|
+
/** ARIA attributes to spread on the container element (`role="list"`). */
|
|
19
|
+
ariaProps: {
|
|
20
|
+
role: 'list';
|
|
21
|
+
};
|
|
22
|
+
/** Data attributes for styling hooks. */
|
|
23
|
+
dataAttributes: Record<string, string>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Zero-pad a 1-indexed ordinal to at least two digits.
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* padOrdinal(1) // '01'
|
|
30
|
+
* padOrdinal(10) // '10'
|
|
31
|
+
*/
|
|
32
|
+
declare function padOrdinal(n: number): string;
|
|
33
|
+
/**
|
|
34
|
+
* Derive the number of grid columns from the item count.
|
|
35
|
+
* Clamps the count to the 2–5 range.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* stepColumns(3) // 3
|
|
39
|
+
* stepColumns(1) // 2
|
|
40
|
+
* stepColumns(6) // 5
|
|
41
|
+
*/
|
|
42
|
+
declare function stepColumns(count: number): number;
|
|
43
|
+
/**
|
|
44
|
+
* Build the framework-agnostic container props for a numbered-steps grid.
|
|
45
|
+
*
|
|
46
|
+
* Returns `role="list"` plus data attributes; adapters spread these onto their
|
|
47
|
+
* container and render each step as a `role="listitem"`.
|
|
48
|
+
*/
|
|
49
|
+
declare function createNumberedSteps(): NumberedStepsAPI;
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Container grid for the numbered steps. The `columns` variant maps to a
|
|
53
|
+
* fixed Tailwind grid-cols class; adapters that need a dynamic column count
|
|
54
|
+
* use `gridTemplateColumns` inline style via {@link stepColumns} instead and
|
|
55
|
+
* omit this variant.
|
|
56
|
+
*/
|
|
57
|
+
declare const numberedStepsVariants: (props?: ({
|
|
58
|
+
columns?: "2" | "3" | "4" | "5" | undefined;
|
|
59
|
+
} & {
|
|
60
|
+
className?: string;
|
|
61
|
+
}) | undefined) => string;
|
|
62
|
+
/** Individual step card. */
|
|
63
|
+
declare const numberedStepsItemClass = "rounded-xl border border-border bg-card p-5";
|
|
64
|
+
/** Zero-padded ordinal badge above each step title. */
|
|
65
|
+
declare const numberedStepsOrdinalClass = "font-mono text-sm text-primary";
|
|
66
|
+
/** Step title. */
|
|
67
|
+
declare const numberedStepsTitleClass = "mt-2 text-sm font-bold text-foreground";
|
|
68
|
+
/** Step body copy. */
|
|
69
|
+
declare const numberedStepsBodyClass = "mt-1 text-xs text-muted-foreground leading-relaxed";
|
|
70
|
+
|
|
71
|
+
export { type NumberedStepItem, type NumberedStepsAPI, type NumberedStepsProps, createNumberedSteps, numberedStepsBodyClass, numberedStepsItemClass, numberedStepsOrdinalClass, numberedStepsTitleClass, numberedStepsVariants, padOrdinal, stepColumns };
|