@refraction-ui/react 0.13.0 → 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.
- package/dist/index.cjs +3616 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +3581 -3
- package/dist/index.js.map +1 -1
- package/dist/internal/audio-room/index.d.ts +91 -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/mini-map/index.d.ts +81 -0
- package/dist/internal/pre-call-lobby/index.d.ts +97 -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-audio-room/index.d.ts +39 -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-mini-map/index.d.ts +35 -0
- package/dist/internal/react-pre-call-lobby/index.d.ts +47 -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-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/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 +24 -1
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/** A participant in an audio-only room. */
|
|
2
|
+
interface AudioParticipant {
|
|
3
|
+
/** Unique participant identifier. */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Display name shown below the orb. */
|
|
6
|
+
name: string;
|
|
7
|
+
/** Optional avatar image URL. Falls back to initials when absent. */
|
|
8
|
+
avatarUrl?: string;
|
|
9
|
+
/** Whether this participant is currently speaking. */
|
|
10
|
+
speaking?: boolean;
|
|
11
|
+
/** Whether this participant's microphone is muted. */
|
|
12
|
+
muted?: boolean;
|
|
13
|
+
/** Whether this participant has raised their hand. */
|
|
14
|
+
handRaised?: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface AudioRoomAPI {
|
|
17
|
+
/** ARIA attributes to spread on the room container element. */
|
|
18
|
+
ariaProps: {
|
|
19
|
+
role: 'group';
|
|
20
|
+
};
|
|
21
|
+
/** Data attributes for styling hooks. */
|
|
22
|
+
dataAttributes: Record<string, string>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Derive up to two uppercase initials from a display name.
|
|
26
|
+
*
|
|
27
|
+
* Examples: "Alice" → "A", "Bob Smith" → "BS", "Dr. Jane Doe" → "JD"
|
|
28
|
+
* (only word-initial alphabetic characters are used).
|
|
29
|
+
*/
|
|
30
|
+
declare function getInitials(name: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Determine the number of grid columns for the orb grid.
|
|
33
|
+
*
|
|
34
|
+
* | Count | Columns |
|
|
35
|
+
* |--------|---------|
|
|
36
|
+
* | 1 | 1 |
|
|
37
|
+
* | 2–4 | 2 |
|
|
38
|
+
* | 5–9 | 3 |
|
|
39
|
+
* | 10+ | 4 |
|
|
40
|
+
*/
|
|
41
|
+
declare function orbColumns(count: number): number;
|
|
42
|
+
/**
|
|
43
|
+
* Build the framework-agnostic container props for an audio room.
|
|
44
|
+
*
|
|
45
|
+
* Returns `role="group"` plus data attributes that adapters spread onto
|
|
46
|
+
* their outermost container element.
|
|
47
|
+
*/
|
|
48
|
+
declare function createAudioRoom(): AudioRoomAPI;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Grid container that lays out the speaking orbs.
|
|
52
|
+
*
|
|
53
|
+
* Column count and gap are applied via inline `gridTemplateColumns` in
|
|
54
|
+
* adapters (dynamic count); this cva handles only the non-dynamic layout
|
|
55
|
+
* concerns — display, alignment, and padding.
|
|
56
|
+
*/
|
|
57
|
+
declare const audioRoomVariants: (props?: ({} & {
|
|
58
|
+
className?: string;
|
|
59
|
+
}) | undefined) => string;
|
|
60
|
+
/**
|
|
61
|
+
* Wrapper cell for a single orb + name label combination.
|
|
62
|
+
* Keeps the avatar and label centred as a column.
|
|
63
|
+
*/
|
|
64
|
+
declare const audioRoomOrbCellVariants: (props?: ({} & {
|
|
65
|
+
className?: string;
|
|
66
|
+
}) | undefined) => string;
|
|
67
|
+
/**
|
|
68
|
+
* The circular avatar / speaking indicator.
|
|
69
|
+
*
|
|
70
|
+
* - `speaking` adds an animated ring using the primary colour.
|
|
71
|
+
* - `muted` dims the orb slightly to signal a silenced microphone.
|
|
72
|
+
*/
|
|
73
|
+
declare const speakingOrbVariants: (props?: ({
|
|
74
|
+
speaking?: "true" | "false" | undefined;
|
|
75
|
+
muted?: "true" | "false" | undefined;
|
|
76
|
+
} & {
|
|
77
|
+
className?: string;
|
|
78
|
+
}) | undefined) => string;
|
|
79
|
+
/** Name label rendered below each orb. */
|
|
80
|
+
declare const audioRoomNameLabelClass = "text-sm font-medium text-foreground text-center max-w-[6rem] truncate";
|
|
81
|
+
/**
|
|
82
|
+
* Muted badge — a small indicator overlaid at the bottom-right of the orb
|
|
83
|
+
* to show the microphone is off.
|
|
84
|
+
*/
|
|
85
|
+
declare const audioRoomMutedBadgeClass: string;
|
|
86
|
+
/**
|
|
87
|
+
* Hand-raise badge — shown at the top-right of the orb.
|
|
88
|
+
*/
|
|
89
|
+
declare const audioRoomHandBadgeClass: string;
|
|
90
|
+
|
|
91
|
+
export { type AudioParticipant, type AudioRoomAPI, audioRoomHandBadgeClass, audioRoomMutedBadgeClass, audioRoomNameLabelClass, audioRoomOrbCellVariants, audioRoomVariants, createAudioRoom, getInitials, orbColumns, speakingOrbVariants };
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { AccessibilityProps } from '../shared/index.js';
|
|
2
|
+
|
|
3
|
+
/** Visual/semantic tone of a call control button. */
|
|
4
|
+
type CallControlTone = 'default' | 'active' | 'destructive';
|
|
5
|
+
/**
|
|
6
|
+
* Toggleable state for controls like mic or camera.
|
|
7
|
+
* `'on'` = currently active (mic/camera live).
|
|
8
|
+
* `'off'` = currently muted/disabled.
|
|
9
|
+
*/
|
|
10
|
+
type CallControlState = 'on' | 'off';
|
|
11
|
+
/**
|
|
12
|
+
* A single control descriptor used by adapters to drive button rendering.
|
|
13
|
+
*/
|
|
14
|
+
interface CallControlItem {
|
|
15
|
+
/** Unique identifier for this control. */
|
|
16
|
+
id: string;
|
|
17
|
+
/** Visible label (also used as aria-label). */
|
|
18
|
+
label: string;
|
|
19
|
+
/** Optional icon to render inside the button. */
|
|
20
|
+
icon?: string;
|
|
21
|
+
/** Explicit tone override; when omitted `controlTone` is used with `state`. */
|
|
22
|
+
tone?: CallControlTone;
|
|
23
|
+
/** Toggleable state (present only for toggleable controls). */
|
|
24
|
+
pressed?: boolean;
|
|
25
|
+
}
|
|
26
|
+
interface CallControlsProps {
|
|
27
|
+
/** Controls to render. */
|
|
28
|
+
controls?: CallControlItem[];
|
|
29
|
+
}
|
|
30
|
+
interface CallControlsAPI {
|
|
31
|
+
/** ARIA attributes to spread on the toolbar element (`role="toolbar"`). */
|
|
32
|
+
ariaProps: Partial<AccessibilityProps>;
|
|
33
|
+
/** Data attributes for styling hooks. */
|
|
34
|
+
dataAttributes: Record<string, string>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Derive the visual tone for a control given its kind and current toggle state.
|
|
38
|
+
*
|
|
39
|
+
* Convention used by easyloops meeting toolbar:
|
|
40
|
+
* - `leave` / `end` → always `'destructive'`
|
|
41
|
+
* - any control that is `'off'` (muted/stopped) → `'destructive'` to signal
|
|
42
|
+
* the user that something is disabled (e.g. mic muted = red indicator).
|
|
43
|
+
* - a control that is `'on'` → `'active'` (lit up / highlighted).
|
|
44
|
+
* - otherwise → `'default'` (neutral).
|
|
45
|
+
*/
|
|
46
|
+
declare function controlTone(kind: string, state: CallControlState | undefined): CallControlTone;
|
|
47
|
+
/**
|
|
48
|
+
* Build the framework-agnostic toolbar props for a call-controls bar.
|
|
49
|
+
*
|
|
50
|
+
* Returns `role="toolbar"` plus `aria-label="Call controls"` and data
|
|
51
|
+
* attributes; adapters spread these onto their container element.
|
|
52
|
+
*/
|
|
53
|
+
declare function createCallControls(_props?: CallControlsProps): CallControlsAPI;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Toolbar container — flex row, centred, with a card background and gap
|
|
57
|
+
* between the control buttons.
|
|
58
|
+
*/
|
|
59
|
+
declare const callControlsVariants: (props?: ({
|
|
60
|
+
size?: "sm" | "md" | undefined;
|
|
61
|
+
} & {
|
|
62
|
+
className?: string;
|
|
63
|
+
}) | undefined) => string;
|
|
64
|
+
/**
|
|
65
|
+
* Individual call-control button.
|
|
66
|
+
*
|
|
67
|
+
* `tone` variants:
|
|
68
|
+
* - `default` → neutral muted appearance (standard inactive controls)
|
|
69
|
+
* - `active` → primary/highlighted (e.g. mic on, screen-share running)
|
|
70
|
+
* - `destructive` → red/danger (leave button or a muted mic indicator)
|
|
71
|
+
*
|
|
72
|
+
* `size` variants match the toolbar container.
|
|
73
|
+
*/
|
|
74
|
+
declare const callControlButtonVariants: (props?: ({
|
|
75
|
+
size?: "sm" | "md" | undefined;
|
|
76
|
+
tone?: "default" | "active" | "destructive" | undefined;
|
|
77
|
+
} & {
|
|
78
|
+
className?: string;
|
|
79
|
+
}) | undefined) => string;
|
|
80
|
+
/** Label beneath the icon inside a call-control button. */
|
|
81
|
+
declare const callControlLabelClass = "sr-only text-[10px] leading-none mt-0.5";
|
|
82
|
+
|
|
83
|
+
export { type CallControlItem, type CallControlState, type CallControlTone, type CallControlsAPI, type CallControlsProps, callControlButtonVariants, callControlLabelClass, callControlsVariants, controlTone, createCallControls };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/** A single item in a checklist. */
|
|
2
|
+
interface ChecklistItemData {
|
|
3
|
+
/** Unique identifier for this item. */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Display label for the item. */
|
|
6
|
+
label: string;
|
|
7
|
+
/** Whether the item is completed. */
|
|
8
|
+
checked?: boolean;
|
|
9
|
+
/** Optional additional description text. */
|
|
10
|
+
description?: string;
|
|
11
|
+
}
|
|
12
|
+
interface ChecklistAPI {
|
|
13
|
+
/** ARIA attributes to spread on the list container (`role="list"`). */
|
|
14
|
+
ariaProps: {
|
|
15
|
+
role: 'list';
|
|
16
|
+
};
|
|
17
|
+
/** Data attributes for styling hooks. */
|
|
18
|
+
dataAttributes: Record<string, string>;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Build the framework-agnostic container props for a checklist.
|
|
22
|
+
*
|
|
23
|
+
* Returns `role="list"` plus a `data-component` attribute. Adapters spread
|
|
24
|
+
* these onto their container element.
|
|
25
|
+
*/
|
|
26
|
+
declare function createChecklist(): ChecklistAPI;
|
|
27
|
+
/**
|
|
28
|
+
* Compute progress statistics for a checklist.
|
|
29
|
+
*
|
|
30
|
+
* Pure function — does not mutate the array.
|
|
31
|
+
*/
|
|
32
|
+
declare function checklistProgress(items: ChecklistItemData[]): {
|
|
33
|
+
completed: number;
|
|
34
|
+
total: number;
|
|
35
|
+
fraction: number;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Toggle a single item's `checked` state by id.
|
|
39
|
+
*
|
|
40
|
+
* Pure — returns a new array; the original is not mutated.
|
|
41
|
+
* Items whose id does not match are returned unchanged (same reference).
|
|
42
|
+
*/
|
|
43
|
+
declare function toggleChecklistItem(items: ChecklistItemData[], id: string): ChecklistItemData[];
|
|
44
|
+
|
|
45
|
+
/** Outer container that wraps the list and optional progress summary. */
|
|
46
|
+
declare const checklistContainerClass = "flex flex-col gap-2";
|
|
47
|
+
/** The `role="list"` element holding all item rows. */
|
|
48
|
+
declare const checklistListClass = "flex flex-col gap-1";
|
|
49
|
+
/**
|
|
50
|
+
* A single item row — a button with checkbox semantics.
|
|
51
|
+
*
|
|
52
|
+
* The `checked` variant applies muted text and a line-through on the label
|
|
53
|
+
* to communicate completion without relying solely on the checkbox visual.
|
|
54
|
+
*/
|
|
55
|
+
declare const checklistItemVariants: (props?: ({
|
|
56
|
+
checked?: "true" | "false" | undefined;
|
|
57
|
+
} & {
|
|
58
|
+
className?: string;
|
|
59
|
+
}) | undefined) => string;
|
|
60
|
+
/**
|
|
61
|
+
* The visual checkbox box (the square indicator beside the label).
|
|
62
|
+
*
|
|
63
|
+
* The `checked` variant fills the box with the primary colour and shows a
|
|
64
|
+
* checkmark via a border trick; the unchecked state shows an empty border.
|
|
65
|
+
*/
|
|
66
|
+
declare const checklistBoxVariants: (props?: ({
|
|
67
|
+
checked?: "true" | "false" | undefined;
|
|
68
|
+
} & {
|
|
69
|
+
className?: string;
|
|
70
|
+
}) | undefined) => string;
|
|
71
|
+
/** Wrapper for label + optional description text. */
|
|
72
|
+
declare const checklistLabelWrapClass = "flex flex-col gap-0.5 min-w-0";
|
|
73
|
+
/** The item's primary label. Strikethrough is applied when the item is checked. */
|
|
74
|
+
declare const checklistLabelVariants: (props?: ({
|
|
75
|
+
checked?: "true" | "false" | undefined;
|
|
76
|
+
} & {
|
|
77
|
+
className?: string;
|
|
78
|
+
}) | undefined) => string;
|
|
79
|
+
/** Optional description — always in muted text, smaller than the label. */
|
|
80
|
+
declare const checklistDescriptionClass = "text-xs text-muted-foreground";
|
|
81
|
+
/** Progress summary line shown below the list when `showProgress` is true. */
|
|
82
|
+
declare const checklistProgressClass = "text-xs text-muted-foreground tabular-nums";
|
|
83
|
+
|
|
84
|
+
export { type ChecklistAPI, type ChecklistItemData, checklistBoxVariants, checklistContainerClass, checklistDescriptionClass, checklistItemVariants, checklistLabelVariants, checklistLabelWrapClass, checklistListClass, checklistProgress, checklistProgressClass, createChecklist, toggleChecklistItem };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { AccessibilityProps } from '../shared/index.js';
|
|
2
|
+
|
|
3
|
+
/** Horizontal alignment of a segment within the bar. */
|
|
4
|
+
type StatusSegmentAlign = 'left' | 'right';
|
|
5
|
+
/** Visual tone / emphasis of a segment. */
|
|
6
|
+
type StatusSegmentTone = 'default' | 'muted' | 'accent';
|
|
7
|
+
/** A single labelled item rendered in the status bar. */
|
|
8
|
+
interface StatusSegment {
|
|
9
|
+
/** Unique identifier for the segment. */
|
|
10
|
+
id: string;
|
|
11
|
+
/** Text displayed in the segment. */
|
|
12
|
+
label: string;
|
|
13
|
+
/** Which side of the bar this segment lives on. Defaults to `'left'`. */
|
|
14
|
+
align?: StatusSegmentAlign;
|
|
15
|
+
/** Visual tone. Defaults to `'default'`. */
|
|
16
|
+
tone?: StatusSegmentTone;
|
|
17
|
+
}
|
|
18
|
+
/** Return value of {@link createEditorStatusBar}. */
|
|
19
|
+
interface EditorStatusBarAPI {
|
|
20
|
+
/** ARIA attributes to spread on the bar element. */
|
|
21
|
+
ariaProps: Partial<AccessibilityProps>;
|
|
22
|
+
/** Data attributes for styling hooks. */
|
|
23
|
+
dataAttributes: Record<string, string>;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Format a cursor position as the canonical IDE string "Ln {line}, Col {col}".
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* formatCursorPosition(17, 1) // → 'Ln 17, Col 1'
|
|
30
|
+
*/
|
|
31
|
+
declare function formatCursorPosition(line: number, col: number): string;
|
|
32
|
+
/**
|
|
33
|
+
* Partition a flat list of segments into left- and right-aligned groups,
|
|
34
|
+
* preserving insertion order within each group.
|
|
35
|
+
*/
|
|
36
|
+
declare function partitionSegments(segments: StatusSegment[]): {
|
|
37
|
+
left: StatusSegment[];
|
|
38
|
+
right: StatusSegment[];
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Build the framework-agnostic ARIA and data attributes for the status bar
|
|
42
|
+
* container.
|
|
43
|
+
*
|
|
44
|
+
* The bar uses `role="status"` with `aria-live="polite"` so screen readers
|
|
45
|
+
* announce updates (e.g. cursor position changes) without interrupting the
|
|
46
|
+
* user's current focus.
|
|
47
|
+
*/
|
|
48
|
+
declare function createEditorStatusBar(): EditorStatusBarAPI;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* The outer bar — a thin, full-width strip that sits at the bottom of an IDE
|
|
52
|
+
* pane. Uses a monospace font stack so numeric values (line, col) don't shift
|
|
53
|
+
* width as they update.
|
|
54
|
+
*/
|
|
55
|
+
declare const editorStatusBarVariants: (props?: ({} & {
|
|
56
|
+
className?: string;
|
|
57
|
+
}) | undefined) => string;
|
|
58
|
+
/** The left or right group that holds a cluster of segments. */
|
|
59
|
+
declare const statusBarGroupClass = "flex items-center gap-3 overflow-hidden";
|
|
60
|
+
/**
|
|
61
|
+
* A single segment pill. The `tone` variant maps to semantic token classes so
|
|
62
|
+
* adapters never inline colour values.
|
|
63
|
+
*/
|
|
64
|
+
declare const statusBarSegmentVariants: (props?: ({
|
|
65
|
+
tone?: "default" | "muted" | "accent" | undefined;
|
|
66
|
+
} & {
|
|
67
|
+
className?: string;
|
|
68
|
+
}) | undefined) => string;
|
|
69
|
+
|
|
70
|
+
export { type EditorStatusBarAPI, type StatusSegment, type StatusSegmentAlign, type StatusSegmentTone, createEditorStatusBar, editorStatusBarVariants, formatCursorPosition, partitionSegments, statusBarGroupClass, statusBarSegmentVariants };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { AccessibilityProps } from '../shared/index.js';
|
|
2
|
+
|
|
3
|
+
/** A single tab entry in the editor tab bar. */
|
|
4
|
+
interface EditorTabData {
|
|
5
|
+
/** Unique identifier for the tab. */
|
|
6
|
+
id: string;
|
|
7
|
+
/** Display label (e.g. "solution.py"). */
|
|
8
|
+
label: string;
|
|
9
|
+
/** Optional icon — a short string like an emoji or a ligature glyph. */
|
|
10
|
+
icon?: string;
|
|
11
|
+
/** Whether the tab has unsaved changes (shows a dirty dot). */
|
|
12
|
+
dirty?: boolean;
|
|
13
|
+
/** Whether the tab shows a close button. */
|
|
14
|
+
closable?: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface EditorTabsProps {
|
|
17
|
+
/** The id of the currently active tab. */
|
|
18
|
+
activeId?: string;
|
|
19
|
+
}
|
|
20
|
+
interface EditorTabsAPI {
|
|
21
|
+
/** ARIA attributes to spread on the tab list container. */
|
|
22
|
+
ariaProps: Partial<AccessibilityProps>;
|
|
23
|
+
/** Data attributes for styling hooks. */
|
|
24
|
+
dataAttributes: Record<string, string>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Build the framework-agnostic container props for an IDE-style editor tab bar.
|
|
28
|
+
*
|
|
29
|
+
* Returns `role="tablist"` plus data attributes. Each individual tab is
|
|
30
|
+
* `role="tab"` with `aria-selected`; adapters spread ariaProps on the container
|
|
31
|
+
* and render the tabs themselves.
|
|
32
|
+
*/
|
|
33
|
+
declare function createEditorTabs(props?: EditorTabsProps): EditorTabsAPI;
|
|
34
|
+
/**
|
|
35
|
+
* Roving keyboard navigation for the editor tab bar.
|
|
36
|
+
*
|
|
37
|
+
* Unlike a rating scale, tabs **wrap** at the ends so you can cycle through
|
|
38
|
+
* them continuously — matching standard tab-bar behaviour (similar to
|
|
39
|
+
* segmented-control). Home/End jump to the first/last tab.
|
|
40
|
+
*
|
|
41
|
+
* - ArrowRight → next (wraps to first after last)
|
|
42
|
+
* - ArrowLeft → previous (wraps to last before first)
|
|
43
|
+
* - Home → first
|
|
44
|
+
* - End → last
|
|
45
|
+
*/
|
|
46
|
+
declare function getNextTabIndex(currentIndex: number, key: string, count: number): number;
|
|
47
|
+
|
|
48
|
+
/** The tab bar container row. */
|
|
49
|
+
declare const editorTabsVariants: (props?: ({} & {
|
|
50
|
+
className?: string;
|
|
51
|
+
}) | undefined) => string;
|
|
52
|
+
/**
|
|
53
|
+
* A single tab button. The `state` variant switches between active and
|
|
54
|
+
* inactive treatments so adapters never inline these classes.
|
|
55
|
+
*/
|
|
56
|
+
declare const editorTabVariants: (props?: ({
|
|
57
|
+
state?: "active" | "inactive" | undefined;
|
|
58
|
+
} & {
|
|
59
|
+
className?: string;
|
|
60
|
+
}) | undefined) => string;
|
|
61
|
+
/** The dot indicator shown when a tab has unsaved changes. */
|
|
62
|
+
declare const editorTabDirtyDotClass = "size-1.5 rounded-full bg-amber-400 shrink-0";
|
|
63
|
+
/** The close button inside a tab. */
|
|
64
|
+
declare const editorTabCloseButtonClass: string;
|
|
65
|
+
/** The optional icon slot to the left of the label. */
|
|
66
|
+
declare const editorTabIconClass = "shrink-0 text-[0.85em] leading-none";
|
|
67
|
+
|
|
68
|
+
export { type EditorTabData, type EditorTabsAPI, type EditorTabsProps, createEditorTabs, editorTabCloseButtonClass, editorTabDirtyDotClass, editorTabIconClass, editorTabVariants, editorTabsVariants, getNextTabIndex };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Headless core for floating emoji reactions.
|
|
3
|
+
*
|
|
4
|
+
* An emoji burst overlay where reactions animate upward and fade — distinct
|
|
5
|
+
* from the static reaction-bar (which shows counts). This module is JSX-free
|
|
6
|
+
* and framework-agnostic; adapters consume it and manage timing with
|
|
7
|
+
* REACTION_LIFETIME_MS.
|
|
8
|
+
*/
|
|
9
|
+
/** A single transient reaction displayed in the overlay. */
|
|
10
|
+
interface FloatingReaction {
|
|
11
|
+
/** Stable unique id assigned by the adapter (used as React key / tracker). */
|
|
12
|
+
id: string;
|
|
13
|
+
/** The emoji character(s) to display, e.g. '👋' or '❤️'. */
|
|
14
|
+
emoji: string;
|
|
15
|
+
/**
|
|
16
|
+
* Horizontal offset bucket (0-indexed). Adapters use laneOffsetPercent() to
|
|
17
|
+
* convert this into a CSS left % so multiple reactions spread across the
|
|
18
|
+
* overlay rather than stacking.
|
|
19
|
+
*/
|
|
20
|
+
lane?: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* How long (ms) a floating reaction should live before the adapter removes it.
|
|
24
|
+
* Use this constant in adapters to drive setTimeout-based auto-expiry so the
|
|
25
|
+
* value stays in sync with the CSS animation duration.
|
|
26
|
+
*/
|
|
27
|
+
declare const REACTION_LIFETIME_MS = 3000;
|
|
28
|
+
/**
|
|
29
|
+
* Compute the horizontal left-offset percentage for a given lane bucket.
|
|
30
|
+
*
|
|
31
|
+
* Pure and deterministic — safe to call in tests and SSR.
|
|
32
|
+
*
|
|
33
|
+
* @param lane Zero-indexed lane number (clamped to [0, lanes-1]).
|
|
34
|
+
* @param lanes Total number of lanes (default 5).
|
|
35
|
+
* @returns A percentage value in [0, 100].
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* laneOffsetPercent(0, 5) // 10
|
|
39
|
+
* laneOffsetPercent(2, 5) // 50
|
|
40
|
+
* laneOffsetPercent(4, 5) // 90
|
|
41
|
+
*/
|
|
42
|
+
declare function laneOffsetPercent(lane?: number, lanes?: number): number;
|
|
43
|
+
interface FloatingReactionsAriaProps {
|
|
44
|
+
role: string;
|
|
45
|
+
'aria-live': 'polite' | 'assertive' | 'off';
|
|
46
|
+
'aria-label': string;
|
|
47
|
+
}
|
|
48
|
+
interface FloatingReactionsAPI {
|
|
49
|
+
/** ARIA attributes to spread on the overlay container. */
|
|
50
|
+
ariaProps: FloatingReactionsAriaProps;
|
|
51
|
+
/** Data attributes for styling hooks. */
|
|
52
|
+
dataAttributes: Record<string, string>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Build the framework-agnostic accessibility and data props for the overlay
|
|
56
|
+
* container.
|
|
57
|
+
*
|
|
58
|
+
* The overlay is a `role="status"` live region so screen readers announce
|
|
59
|
+
* incoming reactions without interrupting the user (polite).
|
|
60
|
+
*/
|
|
61
|
+
declare function createFloatingReactions(): FloatingReactionsAPI;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Overlay container — fills the parent with absolute positioning so reactions
|
|
65
|
+
* float over content. pointer-events-none keeps the overlay non-interactive;
|
|
66
|
+
* overflow-hidden clips reactions that drift outside the bounds.
|
|
67
|
+
*/
|
|
68
|
+
declare const floatingReactionsVariants: (props?: ({
|
|
69
|
+
active?: "true" | "false" | undefined;
|
|
70
|
+
} & {
|
|
71
|
+
className?: string;
|
|
72
|
+
}) | undefined) => string;
|
|
73
|
+
/**
|
|
74
|
+
* A single floating reaction item.
|
|
75
|
+
*
|
|
76
|
+
* The float-up animation is driven by the class
|
|
77
|
+
* `animate-[float-up_3s_ease-out_forwards]`. Consumers must supply the
|
|
78
|
+
* `@keyframes float-up` rule in their global CSS or Tailwind config:
|
|
79
|
+
*
|
|
80
|
+
* ```css
|
|
81
|
+
* @keyframes float-up {
|
|
82
|
+
* 0% { transform: translateY(0); opacity: 1; }
|
|
83
|
+
* 80% { opacity: 1; }
|
|
84
|
+
* 100% { transform: translateY(-80%); opacity: 0; }
|
|
85
|
+
* }
|
|
86
|
+
* ```
|
|
87
|
+
*
|
|
88
|
+
* Without the keyframe the item will still render in place and fade on removal
|
|
89
|
+
* (graceful degradation).
|
|
90
|
+
*/
|
|
91
|
+
declare const floatingReactionItemClass: string;
|
|
92
|
+
/**
|
|
93
|
+
* Accessible label node for the reaction — visually hidden so screen readers
|
|
94
|
+
* read the emoji description once and don't repeat the decorative glyph.
|
|
95
|
+
*/
|
|
96
|
+
declare const floatingReactionLabelClass = "sr-only";
|
|
97
|
+
|
|
98
|
+
export { type FloatingReaction, type FloatingReactionsAPI, type FloatingReactionsAriaProps, REACTION_LIFETIME_MS, createFloatingReactions, floatingReactionItemClass, floatingReactionLabelClass, floatingReactionsVariants, laneOffsetPercent };
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/** A node in the flow editor canvas. */
|
|
2
|
+
type FlowNode = {
|
|
3
|
+
id: string;
|
|
4
|
+
x: number;
|
|
5
|
+
y: number;
|
|
6
|
+
width?: number;
|
|
7
|
+
height?: number;
|
|
8
|
+
label: string;
|
|
9
|
+
selected?: boolean;
|
|
10
|
+
};
|
|
11
|
+
/** A directed edge connecting two nodes. */
|
|
12
|
+
type FlowEdge = {
|
|
13
|
+
id: string;
|
|
14
|
+
source: string;
|
|
15
|
+
target: string;
|
|
16
|
+
label?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Compute the center point of a node in canvas coordinates.
|
|
20
|
+
* Uses the node's explicit dimensions when available, otherwise falls back to
|
|
21
|
+
* the default box size.
|
|
22
|
+
*/
|
|
23
|
+
declare function nodeCenter(node: FlowNode): {
|
|
24
|
+
x: number;
|
|
25
|
+
y: number;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Find a node by id. Returns `undefined` when not found; callers must guard.
|
|
29
|
+
*/
|
|
30
|
+
declare function nodeById(nodes: FlowNode[], id: string): FlowNode | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* Produce an SVG cubic-bezier path `d` string between the anchor points of two
|
|
33
|
+
* nodes. The control handles extend horizontally from each anchor so the curve
|
|
34
|
+
* is smooth regardless of relative position — matching the easyloops
|
|
35
|
+
* architecture-editor style.
|
|
36
|
+
*
|
|
37
|
+
* Source anchor: right-center of the source node.
|
|
38
|
+
* Target anchor: left-center of the target node.
|
|
39
|
+
*/
|
|
40
|
+
declare function edgePath(source: FlowNode, target: FlowNode): string;
|
|
41
|
+
/**
|
|
42
|
+
* Compute the bounding box that contains all nodes. Useful for fitting the
|
|
43
|
+
* viewport to content. Returns zeros when the node list is empty.
|
|
44
|
+
*/
|
|
45
|
+
declare function contentBounds(nodes: FlowNode[]): {
|
|
46
|
+
minX: number;
|
|
47
|
+
minY: number;
|
|
48
|
+
maxX: number;
|
|
49
|
+
maxY: number;
|
|
50
|
+
};
|
|
51
|
+
/** Accessibility and data attributes for the root flow editor container. */
|
|
52
|
+
interface FlowEditorAPI {
|
|
53
|
+
ariaProps: Record<string, string | number | boolean>;
|
|
54
|
+
dataAttributes: Record<string, string>;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Return the framework-agnostic root attributes for a FlowEditor.
|
|
58
|
+
* Adapters spread `ariaProps` and `dataAttributes` on the outermost element.
|
|
59
|
+
*/
|
|
60
|
+
declare function createFlowEditor(): FlowEditorAPI;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Root wrapper for the flow editor canvas. Sized to fill its container and
|
|
64
|
+
* provides a relative positioning context for the node/edge layers.
|
|
65
|
+
*/
|
|
66
|
+
declare const flowEditorVariants: (props?: ({
|
|
67
|
+
size?: "sm" | "md" | "lg" | undefined;
|
|
68
|
+
} & {
|
|
69
|
+
className?: string;
|
|
70
|
+
}) | undefined) => string;
|
|
71
|
+
/**
|
|
72
|
+
* A single node box. The `selected` variant adds a ring to signal the active
|
|
73
|
+
* selection; semantic token classes are used throughout so theming works
|
|
74
|
+
* without overrides.
|
|
75
|
+
*/
|
|
76
|
+
declare const flowNodeVariants: (props?: ({
|
|
77
|
+
selected?: "true" | "false" | undefined;
|
|
78
|
+
} & {
|
|
79
|
+
className?: string;
|
|
80
|
+
}) | undefined) => string;
|
|
81
|
+
/** Accessible label text inside a node box. */
|
|
82
|
+
declare const flowNodeLabelClass = "px-3 py-2 truncate pointer-events-none";
|
|
83
|
+
/**
|
|
84
|
+
* SVG `<path>` element class for an edge. `currentColor` is used so the
|
|
85
|
+
* stroke inherits from `text-muted-foreground` set on the SVG container.
|
|
86
|
+
*/
|
|
87
|
+
declare const flowEdgePathClass = "fill-none stroke-current stroke-2 transition-opacity";
|
|
88
|
+
/** Text label positioned at the midpoint of an edge. */
|
|
89
|
+
declare const flowEdgeLabelClass = "text-xs fill-muted-foreground select-none pointer-events-none";
|
|
90
|
+
|
|
91
|
+
export { type FlowEdge, type FlowEditorAPI, type FlowNode, contentBounds, createFlowEditor, edgePath, flowEdgeLabelClass, flowEdgePathClass, flowEditorVariants, flowNodeLabelClass, flowNodeVariants, nodeById, nodeCenter };
|