@refraction-ui/react 0.18.3 → 0.19.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/dist-IBD7CHHX.js +649 -0
- package/dist/dist-IBD7CHHX.js.map +1 -0
- package/dist/index.cjs +6830 -3824
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4866 -2612
- package/dist/index.js.map +1 -1
- package/dist/internal/ai/index.d.cts +111 -0
- package/dist/internal/ai/index.d.ts +111 -0
- package/dist/internal/analytics/index.d.cts +6 -0
- package/dist/internal/analytics/index.d.ts +6 -0
- package/dist/internal/calendar/index.d.cts +5 -3
- package/dist/internal/calendar/index.d.ts +5 -3
- package/dist/internal/call-controls/index.d.ts +1 -3
- package/dist/internal/charts/index.d.cts +95 -0
- package/dist/internal/charts/index.d.ts +95 -0
- package/dist/internal/command-input/index.d.cts +41 -0
- package/dist/internal/command-input/index.d.ts +41 -0
- package/dist/internal/conversation/index.d.cts +2 -0
- package/dist/internal/conversation/index.d.ts +2 -0
- package/dist/internal/date-picker/index.d.cts +2 -0
- package/dist/internal/date-picker/index.d.ts +2 -0
- package/dist/internal/device-frame/index.d.cts +1 -3
- package/dist/internal/device-frame/index.d.ts +1 -3
- package/dist/internal/diff-viewer/index.d.cts +118 -0
- package/dist/internal/diff-viewer/index.d.ts +118 -0
- package/dist/internal/emoji-picker/index.d.cts +1 -3
- package/dist/internal/emoji-picker/index.d.ts +1 -3
- package/dist/internal/file-tree/index.d.cts +125 -0
- package/dist/internal/file-tree/index.d.ts +125 -0
- package/dist/internal/footer/index.d.cts +2 -0
- package/dist/internal/footer/index.d.ts +2 -0
- package/dist/internal/logger/index.d.cts +4 -0
- package/dist/internal/logger/index.d.ts +4 -0
- package/dist/internal/presence-indicator/index.d.cts +1 -3
- package/dist/internal/presence-indicator/index.d.ts +1 -3
- package/dist/internal/react-ai/index.d.cts +59 -0
- package/dist/internal/react-ai/index.d.ts +59 -0
- package/dist/internal/react-app-shell/index.d.cts +7 -51
- package/dist/internal/react-app-shell/index.d.ts +7 -51
- package/dist/internal/react-avatar-group/index.d.cts +1 -21
- package/dist/internal/react-avatar-group/index.d.ts +1 -21
- package/dist/internal/react-calendar/index.d.cts +2 -27
- package/dist/internal/react-calendar/index.d.ts +2 -27
- package/dist/internal/react-charts/index.d.cts +118 -0
- package/dist/internal/react-charts/index.d.ts +118 -0
- package/dist/internal/react-command/index.d.cts +1 -1
- package/dist/internal/react-command/index.d.ts +1 -1
- package/dist/internal/react-command-input/index.d.cts +21 -0
- package/dist/internal/react-command-input/index.d.ts +21 -0
- package/dist/internal/react-conversation/index.d.cts +2 -6
- package/dist/internal/react-conversation/index.d.ts +2 -6
- package/dist/internal/react-cookie-consent/index.d.cts +1 -6
- package/dist/internal/react-cookie-consent/index.d.ts +1 -6
- package/dist/internal/react-device-frame/index.d.cts +1 -25
- package/dist/internal/react-device-frame/index.d.ts +1 -25
- package/dist/internal/react-diff-viewer/index.d.cts +45 -0
- package/dist/internal/react-diff-viewer/index.d.ts +45 -0
- package/dist/internal/react-dropdown-menu/index.d.cts +1 -1
- package/dist/internal/react-dropdown-menu/index.d.ts +1 -1
- package/dist/internal/react-emoji-picker/index.d.cts +1 -5
- package/dist/internal/react-emoji-picker/index.d.ts +1 -5
- package/dist/internal/react-file-tree/index.d.cts +30 -3
- package/dist/internal/react-file-tree/index.d.ts +30 -3
- package/dist/internal/react-file-upload/index.d.cts +1 -6
- package/dist/internal/react-file-upload/index.d.ts +1 -6
- package/dist/internal/react-inline-editor/index.d.cts +1 -6
- package/dist/internal/react-inline-editor/index.d.ts +1 -6
- package/dist/internal/react-keyboard-shortcut/index.d.cts +1 -1
- package/dist/internal/react-keyboard-shortcut/index.d.ts +1 -1
- package/dist/internal/react-language-selector/index.d.cts +2 -13
- package/dist/internal/react-language-selector/index.d.ts +2 -13
- package/dist/internal/react-location-selector/index.d.cts +12 -0
- package/dist/internal/react-location-selector/index.d.ts +12 -0
- package/dist/internal/react-pagination/index.d.ts +22 -1
- package/dist/internal/react-presence-indicator/index.d.cts +1 -21
- package/dist/internal/react-presence-indicator/index.d.ts +1 -21
- package/dist/internal/react-radio/index.d.ts +2 -17
- package/dist/internal/react-reaction-bar/index.d.cts +1 -21
- package/dist/internal/react-reaction-bar/index.d.ts +1 -21
- package/dist/internal/react-search-bar/index.d.cts +1 -12
- package/dist/internal/react-search-bar/index.d.ts +1 -12
- package/dist/internal/react-slider/index.d.cts +22 -1
- package/dist/internal/react-slider/index.d.ts +22 -1
- package/dist/internal/react-status-indicator/index.d.cts +1 -5
- package/dist/internal/react-status-indicator/index.d.ts +1 -5
- package/dist/internal/react-tabs/index.d.cts +2 -8
- package/dist/internal/react-tabs/index.d.ts +2 -8
- package/dist/internal/react-thread-view/index.d.cts +1 -21
- package/dist/internal/react-thread-view/index.d.ts +1 -21
- package/dist/internal/react-version-selector/index.d.cts +2 -12
- package/dist/internal/react-version-selector/index.d.ts +2 -12
- package/dist/internal/reaction-bar/index.d.cts +1 -3
- package/dist/internal/reaction-bar/index.d.ts +1 -3
- package/dist/internal/status-indicator/index.d.cts +1 -3
- package/dist/internal/status-indicator/index.d.ts +1 -3
- package/dist/internal/thread-view/index.d.cts +3 -5
- package/dist/internal/thread-view/index.d.ts +3 -5
- package/dist/internal/toast/index.d.cts +7 -1
- package/dist/internal/toast/index.d.ts +7 -1
- package/dist/internal/voice-pill/index.d.cts +2 -2
- package/dist/internal/voice-pill/index.d.ts +2 -2
- package/dist/theme.cjs +10 -10
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.js +10 -10
- package/dist/theme.js.map +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/** AI provider interface — implemented by adapter packages (OpenAI, Anthropic, etc.) */
|
|
2
|
+
interface AIProvider {
|
|
3
|
+
name: string;
|
|
4
|
+
generateText(prompt: string, opts?: GenerateOptions): Promise<string>;
|
|
5
|
+
generateJSON<T = unknown>(prompt: string, opts?: GenerateOptions): Promise<T>;
|
|
6
|
+
supportsVision: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** Options passed to generate calls */
|
|
9
|
+
interface GenerateOptions {
|
|
10
|
+
provider?: string;
|
|
11
|
+
model?: string;
|
|
12
|
+
intent?: string;
|
|
13
|
+
image?: unknown;
|
|
14
|
+
maxTokens?: number;
|
|
15
|
+
temperature?: number;
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
}
|
|
18
|
+
/** TTS provider interface — implemented by TTS adapter packages */
|
|
19
|
+
interface TTSProvider {
|
|
20
|
+
name: string;
|
|
21
|
+
speak(text: string, opts?: TTSOptions): void;
|
|
22
|
+
stop(): void;
|
|
23
|
+
isSupported: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** Options passed to TTS calls */
|
|
26
|
+
interface TTSOptions {
|
|
27
|
+
provider?: string;
|
|
28
|
+
voice?: string;
|
|
29
|
+
language?: string;
|
|
30
|
+
speed?: number;
|
|
31
|
+
onEnd?: () => void;
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
}
|
|
34
|
+
/** Router function — picks a provider name given a request and context */
|
|
35
|
+
type RouterFn<T> = (request: T, context: {
|
|
36
|
+
providers: string[];
|
|
37
|
+
default: string;
|
|
38
|
+
}) => string;
|
|
39
|
+
/** Config for createAI */
|
|
40
|
+
interface AIConfig {
|
|
41
|
+
default?: string;
|
|
42
|
+
fallback?: string[];
|
|
43
|
+
router?: RouterFn<GenerateOptions>;
|
|
44
|
+
}
|
|
45
|
+
/** Config for createTTS */
|
|
46
|
+
interface TTSConfig {
|
|
47
|
+
default?: string;
|
|
48
|
+
router?: RouterFn<TTSOptions>;
|
|
49
|
+
}
|
|
50
|
+
/** Return type of createAI */
|
|
51
|
+
interface AIAPI {
|
|
52
|
+
providers: string[];
|
|
53
|
+
generateText(prompt: string, opts?: GenerateOptions): Promise<string>;
|
|
54
|
+
generateJSON<T = unknown>(prompt: string, opts?: GenerateOptions): Promise<T>;
|
|
55
|
+
addProvider(name: string, provider: AIProvider): void;
|
|
56
|
+
removeProvider(name: string): void;
|
|
57
|
+
}
|
|
58
|
+
/** Return type of createTTS */
|
|
59
|
+
interface TTSAPI {
|
|
60
|
+
providers: string[];
|
|
61
|
+
speak(text: string, opts?: TTSOptions): void;
|
|
62
|
+
stop(): void;
|
|
63
|
+
addProvider(name: string, provider: TTSProvider): void;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* createAI — creates an AI manager that routes requests to registered providers.
|
|
68
|
+
*
|
|
69
|
+
* Resolution order: explicit opts.provider -> router -> default -> first available
|
|
70
|
+
* Fallback: on error, try next in fallback chain
|
|
71
|
+
*/
|
|
72
|
+
declare function createAI(config?: AIConfig): AIAPI;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* createTTS — creates a TTS manager that routes requests to registered providers.
|
|
76
|
+
*
|
|
77
|
+
* Resolution order: explicit opts.provider -> router -> default -> first available
|
|
78
|
+
*/
|
|
79
|
+
declare function createTTS(config?: TTSConfig): TTSAPI;
|
|
80
|
+
|
|
81
|
+
interface MockAIResponses {
|
|
82
|
+
text?: string[];
|
|
83
|
+
json?: unknown[];
|
|
84
|
+
}
|
|
85
|
+
interface MockTTSProviderExtended extends TTSProvider {
|
|
86
|
+
speakCalls: Array<{
|
|
87
|
+
text: string;
|
|
88
|
+
opts?: TTSOptions;
|
|
89
|
+
}>;
|
|
90
|
+
stopCalls: number;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* createMockAIProvider — returns an AIProvider that returns canned responses.
|
|
94
|
+
* Used for testing without real API calls.
|
|
95
|
+
*/
|
|
96
|
+
declare function createMockAIProvider(name?: string, responses?: MockAIResponses): AIProvider;
|
|
97
|
+
/**
|
|
98
|
+
* createMockTTSProvider — returns a TTSProvider that tracks calls for assertion.
|
|
99
|
+
* Used for testing without real speech synthesis.
|
|
100
|
+
*/
|
|
101
|
+
declare function createMockTTSProvider(name?: string): MockTTSProviderExtended;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* sanitizeForSpeech — converts AI-generated text (with markdown, LaTeX, HTML)
|
|
105
|
+
* into clean, speakable plain text suitable for TTS engines.
|
|
106
|
+
*
|
|
107
|
+
* 30+ regex-based transformation rules applied in order.
|
|
108
|
+
*/
|
|
109
|
+
declare function sanitizeForSpeech(text: string): string;
|
|
110
|
+
|
|
111
|
+
export { type AIAPI, type AIConfig, type AIProvider, type GenerateOptions, type MockAIResponses, type MockTTSProviderExtended, type RouterFn, type TTSAPI, type TTSConfig, type TTSOptions, type TTSProvider, createAI, createMockAIProvider, createMockTTSProvider, createTTS, sanitizeForSpeech };
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/** AI provider interface — implemented by adapter packages (OpenAI, Anthropic, etc.) */
|
|
2
|
+
interface AIProvider {
|
|
3
|
+
name: string;
|
|
4
|
+
generateText(prompt: string, opts?: GenerateOptions): Promise<string>;
|
|
5
|
+
generateJSON<T = unknown>(prompt: string, opts?: GenerateOptions): Promise<T>;
|
|
6
|
+
supportsVision: boolean;
|
|
7
|
+
}
|
|
8
|
+
/** Options passed to generate calls */
|
|
9
|
+
interface GenerateOptions {
|
|
10
|
+
provider?: string;
|
|
11
|
+
model?: string;
|
|
12
|
+
intent?: string;
|
|
13
|
+
image?: unknown;
|
|
14
|
+
maxTokens?: number;
|
|
15
|
+
temperature?: number;
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
}
|
|
18
|
+
/** TTS provider interface — implemented by TTS adapter packages */
|
|
19
|
+
interface TTSProvider {
|
|
20
|
+
name: string;
|
|
21
|
+
speak(text: string, opts?: TTSOptions): void;
|
|
22
|
+
stop(): void;
|
|
23
|
+
isSupported: boolean;
|
|
24
|
+
}
|
|
25
|
+
/** Options passed to TTS calls */
|
|
26
|
+
interface TTSOptions {
|
|
27
|
+
provider?: string;
|
|
28
|
+
voice?: string;
|
|
29
|
+
language?: string;
|
|
30
|
+
speed?: number;
|
|
31
|
+
onEnd?: () => void;
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
}
|
|
34
|
+
/** Router function — picks a provider name given a request and context */
|
|
35
|
+
type RouterFn<T> = (request: T, context: {
|
|
36
|
+
providers: string[];
|
|
37
|
+
default: string;
|
|
38
|
+
}) => string;
|
|
39
|
+
/** Config for createAI */
|
|
40
|
+
interface AIConfig {
|
|
41
|
+
default?: string;
|
|
42
|
+
fallback?: string[];
|
|
43
|
+
router?: RouterFn<GenerateOptions>;
|
|
44
|
+
}
|
|
45
|
+
/** Config for createTTS */
|
|
46
|
+
interface TTSConfig {
|
|
47
|
+
default?: string;
|
|
48
|
+
router?: RouterFn<TTSOptions>;
|
|
49
|
+
}
|
|
50
|
+
/** Return type of createAI */
|
|
51
|
+
interface AIAPI {
|
|
52
|
+
providers: string[];
|
|
53
|
+
generateText(prompt: string, opts?: GenerateOptions): Promise<string>;
|
|
54
|
+
generateJSON<T = unknown>(prompt: string, opts?: GenerateOptions): Promise<T>;
|
|
55
|
+
addProvider(name: string, provider: AIProvider): void;
|
|
56
|
+
removeProvider(name: string): void;
|
|
57
|
+
}
|
|
58
|
+
/** Return type of createTTS */
|
|
59
|
+
interface TTSAPI {
|
|
60
|
+
providers: string[];
|
|
61
|
+
speak(text: string, opts?: TTSOptions): void;
|
|
62
|
+
stop(): void;
|
|
63
|
+
addProvider(name: string, provider: TTSProvider): void;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* createAI — creates an AI manager that routes requests to registered providers.
|
|
68
|
+
*
|
|
69
|
+
* Resolution order: explicit opts.provider -> router -> default -> first available
|
|
70
|
+
* Fallback: on error, try next in fallback chain
|
|
71
|
+
*/
|
|
72
|
+
declare function createAI(config?: AIConfig): AIAPI;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* createTTS — creates a TTS manager that routes requests to registered providers.
|
|
76
|
+
*
|
|
77
|
+
* Resolution order: explicit opts.provider -> router -> default -> first available
|
|
78
|
+
*/
|
|
79
|
+
declare function createTTS(config?: TTSConfig): TTSAPI;
|
|
80
|
+
|
|
81
|
+
interface MockAIResponses {
|
|
82
|
+
text?: string[];
|
|
83
|
+
json?: unknown[];
|
|
84
|
+
}
|
|
85
|
+
interface MockTTSProviderExtended extends TTSProvider {
|
|
86
|
+
speakCalls: Array<{
|
|
87
|
+
text: string;
|
|
88
|
+
opts?: TTSOptions;
|
|
89
|
+
}>;
|
|
90
|
+
stopCalls: number;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* createMockAIProvider — returns an AIProvider that returns canned responses.
|
|
94
|
+
* Used for testing without real API calls.
|
|
95
|
+
*/
|
|
96
|
+
declare function createMockAIProvider(name?: string, responses?: MockAIResponses): AIProvider;
|
|
97
|
+
/**
|
|
98
|
+
* createMockTTSProvider — returns a TTSProvider that tracks calls for assertion.
|
|
99
|
+
* Used for testing without real speech synthesis.
|
|
100
|
+
*/
|
|
101
|
+
declare function createMockTTSProvider(name?: string): MockTTSProviderExtended;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* sanitizeForSpeech — converts AI-generated text (with markdown, LaTeX, HTML)
|
|
105
|
+
* into clean, speakable plain text suitable for TTS engines.
|
|
106
|
+
*
|
|
107
|
+
* 30+ regex-based transformation rules applied in order.
|
|
108
|
+
*/
|
|
109
|
+
declare function sanitizeForSpeech(text: string): string;
|
|
110
|
+
|
|
111
|
+
export { type AIAPI, type AIConfig, type AIProvider, type GenerateOptions, type MockAIResponses, type MockTTSProviderExtended, type RouterFn, type TTSAPI, type TTSConfig, type TTSOptions, type TTSProvider, createAI, createMockAIProvider, createMockTTSProvider, createTTS, sanitizeForSpeech };
|
|
@@ -166,6 +166,8 @@ interface HttpSinkOptions {
|
|
|
166
166
|
maxBatchBytes?: number;
|
|
167
167
|
/** Soft per-event byte cap (Segment ≈ 32KB). Default 32_000. */
|
|
168
168
|
maxEventBytes?: number;
|
|
169
|
+
/** Clock for the batch `sentAt` stamp. Default: ambient `new Date()` — inject for deterministic tests. */
|
|
170
|
+
now?: () => Date;
|
|
169
171
|
}
|
|
170
172
|
/** `createAnalytics` configuration. */
|
|
171
173
|
interface AnalyticsConfig {
|
|
@@ -200,6 +202,10 @@ interface AnalyticsConfig {
|
|
|
200
202
|
batchSize?: number;
|
|
201
203
|
/** Auto-flush interval in ms (prod). Default 10_000. */
|
|
202
204
|
flushIntervalMs?: number;
|
|
205
|
+
/** Clock for default event timestamps. Default: ambient `new Date()` — inject for deterministic tests/SSR. */
|
|
206
|
+
now?: () => Date;
|
|
207
|
+
/** RNG for sample-rate decisions. Default: ambient `Math.random` — inject for deterministic tests. */
|
|
208
|
+
random?: () => number;
|
|
203
209
|
}
|
|
204
210
|
/** Options accepted by every top-level call. */
|
|
205
211
|
interface CallOptions {
|
|
@@ -166,6 +166,8 @@ interface HttpSinkOptions {
|
|
|
166
166
|
maxBatchBytes?: number;
|
|
167
167
|
/** Soft per-event byte cap (Segment ≈ 32KB). Default 32_000. */
|
|
168
168
|
maxEventBytes?: number;
|
|
169
|
+
/** Clock for the batch `sentAt` stamp. Default: ambient `new Date()` — inject for deterministic tests. */
|
|
170
|
+
now?: () => Date;
|
|
169
171
|
}
|
|
170
172
|
/** `createAnalytics` configuration. */
|
|
171
173
|
interface AnalyticsConfig {
|
|
@@ -200,6 +202,10 @@ interface AnalyticsConfig {
|
|
|
200
202
|
batchSize?: number;
|
|
201
203
|
/** Auto-flush interval in ms (prod). Default 10_000. */
|
|
202
204
|
flushIntervalMs?: number;
|
|
205
|
+
/** Clock for default event timestamps. Default: ambient `new Date()` — inject for deterministic tests/SSR. */
|
|
206
|
+
now?: () => Date;
|
|
207
|
+
/** RNG for sample-rate decisions. Default: ambient `Math.random` — inject for deterministic tests. */
|
|
208
|
+
random?: () => number;
|
|
203
209
|
}
|
|
204
210
|
/** Options accepted by every top-level call. */
|
|
205
211
|
interface CallOptions {
|
|
@@ -17,6 +17,8 @@ interface CalendarProps {
|
|
|
17
17
|
maxDate?: Date;
|
|
18
18
|
/** Specific dates to disable */
|
|
19
19
|
disabledDates?: Date[];
|
|
20
|
+
/** Reference "today" for isToday/aria-current. Default: ambient `new Date()` — inject to avoid SSR/CSR hydration mismatch. */
|
|
21
|
+
today?: Date;
|
|
20
22
|
}
|
|
21
23
|
interface CalendarDay {
|
|
22
24
|
/** The date this cell represents */
|
|
@@ -48,9 +50,9 @@ interface CalendarAPI {
|
|
|
48
50
|
/** Select a date */
|
|
49
51
|
select(date: Date): void;
|
|
50
52
|
/** ARIA attributes for the calendar grid */
|
|
51
|
-
ariaProps: Partial<AccessibilityProps> & Record<string,
|
|
53
|
+
ariaProps: Partial<AccessibilityProps> & Record<string, string | number | boolean>;
|
|
52
54
|
/** Get ARIA attributes for a specific day cell */
|
|
53
|
-
getDayAriaProps(day: CalendarDay): Partial<AccessibilityProps> & Record<string,
|
|
55
|
+
getDayAriaProps(day: CalendarDay): Partial<AccessibilityProps> & Record<string, string | number | boolean>;
|
|
54
56
|
/** Generated IDs */
|
|
55
57
|
ids: {
|
|
56
58
|
grid: string;
|
|
@@ -65,7 +67,7 @@ declare const calendarVariants: (props?: ({
|
|
|
65
67
|
className?: string;
|
|
66
68
|
}) | undefined) => string;
|
|
67
69
|
declare const dayVariants: (props?: ({
|
|
68
|
-
state?: "
|
|
70
|
+
state?: "today" | "default" | "selected" | "disabled" | "outside" | undefined;
|
|
69
71
|
} & {
|
|
70
72
|
className?: string;
|
|
71
73
|
}) | undefined) => string;
|
|
@@ -17,6 +17,8 @@ interface CalendarProps {
|
|
|
17
17
|
maxDate?: Date;
|
|
18
18
|
/** Specific dates to disable */
|
|
19
19
|
disabledDates?: Date[];
|
|
20
|
+
/** Reference "today" for isToday/aria-current. Default: ambient `new Date()` — inject to avoid SSR/CSR hydration mismatch. */
|
|
21
|
+
today?: Date;
|
|
20
22
|
}
|
|
21
23
|
interface CalendarDay {
|
|
22
24
|
/** The date this cell represents */
|
|
@@ -48,9 +50,9 @@ interface CalendarAPI {
|
|
|
48
50
|
/** Select a date */
|
|
49
51
|
select(date: Date): void;
|
|
50
52
|
/** ARIA attributes for the calendar grid */
|
|
51
|
-
ariaProps: Partial<AccessibilityProps> & Record<string,
|
|
53
|
+
ariaProps: Partial<AccessibilityProps> & Record<string, string | number | boolean>;
|
|
52
54
|
/** Get ARIA attributes for a specific day cell */
|
|
53
|
-
getDayAriaProps(day: CalendarDay): Partial<AccessibilityProps> & Record<string,
|
|
55
|
+
getDayAriaProps(day: CalendarDay): Partial<AccessibilityProps> & Record<string, string | number | boolean>;
|
|
54
56
|
/** Generated IDs */
|
|
55
57
|
ids: {
|
|
56
58
|
grid: string;
|
|
@@ -65,7 +67,7 @@ declare const calendarVariants: (props?: ({
|
|
|
65
67
|
className?: string;
|
|
66
68
|
}) | undefined) => string;
|
|
67
69
|
declare const dayVariants: (props?: ({
|
|
68
|
-
state?: "
|
|
70
|
+
state?: "today" | "default" | "selected" | "disabled" | "outside" | undefined;
|
|
69
71
|
} & {
|
|
70
72
|
className?: string;
|
|
71
73
|
}) | undefined) => string;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { AccessibilityProps } from '../shared/index.js';
|
|
2
|
-
|
|
3
1
|
/** Visual/semantic tone of a call control button. */
|
|
4
2
|
type CallControlTone = 'default' | 'active' | 'destructive';
|
|
5
3
|
/**
|
|
@@ -29,7 +27,7 @@ interface CallControlsProps {
|
|
|
29
27
|
}
|
|
30
28
|
interface CallControlsAPI {
|
|
31
29
|
/** ARIA attributes to spread on the toolbar element (`role="toolbar"`). */
|
|
32
|
-
ariaProps:
|
|
30
|
+
ariaProps: Record<string, string | number | boolean>;
|
|
33
31
|
/** Data attributes for styling hooks. */
|
|
34
32
|
dataAttributes: Record<string, string>;
|
|
35
33
|
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
interface LinearScale {
|
|
2
|
+
(value: number): number;
|
|
3
|
+
invert: (value: number) => number;
|
|
4
|
+
ticks: (count?: number) => number[];
|
|
5
|
+
type: 'linear';
|
|
6
|
+
domain: [number, number];
|
|
7
|
+
range: [number, number];
|
|
8
|
+
}
|
|
9
|
+
declare function createLinearScale(domain: [number, number], range: [number, number]): LinearScale;
|
|
10
|
+
interface BandScale {
|
|
11
|
+
(value: string): number;
|
|
12
|
+
bandwidth: () => number;
|
|
13
|
+
type: 'band';
|
|
14
|
+
domain: string[];
|
|
15
|
+
range: [number, number];
|
|
16
|
+
}
|
|
17
|
+
declare function createBandScale(domain: string[], range: [number, number], padding?: number): BandScale;
|
|
18
|
+
interface TimeScale {
|
|
19
|
+
(value: Date): number;
|
|
20
|
+
invert: (value: number) => Date;
|
|
21
|
+
ticks: (count?: number) => Date[];
|
|
22
|
+
type: 'time';
|
|
23
|
+
domain: [Date, Date];
|
|
24
|
+
range: [number, number];
|
|
25
|
+
}
|
|
26
|
+
declare function createTimeScale(domain: [Date, Date], range: [number, number]): TimeScale;
|
|
27
|
+
|
|
28
|
+
interface HistogramBin {
|
|
29
|
+
x0: number;
|
|
30
|
+
x1: number;
|
|
31
|
+
count: number;
|
|
32
|
+
}
|
|
33
|
+
declare function computeExtent(data: number[]): [number, number];
|
|
34
|
+
declare function computeMean(data: number[]): number;
|
|
35
|
+
declare function computeHistogramBins(data: number[], binCount?: number): HistogramBin[];
|
|
36
|
+
declare function normalizeData<T>(data: T[], accessor: string | ((d: T) => unknown)): unknown[];
|
|
37
|
+
|
|
38
|
+
interface Point {
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
}
|
|
42
|
+
declare function linePath(points: Point[]): string;
|
|
43
|
+
declare function areaPath(points: Point[], baseline: number): string;
|
|
44
|
+
declare function arcPath(cx: number, cy: number, radius: number, startAngle: number, endAngle: number): string;
|
|
45
|
+
|
|
46
|
+
interface Margin {
|
|
47
|
+
top: number;
|
|
48
|
+
right: number;
|
|
49
|
+
bottom: number;
|
|
50
|
+
left: number;
|
|
51
|
+
}
|
|
52
|
+
interface Dimensions {
|
|
53
|
+
width: number;
|
|
54
|
+
height: number;
|
|
55
|
+
margin: Margin;
|
|
56
|
+
boundedWidth: number;
|
|
57
|
+
boundedHeight: number;
|
|
58
|
+
}
|
|
59
|
+
interface ChartConfig {
|
|
60
|
+
width?: number;
|
|
61
|
+
height?: number;
|
|
62
|
+
margin?: Partial<Margin>;
|
|
63
|
+
data?: unknown[];
|
|
64
|
+
}
|
|
65
|
+
interface ChartAPI {
|
|
66
|
+
dimensions: Dimensions;
|
|
67
|
+
scales: Record<string, unknown>;
|
|
68
|
+
updateDimensions: (partial: Partial<ChartConfig>) => void;
|
|
69
|
+
}
|
|
70
|
+
declare function combineDimensions(partial: Partial<ChartConfig>): Dimensions;
|
|
71
|
+
declare function createChart(config: ChartConfig): ChartAPI;
|
|
72
|
+
|
|
73
|
+
type AnyScale = LinearScale | BandScale | TimeScale;
|
|
74
|
+
declare function generateTicks(scale: AnyScale, count?: number): (number | string | Date)[];
|
|
75
|
+
declare function formatTick(value: number | string | Date, type: 'number' | 'date' | 'string'): string;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Colorblind-safe color palettes for charts.
|
|
79
|
+
* Based on Wong (2011) "Points of view: Color blindness" — Nature Methods.
|
|
80
|
+
* These 8 colors are distinguishable by people with all types of color vision deficiency.
|
|
81
|
+
*/
|
|
82
|
+
declare const COLORBLIND_SAFE_PALETTE: readonly ["#0072B2", "#E69F00", "#009E73", "#F0E442", "#56B4E9", "#D55E00", "#CC79A7", "#000000"];
|
|
83
|
+
/** Convert hex to HSL string for CSS variables */
|
|
84
|
+
declare function hexToHSL(hex: string): string;
|
|
85
|
+
/** Get a colorblind-safe color by index (wraps around) */
|
|
86
|
+
declare function getChartColor(index: number): string;
|
|
87
|
+
/**
|
|
88
|
+
* Pattern fills for charts — when color alone isn't enough.
|
|
89
|
+
* Returns SVG pattern definitions that can be used as fill.
|
|
90
|
+
*/
|
|
91
|
+
type PatternType = 'solid' | 'diagonal' | 'dots' | 'crosshatch' | 'horizontal' | 'vertical' | 'zigzag' | 'checker';
|
|
92
|
+
declare function getPatternDef(type: PatternType, color: string, id: string): string;
|
|
93
|
+
declare const PATTERNS: PatternType[];
|
|
94
|
+
|
|
95
|
+
export { type BandScale, COLORBLIND_SAFE_PALETTE, type ChartAPI, type ChartConfig, type Dimensions, type HistogramBin, type LinearScale, type Margin, PATTERNS, type PatternType, type Point, type TimeScale, arcPath, areaPath, combineDimensions, computeExtent, computeHistogramBins, computeMean, createBandScale, createChart, createLinearScale, createTimeScale, formatTick, generateTicks, getChartColor, getPatternDef, hexToHSL, linePath, normalizeData };
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
interface LinearScale {
|
|
2
|
+
(value: number): number;
|
|
3
|
+
invert: (value: number) => number;
|
|
4
|
+
ticks: (count?: number) => number[];
|
|
5
|
+
type: 'linear';
|
|
6
|
+
domain: [number, number];
|
|
7
|
+
range: [number, number];
|
|
8
|
+
}
|
|
9
|
+
declare function createLinearScale(domain: [number, number], range: [number, number]): LinearScale;
|
|
10
|
+
interface BandScale {
|
|
11
|
+
(value: string): number;
|
|
12
|
+
bandwidth: () => number;
|
|
13
|
+
type: 'band';
|
|
14
|
+
domain: string[];
|
|
15
|
+
range: [number, number];
|
|
16
|
+
}
|
|
17
|
+
declare function createBandScale(domain: string[], range: [number, number], padding?: number): BandScale;
|
|
18
|
+
interface TimeScale {
|
|
19
|
+
(value: Date): number;
|
|
20
|
+
invert: (value: number) => Date;
|
|
21
|
+
ticks: (count?: number) => Date[];
|
|
22
|
+
type: 'time';
|
|
23
|
+
domain: [Date, Date];
|
|
24
|
+
range: [number, number];
|
|
25
|
+
}
|
|
26
|
+
declare function createTimeScale(domain: [Date, Date], range: [number, number]): TimeScale;
|
|
27
|
+
|
|
28
|
+
interface HistogramBin {
|
|
29
|
+
x0: number;
|
|
30
|
+
x1: number;
|
|
31
|
+
count: number;
|
|
32
|
+
}
|
|
33
|
+
declare function computeExtent(data: number[]): [number, number];
|
|
34
|
+
declare function computeMean(data: number[]): number;
|
|
35
|
+
declare function computeHistogramBins(data: number[], binCount?: number): HistogramBin[];
|
|
36
|
+
declare function normalizeData<T>(data: T[], accessor: string | ((d: T) => unknown)): unknown[];
|
|
37
|
+
|
|
38
|
+
interface Point {
|
|
39
|
+
x: number;
|
|
40
|
+
y: number;
|
|
41
|
+
}
|
|
42
|
+
declare function linePath(points: Point[]): string;
|
|
43
|
+
declare function areaPath(points: Point[], baseline: number): string;
|
|
44
|
+
declare function arcPath(cx: number, cy: number, radius: number, startAngle: number, endAngle: number): string;
|
|
45
|
+
|
|
46
|
+
interface Margin {
|
|
47
|
+
top: number;
|
|
48
|
+
right: number;
|
|
49
|
+
bottom: number;
|
|
50
|
+
left: number;
|
|
51
|
+
}
|
|
52
|
+
interface Dimensions {
|
|
53
|
+
width: number;
|
|
54
|
+
height: number;
|
|
55
|
+
margin: Margin;
|
|
56
|
+
boundedWidth: number;
|
|
57
|
+
boundedHeight: number;
|
|
58
|
+
}
|
|
59
|
+
interface ChartConfig {
|
|
60
|
+
width?: number;
|
|
61
|
+
height?: number;
|
|
62
|
+
margin?: Partial<Margin>;
|
|
63
|
+
data?: unknown[];
|
|
64
|
+
}
|
|
65
|
+
interface ChartAPI {
|
|
66
|
+
dimensions: Dimensions;
|
|
67
|
+
scales: Record<string, unknown>;
|
|
68
|
+
updateDimensions: (partial: Partial<ChartConfig>) => void;
|
|
69
|
+
}
|
|
70
|
+
declare function combineDimensions(partial: Partial<ChartConfig>): Dimensions;
|
|
71
|
+
declare function createChart(config: ChartConfig): ChartAPI;
|
|
72
|
+
|
|
73
|
+
type AnyScale = LinearScale | BandScale | TimeScale;
|
|
74
|
+
declare function generateTicks(scale: AnyScale, count?: number): (number | string | Date)[];
|
|
75
|
+
declare function formatTick(value: number | string | Date, type: 'number' | 'date' | 'string'): string;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Colorblind-safe color palettes for charts.
|
|
79
|
+
* Based on Wong (2011) "Points of view: Color blindness" — Nature Methods.
|
|
80
|
+
* These 8 colors are distinguishable by people with all types of color vision deficiency.
|
|
81
|
+
*/
|
|
82
|
+
declare const COLORBLIND_SAFE_PALETTE: readonly ["#0072B2", "#E69F00", "#009E73", "#F0E442", "#56B4E9", "#D55E00", "#CC79A7", "#000000"];
|
|
83
|
+
/** Convert hex to HSL string for CSS variables */
|
|
84
|
+
declare function hexToHSL(hex: string): string;
|
|
85
|
+
/** Get a colorblind-safe color by index (wraps around) */
|
|
86
|
+
declare function getChartColor(index: number): string;
|
|
87
|
+
/**
|
|
88
|
+
* Pattern fills for charts — when color alone isn't enough.
|
|
89
|
+
* Returns SVG pattern definitions that can be used as fill.
|
|
90
|
+
*/
|
|
91
|
+
type PatternType = 'solid' | 'diagonal' | 'dots' | 'crosshatch' | 'horizontal' | 'vertical' | 'zigzag' | 'checker';
|
|
92
|
+
declare function getPatternDef(type: PatternType, color: string, id: string): string;
|
|
93
|
+
declare const PATTERNS: PatternType[];
|
|
94
|
+
|
|
95
|
+
export { type BandScale, COLORBLIND_SAFE_PALETTE, type ChartAPI, type ChartConfig, type Dimensions, type HistogramBin, type LinearScale, type Margin, PATTERNS, type PatternType, type Point, type TimeScale, arcPath, areaPath, combineDimensions, computeExtent, computeHistogramBins, computeMean, createBandScale, createChart, createLinearScale, createTimeScale, formatTick, generateTicks, getChartColor, getPatternDef, hexToHSL, linePath, normalizeData };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
interface Trigger {
|
|
2
|
+
char: string;
|
|
3
|
+
pattern?: RegExp;
|
|
4
|
+
}
|
|
5
|
+
interface CommandNode {
|
|
6
|
+
type: 'command';
|
|
7
|
+
trigger: string;
|
|
8
|
+
text: string;
|
|
9
|
+
}
|
|
10
|
+
interface TextNode {
|
|
11
|
+
type: 'text';
|
|
12
|
+
text: string;
|
|
13
|
+
}
|
|
14
|
+
type InputNode = TextNode | CommandNode;
|
|
15
|
+
interface CommandInputState {
|
|
16
|
+
nodes: InputNode[];
|
|
17
|
+
rawText: string;
|
|
18
|
+
cursorPosition: number;
|
|
19
|
+
activeTrigger: Trigger | null;
|
|
20
|
+
activeCommandText: string | null;
|
|
21
|
+
}
|
|
22
|
+
interface CommandInputOptions {
|
|
23
|
+
triggers: Trigger[];
|
|
24
|
+
onCommandTriggered?: (trigger: Trigger, text: string) => void;
|
|
25
|
+
onStateChange?: (state: CommandInputState) => void;
|
|
26
|
+
onCommandCommit?: (trigger: Trigger, text: string) => void;
|
|
27
|
+
onCommandCancel?: () => void;
|
|
28
|
+
}
|
|
29
|
+
declare class CommandInput {
|
|
30
|
+
private state;
|
|
31
|
+
private options;
|
|
32
|
+
constructor(options: CommandInputOptions);
|
|
33
|
+
handleInput(text: string, cursorPosition: number): void;
|
|
34
|
+
handleKeyDown(key: string, event?: Event): void;
|
|
35
|
+
get value(): InputNode[];
|
|
36
|
+
getState(): CommandInputState;
|
|
37
|
+
private parseInput;
|
|
38
|
+
private notifyStateChange;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { CommandInput, type CommandInputOptions, type CommandInputState, type CommandNode, type InputNode, type TextNode, type Trigger };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
interface Trigger {
|
|
2
|
+
char: string;
|
|
3
|
+
pattern?: RegExp;
|
|
4
|
+
}
|
|
5
|
+
interface CommandNode {
|
|
6
|
+
type: 'command';
|
|
7
|
+
trigger: string;
|
|
8
|
+
text: string;
|
|
9
|
+
}
|
|
10
|
+
interface TextNode {
|
|
11
|
+
type: 'text';
|
|
12
|
+
text: string;
|
|
13
|
+
}
|
|
14
|
+
type InputNode = TextNode | CommandNode;
|
|
15
|
+
interface CommandInputState {
|
|
16
|
+
nodes: InputNode[];
|
|
17
|
+
rawText: string;
|
|
18
|
+
cursorPosition: number;
|
|
19
|
+
activeTrigger: Trigger | null;
|
|
20
|
+
activeCommandText: string | null;
|
|
21
|
+
}
|
|
22
|
+
interface CommandInputOptions {
|
|
23
|
+
triggers: Trigger[];
|
|
24
|
+
onCommandTriggered?: (trigger: Trigger, text: string) => void;
|
|
25
|
+
onStateChange?: (state: CommandInputState) => void;
|
|
26
|
+
onCommandCommit?: (trigger: Trigger, text: string) => void;
|
|
27
|
+
onCommandCancel?: () => void;
|
|
28
|
+
}
|
|
29
|
+
declare class CommandInput {
|
|
30
|
+
private state;
|
|
31
|
+
private options;
|
|
32
|
+
constructor(options: CommandInputOptions);
|
|
33
|
+
handleInput(text: string, cursorPosition: number): void;
|
|
34
|
+
handleKeyDown(key: string, event?: Event): void;
|
|
35
|
+
get value(): InputNode[];
|
|
36
|
+
getState(): CommandInputState;
|
|
37
|
+
private parseInput;
|
|
38
|
+
private notifyStateChange;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export { CommandInput, type CommandInputOptions, type CommandInputState, type CommandNode, type InputNode, type TextNode, type Trigger };
|
|
@@ -157,6 +157,8 @@ interface ConversationConfig {
|
|
|
157
157
|
generateTitle?: (firstMessage: string) => string;
|
|
158
158
|
/** Threading mode (default 'inline') */
|
|
159
159
|
threadingMode?: ThreadingMode;
|
|
160
|
+
/** Clock for conversation/message timestamps. Default: ambient `new Date()` — inject for deterministic SSR/tests. */
|
|
161
|
+
now?: () => Date;
|
|
160
162
|
}
|
|
161
163
|
/** Options for a single `sendMessage`. */
|
|
162
164
|
interface SendOptions {
|
|
@@ -157,6 +157,8 @@ interface ConversationConfig {
|
|
|
157
157
|
generateTitle?: (firstMessage: string) => string;
|
|
158
158
|
/** Threading mode (default 'inline') */
|
|
159
159
|
threadingMode?: ThreadingMode;
|
|
160
|
+
/** Clock for conversation/message timestamps. Default: ambient `new Date()` — inject for deterministic SSR/tests. */
|
|
161
|
+
now?: () => Date;
|
|
160
162
|
}
|
|
161
163
|
/** Options for a single `sendMessage`. */
|
|
162
164
|
interface SendOptions {
|
|
@@ -24,6 +24,8 @@ interface DatePickerProps {
|
|
|
24
24
|
onOpenChange?: (open: boolean) => void;
|
|
25
25
|
/** The currently displayed month (controlled) */
|
|
26
26
|
currentMonth?: Date;
|
|
27
|
+
/** Reference "today" for isToday/aria-current and time defaults. Default: ambient `new Date()` — inject to avoid SSR/CSR hydration mismatch. */
|
|
28
|
+
today?: Date;
|
|
27
29
|
}
|
|
28
30
|
interface DatePickerState {
|
|
29
31
|
open: boolean;
|
|
@@ -24,6 +24,8 @@ interface DatePickerProps {
|
|
|
24
24
|
onOpenChange?: (open: boolean) => void;
|
|
25
25
|
/** The currently displayed month (controlled) */
|
|
26
26
|
currentMonth?: Date;
|
|
27
|
+
/** Reference "today" for isToday/aria-current and time defaults. Default: ambient `new Date()` — inject to avoid SSR/CSR hydration mismatch. */
|
|
28
|
+
today?: Date;
|
|
27
29
|
}
|
|
28
30
|
interface DatePickerState {
|
|
29
31
|
open: boolean;
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { AccessibilityProps } from '../shared/index.cjs';
|
|
2
|
-
|
|
3
1
|
type DeviceType = 'iphone' | 'ipad' | 'android-phone' | 'android-tablet';
|
|
4
2
|
type DeviceOrientation = 'portrait' | 'landscape';
|
|
5
3
|
interface DeviceFrameProps {
|
|
@@ -24,7 +22,7 @@ interface DeviceFrameAPI {
|
|
|
24
22
|
/** Computed dimensions for the device */
|
|
25
23
|
dimensions: DeviceDimensions;
|
|
26
24
|
/** ARIA attributes for the device frame */
|
|
27
|
-
ariaProps:
|
|
25
|
+
ariaProps: Record<string, string | number | boolean>;
|
|
28
26
|
/** Data attributes for styling hooks */
|
|
29
27
|
dataAttributes: Record<string, string>;
|
|
30
28
|
}
|