@refraction-ui/react 0.4.2 → 0.6.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/README.md +9 -1
- package/dist/chunk-O4453CBF.js +137 -0
- package/dist/chunk-O4453CBF.js.map +1 -0
- package/dist/chunk-XWP763SH.js +76 -0
- package/dist/chunk-XWP763SH.js.map +1 -0
- package/dist/faro-engine-47HGRAQH-JKINJPMH.js +3 -0
- package/dist/faro-engine-47HGRAQH-JKINJPMH.js.map +1 -0
- package/dist/form.cjs +340 -0
- package/dist/form.cjs.map +1 -0
- package/dist/form.d.cts +1 -0
- package/dist/form.d.ts +1 -0
- package/dist/form.js +204 -0
- package/dist/form.js.map +1 -0
- package/dist/index.cjs +1438 -237
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +76 -76
- package/dist/index.d.ts +76 -76
- package/dist/index.js +1317 -312
- package/dist/index.js.map +1 -1
- package/dist/internal/analytics/index.d.cts +448 -0
- package/dist/internal/analytics/index.d.ts +448 -0
- package/dist/internal/animated-text/index.d.cts +47 -0
- package/dist/internal/animated-text/index.d.ts +47 -0
- package/dist/internal/app-shell/index.d.cts +128 -0
- package/dist/internal/app-shell/index.d.ts +128 -0
- package/dist/internal/auth/index.d.cts +74 -0
- package/dist/internal/auth/index.d.ts +74 -0
- package/dist/internal/avatar/index.d.cts +53 -0
- package/dist/internal/avatar/index.d.ts +53 -0
- package/dist/internal/avatar-group/index.d.cts +70 -0
- package/dist/internal/avatar-group/index.d.ts +70 -0
- package/dist/internal/badge/index.d.cts +26 -0
- package/dist/internal/badge/index.d.ts +26 -0
- package/dist/internal/bottom-nav/index.d.cts +29 -0
- package/dist/internal/bottom-nav/index.d.ts +29 -0
- package/dist/internal/breadcrumbs/index.d.cts +38 -0
- package/dist/internal/breadcrumbs/index.d.ts +38 -0
- package/dist/internal/button/index.d.cts +34 -0
- package/dist/internal/button/index.d.ts +34 -0
- package/dist/internal/calendar/index.d.cts +73 -0
- package/dist/internal/calendar/index.d.ts +73 -0
- package/dist/internal/card/index.d.cts +62 -0
- package/dist/internal/card/index.d.ts +62 -0
- package/dist/internal/card-grid/index.d.cts +10 -0
- package/dist/internal/card-grid/index.d.ts +10 -0
- package/dist/internal/checkbox/index.d.cts +40 -0
- package/dist/internal/checkbox/index.d.ts +40 -0
- package/dist/internal/code-editor/index.d.cts +47 -0
- package/dist/internal/code-editor/index.d.ts +47 -0
- package/dist/internal/collapsible/index.d.cts +43 -0
- package/dist/internal/collapsible/index.d.ts +43 -0
- package/dist/internal/command/index.d.cts +80 -0
- package/dist/internal/command/index.d.ts +80 -0
- package/dist/internal/content-protection/index.d.cts +47 -0
- package/dist/internal/content-protection/index.d.ts +47 -0
- package/dist/internal/data-table/index.d.cts +73 -0
- package/dist/internal/data-table/index.d.ts +73 -0
- package/dist/internal/date-picker/index.d.cts +98 -0
- package/dist/internal/date-picker/index.d.ts +98 -0
- package/dist/internal/device-frame/index.d.cts +40 -0
- package/dist/internal/device-frame/index.d.ts +40 -0
- package/dist/internal/dialog/index.d.cts +54 -0
- package/dist/internal/dialog/index.d.ts +54 -0
- package/dist/internal/dropdown-menu/index.d.cts +55 -0
- package/dist/internal/dropdown-menu/index.d.ts +55 -0
- package/dist/internal/emoji-picker/index.d.cts +77 -0
- package/dist/internal/emoji-picker/index.d.ts +77 -0
- package/dist/internal/feedback-dialog/index.d.cts +55 -0
- package/dist/internal/feedback-dialog/index.d.ts +55 -0
- package/dist/internal/file-upload/index.d.cts +91 -0
- package/dist/internal/file-upload/index.d.ts +91 -0
- package/dist/internal/footer/index.d.cts +30 -0
- package/dist/internal/footer/index.d.ts +30 -0
- package/dist/internal/inline-editor/index.d.cts +52 -0
- package/dist/internal/inline-editor/index.d.ts +52 -0
- package/dist/internal/input/index.d.cts +38 -0
- package/dist/internal/input/index.d.ts +38 -0
- package/dist/internal/input-group/index.d.cts +35 -0
- package/dist/internal/input-group/index.d.ts +35 -0
- package/dist/internal/install-prompt/index.d.cts +36 -0
- package/dist/internal/install-prompt/index.d.ts +36 -0
- package/dist/internal/keyboard-shortcut/index.d.cts +49 -0
- package/dist/internal/keyboard-shortcut/index.d.ts +49 -0
- package/dist/internal/language-selector/index.d.cts +63 -0
- package/dist/internal/language-selector/index.d.ts +63 -0
- package/dist/internal/logger/index.d.cts +229 -0
- package/dist/internal/logger/index.d.ts +229 -0
- package/dist/internal/markdown-renderer/index.d.cts +40 -0
- package/dist/internal/markdown-renderer/index.d.ts +40 -0
- package/dist/internal/mobile-nav/index.d.cts +45 -0
- package/dist/internal/mobile-nav/index.d.ts +45 -0
- package/dist/internal/navbar/index.d.cts +30 -0
- package/dist/internal/navbar/index.d.ts +30 -0
- package/dist/internal/otp-input/index.d.cts +66 -0
- package/dist/internal/otp-input/index.d.ts +66 -0
- package/dist/internal/payment/index.d.cts +9 -0
- package/dist/internal/payment/index.d.ts +9 -0
- package/dist/internal/popover/index.d.cts +46 -0
- package/dist/internal/popover/index.d.ts +46 -0
- package/dist/internal/presence-indicator/index.d.cts +38 -0
- package/dist/internal/presence-indicator/index.d.ts +38 -0
- package/dist/internal/progress-display/index.d.cts +60 -0
- package/dist/internal/progress-display/index.d.ts +60 -0
- package/dist/internal/radio/index.d.ts +43 -0
- package/dist/internal/react-accordion/index.d.ts +22 -0
- package/dist/internal/react-analytics/index.d.cts +44 -0
- package/dist/internal/react-analytics/index.d.ts +44 -0
- package/dist/internal/react-animated-text/index.d.cts +12 -0
- package/dist/internal/react-animated-text/index.d.ts +12 -0
- package/dist/internal/react-app-shell/index.d.cts +169 -0
- package/dist/internal/react-app-shell/index.d.ts +169 -0
- package/dist/internal/react-auth/index.d.cts +59 -0
- package/dist/internal/react-auth/index.d.ts +59 -0
- package/dist/internal/react-avatar/index.d.cts +20 -0
- package/dist/internal/react-avatar/index.d.ts +20 -0
- package/dist/internal/react-avatar-group/index.d.cts +33 -0
- package/dist/internal/react-avatar-group/index.d.ts +33 -0
- package/dist/internal/react-badge/index.d.cts +17 -0
- package/dist/internal/react-badge/index.d.ts +17 -0
- package/dist/internal/react-bottom-nav/index.d.cts +19 -0
- package/dist/internal/react-bottom-nav/index.d.ts +19 -0
- package/dist/internal/react-breadcrumbs/index.d.cts +24 -0
- package/dist/internal/react-breadcrumbs/index.d.ts +24 -0
- package/dist/internal/react-button/index.d.cts +21 -0
- package/dist/internal/react-button/index.d.ts +21 -0
- package/dist/internal/react-calendar/index.d.cts +44 -0
- package/dist/internal/react-calendar/index.d.ts +44 -0
- package/dist/internal/react-callout/index.d.cts +12 -0
- package/dist/internal/react-callout/index.d.ts +12 -0
- package/dist/internal/react-card/index.d.cts +29 -0
- package/dist/internal/react-card/index.d.ts +29 -0
- package/dist/internal/react-card-grid/index.d.cts +8 -0
- package/dist/internal/react-card-grid/index.d.ts +8 -0
- package/dist/internal/react-carousel/index.d.ts +22 -0
- package/dist/internal/react-checkbox/index.d.cts +18 -0
- package/dist/internal/react-checkbox/index.d.ts +18 -0
- package/dist/internal/react-code-block/index.d.cts +7 -0
- package/dist/internal/react-code-block/index.d.ts +7 -0
- package/dist/internal/react-code-editor/index.d.cts +28 -0
- package/dist/internal/react-code-editor/index.d.ts +28 -0
- package/dist/internal/react-collapsible/index.d.cts +29 -0
- package/dist/internal/react-collapsible/index.d.ts +29 -0
- package/dist/internal/react-combobox/index.d.cts +94 -0
- package/dist/internal/react-combobox/index.d.ts +94 -0
- package/dist/internal/react-command/index.d.cts +51 -0
- package/dist/internal/react-command/index.d.ts +51 -0
- package/dist/internal/react-content-protection/index.d.cts +22 -0
- package/dist/internal/react-content-protection/index.d.ts +22 -0
- package/dist/internal/react-data-table/index.d.cts +22 -0
- package/dist/internal/react-data-table/index.d.ts +22 -0
- package/dist/internal/react-date-picker/index.d.cts +23 -0
- package/dist/internal/react-date-picker/index.d.ts +23 -0
- package/dist/internal/react-device-frame/index.d.cts +37 -0
- package/dist/internal/react-device-frame/index.d.ts +37 -0
- package/dist/internal/react-dialog/index.d.cts +49 -0
- package/dist/internal/react-dialog/index.d.ts +49 -0
- package/dist/internal/react-dropdown-menu/index.d.cts +37 -0
- package/dist/internal/react-dropdown-menu/index.d.ts +37 -0
- package/dist/internal/react-emoji-picker/index.d.cts +32 -0
- package/dist/internal/react-emoji-picker/index.d.ts +32 -0
- package/dist/internal/react-feedback-dialog/index.d.cts +40 -0
- package/dist/internal/react-feedback-dialog/index.d.ts +40 -0
- package/dist/internal/react-file-tree/index.d.cts +5 -0
- package/dist/internal/react-file-tree/index.d.ts +5 -0
- package/dist/internal/react-file-upload/index.d.cts +22 -0
- package/dist/internal/react-file-upload/index.d.ts +22 -0
- package/dist/internal/react-footer/index.d.cts +20 -0
- package/dist/internal/react-footer/index.d.ts +20 -0
- package/dist/internal/react-form/index.d.cts +85 -0
- package/dist/internal/react-form/index.d.ts +85 -0
- package/dist/internal/react-icon-system/index.d.cts +5 -0
- package/dist/internal/react-icon-system/index.d.ts +5 -0
- package/dist/internal/react-inline-editor/index.d.cts +17 -0
- package/dist/internal/react-inline-editor/index.d.ts +17 -0
- package/dist/internal/react-input/index.d.cts +31 -0
- package/dist/internal/react-input/index.d.ts +31 -0
- package/dist/internal/react-input-group/index.d.cts +34 -0
- package/dist/internal/react-input-group/index.d.ts +34 -0
- package/dist/internal/react-install-prompt/index.d.cts +24 -0
- package/dist/internal/react-install-prompt/index.d.ts +24 -0
- package/dist/internal/react-keyboard-shortcut/index.d.cts +57 -0
- package/dist/internal/react-keyboard-shortcut/index.d.ts +57 -0
- package/dist/internal/react-language-selector/index.d.cts +26 -0
- package/dist/internal/react-language-selector/index.d.ts +26 -0
- package/dist/internal/react-link-card/index.d.cts +5 -0
- package/dist/internal/react-link-card/index.d.ts +5 -0
- package/dist/internal/react-logger/index.d.cts +107 -0
- package/dist/internal/react-logger/index.d.ts +107 -0
- package/dist/internal/react-markdown-renderer/index.d.cts +20 -0
- package/dist/internal/react-markdown-renderer/index.d.ts +20 -0
- package/dist/internal/react-mobile-nav/index.d.cts +33 -0
- package/dist/internal/react-mobile-nav/index.d.ts +33 -0
- package/dist/internal/react-navbar/index.d.cts +25 -0
- package/dist/internal/react-navbar/index.d.ts +25 -0
- package/dist/internal/react-otp-input/index.d.cts +21 -0
- package/dist/internal/react-otp-input/index.d.ts +21 -0
- package/dist/internal/react-pagination/index.d.ts +7 -0
- package/dist/internal/react-payment/index.d.cts +9 -0
- package/dist/internal/react-payment/index.d.ts +9 -0
- package/dist/internal/react-popover/index.d.cts +33 -0
- package/dist/internal/react-popover/index.d.ts +33 -0
- package/dist/internal/react-presence-indicator/index.d.cts +34 -0
- package/dist/internal/react-presence-indicator/index.d.ts +34 -0
- package/dist/internal/react-progress-display/index.d.cts +21 -0
- package/dist/internal/react-progress-display/index.d.ts +21 -0
- package/dist/internal/react-radio/index.d.ts +33 -0
- package/dist/internal/react-reaction-bar/index.d.cts +34 -0
- package/dist/internal/react-reaction-bar/index.d.ts +34 -0
- package/dist/internal/react-resizable-layout/index.d.cts +36 -0
- package/dist/internal/react-resizable-layout/index.d.ts +36 -0
- package/dist/internal/react-rich-editor/index.d.cts +2 -0
- package/dist/internal/react-rich-editor/index.d.ts +2 -0
- package/dist/internal/react-search-bar/index.d.cts +32 -0
- package/dist/internal/react-search-bar/index.d.ts +32 -0
- package/dist/internal/react-select/index.d.cts +30 -0
- package/dist/internal/react-select/index.d.ts +30 -0
- package/dist/internal/react-sheet/index.d.cts +67 -0
- package/dist/internal/react-sheet/index.d.ts +67 -0
- package/dist/internal/react-sidebar/index.d.cts +23 -0
- package/dist/internal/react-sidebar/index.d.ts +23 -0
- package/dist/internal/react-skeleton/index.d.cts +31 -0
- package/dist/internal/react-skeleton/index.d.ts +31 -0
- package/dist/internal/react-skip-to-content/index.d.cts +9 -0
- package/dist/internal/react-skip-to-content/index.d.ts +9 -0
- package/dist/internal/react-slide-viewer/index.d.cts +23 -0
- package/dist/internal/react-slide-viewer/index.d.ts +23 -0
- package/dist/internal/react-slider/index.d.cts +1 -0
- package/dist/internal/react-slider/index.d.ts +1 -0
- package/dist/internal/react-status-indicator/index.d.cts +34 -0
- package/dist/internal/react-status-indicator/index.d.ts +34 -0
- package/dist/internal/react-steps/index.d.cts +19 -0
- package/dist/internal/react-steps/index.d.ts +19 -0
- package/dist/internal/react-switch/index.d.cts +17 -0
- package/dist/internal/react-switch/index.d.ts +17 -0
- package/dist/internal/react-table-of-contents/index.d.ts +10 -0
- package/dist/internal/react-tabs/index.d.cts +31 -0
- package/dist/internal/react-tabs/index.d.ts +31 -0
- package/dist/internal/react-textarea/index.d.cts +16 -0
- package/dist/internal/react-textarea/index.d.ts +16 -0
- package/dist/internal/react-theme/index.d.cts +44 -0
- package/dist/internal/react-theme/index.d.ts +44 -0
- package/dist/internal/react-thread-view/index.d.cts +34 -0
- package/dist/internal/react-thread-view/index.d.ts +34 -0
- package/dist/internal/react-toast/index.d.cts +36 -0
- package/dist/internal/react-toast/index.d.ts +36 -0
- package/dist/internal/react-tooltip/index.d.cts +33 -0
- package/dist/internal/react-tooltip/index.d.ts +33 -0
- package/dist/internal/react-version-selector/index.d.cts +24 -0
- package/dist/internal/react-version-selector/index.d.ts +24 -0
- package/dist/internal/react-video-player/index.d.cts +9 -0
- package/dist/internal/react-video-player/index.d.ts +9 -0
- package/dist/internal/react-voice-pill/index.d.cts +10 -0
- package/dist/internal/react-voice-pill/index.d.ts +10 -0
- package/dist/internal/react-waveform/index.d.cts +9 -0
- package/dist/internal/react-waveform/index.d.ts +9 -0
- package/dist/internal/reaction-bar/index.d.cts +50 -0
- package/dist/internal/reaction-bar/index.d.ts +50 -0
- package/dist/internal/resizable-layout/index.d.cts +47 -0
- package/dist/internal/resizable-layout/index.d.ts +47 -0
- package/dist/internal/search-bar/index.d.cts +51 -0
- package/dist/internal/search-bar/index.d.ts +51 -0
- package/dist/internal/select/index.d.cts +69 -0
- package/dist/internal/select/index.d.ts +69 -0
- package/dist/internal/shared/index.d.cts +419 -0
- package/dist/internal/shared/index.d.ts +419 -0
- package/dist/internal/sidebar/index.d.cts +40 -0
- package/dist/internal/sidebar/index.d.ts +40 -0
- package/dist/internal/skeleton/index.d.cts +27 -0
- package/dist/internal/skeleton/index.d.ts +27 -0
- package/dist/internal/slide-viewer/index.d.cts +72 -0
- package/dist/internal/slide-viewer/index.d.ts +72 -0
- package/dist/internal/slider/index.d.cts +4 -0
- package/dist/internal/slider/index.d.ts +4 -0
- package/dist/internal/status-indicator/index.d.cts +42 -0
- package/dist/internal/status-indicator/index.d.ts +42 -0
- package/dist/internal/switch/index.d.cts +41 -0
- package/dist/internal/switch/index.d.ts +41 -0
- package/dist/internal/tabs/index.d.cts +45 -0
- package/dist/internal/tabs/index.d.ts +45 -0
- package/dist/internal/textarea/index.d.cts +28 -0
- package/dist/internal/textarea/index.d.ts +28 -0
- package/dist/internal/theme/index.d.cts +60 -0
- package/dist/internal/theme/index.d.ts +60 -0
- package/dist/internal/thread-view/index.d.cts +95 -0
- package/dist/internal/thread-view/index.d.ts +95 -0
- package/dist/internal/toast/index.d.cts +64 -0
- package/dist/internal/toast/index.d.ts +64 -0
- package/dist/internal/tooltip/index.d.cts +45 -0
- package/dist/internal/tooltip/index.d.ts +45 -0
- package/dist/internal/version-selector/index.d.cts +68 -0
- package/dist/internal/version-selector/index.d.ts +68 -0
- package/dist/internal/video-player/index.d.cts +50 -0
- package/dist/internal/video-player/index.d.ts +50 -0
- package/dist/internal/voice-pill/index.d.cts +86 -0
- package/dist/internal/voice-pill/index.d.ts +86 -0
- package/dist/internal/waveform/index.d.cts +83 -0
- package/dist/internal/waveform/index.d.ts +83 -0
- package/dist/theme.cjs +23 -0
- package/dist/theme.cjs.map +1 -1
- package/dist/theme.d.cts +1 -1
- package/dist/theme.d.ts +1 -1
- package/dist/theme.js +5 -2
- package/dist/theme.js.map +1 -1
- package/package.json +10 -7
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/** Severity levels, ordered low -> high. */
|
|
2
|
+
type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
|
3
|
+
/** Numeric ordering used for level threshold comparisons. */
|
|
4
|
+
declare const LEVEL_ORDER: Record<LogLevel, number>;
|
|
5
|
+
/** Bound key/value pairs attached to every record emitted by a logger. */
|
|
6
|
+
type LogContext = Record<string, unknown>;
|
|
7
|
+
/** A single structured log record handed to a sink. */
|
|
8
|
+
interface LogRecord {
|
|
9
|
+
level: LogLevel;
|
|
10
|
+
message: string;
|
|
11
|
+
timestamp: number;
|
|
12
|
+
app: string;
|
|
13
|
+
env: TelemetryEnv;
|
|
14
|
+
/** Merged bound context (child loggers) + per-call context, post-redaction. */
|
|
15
|
+
context: LogContext;
|
|
16
|
+
}
|
|
17
|
+
/** A span record handed to a sink when a span ends. */
|
|
18
|
+
interface SpanRecord {
|
|
19
|
+
name: string;
|
|
20
|
+
startTime: number;
|
|
21
|
+
endTime: number;
|
|
22
|
+
durationMs: number;
|
|
23
|
+
app: string;
|
|
24
|
+
env: TelemetryEnv;
|
|
25
|
+
/** Merged bound context + span attributes, post-redaction. */
|
|
26
|
+
context: LogContext;
|
|
27
|
+
/** 'ok' unless ended with an error. */
|
|
28
|
+
status: 'ok' | 'error';
|
|
29
|
+
error?: {
|
|
30
|
+
name: string;
|
|
31
|
+
message: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Vendor-neutral telemetry sink. Engines (console, Faro, custom) implement
|
|
36
|
+
* this — no vendor type ever leaks across this boundary.
|
|
37
|
+
*/
|
|
38
|
+
interface TelemetrySink {
|
|
39
|
+
/** Engine name, for diagnostics. */
|
|
40
|
+
name: string;
|
|
41
|
+
/** Receive a log record. May buffer; honor flush(). */
|
|
42
|
+
log(record: LogRecord): void;
|
|
43
|
+
/** Receive a finished span. May buffer; honor flush(). */
|
|
44
|
+
span(record: SpanRecord): void;
|
|
45
|
+
/** Force-deliver any buffered records. Resolves once delivery is attempted. */
|
|
46
|
+
flush(): Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
/** Telemetry environment — selects a behavior preset. */
|
|
49
|
+
type TelemetryEnv = 'development' | 'production';
|
|
50
|
+
/** Config for {@link createTelemetry} — mirrors `createAI`'s config shape. */
|
|
51
|
+
interface TelemetryConfig {
|
|
52
|
+
/** Logical app/service name attached to every record. */
|
|
53
|
+
app: string;
|
|
54
|
+
/** Environment preset selector. */
|
|
55
|
+
env: TelemetryEnv;
|
|
56
|
+
/**
|
|
57
|
+
* Remote collector endpoint. When omitted, telemetry stays console-only
|
|
58
|
+
* (no network engine is constructed).
|
|
59
|
+
*/
|
|
60
|
+
endpoint?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Master kill switch. When `false`, a tree-shakeable noop logger is
|
|
63
|
+
* returned and zero records are ever produced. Defaults to `true`.
|
|
64
|
+
*/
|
|
65
|
+
enabled?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Fraction of records kept, 0..1. Defaults to the preset value
|
|
68
|
+
* (1 in development, 0.25 in production). Records below the sample
|
|
69
|
+
* are dropped before reaching any sink.
|
|
70
|
+
*/
|
|
71
|
+
sampleRate?: number;
|
|
72
|
+
/**
|
|
73
|
+
* Context keys to strip (deep) before a record is emitted. Use for
|
|
74
|
+
* PII / secrets, e.g. `['password', 'token', 'authorization']`.
|
|
75
|
+
*/
|
|
76
|
+
redactKeys?: string[];
|
|
77
|
+
}
|
|
78
|
+
/** A logger bound to a context. Child loggers inherit + extend that context. */
|
|
79
|
+
interface Logger {
|
|
80
|
+
debug(message: string, context?: LogContext): void;
|
|
81
|
+
info(message: string, context?: LogContext): void;
|
|
82
|
+
warn(message: string, context?: LogContext): void;
|
|
83
|
+
error(message: string, context?: LogContext): void;
|
|
84
|
+
fatal(message: string, context?: LogContext): void;
|
|
85
|
+
/**
|
|
86
|
+
* Derive a logger with additional bound context (e.g.
|
|
87
|
+
* `{ sessionId, interviewId, turnId }`). Merges over the parent's context.
|
|
88
|
+
*/
|
|
89
|
+
child(context: LogContext): Logger;
|
|
90
|
+
/** Begin a span. Call {@link Span.end} to record its duration. */
|
|
91
|
+
startSpan(name: string, attributes?: LogContext): Span;
|
|
92
|
+
/** Force-deliver buffered records on every sink. */
|
|
93
|
+
flush(): Promise<void>;
|
|
94
|
+
}
|
|
95
|
+
/** An in-flight span returned by {@link Logger.startSpan}. */
|
|
96
|
+
interface Span {
|
|
97
|
+
/** End the span and emit a {@link SpanRecord}. Optionally attach error/attrs. */
|
|
98
|
+
end(opts?: {
|
|
99
|
+
error?: unknown;
|
|
100
|
+
attributes?: LogContext;
|
|
101
|
+
}): void;
|
|
102
|
+
}
|
|
103
|
+
/** Return type of {@link createTelemetry}. */
|
|
104
|
+
interface Telemetry extends Logger {
|
|
105
|
+
/** Registered sink names, in insertion order. */
|
|
106
|
+
readonly sinks: string[];
|
|
107
|
+
/** Register an additional sink (e.g. a custom collector). */
|
|
108
|
+
addSink(sink: TelemetrySink): void;
|
|
109
|
+
/** Remove a sink by name. */
|
|
110
|
+
removeSink(name: string): void;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Behavior derived from {@link TelemetryConfig.env}. The manager reads these
|
|
115
|
+
* fields to decide level filtering, batching, sampling, and flush triggers.
|
|
116
|
+
*/
|
|
117
|
+
interface TelemetryPreset {
|
|
118
|
+
/** Records strictly below this level are dropped. */
|
|
119
|
+
minLevel: LogLevel;
|
|
120
|
+
/** Buffer records and deliver in batches instead of synchronously. */
|
|
121
|
+
batch: boolean;
|
|
122
|
+
/** Batch size before an automatic flush (only when `batch`). */
|
|
123
|
+
batchSize: number;
|
|
124
|
+
/** Default sample rate when config omits `sampleRate`. */
|
|
125
|
+
sampleRate: number;
|
|
126
|
+
/** Pretty, single-line console output (vs. structured JSON). */
|
|
127
|
+
pretty: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Flush buffered records on `pagehide` + `visibilitychange` (hidden),
|
|
130
|
+
* using `navigator.sendBeacon` when available.
|
|
131
|
+
*/
|
|
132
|
+
beaconFlush: boolean;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* - development: sync, pretty, level=debug, no batching, sample everything.
|
|
136
|
+
* - production: batched + sampled, level>=warn, beacon flush on page exit.
|
|
137
|
+
*/
|
|
138
|
+
declare const PRESETS: Record<TelemetryEnv, TelemetryPreset>;
|
|
139
|
+
/** Resolve the preset for an env (defensive copy so callers can't mutate it). */
|
|
140
|
+
declare function resolvePreset(env: TelemetryEnv): TelemetryPreset;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* createTelemetry — creates a telemetry manager that fans records out to
|
|
144
|
+
* registered sinks. Manager/provider pattern, mirroring `createAI`.
|
|
145
|
+
*
|
|
146
|
+
* - `enabled: false` -> tree-shakeable noop (zero emissions, no engines).
|
|
147
|
+
* - no `endpoint` -> console-only transport.
|
|
148
|
+
* - `endpoint` set -> async Faro engine is registered when the optional
|
|
149
|
+
* peers exist; console stays as a safe fallback until then.
|
|
150
|
+
*
|
|
151
|
+
* The returned object IS a logger (root context = `{}`); `child()` derives
|
|
152
|
+
* loggers with bound context (sessionId / interviewId / turnId / ...).
|
|
153
|
+
*/
|
|
154
|
+
declare function createTelemetry(config: TelemetryConfig): Telemetry;
|
|
155
|
+
|
|
156
|
+
interface ConsoleSinkOptions {
|
|
157
|
+
/** Single-line pretty output (vs. structured JSON). */
|
|
158
|
+
pretty?: boolean;
|
|
159
|
+
/** Console to write to (injectable for tests). Defaults to global console. */
|
|
160
|
+
console?: Pick<Console, 'debug' | 'info' | 'warn' | 'error'>;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Default zero-dependency transport. Used whenever no `endpoint` is set.
|
|
164
|
+
* Synchronous; `flush()` is a resolved no-op (nothing is buffered).
|
|
165
|
+
*/
|
|
166
|
+
declare function createConsoleSink(opts?: ConsoleSinkOptions): TelemetrySink;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Faro-backed engine. `@grafana/faro-web-sdk` + `@grafana/faro-web-tracing`
|
|
170
|
+
* are **optional peerDependencies** — they are loaded dynamically and never
|
|
171
|
+
* referenced in this module's public types. If the peers are absent the
|
|
172
|
+
* factory resolves to `null` so the caller can fall back to console.
|
|
173
|
+
*
|
|
174
|
+
* For tests, a `transport` may be injected: an object with a `push(payload)`
|
|
175
|
+
* method. This bypasses Faro entirely (no network, no peer required).
|
|
176
|
+
*/
|
|
177
|
+
/** Minimal structural shape of a Faro-ish transport. Not exported. */
|
|
178
|
+
interface FaroTransport {
|
|
179
|
+
push(payload: {
|
|
180
|
+
kind: 'log' | 'span';
|
|
181
|
+
record: LogRecord | SpanRecord;
|
|
182
|
+
}): void;
|
|
183
|
+
}
|
|
184
|
+
interface FaroEngineOptions {
|
|
185
|
+
app: string;
|
|
186
|
+
endpoint: string;
|
|
187
|
+
/**
|
|
188
|
+
* Test/override transport. When provided, the Faro peers are NOT loaded
|
|
189
|
+
* and records are forwarded straight to `transport.push`.
|
|
190
|
+
*/
|
|
191
|
+
transport?: FaroTransport;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Construct the Faro engine. Returns `null` when the optional peers are not
|
|
195
|
+
* installed and no override transport was supplied — callers treat `null` as
|
|
196
|
+
* "fall back to console".
|
|
197
|
+
*/
|
|
198
|
+
declare function createFaroSink(opts: FaroEngineOptions): Promise<TelemetrySink | null>;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Returned by {@link createTelemetry} when `enabled: false`. Every method is
|
|
202
|
+
* an empty stub, so a bundler can dead-code-eliminate call sites and the
|
|
203
|
+
* engines (console/Faro) are never imported at runtime. Zero emissions.
|
|
204
|
+
*/
|
|
205
|
+
declare function createNoopTelemetry(): Telemetry;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Deep-strip any object key whose name (case-insensitive) is in `keys`.
|
|
209
|
+
* Arrays are walked; cycles are guarded; non-matching values pass through
|
|
210
|
+
* unchanged. Returns a new structure — the input is never mutated.
|
|
211
|
+
*/
|
|
212
|
+
declare function redact(value: LogContext, keys: string[]): LogContext;
|
|
213
|
+
|
|
214
|
+
interface MockSinkExtended extends TelemetrySink {
|
|
215
|
+
/** Every log record received, in order. */
|
|
216
|
+
logs: LogRecord[];
|
|
217
|
+
/** Every span record received, in order. */
|
|
218
|
+
spans: SpanRecord[];
|
|
219
|
+
/** Number of times {@link TelemetrySink.flush} was called. */
|
|
220
|
+
flushCalls: number;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* createMockSink — a {@link TelemetrySink} that records everything for
|
|
224
|
+
* assertions instead of doing I/O. Used to test the manager and the Faro
|
|
225
|
+
* engine without any network. Mirrors `createMockAIProvider` in `packages/ai`.
|
|
226
|
+
*/
|
|
227
|
+
declare function createMockSink(name?: string): MockSinkExtended;
|
|
228
|
+
|
|
229
|
+
export { type ConsoleSinkOptions, type FaroEngineOptions, LEVEL_ORDER, type LogContext, type LogLevel, type LogRecord, type Logger, type MockSinkExtended, PRESETS, type Span, type SpanRecord, type Telemetry, type TelemetryConfig, type TelemetryEnv, type TelemetryPreset, type TelemetrySink, createConsoleSink, createFaroSink, createMockSink, createNoopTelemetry, createTelemetry, redact, resolvePreset };
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/** Severity levels, ordered low -> high. */
|
|
2
|
+
type LogLevel = 'debug' | 'info' | 'warn' | 'error' | 'fatal';
|
|
3
|
+
/** Numeric ordering used for level threshold comparisons. */
|
|
4
|
+
declare const LEVEL_ORDER: Record<LogLevel, number>;
|
|
5
|
+
/** Bound key/value pairs attached to every record emitted by a logger. */
|
|
6
|
+
type LogContext = Record<string, unknown>;
|
|
7
|
+
/** A single structured log record handed to a sink. */
|
|
8
|
+
interface LogRecord {
|
|
9
|
+
level: LogLevel;
|
|
10
|
+
message: string;
|
|
11
|
+
timestamp: number;
|
|
12
|
+
app: string;
|
|
13
|
+
env: TelemetryEnv;
|
|
14
|
+
/** Merged bound context (child loggers) + per-call context, post-redaction. */
|
|
15
|
+
context: LogContext;
|
|
16
|
+
}
|
|
17
|
+
/** A span record handed to a sink when a span ends. */
|
|
18
|
+
interface SpanRecord {
|
|
19
|
+
name: string;
|
|
20
|
+
startTime: number;
|
|
21
|
+
endTime: number;
|
|
22
|
+
durationMs: number;
|
|
23
|
+
app: string;
|
|
24
|
+
env: TelemetryEnv;
|
|
25
|
+
/** Merged bound context + span attributes, post-redaction. */
|
|
26
|
+
context: LogContext;
|
|
27
|
+
/** 'ok' unless ended with an error. */
|
|
28
|
+
status: 'ok' | 'error';
|
|
29
|
+
error?: {
|
|
30
|
+
name: string;
|
|
31
|
+
message: string;
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Vendor-neutral telemetry sink. Engines (console, Faro, custom) implement
|
|
36
|
+
* this — no vendor type ever leaks across this boundary.
|
|
37
|
+
*/
|
|
38
|
+
interface TelemetrySink {
|
|
39
|
+
/** Engine name, for diagnostics. */
|
|
40
|
+
name: string;
|
|
41
|
+
/** Receive a log record. May buffer; honor flush(). */
|
|
42
|
+
log(record: LogRecord): void;
|
|
43
|
+
/** Receive a finished span. May buffer; honor flush(). */
|
|
44
|
+
span(record: SpanRecord): void;
|
|
45
|
+
/** Force-deliver any buffered records. Resolves once delivery is attempted. */
|
|
46
|
+
flush(): Promise<void>;
|
|
47
|
+
}
|
|
48
|
+
/** Telemetry environment — selects a behavior preset. */
|
|
49
|
+
type TelemetryEnv = 'development' | 'production';
|
|
50
|
+
/** Config for {@link createTelemetry} — mirrors `createAI`'s config shape. */
|
|
51
|
+
interface TelemetryConfig {
|
|
52
|
+
/** Logical app/service name attached to every record. */
|
|
53
|
+
app: string;
|
|
54
|
+
/** Environment preset selector. */
|
|
55
|
+
env: TelemetryEnv;
|
|
56
|
+
/**
|
|
57
|
+
* Remote collector endpoint. When omitted, telemetry stays console-only
|
|
58
|
+
* (no network engine is constructed).
|
|
59
|
+
*/
|
|
60
|
+
endpoint?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Master kill switch. When `false`, a tree-shakeable noop logger is
|
|
63
|
+
* returned and zero records are ever produced. Defaults to `true`.
|
|
64
|
+
*/
|
|
65
|
+
enabled?: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Fraction of records kept, 0..1. Defaults to the preset value
|
|
68
|
+
* (1 in development, 0.25 in production). Records below the sample
|
|
69
|
+
* are dropped before reaching any sink.
|
|
70
|
+
*/
|
|
71
|
+
sampleRate?: number;
|
|
72
|
+
/**
|
|
73
|
+
* Context keys to strip (deep) before a record is emitted. Use for
|
|
74
|
+
* PII / secrets, e.g. `['password', 'token', 'authorization']`.
|
|
75
|
+
*/
|
|
76
|
+
redactKeys?: string[];
|
|
77
|
+
}
|
|
78
|
+
/** A logger bound to a context. Child loggers inherit + extend that context. */
|
|
79
|
+
interface Logger {
|
|
80
|
+
debug(message: string, context?: LogContext): void;
|
|
81
|
+
info(message: string, context?: LogContext): void;
|
|
82
|
+
warn(message: string, context?: LogContext): void;
|
|
83
|
+
error(message: string, context?: LogContext): void;
|
|
84
|
+
fatal(message: string, context?: LogContext): void;
|
|
85
|
+
/**
|
|
86
|
+
* Derive a logger with additional bound context (e.g.
|
|
87
|
+
* `{ sessionId, interviewId, turnId }`). Merges over the parent's context.
|
|
88
|
+
*/
|
|
89
|
+
child(context: LogContext): Logger;
|
|
90
|
+
/** Begin a span. Call {@link Span.end} to record its duration. */
|
|
91
|
+
startSpan(name: string, attributes?: LogContext): Span;
|
|
92
|
+
/** Force-deliver buffered records on every sink. */
|
|
93
|
+
flush(): Promise<void>;
|
|
94
|
+
}
|
|
95
|
+
/** An in-flight span returned by {@link Logger.startSpan}. */
|
|
96
|
+
interface Span {
|
|
97
|
+
/** End the span and emit a {@link SpanRecord}. Optionally attach error/attrs. */
|
|
98
|
+
end(opts?: {
|
|
99
|
+
error?: unknown;
|
|
100
|
+
attributes?: LogContext;
|
|
101
|
+
}): void;
|
|
102
|
+
}
|
|
103
|
+
/** Return type of {@link createTelemetry}. */
|
|
104
|
+
interface Telemetry extends Logger {
|
|
105
|
+
/** Registered sink names, in insertion order. */
|
|
106
|
+
readonly sinks: string[];
|
|
107
|
+
/** Register an additional sink (e.g. a custom collector). */
|
|
108
|
+
addSink(sink: TelemetrySink): void;
|
|
109
|
+
/** Remove a sink by name. */
|
|
110
|
+
removeSink(name: string): void;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Behavior derived from {@link TelemetryConfig.env}. The manager reads these
|
|
115
|
+
* fields to decide level filtering, batching, sampling, and flush triggers.
|
|
116
|
+
*/
|
|
117
|
+
interface TelemetryPreset {
|
|
118
|
+
/** Records strictly below this level are dropped. */
|
|
119
|
+
minLevel: LogLevel;
|
|
120
|
+
/** Buffer records and deliver in batches instead of synchronously. */
|
|
121
|
+
batch: boolean;
|
|
122
|
+
/** Batch size before an automatic flush (only when `batch`). */
|
|
123
|
+
batchSize: number;
|
|
124
|
+
/** Default sample rate when config omits `sampleRate`. */
|
|
125
|
+
sampleRate: number;
|
|
126
|
+
/** Pretty, single-line console output (vs. structured JSON). */
|
|
127
|
+
pretty: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Flush buffered records on `pagehide` + `visibilitychange` (hidden),
|
|
130
|
+
* using `navigator.sendBeacon` when available.
|
|
131
|
+
*/
|
|
132
|
+
beaconFlush: boolean;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* - development: sync, pretty, level=debug, no batching, sample everything.
|
|
136
|
+
* - production: batched + sampled, level>=warn, beacon flush on page exit.
|
|
137
|
+
*/
|
|
138
|
+
declare const PRESETS: Record<TelemetryEnv, TelemetryPreset>;
|
|
139
|
+
/** Resolve the preset for an env (defensive copy so callers can't mutate it). */
|
|
140
|
+
declare function resolvePreset(env: TelemetryEnv): TelemetryPreset;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* createTelemetry — creates a telemetry manager that fans records out to
|
|
144
|
+
* registered sinks. Manager/provider pattern, mirroring `createAI`.
|
|
145
|
+
*
|
|
146
|
+
* - `enabled: false` -> tree-shakeable noop (zero emissions, no engines).
|
|
147
|
+
* - no `endpoint` -> console-only transport.
|
|
148
|
+
* - `endpoint` set -> async Faro engine is registered when the optional
|
|
149
|
+
* peers exist; console stays as a safe fallback until then.
|
|
150
|
+
*
|
|
151
|
+
* The returned object IS a logger (root context = `{}`); `child()` derives
|
|
152
|
+
* loggers with bound context (sessionId / interviewId / turnId / ...).
|
|
153
|
+
*/
|
|
154
|
+
declare function createTelemetry(config: TelemetryConfig): Telemetry;
|
|
155
|
+
|
|
156
|
+
interface ConsoleSinkOptions {
|
|
157
|
+
/** Single-line pretty output (vs. structured JSON). */
|
|
158
|
+
pretty?: boolean;
|
|
159
|
+
/** Console to write to (injectable for tests). Defaults to global console. */
|
|
160
|
+
console?: Pick<Console, 'debug' | 'info' | 'warn' | 'error'>;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Default zero-dependency transport. Used whenever no `endpoint` is set.
|
|
164
|
+
* Synchronous; `flush()` is a resolved no-op (nothing is buffered).
|
|
165
|
+
*/
|
|
166
|
+
declare function createConsoleSink(opts?: ConsoleSinkOptions): TelemetrySink;
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Faro-backed engine. `@grafana/faro-web-sdk` + `@grafana/faro-web-tracing`
|
|
170
|
+
* are **optional peerDependencies** — they are loaded dynamically and never
|
|
171
|
+
* referenced in this module's public types. If the peers are absent the
|
|
172
|
+
* factory resolves to `null` so the caller can fall back to console.
|
|
173
|
+
*
|
|
174
|
+
* For tests, a `transport` may be injected: an object with a `push(payload)`
|
|
175
|
+
* method. This bypasses Faro entirely (no network, no peer required).
|
|
176
|
+
*/
|
|
177
|
+
/** Minimal structural shape of a Faro-ish transport. Not exported. */
|
|
178
|
+
interface FaroTransport {
|
|
179
|
+
push(payload: {
|
|
180
|
+
kind: 'log' | 'span';
|
|
181
|
+
record: LogRecord | SpanRecord;
|
|
182
|
+
}): void;
|
|
183
|
+
}
|
|
184
|
+
interface FaroEngineOptions {
|
|
185
|
+
app: string;
|
|
186
|
+
endpoint: string;
|
|
187
|
+
/**
|
|
188
|
+
* Test/override transport. When provided, the Faro peers are NOT loaded
|
|
189
|
+
* and records are forwarded straight to `transport.push`.
|
|
190
|
+
*/
|
|
191
|
+
transport?: FaroTransport;
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Construct the Faro engine. Returns `null` when the optional peers are not
|
|
195
|
+
* installed and no override transport was supplied — callers treat `null` as
|
|
196
|
+
* "fall back to console".
|
|
197
|
+
*/
|
|
198
|
+
declare function createFaroSink(opts: FaroEngineOptions): Promise<TelemetrySink | null>;
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Returned by {@link createTelemetry} when `enabled: false`. Every method is
|
|
202
|
+
* an empty stub, so a bundler can dead-code-eliminate call sites and the
|
|
203
|
+
* engines (console/Faro) are never imported at runtime. Zero emissions.
|
|
204
|
+
*/
|
|
205
|
+
declare function createNoopTelemetry(): Telemetry;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Deep-strip any object key whose name (case-insensitive) is in `keys`.
|
|
209
|
+
* Arrays are walked; cycles are guarded; non-matching values pass through
|
|
210
|
+
* unchanged. Returns a new structure — the input is never mutated.
|
|
211
|
+
*/
|
|
212
|
+
declare function redact(value: LogContext, keys: string[]): LogContext;
|
|
213
|
+
|
|
214
|
+
interface MockSinkExtended extends TelemetrySink {
|
|
215
|
+
/** Every log record received, in order. */
|
|
216
|
+
logs: LogRecord[];
|
|
217
|
+
/** Every span record received, in order. */
|
|
218
|
+
spans: SpanRecord[];
|
|
219
|
+
/** Number of times {@link TelemetrySink.flush} was called. */
|
|
220
|
+
flushCalls: number;
|
|
221
|
+
}
|
|
222
|
+
/**
|
|
223
|
+
* createMockSink — a {@link TelemetrySink} that records everything for
|
|
224
|
+
* assertions instead of doing I/O. Used to test the manager and the Faro
|
|
225
|
+
* engine without any network. Mirrors `createMockAIProvider` in `packages/ai`.
|
|
226
|
+
*/
|
|
227
|
+
declare function createMockSink(name?: string): MockSinkExtended;
|
|
228
|
+
|
|
229
|
+
export { type ConsoleSinkOptions, type FaroEngineOptions, LEVEL_ORDER, type LogContext, type LogLevel, type LogRecord, type Logger, type MockSinkExtended, PRESETS, type Span, type SpanRecord, type Telemetry, type TelemetryConfig, type TelemetryEnv, type TelemetryPreset, type TelemetrySink, createConsoleSink, createFaroSink, createMockSink, createNoopTelemetry, createTelemetry, redact, resolvePreset };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AccessibilityProps, TokenContract } from '../shared/index.cjs';
|
|
2
|
+
|
|
3
|
+
interface ComponentDef {
|
|
4
|
+
type: string;
|
|
5
|
+
pattern: RegExp;
|
|
6
|
+
props: Record<string, string>;
|
|
7
|
+
}
|
|
8
|
+
interface MarkdownRendererProps {
|
|
9
|
+
content: string;
|
|
10
|
+
components?: Record<string, ComponentDef>;
|
|
11
|
+
linkResolver?: (url: string) => string;
|
|
12
|
+
}
|
|
13
|
+
interface MarkdownRendererAPI {
|
|
14
|
+
/** Rendered HTML string */
|
|
15
|
+
html: string;
|
|
16
|
+
/** Extracted component slots from custom component definitions */
|
|
17
|
+
components: Array<{
|
|
18
|
+
name: string;
|
|
19
|
+
props: Record<string, string>;
|
|
20
|
+
}>;
|
|
21
|
+
/** ARIA attributes for the rendered content container */
|
|
22
|
+
ariaProps: Partial<AccessibilityProps>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create a headless markdown renderer.
|
|
26
|
+
*
|
|
27
|
+
* Uses the headless pattern — returns an API object with rendered HTML,
|
|
28
|
+
* extracted component slots, and ARIA props for the container.
|
|
29
|
+
*/
|
|
30
|
+
declare function createMarkdownRenderer(props: MarkdownRendererProps): MarkdownRendererAPI;
|
|
31
|
+
|
|
32
|
+
declare const markdownRendererTokens: TokenContract;
|
|
33
|
+
declare const proseVariants: (props?: ({
|
|
34
|
+
size?: "sm" | "default" | "lg" | undefined;
|
|
35
|
+
theme?: "light" | "dark" | undefined;
|
|
36
|
+
} & {
|
|
37
|
+
className?: string;
|
|
38
|
+
}) | undefined) => string;
|
|
39
|
+
|
|
40
|
+
export { type ComponentDef, type MarkdownRendererAPI, type MarkdownRendererProps, createMarkdownRenderer, markdownRendererTokens, proseVariants };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AccessibilityProps, TokenContract } from '../shared/index.js';
|
|
2
|
+
|
|
3
|
+
interface ComponentDef {
|
|
4
|
+
type: string;
|
|
5
|
+
pattern: RegExp;
|
|
6
|
+
props: Record<string, string>;
|
|
7
|
+
}
|
|
8
|
+
interface MarkdownRendererProps {
|
|
9
|
+
content: string;
|
|
10
|
+
components?: Record<string, ComponentDef>;
|
|
11
|
+
linkResolver?: (url: string) => string;
|
|
12
|
+
}
|
|
13
|
+
interface MarkdownRendererAPI {
|
|
14
|
+
/** Rendered HTML string */
|
|
15
|
+
html: string;
|
|
16
|
+
/** Extracted component slots from custom component definitions */
|
|
17
|
+
components: Array<{
|
|
18
|
+
name: string;
|
|
19
|
+
props: Record<string, string>;
|
|
20
|
+
}>;
|
|
21
|
+
/** ARIA attributes for the rendered content container */
|
|
22
|
+
ariaProps: Partial<AccessibilityProps>;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Create a headless markdown renderer.
|
|
26
|
+
*
|
|
27
|
+
* Uses the headless pattern — returns an API object with rendered HTML,
|
|
28
|
+
* extracted component slots, and ARIA props for the container.
|
|
29
|
+
*/
|
|
30
|
+
declare function createMarkdownRenderer(props: MarkdownRendererProps): MarkdownRendererAPI;
|
|
31
|
+
|
|
32
|
+
declare const markdownRendererTokens: TokenContract;
|
|
33
|
+
declare const proseVariants: (props?: ({
|
|
34
|
+
size?: "sm" | "default" | "lg" | undefined;
|
|
35
|
+
theme?: "light" | "dark" | undefined;
|
|
36
|
+
} & {
|
|
37
|
+
className?: string;
|
|
38
|
+
}) | undefined) => string;
|
|
39
|
+
|
|
40
|
+
export { type ComponentDef, type MarkdownRendererAPI, type MarkdownRendererProps, createMarkdownRenderer, markdownRendererTokens, proseVariants };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { AccessibilityProps, KeyboardHandlerMap, TokenContract } from '../shared/index.cjs';
|
|
2
|
+
|
|
3
|
+
interface MobileNavProps {
|
|
4
|
+
open?: boolean;
|
|
5
|
+
onOpenChange?: (open: boolean) => void;
|
|
6
|
+
id?: string;
|
|
7
|
+
}
|
|
8
|
+
interface MobileNavState {
|
|
9
|
+
open: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface MobileNavAPI {
|
|
12
|
+
/** Current state */
|
|
13
|
+
state: MobileNavState;
|
|
14
|
+
/** ARIA and interaction props for the trigger button */
|
|
15
|
+
triggerProps: Partial<AccessibilityProps> & Record<string, string | boolean | undefined>;
|
|
16
|
+
/** ARIA and data attributes for the content panel */
|
|
17
|
+
contentProps: Partial<AccessibilityProps> & Record<string, string | boolean | undefined>;
|
|
18
|
+
/** Toggle open state */
|
|
19
|
+
toggle: () => void;
|
|
20
|
+
/** Open the nav */
|
|
21
|
+
open: () => void;
|
|
22
|
+
/** Close the nav */
|
|
23
|
+
close: () => void;
|
|
24
|
+
/** Keyboard handlers (Escape closes) */
|
|
25
|
+
keyboardHandlers: KeyboardHandlerMap;
|
|
26
|
+
}
|
|
27
|
+
declare function createMobileNav(props?: MobileNavProps): MobileNavAPI;
|
|
28
|
+
|
|
29
|
+
declare const mobileNavTokens: TokenContract;
|
|
30
|
+
declare const mobileNavVariants: (props?: ({} & {
|
|
31
|
+
className?: string;
|
|
32
|
+
}) | undefined) => string;
|
|
33
|
+
declare const mobileNavContentVariants: (props?: ({
|
|
34
|
+
state?: "open" | "closed" | undefined;
|
|
35
|
+
} & {
|
|
36
|
+
className?: string;
|
|
37
|
+
}) | undefined) => string;
|
|
38
|
+
declare const mobileNavTriggerVariants: (props?: ({} & {
|
|
39
|
+
className?: string;
|
|
40
|
+
}) | undefined) => string;
|
|
41
|
+
declare const mobileNavLinkVariants: (props?: ({} & {
|
|
42
|
+
className?: string;
|
|
43
|
+
}) | undefined) => string;
|
|
44
|
+
|
|
45
|
+
export { type MobileNavAPI, type MobileNavProps, type MobileNavState, createMobileNav, mobileNavContentVariants, mobileNavLinkVariants, mobileNavTokens, mobileNavTriggerVariants, mobileNavVariants };
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { AccessibilityProps, KeyboardHandlerMap, TokenContract } from '../shared/index.js';
|
|
2
|
+
|
|
3
|
+
interface MobileNavProps {
|
|
4
|
+
open?: boolean;
|
|
5
|
+
onOpenChange?: (open: boolean) => void;
|
|
6
|
+
id?: string;
|
|
7
|
+
}
|
|
8
|
+
interface MobileNavState {
|
|
9
|
+
open: boolean;
|
|
10
|
+
}
|
|
11
|
+
interface MobileNavAPI {
|
|
12
|
+
/** Current state */
|
|
13
|
+
state: MobileNavState;
|
|
14
|
+
/** ARIA and interaction props for the trigger button */
|
|
15
|
+
triggerProps: Partial<AccessibilityProps> & Record<string, string | boolean | undefined>;
|
|
16
|
+
/** ARIA and data attributes for the content panel */
|
|
17
|
+
contentProps: Partial<AccessibilityProps> & Record<string, string | boolean | undefined>;
|
|
18
|
+
/** Toggle open state */
|
|
19
|
+
toggle: () => void;
|
|
20
|
+
/** Open the nav */
|
|
21
|
+
open: () => void;
|
|
22
|
+
/** Close the nav */
|
|
23
|
+
close: () => void;
|
|
24
|
+
/** Keyboard handlers (Escape closes) */
|
|
25
|
+
keyboardHandlers: KeyboardHandlerMap;
|
|
26
|
+
}
|
|
27
|
+
declare function createMobileNav(props?: MobileNavProps): MobileNavAPI;
|
|
28
|
+
|
|
29
|
+
declare const mobileNavTokens: TokenContract;
|
|
30
|
+
declare const mobileNavVariants: (props?: ({} & {
|
|
31
|
+
className?: string;
|
|
32
|
+
}) | undefined) => string;
|
|
33
|
+
declare const mobileNavContentVariants: (props?: ({
|
|
34
|
+
state?: "open" | "closed" | undefined;
|
|
35
|
+
} & {
|
|
36
|
+
className?: string;
|
|
37
|
+
}) | undefined) => string;
|
|
38
|
+
declare const mobileNavTriggerVariants: (props?: ({} & {
|
|
39
|
+
className?: string;
|
|
40
|
+
}) | undefined) => string;
|
|
41
|
+
declare const mobileNavLinkVariants: (props?: ({} & {
|
|
42
|
+
className?: string;
|
|
43
|
+
}) | undefined) => string;
|
|
44
|
+
|
|
45
|
+
export { type MobileNavAPI, type MobileNavProps, type MobileNavState, createMobileNav, mobileNavContentVariants, mobileNavLinkVariants, mobileNavTokens, mobileNavTriggerVariants, mobileNavVariants };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
interface NavLink {
|
|
2
|
+
label: string;
|
|
3
|
+
href: string;
|
|
4
|
+
icon?: string;
|
|
5
|
+
}
|
|
6
|
+
type NavbarVariant = 'solid' | 'blur' | 'gradient' | 'transparent';
|
|
7
|
+
interface NavbarProps {
|
|
8
|
+
links?: NavLink[];
|
|
9
|
+
currentPath?: string;
|
|
10
|
+
variant?: NavbarVariant;
|
|
11
|
+
}
|
|
12
|
+
interface NavbarAPI {
|
|
13
|
+
ariaProps: Record<string, string>;
|
|
14
|
+
isActive: (href: string) => boolean;
|
|
15
|
+
linkAriaProps: (href: string) => Record<string, string>;
|
|
16
|
+
}
|
|
17
|
+
declare function createNavbar(props?: NavbarProps): NavbarAPI;
|
|
18
|
+
|
|
19
|
+
declare const navbarVariants: (props?: ({
|
|
20
|
+
variant?: "solid" | "blur" | "gradient" | "transparent" | undefined;
|
|
21
|
+
} & {
|
|
22
|
+
className?: string;
|
|
23
|
+
}) | undefined) => string;
|
|
24
|
+
declare const navLinkVariants: (props?: ({
|
|
25
|
+
active?: "true" | "false" | undefined;
|
|
26
|
+
} & {
|
|
27
|
+
className?: string;
|
|
28
|
+
}) | undefined) => string;
|
|
29
|
+
|
|
30
|
+
export { type NavLink, type NavbarAPI, type NavbarProps, type NavbarVariant, createNavbar, navLinkVariants, navbarVariants };
|